Skip to content

Commit 970d562

Browse files
authored
Merge pull request #526 from apple/revert-519-swift-support
Revert "build: port to new Swift support"
2 parents ec3fd9b + 91c435e commit 970d562

File tree

5 files changed

+626
-317
lines changed

5 files changed

+626
-317
lines changed

CMakeLists.txt

Lines changed: 75 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,22 @@
11

2-
cmake_minimum_required(VERSION 3.15.1)
2+
cmake_minimum_required(VERSION 3.4.3)
33

4-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
5-
6-
# NOTE(compnerd) enable CMP0091 - select MSVC runtime based on
7-
# CMAKE_MSVC_RUNTIME_LIBRARY. Requires CMake 3.15 or newer.
8-
if(POLICY CMP0091)
9-
cmake_policy(SET CMP0091 NEW)
10-
endif()
4+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
115

126
project(dispatch
13-
VERSION 1.3
14-
LANGUAGES C CXX)
7+
VERSION 1.3
8+
LANGUAGES C CXX)
159

1610
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
1711
include(ClangClCompileRules)
1812
endif()
1913

20-
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
21-
include(DispatchWindowsSupport)
22-
dispatch_windows_arch_spelling(${CMAKE_SYSTEM_PROCESSOR} DISPATCH_MSVC_ARCH)
23-
dispatch_windows_include_for_arch(${DISPATCH_MSVC_ARCH} DISPATCH_INCLUDES)
24-
include_directories(BEFORE SYSTEM ${DISPATCH_INCLUDES})
25-
dispatch_windows_lib_for_arch(${CMAKE_SYSTEM_PROCESSOR} DISPATCH_LIBDIR)
26-
link_directories(${DISPATCH_LIBDIR})
27-
endif()
28-
2914
set(CMAKE_C_STANDARD 11)
3015
set(CMAKE_C_STANDARD_REQUIRED YES)
3116

3217
set(CMAKE_CXX_STANDARD 11)
3318

3419
set(CMAKE_C_VISIBILITY_PRESET hidden)
35-
set(CMAKE_C_VISIBILITY_INLINES_HIDDEN YES)
3620

3721
# NOTE(compnerd) this is a horrible workaround for Windows to ensure that the
3822
# tests can run as there is no rpath equivalent and `PATH` is used to lookup the
@@ -44,37 +28,74 @@ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
4428
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
4529
find_package(Threads REQUIRED)
4630

47-
include(CheckCCompilerFlag)
4831
include(CheckCSourceCompiles)
4932
include(CheckFunctionExists)
5033
include(CheckIncludeFiles)
5134
include(CheckLibraryExists)
5235
include(CheckSymbolExists)
5336
include(GNUInstallDirs)
37+
include(SwiftSupport)
5438
include(CTest)
5539

40+
set(SWIFT_LIBDIR "lib" CACHE PATH "Library folder name, defined by swift main buildscript")
41+
set(INSTALL_LIBDIR "${SWIFT_LIBDIR}" CACHE PATH "Path where the libraries should be installed")
42+
5643
include(DispatchAppleOptions)
5744
include(DispatchSanitization)
45+
5846
include(DispatchCompilerWarnings)
59-
include(DTrace)
60-
include(SwiftSupport)
47+
dispatch_common_warnings()
48+
49+
option(ENABLE_DISPATCH_INIT_CONSTRUCTOR "enable libdispatch_init as a constructor" ON)
50+
set(USE_LIBDISPATCH_INIT_CONSTRUCTOR ${ENABLE_DISPATCH_INIT_CONSTRUCTOR})
6151

6252
# NOTE(abdulras) this is the CMake supported way to control whether we generate
6353
# shared or static libraries. This impacts the behaviour of `add_library` in
6454
# what type of library it generates.
6555
option(BUILD_SHARED_LIBS "build shared libraries" ON)
6656

67-
option(DISPATCH_ENABLE_ASSERTS "enable debug assertions" FALSE)
57+
option(ENABLE_SWIFT "enable libdispatch swift overlay" OFF)
58+
if(ENABLE_SWIFT)
59+
if(NOT CMAKE_SWIFT_COMPILER)
60+
message(FATAL_ERROR "CMAKE_SWIFT_COMPILER must be defined to enable swift")
61+
endif()
6862

69-
option(ENABLE_DISPATCH_INIT_CONSTRUCTOR "enable libdispatch_init as a constructor" ON)
70-
set(USE_LIBDISPATCH_INIT_CONSTRUCTOR ${ENABLE_DISPATCH_INIT_CONSTRUCTOR})
63+
string(TOLOWER ${CMAKE_SYSTEM_NAME} swift_os)
64+
get_swift_host_arch(swift_arch)
65+
66+
if(BUILD_SHARED_LIBS)
67+
set(swift_dir swift)
68+
else()
69+
set(swift_dir swift_static)
70+
endif()
71+
72+
set(INSTALL_TARGET_DIR "${INSTALL_LIBDIR}/${swift_dir}/${swift_os}" CACHE PATH "Path where the libraries will be installed")
73+
set(INSTALL_DISPATCH_HEADERS_DIR "${INSTALL_LIBDIR}/${swift_dir}/dispatch" CACHE PATH "Path where the headers will be installed for libdispatch")
74+
set(INSTALL_BLOCK_HEADERS_DIR "${INSTALL_LIBDIR}/${swift_dir}/Block" CACHE PATH "Path where the headers will be installed for the blocks runtime")
75+
set(INSTALL_OS_HEADERS_DIR "${INSTALL_LIBDIR}/${swift_dir}/os" CACHE PATH "Path where the os/ headers will be installed")
76+
endif()
77+
78+
if(NOT ENABLE_SWIFT)
79+
set(INSTALL_TARGET_DIR "${INSTALL_LIBDIR}" CACHE PATH "Path where the libraries will be installed")
80+
set(INSTALL_DISPATCH_HEADERS_DIR "include/dispatch" CACHE PATH "Path where the headers will be installed")
81+
set(INSTALL_BLOCK_HEADERS_DIR "include" CACHE PATH "Path where the headers will be installed for the blocks runtime")
82+
set(INSTALL_OS_HEADERS_DIR "include/os" CACHE PATH "Path where the headers will be installed")
83+
endif()
84+
85+
option(DISPATCH_ENABLE_ASSERTS "enable debug assertions" FALSE)
7186

7287
option(ENABLE_DTRACE "enable dtrace support" "")
7388

74-
if(CMAKE_SYSTEM_NAME STREQUAL Darwin OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
75-
set(ENABLE_INTERNAL_PTHREAD_WORKQUEUES_DEFAULT OFF)
76-
else()
89+
option(ENABLE_THREAD_LOCAL_STORAGE "enable usage of thread local storage via _Thread_local" ON)
90+
set(DISPATCH_USE_THREAD_LOCAL_STORAGE ${ENABLE_THREAD_LOCAL_STORAGE})
91+
92+
if(CMAKE_SYSTEM_NAME STREQUAL Linux OR
93+
CMAKE_SYSTEM_NAME STREQUAL Android OR
94+
CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR
95+
CMAKE_SYSTEM_NAME STREQUAL Windows)
7796
set(ENABLE_INTERNAL_PTHREAD_WORKQUEUES_DEFAULT ON)
97+
else()
98+
set(ENABLE_INTERNAL_PTHREAD_WORKQUEUES_DEFAULT OFF)
7899
endif()
79100
option(ENABLE_INTERNAL_PTHREAD_WORKQUEUES "use libdispatch's own implementation of pthread workqueues" ${ENABLE_INTERNAL_PTHREAD_WORKQUEUES_DEFAULT})
80101
if(ENABLE_INTERNAL_PTHREAD_WORKQUEUES)
@@ -93,15 +114,6 @@ endif()
93114

94115
option(INSTALL_PRIVATE_HEADERS "installs private headers in the same location as the public ones" OFF)
95116

96-
option(ENABLE_SWIFT "enable libdispatch swift overlay" OFF)
97-
if(ENABLE_SWIFT)
98-
enable_language(Swift)
99-
endif()
100-
101-
option(ENABLE_THREAD_LOCAL_STORAGE "enable usage of thread local storage via _Thread_local" ON)
102-
set(DISPATCH_USE_THREAD_LOCAL_STORAGE ${ENABLE_THREAD_LOCAL_STORAGE})
103-
104-
105117
check_symbol_exists(__GNU_LIBRARY__ "features.h" _GNU_SOURCE)
106118
if(_GNU_SOURCE)
107119
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE)
@@ -132,6 +144,8 @@ check_function_exists(strlcpy HAVE_STRLCPY)
132144
check_function_exists(sysconf HAVE_SYSCONF)
133145
check_function_exists(arc4random HAVE_ARC4RANDOM)
134146

147+
find_package(Threads REQUIRED)
148+
135149
check_include_files("TargetConditionals.h" HAVE_TARGETCONDITIONALS_H)
136150
check_include_files("dlfcn.h" HAVE_DLFCN_H)
137151
check_include_files("fcntl.h" HAVE_FCNTL_H)
@@ -167,7 +181,7 @@ else()
167181
set(USE_MACH_SEM 0)
168182
endif()
169183
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
170-
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:USE_WIN32_SEM>)
184+
add_definitions(-DUSE_WIN32_SEM)
171185
endif()
172186
check_library_exists(pthread sem_init "" USE_POSIX_SEM)
173187
# NOTE: android has not always provided a libpthread, but uses the pthreads API
@@ -197,7 +211,7 @@ check_symbol_exists(VQ_FREE_SPACE_CHANGE "sys/mount.h" HAVE_DECL_VQ_FREE_SPACE_C
197211
check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY)
198212
check_symbol_exists(program_invocation_name "errno.h" HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME)
199213
if (HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME)
200-
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:_GNU_SOURCE=1>)
214+
add_definitions(-D_GNU_SOURCE=1)
201215
endif()
202216
check_symbol_exists(__printflike "bsd/sys/cdefs.h" HAVE_PRINTFLIKE)
203217

@@ -206,28 +220,31 @@ if(CMAKE_SYSTEM_NAME STREQUAL Android)
206220
endif()
207221

208222
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
209-
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:_WITH_DPRINTF>)
223+
add_definitions(-D_WITH_DPRINTF)
210224
endif()
211225

212-
if(ENABLE_DTRACE)
226+
if(ENABLE_DTRACE STREQUAL "")
213227
find_program(dtrace_EXECUTABLE dtrace)
214-
if(NOT dtrace_EXECUTABLE AND NOT ENABLE_DTRACE STREQUAL "")
228+
if(dtrace_EXECUTABLE)
229+
add_definitions(-DDISPATCH_USE_DTRACE=1)
230+
else()
231+
add_definitions(-DDISPATCH_USE_DTRACE=0)
232+
endif()
233+
elseif(ENABLE_DTRACE)
234+
find_program(dtrace_EXECUTABLE dtrace)
235+
if(NOT dtrace_EXECUTABLE)
215236
message(FATAL_ERROR "dtrace not found but explicitly requested")
216237
endif()
217-
endif()
218-
219-
if(dtrace_EXECUTABLE)
220-
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:DISPATCH_USE_DTRACE=1>)
238+
add_definitions(-DDISPATCH_USE_DTRACE=1)
221239
else()
222-
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:DISPATCH_USE_DTRACE=0>)
240+
add_definitions(-DDISPATCH_USE_DTRACE=0)
223241
endif()
224242

225243
find_program(leaks_EXECUTABLE leaks)
226244
if(leaks_EXECUTABLE)
227245
set(HAVE_LEAKS TRUE)
228246
endif()
229247

230-
231248
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
232249
add_custom_command(OUTPUT
233250
"${PROJECT_SOURCE_DIR}/dispatch/module.modulemap"
@@ -249,25 +266,19 @@ add_custom_target(module-maps ALL
249266
DEPENDS
250267
"${PROJECT_SOURCE_DIR}/dispatch/module.modulemap"
251268
"${PROJECT_SOURCE_DIR}/private/module.modulemap")
252-
253269
configure_file("${PROJECT_SOURCE_DIR}/cmake/config.h.in"
254270
"${PROJECT_BINARY_DIR}/config/config_ac.h")
255-
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:HAVE_CONFIG_H>)
271+
add_definitions(-DHAVE_CONFIG_H)
256272

257-
258-
if(ENABLE_SWIFT)
259-
set(INSTALL_TARGET_DIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>" CACHE PATH "Path where the libraries will be installed")
260-
set(INSTALL_DISPATCH_HEADERS_DIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/dispatch" CACHE PATH "Path where the headers will be installed for libdispatch")
261-
set(INSTALL_BLOCK_HEADERS_DIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/Block" CACHE PATH "Path where the headers will be installed for the blocks runtime")
262-
set(INSTALL_OS_HEADERS_DIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/os" CACHE PATH "Path where the os/ headers will be installed")
263-
else()
264-
set(INSTALL_TARGET_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Path where the libraries will be installed")
265-
set(INSTALL_DISPATCH_HEADERS_DIR "include/dispatch" CACHE PATH "Path where the headers will be installed")
266-
set(INSTALL_BLOCK_HEADERS_DIR "include" CACHE PATH "Path where the headers will be installed for the blocks runtime")
267-
set(INSTALL_OS_HEADERS_DIR "include/os" CACHE PATH "Path where the headers will be installed")
273+
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
274+
include(DispatchWindowsSupport)
275+
dispatch_windows_arch_spelling(${CMAKE_SYSTEM_PROCESSOR} DISPATCH_MSVC_ARCH)
276+
dispatch_windows_include_for_arch(${DISPATCH_MSVC_ARCH} DISPATCH_INCLUDES)
277+
include_directories(BEFORE SYSTEM ${DISPATCH_INCLUDES})
278+
dispatch_windows_lib_for_arch(${CMAKE_SYSTEM_PROCESSOR} DISPATCH_LIBDIR)
279+
link_directories(${DISPATCH_LIBDIR})
268280
endif()
269281

270-
271282
add_subdirectory(dispatch)
272283
add_subdirectory(man)
273284
add_subdirectory(os)
@@ -276,3 +287,4 @@ add_subdirectory(src)
276287
if(BUILD_TESTING)
277288
add_subdirectory(tests)
278289
endif()
290+
Lines changed: 71 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,79 @@
11

22
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
33
# TODO: someone needs to provide the msvc equivalent warning flags
4+
macro(dispatch_common_warnings)
5+
endmacro()
46
else()
5-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Werror>)
6-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wall>)
7-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wextra>)
7+
macro(dispatch_common_warnings)
8+
add_compile_options(-Werror)
9+
add_compile_options(-Wall)
10+
add_compile_options(-Wextra)
811

9-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Warray-bounds-pointer-arithmetic>)
10-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wassign-enum>)
11-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Watomic-properties>)
12-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wcomma>)
13-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wconditional-uninitialized>)
14-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wconversion>)
15-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wcovered-switch-default>)
16-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wdate-time>)
17-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wdeprecated>)
18-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wdocumentation>)
19-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wdouble-promotion>)
20-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wduplicate-enum>)
21-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wexpansion-to-defined>)
22-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wfloat-equal>)
23-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Widiomatic-parentheses>)
24-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Winfinite-recursion>)
25-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wmissing-prototypes>)
26-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wnewline-eof>)
27-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wnullable-to-nonnull-conversion>)
28-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wobjc-interface-ivars>)
29-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wover-aligned>)
30-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wpacked>)
31-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wpointer-arith>)
32-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wselector>)
33-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wshadow>)
34-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wshorten-64-to-32>)
35-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wsign-conversion>)
36-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wstatic-in-inline>)
37-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wsuper-class-method-mismatch>)
38-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wswitch>)
39-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wunguarded-availability>)
40-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wunreachable-code>)
41-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wunused>)
12+
add_compile_options(-Warray-bounds-pointer-arithmetic)
13+
add_compile_options(-Wassign-enum)
14+
add_compile_options(-Watomic-properties)
15+
add_compile_options(-Wcomma)
16+
add_compile_options(-Wconditional-uninitialized)
17+
add_compile_options(-Wconversion)
18+
add_compile_options(-Wcovered-switch-default)
19+
add_compile_options(-Wdate-time)
20+
add_compile_options(-Wdeprecated)
21+
add_compile_options(-Wdocumentation)
22+
add_compile_options(-Wdouble-promotion)
23+
add_compile_options(-Wduplicate-enum)
24+
add_compile_options(-Wexpansion-to-defined)
25+
add_compile_options(-Wfloat-equal)
26+
add_compile_options(-Widiomatic-parentheses)
27+
add_compile_options(-Winfinite-recursion)
28+
add_compile_options(-Wmissing-prototypes)
29+
add_compile_options(-Wnewline-eof)
30+
add_compile_options(-Wnullable-to-nonnull-conversion)
31+
add_compile_options(-Wobjc-interface-ivars)
32+
add_compile_options(-Wover-aligned)
33+
add_compile_options(-Wpacked)
34+
add_compile_options(-Wpointer-arith)
35+
add_compile_options(-Wselector)
36+
add_compile_options(-Wshadow)
37+
add_compile_options(-Wshorten-64-to-32)
38+
add_compile_options(-Wsign-conversion)
39+
add_compile_options(-Wstatic-in-inline)
40+
add_compile_options(-Wsuper-class-method-mismatch)
41+
add_compile_options(-Wswitch)
42+
add_compile_options(-Wunguarded-availability)
43+
add_compile_options(-Wunreachable-code)
44+
add_compile_options(-Wunused)
4245

43-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-unknown-warning-option>)
44-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-trigraphs>)
45-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-four-char-constants>)
46-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-disabled-macro-expansion>)
47-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-pedantic>)
48-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-bad-function-cast>)
49-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-c++-compat>)
50-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-c++98-compat>)
51-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-c++98-compat-pedantic>)
52-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-cast-align>)
53-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-cast-qual>)
54-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-documentation-unknown-command>)
55-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-format-nonliteral>)
56-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-missing-variable-declarations>)
57-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-old-style-cast>)
58-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-padded>)
59-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-reserved-id-macro>)
60-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-shift-sign-overflow>)
61-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-undef>)
62-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-unreachable-code-aggressive>)
63-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-unused-macros>)
64-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-used-but-marked-unused>)
65-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-vla>)
46+
add_compile_options(-Wno-unknown-warning-option)
47+
add_compile_options(-Wno-trigraphs)
48+
add_compile_options(-Wno-four-char-constants)
49+
add_compile_options(-Wno-disabled-macro-expansion)
50+
add_compile_options(-Wno-pedantic)
51+
add_compile_options(-Wno-bad-function-cast)
52+
add_compile_options(-Wno-c++-compat)
53+
add_compile_options(-Wno-c++98-compat)
54+
add_compile_options(-Wno-c++98-compat-pedantic)
55+
add_compile_options(-Wno-cast-align)
56+
add_compile_options(-Wno-cast-qual)
57+
add_compile_options(-Wno-documentation-unknown-command)
58+
add_compile_options(-Wno-format-nonliteral)
59+
add_compile_options(-Wno-missing-variable-declarations)
60+
add_compile_options(-Wno-old-style-cast)
61+
add_compile_options(-Wno-padded)
62+
add_compile_options(-Wno-reserved-id-macro)
63+
add_compile_options(-Wno-shift-sign-overflow)
64+
add_compile_options(-Wno-undef)
65+
add_compile_options(-Wno-unreachable-code-aggressive)
66+
add_compile_options(-Wno-unused-macros)
67+
add_compile_options(-Wno-used-but-marked-unused)
68+
add_compile_options(-Wno-vla)
6669

67-
if(CMAKE_SYSTEM_NAME STREQUAL Android)
68-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-incompatible-function-pointer-types>)
69-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-implicit-function-declaration>)
70-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-conversion>)
71-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-int-conversion>)
72-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-shorten-64-to-32>)
73-
endif()
74-
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-error=assign-enum>)
70+
if(CMAKE_SYSTEM_NAME STREQUAL Android)
71+
add_compile_options(-Wno-incompatible-function-pointer-types)
72+
add_compile_options(-Wno-implicit-function-declaration)
73+
add_compile_options(-Wno-conversion)
74+
add_compile_options(-Wno-int-conversion)
75+
add_compile_options(-Wno-shorten-64-to-32)
76+
endif()
77+
add_compile_options(-Wno-error=assign-enum)
78+
endmacro()
7579
endif()

0 commit comments

Comments
 (0)