summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Biro <nurupo.contributions@gmail.com>2018-10-03 07:49:17 -0400
committerMaxim Biro <nurupo.contributions@gmail.com>2018-10-07 15:15:58 -0400
commitf5afc526550d935585f4023142853eeb95115734 (patch)
tree5631d20eb74e06b57b752d9619d28cd552277b4b
parent11e1f63f54356aa6fcedea348a7be73aac81d051 (diff)
Default to not defining MIN_LOGGER_LEVEL in CMake
That way CMake's behavior matches what autotools does -- letting toxcore/logger.h handle the default case.
-rwxr-xr-x.travis/cmake-freebsd-stage22
-rwxr-xr-x.travis/cmake-linux2
-rwxr-xr-x.travis/cmake-osx2
-rw-r--r--.travis/cmake-windows.sh2
-rw-r--r--CMakeLists.txt21
-rw-r--r--INSTALL.md29
-rw-r--r--configure.ac2
7 files changed, 29 insertions, 31 deletions
diff --git a/.travis/cmake-freebsd-stage2 b/.travis/cmake-freebsd-stage2
index 92e681f0..cf09490c 100755
--- a/.travis/cmake-freebsd-stage2
+++ b/.travis/cmake-freebsd-stage2
@@ -56,7 +56,7 @@ travis_script() {
56 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \ 56 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
57 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \ 57 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
58 -DCMAKE_INSTALL_PREFIX:PATH="_install" \ 58 -DCMAKE_INSTALL_PREFIX:PATH="_install" \
59 -DTRACE=ON \ 59 -DMIN_LOGGER_LEVEL=TRACE \
60 -DMUST_BUILD_TOXAV=ON \ 60 -DMUST_BUILD_TOXAV=ON \
61 -DSTRICT_ABI=ON \ 61 -DSTRICT_ABI=ON \
62 -DTEST_TIMEOUT_SECONDS=120 \ 62 -DTEST_TIMEOUT_SECONDS=120 \
diff --git a/.travis/cmake-linux b/.travis/cmake-linux
index 541eb014..87df3b37 100755
--- a/.travis/cmake-linux
+++ b/.travis/cmake-linux
@@ -91,7 +91,7 @@ travis_script() {
91 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \ 91 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
92 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \ 92 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
93 -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \ 93 -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
94 -DTRACE=ON \ 94 -DMIN_LOGGER_LEVEL=TRACE \
95 -DMUST_BUILD_TOXAV=ON \ 95 -DMUST_BUILD_TOXAV=ON \
96 -DSTRICT_ABI=ON \ 96 -DSTRICT_ABI=ON \
97 -DTEST_TIMEOUT_SECONDS=120 \ 97 -DTEST_TIMEOUT_SECONDS=120 \
diff --git a/.travis/cmake-osx b/.travis/cmake-osx
index 524f7116..9c5b8e10 100755
--- a/.travis/cmake-osx
+++ b/.travis/cmake-osx
@@ -28,7 +28,7 @@ travis_script() {
28 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \ 28 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
29 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \ 29 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
30 -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \ 30 -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
31 -DTRACE=ON \ 31 -DMIN_LOGGER_LEVEL=TRACE \
32 -DMUST_BUILD_TOXAV=ON \ 32 -DMUST_BUILD_TOXAV=ON \
33 -DTEST_TIMEOUT_SECONDS=120 \ 33 -DTEST_TIMEOUT_SECONDS=120 \
34 -DUSE_IPV6=OFF 34 -DUSE_IPV6=OFF
diff --git a/.travis/cmake-windows.sh b/.travis/cmake-windows.sh
index a7d1f7e1..80e37141 100644
--- a/.travis/cmake-windows.sh
+++ b/.travis/cmake-windows.sh
@@ -30,7 +30,7 @@ travis_script() {
30 -e ENABLE_ARCH_i686=$i686 \ 30 -e ENABLE_ARCH_i686=$i686 \
31 -e ENABLE_ARCH_x86_64=$x86_64 \ 31 -e ENABLE_ARCH_x86_64=$x86_64 \
32 -e ENABLE_TEST=true \ 32 -e ENABLE_TEST=true \
33 -e EXTRA_CMAKE_FLAGS="-DBOOTSTRAP_DAEMON=OFF -DDEBUG=ON -DTEST_TIMEOUT_SECONDS=90" \ 33 -e EXTRA_CMAKE_FLAGS="-DBOOTSTRAP_DAEMON=OFF -DMIN_LOGGER_LEVEL=DEBUG -DTEST_TIMEOUT_SECONDS=90" \
34 -e DCMAKE_C_FLAGS="$C_FLAGS" \ 34 -e DCMAKE_C_FLAGS="$C_FLAGS" \
35 -e CMAKE_CXX_FLAGS="$CXX_FLAGS" \ 35 -e CMAKE_CXX_FLAGS="$CXX_FLAGS" \
36 -e CMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \ 36 -e CMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d68eb801..435cdad3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -93,18 +93,17 @@ else()
93 message(STATUS "Supported C++ compiler features = ${CMAKE_CXX_COMPILE_FEATURES}") 93 message(STATUS "Supported C++ compiler features = ${CMAKE_CXX_COMPILE_FEATURES}")
94endif() 94endif()
95 95
96option(DEBUG "Enable DEBUG level logging (default)" ON) 96set(MIN_LOGGER_LEVEL "" CACHE STRING "Logging level to use (TRACE, DEBUG, INFO, WARNING, ERROR)")
97if(DEBUG)
98 set(MIN_LOGGER_LEVEL DEBUG)
99endif()
100
101option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF)
102if(TRACE)
103 set(MIN_LOGGER_LEVEL TRACE)
104endif()
105
106if(MIN_LOGGER_LEVEL) 97if(MIN_LOGGER_LEVEL)
107 add_definitions(-DMIN_LOGGER_LEVEL=LOGGER_LEVEL_${MIN_LOGGER_LEVEL}) 98 if(("${MIN_LOGGER_LEVEL}" STREQUAL "TRACE") OR
99 ("${MIN_LOGGER_LEVEL}" STREQUAL "DEBUG") OR
100 ("${MIN_LOGGER_LEVEL}" STREQUAL "INFO") OR
101 ("${MIN_LOGGER_LEVEL}" STREQUAL "WARNING") OR
102 ("${MIN_LOGGER_LEVEL}" STREQUAL "ERROR"))
103 add_definitions(-DMIN_LOGGER_LEVEL=LOGGER_LEVEL_${MIN_LOGGER_LEVEL})
104 else()
105 message(FATAL_ERROR "Unknown value provided for MIN_LOGGER_LEVEL: \"${MIN_LOGGER_LEVEL}\", must be one of TRACE, DEBUG, INFO, WARNING or ERROR")
106 endif()
108endif() 107endif()
109 108
110option(USE_IPV6 "Use IPv6 in tests" ON) 109option(USE_IPV6 "Use IPv6 in tests" ON)
diff --git a/INSTALL.md b/INSTALL.md
index 8b2f7f18..9ba73e33 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -81,20 +81,19 @@ There is some experimental accommodation for building natively on Windows, i.e.
81 81
82There are some options that are available to configure the build. 82There are some options that are available to configure the build.
83 83
84| Name | Description | Expected Value | Default Value | 84| Name | Description | Expected Value | Default Value |
85|------------------------|-----------------------------------------------------------------------------------------------|--------------------------------------------|---------------------------------------------------| 85|------------------------|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|---------------------------------------------------|
86| `BOOTSTRAP_DAEMON` | Enable building of tox-bootstrapd, the DHT bootstrap node daemon. For Unix-like systems only. | ON or OFF | ON | 86| `BOOTSTRAP_DAEMON` | Enable building of tox-bootstrapd, the DHT bootstrap node daemon. For Unix-like systems only. | ON or OFF | ON |
87| `BUILD_AV_TEST` | Build toxav test. | ON or OFF | ON | 87| `BUILD_AV_TEST` | Build toxav test. | ON or OFF | ON |
88| `BUILD_TOXAV` | Whether to build the tox AV library. | ON or OFF | ON | 88| `BUILD_TOXAV` | Whether to build the tox AV library. | ON or OFF | ON |
89| `CMAKE_INSTALL_PREFIX` | Path to where everything should be installed. | Directory path. | Platform-dependent. Refer to CMake documentation. | 89| `CMAKE_INSTALL_PREFIX` | Path to where everything should be installed. | Directory path. | Platform-dependent. Refer to CMake documentation. |
90| `DEBUG` | Enable assertions and other debugging facilities. | ON or OFF | OFF | 90| `DHT_BOOTSTRAP` | Enable building of `DHT_bootstrap` | ON or OFF | ON |
91| `DHT_BOOTSTRAP` | Enable building of `DHT_bootstrap` | ON or OFF | ON | 91| `ENABLE_SHARED` | Build shared (dynamic) libraries for all modules. | ON or OFF | ON |
92| `ENABLE_SHARED` | Build shared (dynamic) libraries for all modules. | ON or OFF | ON | 92| `ENABLE_STATIC` | Build static libraries for all modules. | ON or OFF | ON |
93| `ENABLE_STATIC` | Build static libraries for all modules. | ON or OFF | ON | 93| `MIN_LOGGER_LEVEL` | Logging level to use. | TRACE, DEBUG, INFO, WARNING, ERROR or nothing (empty string) for default. | Empty string. |
94| `STRICT_ABI` | Enforce strict ABI export in dynamic libraries. | ON or OFF | OFF | 94| `STRICT_ABI` | Enforce strict ABI export in dynamic libraries. | ON or OFF | OFF |
95| `TEST_TIMEOUT_SECONDS` | Limit runtime of each test to the number of seconds specified. | Positive number or nothing (empty string). | Empty string. | 95| `TEST_TIMEOUT_SECONDS` | Limit runtime of each test to the number of seconds specified. | Positive number or nothing (empty string). | Empty string. |
96| `TRACE` | Enable TRACE level logging (expensive, for network debugging). | ON or OFF | OFF | 96| `USE_IPV6` | Use IPv6 in tests. | ON or OFF | ON |
97| `USE_IPV6` | Use IPv6 in tests. | ON or OFF | ON |
98 97
99You can get this list of option using the following commands 98You can get this list of option using the following commands
100 99
@@ -110,7 +109,7 @@ Example of calling cmake with options
110```sh 109```sh
111cmake \ 110cmake \
112 -D ENABLE_STATIC=OFF \ 111 -D ENABLE_STATIC=OFF \
113 -D DEBUG=ON \ 112 -D MIN_LOGGER_LEVEL=DEBUG \
114 -D CMAKE_INSTALL_PREFIX=/opt \ 113 -D CMAKE_INSTALL_PREFIX=/opt \
115 -D TEST_TIMEOUT_SECONDS=120 \ 114 -D TEST_TIMEOUT_SECONDS=120 \
116 .. 115 ..
diff --git a/configure.ac b/configure.ac
index 13913622..0ad65de4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,7 +82,7 @@ AC_ARG_WITH(log-level,
82 elif test "x$withval" = "xERROR"; then 82 elif test "x$withval" = "xERROR"; then
83 AC_DEFINE([MIN_LOGGER_LEVEL], [LOGGER_LEVEL_ERROR], [Logger_Level value]) 83 AC_DEFINE([MIN_LOGGER_LEVEL], [LOGGER_LEVEL_ERROR], [Logger_Level value])
84 else 84 else
85 AC_MSG_WARN([Invalid logger level: $withval. Using default 'DEBUG']) 85 AC_MSG_WARN([Invalid logger level: $withval. Using default.])
86 fi 86 fi
87 ] 87 ]
88) 88)