-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
68 lines (46 loc) · 1.98 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
cmake_minimum_required(VERSION 3.21)
project(apac LANGUAGES C VERSION 0.1.5)
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(ENB_APPLE_ASAN False)
unset(CMAKE_CXX_FLAGS_RELEASE)
unset(CMAKE_CXX_FLAGS_DEBUG)
set(APAC_IS_COMPILING_FOR_HOST ON)
if (CMAKE_SYSTEM_PROCESSOR MATCHES arm|aarch64)
set(APAC_USE_ARCH armv8.1-a)
else()
set(APAC_USE_ARCH native)
endif()
unset(CMAKE_C_FLAGS)
add_executable(apac)
add_subdirectory(modules)
target_compile_options(apac PRIVATE -Wall -Wno-uninitialized -pipe -Wno-ignored-attributes
$<$<CONFIG:Release>:-Ofast;-fstack-protector-strong;-fvisibility=hidden>
$<$<CONFIG:Debug>:-Og;>)
target_link_options(apac PRIVATE -rdynamic)
if (APAC_IS_COMPILING_FOR_HOST)
target_compile_options(apac PRIVATE -march=${APAC_USE_ARCH})
endif()
target_compile_definitions(apac PRIVATE $<$<CONFIG:Debug>:APAC_IS_UNDER_DEBUG=1>)
target_compile_definitions(apac PRIVATE _GNU_SOURCE)
if (CMAKE_C_COMPILER_ID STREQUAL Clang AND ${ENB_APPLE_ASAN})
target_compile_options(apac PRIVATE $<$<CONFIG:Debug>:-gdwarf-4;-fsanitize=address>)
if (LINUX)
target_link_options(apac PRIVATE $<$<CONFIG:Debug>:-lasan>)
endif()
elseif(CMAKE_C_COMPILER_ID STREQUAL GNU)
target_compile_options(apac PRIVATE $<$<CONFIG:Debug>:-ggdb;-grecord-gcc-switches>)
endif()
add_subdirectory(OpenCL-Headers)
add_subdirectory(source)
find_package(Threads REQUIRED)
find_package(OpenAL REQUIRED)
install(TARGETS apac DESTINATION ${CMAKE_SOURCE_DIR}/runtime)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/default/ DESTINATION ${CMAKE_SOURCE_DIR}/runtime)
if (UNIX)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/tools/unix/ DESTINATION ${CMAKE_SOURCE_DIR}/runtime)
endif()
target_link_libraries(apac PRIVATE m Threads::Threads OpenCL::Headers openal)
target_include_directories(apac PRIVATE ${CMAKE_SOURCE_DIR}/source ${CMAKE_SOURCE_DIR}/res)