diff options
author | iphydf <iphydf@users.noreply.github.com> | 2017-01-20 17:42:30 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2017-01-22 11:56:02 +0000 |
commit | ce0bf232d1b2c01df056df9a030e10ba5252832f (patch) | |
tree | 394ff60b46856d63737f6431c199b6aa38c90f9c /CMakeLists.txt | |
parent | b630121f2f659027e1c9f00cd97087ef34e95677 (diff) |
Add appveyor build for native windows tests.
It doesn't compile, yet. A few changes (like VLA support) need to be made
before we can enable appveyor as a required PR check.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 169 |
1 files changed, 73 insertions, 96 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e436d35..52a52dee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -1,4 +1,5 @@ | |||
1 | cmake_minimum_required(VERSION 2.8.6) | 1 | cmake_minimum_required(VERSION 2.8.6) |
2 | cmake_policy(VERSION 2.8.6) | ||
2 | project(toxcore) | 3 | project(toxcore) |
3 | include(CTest) | 4 | include(CTest) |
4 | 5 | ||
@@ -41,7 +42,6 @@ include(ApiDsl) | |||
41 | include(CheckCCompilerFlag) | 42 | include(CheckCCompilerFlag) |
42 | include(CheckCXXCompilerFlag) | 43 | include(CheckCXXCompilerFlag) |
43 | include(MacRpath) | 44 | include(MacRpath) |
44 | include(ModulePackage) | ||
45 | 45 | ||
46 | set(CMAKE_MACOSX_RPATH ON) | 46 | set(CMAKE_MACOSX_RPATH ON) |
47 | 47 | ||
@@ -76,77 +76,79 @@ macro(add_flag flag) | |||
76 | add_cxxflag(${flag}) | 76 | add_cxxflag(${flag}) |
77 | endmacro() | 77 | endmacro() |
78 | 78 | ||
79 | # Set standard version for compiler. | 79 | if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") |
80 | add_cflag("-std=c99") | 80 | # Set standard version for compiler. |
81 | add_cxxflag("-std=c++11") | 81 | add_cflag("-std=c99") |
82 | 82 | add_cxxflag("-std=c++11") | |
83 | # Warn on non-ISO C. | 83 | |
84 | add_cflag("-pedantic") | 84 | # Warn on non-ISO C. |
85 | 85 | add_cflag("-pedantic") | |
86 | option(WARNINGS "Enable additional compiler warnings" ON) | 86 | |
87 | if(WARNINGS) | 87 | option(WARNINGS "Enable additional compiler warnings" ON) |
88 | # Add all warning flags we can. | 88 | if(WARNINGS) |
89 | add_flag("-Wall") | 89 | # Add all warning flags we can. |
90 | add_flag("-Wextra") | 90 | add_flag("-Wall") |
91 | add_flag("-Weverything") | 91 | add_flag("-Wextra") |
92 | 92 | add_flag("-Weverything") | |
93 | # Disable specific warning flags for both C and C++. | 93 | |
94 | add_flag("-Wno-cast-align") | 94 | # Disable specific warning flags for both C and C++. |
95 | add_flag("-Wno-conversion") | 95 | add_flag("-Wno-cast-align") |
96 | add_flag("-Wno-covered-switch-default") | 96 | add_flag("-Wno-conversion") |
97 | add_flag("-Wno-documentation-deprecated-sync") | 97 | add_flag("-Wno-covered-switch-default") |
98 | add_flag("-Wno-format-nonliteral") | 98 | add_flag("-Wno-documentation-deprecated-sync") |
99 | add_flag("-Wno-missing-field-initializers") | 99 | add_flag("-Wno-format-nonliteral") |
100 | add_flag("-Wno-missing-prototypes") | 100 | add_flag("-Wno-missing-field-initializers") |
101 | add_flag("-Wno-padded") | 101 | add_flag("-Wno-missing-prototypes") |
102 | add_flag("-Wno-parentheses") | 102 | add_flag("-Wno-padded") |
103 | add_flag("-Wno-return-type") | 103 | add_flag("-Wno-parentheses") |
104 | add_flag("-Wno-sign-compare") | 104 | add_flag("-Wno-return-type") |
105 | add_flag("-Wno-sign-conversion") | 105 | add_flag("-Wno-sign-compare") |
106 | add_flag("-Wno-tautological-constant-out-of-range-compare") | 106 | add_flag("-Wno-sign-conversion") |
107 | add_flag("-Wno-type-limits") | 107 | add_flag("-Wno-tautological-constant-out-of-range-compare") |
108 | add_flag("-Wno-undef") | 108 | add_flag("-Wno-type-limits") |
109 | add_flag("-Wno-unreachable-code") | 109 | add_flag("-Wno-undef") |
110 | add_flag("-Wno-unused-macros") | 110 | add_flag("-Wno-unreachable-code") |
111 | add_flag("-Wno-unused-parameter") | 111 | add_flag("-Wno-unused-macros") |
112 | add_flag("-Wno-vla") | 112 | add_flag("-Wno-unused-parameter") |
113 | 113 | add_flag("-Wno-vla") | |
114 | # Disable specific warning flags for C. | 114 | |
115 | add_cflag("-Wno-assign-enum") | 115 | # Disable specific warning flags for C. |
116 | add_cflag("-Wno-bad-function-cast") | 116 | add_cflag("-Wno-assign-enum") |
117 | add_cflag("-Wno-double-promotion") | 117 | add_cflag("-Wno-bad-function-cast") |
118 | add_cflag("-Wno-gnu-zero-variadic-macro-arguments") | 118 | add_cflag("-Wno-double-promotion") |
119 | add_cflag("-Wno-packed") | 119 | add_cflag("-Wno-gnu-zero-variadic-macro-arguments") |
120 | add_cflag("-Wno-reserved-id-macro") | 120 | add_cflag("-Wno-packed") |
121 | add_cflag("-Wno-shadow") | 121 | add_cflag("-Wno-reserved-id-macro") |
122 | add_cflag("-Wno-shorten-64-to-32") | 122 | add_cflag("-Wno-shadow") |
123 | add_cflag("-Wno-unreachable-code-return") | 123 | add_cflag("-Wno-shorten-64-to-32") |
124 | add_cflag("-Wno-unused-but-set-variable") | 124 | add_cflag("-Wno-unreachable-code-return") |
125 | add_cflag("-Wno-used-but-marked-unused") | 125 | add_cflag("-Wno-unused-but-set-variable") |
126 | 126 | add_cflag("-Wno-used-but-marked-unused") | |
127 | # Disable specific warning flags for C++. | 127 | |
128 | add_cxxflag("-Wno-c++11-compat") | 128 | # Disable specific warning flags for C++. |
129 | add_cxxflag("-Wno-c++11-extensions") | 129 | add_cxxflag("-Wno-c++11-compat") |
130 | add_cxxflag("-Wno-c++11-narrowing") | 130 | add_cxxflag("-Wno-c++11-extensions") |
131 | add_cxxflag("-Wno-c99-extensions") | 131 | add_cxxflag("-Wno-c++11-narrowing") |
132 | add_cxxflag("-Wno-narrowing") | 132 | add_cxxflag("-Wno-c99-extensions") |
133 | add_cxxflag("-Wno-old-style-cast") | 133 | add_cxxflag("-Wno-narrowing") |
134 | add_cxxflag("-Wno-variadic-macros") | 134 | add_cxxflag("-Wno-old-style-cast") |
135 | add_cxxflag("-Wno-vla-extension") | 135 | add_cxxflag("-Wno-variadic-macros") |
136 | endif() | 136 | add_cxxflag("-Wno-vla-extension") |
137 | endif() | ||
137 | 138 | ||
138 | option(ERROR_ON_WARNING "Make compilation error on a warning" OFF) | 139 | option(ERROR_ON_WARNING "Make compilation error on a warning" OFF) |
139 | if(ERROR_ON_WARNING) | 140 | if(ERROR_ON_WARNING) |
140 | # Set error-on-warn for C compilation. C++ compilation can't use this because | 141 | # Set error-on-warn for C compilation. C++ compilation can't use this because |
141 | # treating 'c' input as 'c++' when in C++ mode is deprecated in clang and | 142 | # treating 'c' input as 'c++' when in C++ mode is deprecated in clang and |
142 | # there is no way to turn off that warning. | 143 | # there is no way to turn off that warning. |
143 | add_cflag("-Werror") | 144 | add_cflag("-Werror") |
144 | endif() | 145 | endif() |
145 | 146 | ||
146 | option(DEBUG "Enable assertions and other debugging facilities" OFF) | 147 | option(DEBUG "Enable assertions and other debugging facilities" OFF) |
147 | if(DEBUG) | 148 | if(DEBUG) |
148 | set(MIN_LOGGER_LEVEL DEBUG) | 149 | set(MIN_LOGGER_LEVEL DEBUG) |
149 | add_cflag("-g3") | 150 | add_cflag("-g3") |
151 | endif() | ||
150 | endif() | 152 | endif() |
151 | 153 | ||
152 | option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF) | 154 | option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF) |
@@ -166,32 +168,7 @@ if(ASAN) | |||
166 | set(CMAKE_REQUIRED_LIBRARIES "${SAFE_CMAKE_REQUIRED_LIBRARIES}") | 168 | set(CMAKE_REQUIRED_LIBRARIES "${SAFE_CMAKE_REQUIRED_LIBRARIES}") |
167 | endif() | 169 | endif() |
168 | 170 | ||
169 | find_package(Threads REQUIRED) | 171 | include(Dependencies) |
170 | |||
171 | find_library(NCURSES_LIBRARIES ncurses ) | ||
172 | find_library(UTIL_LIBRARIES util ) | ||
173 | find_library(RT_LIBRARIES rt ) | ||
174 | |||
175 | # For toxcore. | ||
176 | pkg_use_module(LIBSODIUM REQUIRED libsodium ) | ||
177 | |||
178 | # For toxav. | ||
179 | pkg_use_module(OPUS opus ) | ||
180 | pkg_use_module(VPX vpx ) | ||
181 | |||
182 | # For tox-bootstrapd. | ||
183 | pkg_use_module(LIBCONFIG libconfig ) | ||
184 | |||
185 | # For auto tests. | ||
186 | pkg_use_module(CHECK check ) | ||
187 | |||
188 | # For tox-spectest. | ||
189 | pkg_use_module(MSGPACK msgpack ) | ||
190 | |||
191 | # For av_test. | ||
192 | pkg_use_module(OPENCV opencv ) | ||
193 | pkg_use_module(PORTAUDIO portaudio-2.0 ) | ||
194 | pkg_use_module(SNDFILE sndfile ) | ||
195 | 172 | ||
196 | if(OPUS_FOUND AND VPX_FOUND) | 173 | if(OPUS_FOUND AND VPX_FOUND) |
197 | set(BUILD_TOXAV TRUE) | 174 | set(BUILD_TOXAV TRUE) |