diff options
-rw-r--r-- | CMakeLists.txt | 10 | ||||
-rw-r--r-- | cmake/ModulePackage.cmake | 8 | ||||
-rwxr-xr-x | other/travis/toxcore-script | 21 |
3 files changed, 32 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e9888601..f0707a76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -596,11 +596,11 @@ endif() | |||
596 | # | 596 | # |
597 | ################################################################################ | 597 | ################################################################################ |
598 | 598 | ||
599 | find_program(SH NAMES sh dash bash zsh) | 599 | find_program(SHELL NAMES sh dash bash zsh) |
600 | 600 | ||
601 | if(SH) | 601 | if(SHELL) |
602 | execute_process( | 602 | execute_process( |
603 | COMMAND ${SH} ${toxcore_SOURCE_DIR}/other/version-sync | 603 | COMMAND ${SHELL} ${toxcore_SOURCE_DIR}/other/version-sync |
604 | ${toxcore_SOURCE_DIR} | 604 | ${toxcore_SOURCE_DIR} |
605 | ${PROJECT_VERSION_MAJOR} | 605 | ${PROJECT_VERSION_MAJOR} |
606 | ${PROJECT_VERSION_MINOR} | 606 | ${PROJECT_VERSION_MINOR} |
@@ -615,7 +615,7 @@ endif() | |||
615 | 615 | ||
616 | function(make_version_script header ns lib) | 616 | function(make_version_script header ns lib) |
617 | execute_process( | 617 | execute_process( |
618 | 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" | 618 | 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" |
619 | OUTPUT_VARIABLE ${lib}_SYMS | 619 | OUTPUT_VARIABLE ${lib}_SYMS |
620 | OUTPUT_STRIP_TRAILING_WHITESPACE) | 620 | OUTPUT_STRIP_TRAILING_WHITESPACE) |
621 | string(REPLACE "\n" ";" ${lib}_SYMS ${${lib}_SYMS}) | 621 | string(REPLACE "\n" ";" ${lib}_SYMS ${${lib}_SYMS}) |
@@ -641,7 +641,7 @@ if(WIN32 OR APPLE) | |||
641 | set(STRICT_ABI OFF) | 641 | set(STRICT_ABI OFF) |
642 | endif() | 642 | endif() |
643 | 643 | ||
644 | if(STRICT_ABI AND SH) | 644 | if(STRICT_ABI AND SHELL AND ENABLE_SHARED) |
645 | if(BUILD_TOXAV) | 645 | if(BUILD_TOXAV) |
646 | make_version_script(${toxcore_SOURCE_DIR}/toxav/toxav.h toxav toxav) | 646 | make_version_script(${toxcore_SOURCE_DIR}/toxav/toxav.h toxav toxav) |
647 | endif() | 647 | endif() |
diff --git a/cmake/ModulePackage.cmake b/cmake/ModulePackage.cmake index 26c6c39a..613633ba 100644 --- a/cmake/ModulePackage.cmake +++ b/cmake/ModulePackage.cmake | |||
@@ -2,6 +2,14 @@ option(ENABLE_SHARED "Build shared (dynamic) libraries for all modules" ON) | |||
2 | option(ENABLE_STATIC "Build static libraries for all modules" ON) | 2 | option(ENABLE_STATIC "Build static libraries for all modules" ON) |
3 | option(COMPILE_AS_CXX "Compile all C code as C++ code" OFF) | 3 | option(COMPILE_AS_CXX "Compile all C code as C++ code" OFF) |
4 | 4 | ||
5 | if(NOT ENABLE_SHARED AND NOT ENABLE_STATIC) | ||
6 | message(WARNING | ||
7 | "Both static and shared libraries are disabled; " | ||
8 | "enabling only shared libraries. Use -DENABLE_SHARED or -DENABLE_STATIC to " | ||
9 | "select one manually.") | ||
10 | set(ENABLE_SHARED ON) | ||
11 | endif() | ||
12 | |||
5 | find_package(PkgConfig REQUIRED) | 13 | find_package(PkgConfig REQUIRED) |
6 | 14 | ||
7 | if(COMPILE_AS_CXX) | 15 | if(COMPILE_AS_CXX) |
diff --git a/other/travis/toxcore-script b/other/travis/toxcore-script index d25dc135..9b81b863 100755 --- a/other/travis/toxcore-script +++ b/other/travis/toxcore-script | |||
@@ -3,9 +3,26 @@ | |||
3 | # Enable test coverage recording. | 3 | # Enable test coverage recording. |
4 | export CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" | 4 | export CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" |
5 | 5 | ||
6 | set_opt() { | ||
7 | opts="$opts -D$1="`expr ON \& \( $i % 2 \) \| OFF` | ||
8 | set +e # result can be 0 | ||
9 | i=`expr $i / 2` | ||
10 | set -e | ||
11 | } | ||
12 | |||
13 | # Try some combinations of cmake options. | ||
14 | for i in `seq 0 7`; do | ||
15 | set +x | ||
16 | opts="$CMAKE_EXTRA_FLAGS -DWARNINGS=OFF" | ||
17 | set_opt STRICT_ABI | ||
18 | set_opt ENABLE_STATIC | ||
19 | set_opt ENABLE_SHARED | ||
20 | set -x | ||
21 | RUN $CMAKE -B$BUILD_DIR -H. $opts | ||
22 | rm -rf $BUILD_DIR | ||
23 | done | ||
24 | |||
6 | # Build toxcore and run tests. | 25 | # Build toxcore and run tests. |
7 | # TODO(iphydf): Enable ASAN. It currently has some bad interactions with gcov, | ||
8 | # so it's disabled on Travis. | ||
9 | RUN $CMAKE \ | 26 | RUN $CMAKE \ |
10 | -B$BUILD_DIR \ | 27 | -B$BUILD_DIR \ |
11 | -H. \ | 28 | -H. \ |