From 0f8f82a3cf639233c69c893c102a82b6e11ae98e Mon Sep 17 00:00:00 2001 From: "zugz (tox)" Date: Sat, 8 Dec 2018 12:32:32 +0100 Subject: [PATCH] Add cmake option for building additional tests Closes #1262 --- CMakeLists.txt | 27 +++++++++++++++------------ INSTALL.md | 3 ++- cmake/StrictAbi.cmake | 22 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c82f8a69..ed4c2191 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -508,18 +508,21 @@ if(NOT WIN32 endif() endif() -add_executable(DHT_test ${CPUFEATURES} - testing/DHT_test.c) -target_link_modules(DHT_test toxcore misc_tools) +option(BUILD_MISC_TESTS "Build additional tests" OFF) +if (BUILD_MISC_TESTS) + add_executable(DHT_test ${CPUFEATURES} + testing/DHT_test.c) + target_link_modules(DHT_test toxcore misc_tools) -add_executable(Messenger_test ${CPUFEATURES} - testing/Messenger_test.c) -target_link_modules(Messenger_test toxcore misc_tools) + add_executable(Messenger_test ${CPUFEATURES} + testing/Messenger_test.c) + target_link_modules(Messenger_test toxcore misc_tools) -add_executable(random_testing ${CPUFEATURES} - testing/random_testing.cc) -target_link_modules(random_testing toxcore misc_tools) + add_executable(random_testing ${CPUFEATURES} + testing/random_testing.cc) + target_link_modules(random_testing toxcore misc_tools) -add_executable(save-generator - other/fun/save-generator.c) -target_link_modules(save-generator toxcore misc_tools) + add_executable(save-generator + other/fun/save-generator.c) + target_link_modules(save-generator toxcore misc_tools) +endif() diff --git a/INSTALL.md b/INSTALL.md index 5e5828ac..2cb25741 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -83,8 +83,10 @@ There are some options that are available to configure the build. | Name | Description | Expected Value | Default Value | |------------------------|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|---------------------------------------------------| +| `AUTOTEST` | Enable autotests (mainly for CI). | ON or OFF | OFF | | `BOOTSTRAP_DAEMON` | Enable building of tox-bootstrapd, the DHT bootstrap node daemon. For Unix-like systems only. | ON or OFF | ON | | `BUILD_AV_TEST` | Build toxav test. | ON or OFF | ON | +| `BUILD_MISC_TESTS` | Build additional tests. | ON or OFF | OFF | | `BUILD_TOXAV` | Whether to build the tox AV library. | ON or OFF | ON | | `CMAKE_INSTALL_PREFIX` | Path to where everything should be installed. | Directory path. | Platform-dependent. Refer to CMake documentation. | | `DHT_BOOTSTRAP` | Enable building of `DHT_bootstrap` | ON or OFF | ON | @@ -94,7 +96,6 @@ There are some options that are available to configure the build. | `STRICT_ABI` | Enforce strict ABI export in dynamic libraries. | ON or OFF | OFF | | `TEST_TIMEOUT_SECONDS` | Limit runtime of each test to the number of seconds specified. | Positive number or nothing (empty string). | Empty string. | | `USE_IPV6` | Use IPv6 in tests. | ON or OFF | ON | -| `AUTOTEST` | Enable autotests (mainly for CI). | ON or OFF | OFF | You can get this list of option using the following commands diff --git a/cmake/StrictAbi.cmake b/cmake/StrictAbi.cmake index 5a646d77..2dc5c5e0 100644 --- a/cmake/StrictAbi.cmake +++ b/cmake/StrictAbi.cmake @@ -52,3 +52,25 @@ if(WIN32 OR APPLE) # Windows and OSX don't have this linker functionality. set(STRICT_ABI OFF) endif() + +if(STRICT_ABI) + if(AUTOTEST) + message("AUTOTEST option is incompatible with STRICT_ABI. Disabling AUTOTEST.") + endif() + set(AUTOTEST OFF) + + if(BUILD_MISC_TESTS) + message("BUILD_MISC_TESTS option is incompatible with STRICT_ABI. Disabling BUILD_MISC_TESTS.") + endif() + set(BUILD_MISC_TESTS OFF) + + if(BOOTSTRAP_DAEMON) + message("BOOTSTRAP_DAEMON option is incompatible with STRICT_ABI. Disabling BOOTSTRAP_DAEMON.") + endif() + set(BOOTSTRAP_DAEMON OFF) + + if(DHT_BOOTSTRAP) + message("DHT_BOOTSTRAP option is incompatible with STRICT_ABI. Disabling DHT_BOOTSTRAP.") + endif() + set(DHT_BOOTSTRAP OFF) +endif()