|
1 |
| -set(CMAKE_CXX_STANDARD 17) |
| 1 | +set(CMAKE_CXX_STANDARD 20) |
2 | 2 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
3 | 3 | set(CMAKE_CXX_EXTENSIONS OFF)
|
4 | 4 | set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
|
5 | 5 |
|
6 |
| -if (MSVC) |
7 |
| - add_compile_definitions( |
8 |
| - UNICODE |
9 |
| - _UNICODE |
10 |
| - _CRT_SECURE_NO_WARNINGS |
11 |
| - NOMINMAX |
12 |
| - ) |
13 |
| - add_compile_options( |
14 |
| - /MP |
15 |
| - /wd4005 |
16 |
| - /wd4838 |
17 |
| - /wd5051 |
18 |
| - ) |
19 |
| -else() |
20 |
| - add_compile_options( |
21 |
| - $<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-declarations> |
22 |
| - $<$<COMPILE_LANGUAGE:CXX>:-Wno-shorten-64-to-32> |
23 |
| - $<$<COMPILE_LANGUAGE:CXX>:-Wno-unguarded-availability-new> |
24 |
| - ) |
25 |
| -endif() |
| 6 | +set(appleclang_clang_compile_options |
| 7 | + -Wno-deprecated-anon-enum-enum-conversion |
| 8 | +) |
| 9 | +set(appleclang_compile_options |
| 10 | + -Wno-deprecated-declarations |
| 11 | + -Wno-deprecated-volatile |
| 12 | + -Wno-shorten-64-to-32 |
| 13 | + -Wno-unguarded-availability-new |
| 14 | +) |
| 15 | +set(gpu_compile_options |
| 16 | + -Wno-deprecated-enum-enum-conversion |
| 17 | +) |
| 18 | +set(msvc_compile_options |
| 19 | + /MP |
| 20 | + /wd4005 |
| 21 | + /wd4838 |
| 22 | + /wd5051 |
| 23 | +) |
| 24 | +add_compile_options( |
| 25 | + "$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:${appleclang_clang_compile_options}>" |
| 26 | + "$<$<COMPILE_LANG_AND_ID:CXX,AppleClang>:${appleclang_compile_options}>" |
| 27 | + "$<$<COMPILE_LANG_AND_ID:CXX,GNU>:${gpu_compile_options}>" |
| 28 | + "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:${msvc_compile_options}>" |
| 29 | +) |
26 | 30 |
|
27 |
| -if (CMAKE_SYSTEM_NAME STREQUAL "iOS") |
28 |
| - add_compile_definitions(TARGET_IOS=1) |
29 |
| -elseif (CMAKE_SYSTEM_NAME STREQUAL "tvOS") |
30 |
| - add_compile_definitions(TARGET_TVOS=1) |
31 |
| -else() |
32 |
| - add_compile_definitions(TARGET_MACOS=1) |
33 |
| -endif() |
34 |
| - |
35 |
| -if (CMAKE_SIZEOF_VOID_P STREQUAL "4" AND NOT CMAKE_CROSSCOMPILING) |
36 |
| - message(FATAL_ERROR "x86 build is not supported") |
37 |
| -endif() |
| 31 | +set(msvc_compile_definitions |
| 32 | + _CRT_SECURE_NO_WARNINGS |
| 33 | + _UNICODE |
| 34 | + NOMINMAX |
| 35 | + UNICODE |
| 36 | +) |
| 37 | +set(darwin_compile_definitions |
| 38 | + TARGET_MACOS=1 |
| 39 | +) |
| 40 | +set(ios_compile_definitions |
| 41 | + TARGET_IOS=1 |
| 42 | +) |
| 43 | +set(tvos_compile_definitions |
| 44 | + TARGET_TVOS=1 |
| 45 | +) |
| 46 | +add_compile_definitions( |
| 47 | + "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:${msvc_compile_definitions}>" |
| 48 | + "$<$<PLATFORM_ID:Darwin>:${darwin_compile_definitions}>" |
| 49 | + "$<$<PLATFORM_ID:iOS>:${ios_compile_definitions}>" |
| 50 | + "$<$<PLATFORM_ID:tvOS>:${tvos_compile_definitions}>" |
| 51 | +) |
0 commit comments