-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
39 lines (30 loc) · 1.31 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
cmake_minimum_required(VERSION 3.10)
project(phoenix-studio)
option(PSTUDIO_DISABLE_SANITIZERS "Build without sanitizers in debug mode" OFF)
set(CMAKE_CXX_STANDARD 17)
if (MSVC)
# enable all warnings
set(PSTUDIO_CXX_FLAGS "/W4")
# in debug mode, enable sanitizers
if (${CMAKE_BUILD_TYPE} MATCHES "Debug" AND NOT ${PSTUDIO_DISABLE_SANITIZERS})
set(PSTUDIO_CXX_FLAGS ${PSTUDIO_CXX_FLAGS} "/fsanitize=address")
endif ()
else ()
# enable all warnings
set(PSTUDIO_CXX_FLAGS -Wall -Wextra -Werror -Wconversion)
# in debug mode, enable sanitizers
if (${CMAKE_BUILD_TYPE} MATCHES "Debug" AND NOT ${PSTUDIO_DISABLE_SANITIZERS})
set(PSTUDIO_CXX_FLAGS ${PSTUDIO_CXX_FLAGS} -fsanitize=address -fsanitize=undefined)
# when not compiling for MacOS, enable leak sanitizer
if (NOT APPLE)
set(PSTUDIO_CXX_FLAGS ${PSTUDIO_CXX_FLAGS} -fsanitize=leak)
endif ()
endif ()
# in debug mode on Clang to get proper debugging support, add -fstandalone-debug
if (${CMAKE_BUILD_TYPE} MATCHES "Debug" AND ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set(PSTUDIO_CXX_FLAGS ${PSTUDIO_CXX_FLAGS} -fstandalone-debug)
endif ()
endif ()
add_subdirectory(vendor)
add_subdirectory(src)
add_custom_target(phoenix-studio DEPENDS zdump zscript zvdfs ztex zmodel)