mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Test a few cmake option combinations before the build.
This takes a few seconds but allows us to cover cases that aren't checked often.
This commit is contained in:
parent
69e1b99b1d
commit
0a61d11085
|
@ -596,11 +596,11 @@ endif()
|
|||
#
|
||||
################################################################################
|
||||
|
||||
find_program(SH NAMES sh dash bash zsh)
|
||||
find_program(SHELL NAMES sh dash bash zsh)
|
||||
|
||||
if(SH)
|
||||
if(SHELL)
|
||||
execute_process(
|
||||
COMMAND ${SH} ${toxcore_SOURCE_DIR}/other/version-sync
|
||||
COMMAND ${SHELL} ${toxcore_SOURCE_DIR}/other/version-sync
|
||||
${toxcore_SOURCE_DIR}
|
||||
${PROJECT_VERSION_MAJOR}
|
||||
${PROJECT_VERSION_MINOR}
|
||||
|
@ -615,7 +615,7 @@ endif()
|
|||
|
||||
function(make_version_script header ns lib)
|
||||
execute_process(
|
||||
COMMAND ${SH} -c "egrep '^\\w' ${header} | grep '${ns}_[a-z0-9_]*(' | grep -v '^typedef' | grep -o '${ns}_[a-z0-9_]*(' | egrep -o '\\w+' | sort -u"
|
||||
COMMAND ${SHELL} -c "egrep '^\\w' ${header} | grep '${ns}_[a-z0-9_]*(' | grep -v '^typedef' | grep -o '${ns}_[a-z0-9_]*(' | egrep -o '\\w+' | sort -u"
|
||||
OUTPUT_VARIABLE ${lib}_SYMS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE "\n" ";" ${lib}_SYMS ${${lib}_SYMS})
|
||||
|
@ -641,7 +641,7 @@ if(WIN32 OR APPLE)
|
|||
set(STRICT_ABI OFF)
|
||||
endif()
|
||||
|
||||
if(STRICT_ABI AND SH)
|
||||
if(STRICT_ABI AND SHELL AND ENABLE_SHARED)
|
||||
if(BUILD_TOXAV)
|
||||
make_version_script(${toxcore_SOURCE_DIR}/toxav/toxav.h toxav toxav)
|
||||
endif()
|
||||
|
|
|
@ -2,6 +2,14 @@ option(ENABLE_SHARED "Build shared (dynamic) libraries for all modules" ON)
|
|||
option(ENABLE_STATIC "Build static libraries for all modules" ON)
|
||||
option(COMPILE_AS_CXX "Compile all C code as C++ code" OFF)
|
||||
|
||||
if(NOT ENABLE_SHARED AND NOT ENABLE_STATIC)
|
||||
message(WARNING
|
||||
"Both static and shared libraries are disabled; "
|
||||
"enabling only shared libraries. Use -DENABLE_SHARED or -DENABLE_STATIC to "
|
||||
"select one manually.")
|
||||
set(ENABLE_SHARED ON)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
if(COMPILE_AS_CXX)
|
||||
|
|
|
@ -3,9 +3,26 @@
|
|||
# Enable test coverage recording.
|
||||
export CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
|
||||
|
||||
set_opt() {
|
||||
opts="$opts -D$1="`expr ON \& \( $i % 2 \) \| OFF`
|
||||
set +e # result can be 0
|
||||
i=`expr $i / 2`
|
||||
set -e
|
||||
}
|
||||
|
||||
# Try some combinations of cmake options.
|
||||
for i in `seq 0 7`; do
|
||||
set +x
|
||||
opts="$CMAKE_EXTRA_FLAGS -DWARNINGS=OFF"
|
||||
set_opt STRICT_ABI
|
||||
set_opt ENABLE_STATIC
|
||||
set_opt ENABLE_SHARED
|
||||
set -x
|
||||
RUN $CMAKE -B$BUILD_DIR -H. $opts
|
||||
rm -rf $BUILD_DIR
|
||||
done
|
||||
|
||||
# Build toxcore and run tests.
|
||||
# TODO(iphydf): Enable ASAN. It currently has some bad interactions with gcov,
|
||||
# so it's disabled on Travis.
|
||||
RUN $CMAKE \
|
||||
-B$BUILD_DIR \
|
||||
-H. \
|
||||
|
|
Loading…
Reference in New Issue
Block a user