drop KATIE_ALLINONE build option in favour of CMAKE_UNITY_BUILD

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2020-12-20 15:13:50 +00:00
parent c6d001882d
commit 716ee27810
5 changed files with 8 additions and 43 deletions

View file

@ -147,9 +147,6 @@ add_feature_info(benchmarks KATIE_BENCHMARKS "build automatic benchmarks")
option(KATIE_UTILS "Build maintainance utilities" OFF)
add_feature_info(utils KATIE_UTILS "build maintainance utilities")
option(KATIE_ALLINONE "Build targets from single source file" OFF)
add_feature_info(allinone KATIE_ALLINONE "build targets from single source file")
option(KATIE_PCH "Build components with pre-compiled header" OFF)
add_feature_info(pch KATIE_PCH "build components with pre-compiled header")

View file

@ -18,7 +18,7 @@ build_script:
export CXXFLAGS="$CXXFLAGS -w"
cmake . -Wno-dev -DKATIE_TESTS=ON -DKATIE_BENCHMARKS=ON -DKATIE_UTILS=ON -DKATIE_ALLINONE=ON -DKATIE_PCH=ON
cmake . -Wno-dev -DKATIE_TESTS=ON -DKATIE_BENCHMARKS=ON -DKATIE_UTILS=ON -DKATIE_PCH=ON -DCMAKE_UNITY_BUILD=ON
make -j $(nproc || echo 1)

View file

@ -203,10 +203,9 @@ function(KATIE_STRING_UNWRAP INSTR OUTLST)
endif()
endfunction()
# a macro to instruct katie_setup_target() which sources to exclude from the
# all-in-one source file
# a macro to instruct CMake which sources to exclude from the unity source file
macro(KATIE_ALLINONE_EXCLUDE ARG1)
set_source_files_properties(${ARG1} ${ARGN} PROPERTIES ALLINONE_EXCLUDE TRUE)
set_source_files_properties(${ARG1} ${ARGN} PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
endmacro()
# a function to create an array of source files for a target while taking into
@ -227,6 +226,7 @@ function(KATIE_SETUP_TARGET FORTARGET)
# this can be simpler if continue() was supported by old CMake versions
set(resourcesdep "${CMAKE_CURRENT_BINARY_DIR}/${FORTARGET}_resources.cpp")
katie_write_file("${resourcesdep}" "enum { CompilersWorkaroundAlaAutomoc = 1 };\n")
set(filteredsources)
set(targetresources)
set(rscpath "${CMAKE_CURRENT_BINARY_DIR}/${FORTARGET}_resources")
include_directories("${rscpath}")
@ -252,7 +252,8 @@ function(KATIE_SETUP_TARGET FORTARGET)
DEPENDS "${KATIE_RCC}"
OUTPUT "${rscout}"
)
elseif("${rscext}" MATCHES "(.h|.hpp|.cc|.cpp)")
elseif("${rscext}" MATCHES "(.c|.h|.hpp|.cc|.cpp)")
set(filteredsources ${filteredsources} "${resource}")
file(READ "${resource}" rsccontent)
if("${rsccontent}" MATCHES "(Q_OBJECT|Q_OBJECT_FAKE|Q_GADGET)")
set(rscout "${rscpath}/moc_${rscname}${rscext}")
@ -268,31 +269,7 @@ function(KATIE_SETUP_TARGET FORTARGET)
endforeach()
set_property(SOURCE "${resourcesdep}" APPEND PROPERTY OBJECT_DEPENDS "${targetresources}")
if(NOT KATIE_ALLINONE)
set(filteredsources)
foreach(srcstring ${ARGN})
get_filename_component(srcext "${srcstring}" EXT)
if(NOT "${srcext}" MATCHES "(.qrc|.ui)")
set(filteredsources ${filteredsources} "${srcstring}")
endif()
endforeach()
set(${FORTARGET}_SOURCES "${resourcesdep}" ${filteredsources} PARENT_SCOPE)
else()
set(allinonesource "${CMAKE_CURRENT_BINARY_DIR}/${FORTARGET}_allinone.cpp")
set(allinonedata)
set(excludesources)
foreach(srcstring ${ARGN})
get_filename_component(srcext "${srcstring}" EXT)
get_source_file_property(skip "${srcstring}" ALLINONE_EXCLUDE)
if(skip OR "${srcext}" STREQUAL ".c")
set(excludesources ${excludesources} "${srcstring}")
elseif(NOT "${srcext}" MATCHES "(.h|.qrc|.ui)")
set(allinonedata "${allinonedata}#include \"${srcstring}\"\n")
endif()
endforeach()
katie_write_file("${allinonesource}" "${allinonedata}")
set(${FORTARGET}_SOURCES ${resourcesdep} "${allinonesource}" ${excludesources} PARENT_SCOPE)
endif()
set(${FORTARGET}_SOURCES "${resourcesdep}" ${filteredsources} PARENT_SCOPE)
endfunction()
# a macro to ensure that object targets are build with PIC if the target they

View file

@ -35,8 +35,7 @@ build() {
-DCMAKE_INSTALL_PREFIX=/usr \
-DKATIE_LDCONF_PATH=/etc/ld.so.conf.d \
-DKATIE_PROFILE_PATH=/etc/profile.d \
-DKATIE_TOOLS_SUFFIX="-katie" \
-DKATIE_ALLINONE=ON
-DKATIE_TOOLS_SUFFIX="-katie"
make
}

View file

@ -22,15 +22,7 @@ tar -xaf "$cwd/$cmake.$cmakeext"
"$cmake/bin/cmake" ../ -DKATIE_TESTS=ON -DKATIE_BENCHMARKS=ON -DKATIE_UTILS=ON $@
rm -rf *
tar -xaf "$cwd/$cmake.$cmakeext"
"$cmake/bin/cmake" ../ -DKATIE_TESTS=ON -DKATIE_BENCHMARKS=ON -DKATIE_UTILS=ON -DKATIE_ALLINONE=ON $@
rm -rf *
tar -xaf "$cwd/$cmake.$cmakeext"
"$cmake/bin/cmake" ../ -GNinja -DKATIE_TESTS=ON -DKATIE_BENCHMARKS=ON -DKATIE_UTILS=ON $@
ninja -n
rm -rf *
tar -xaf "$cwd/$cmake.$cmakeext"
"$cmake/bin/cmake" ../ -GNinja -DKATIE_TESTS=ON -DKATIE_BENCHMARKS=ON -DKATIE_UTILS=ON -DKATIE_ALLINONE=ON $@
ninja -n