-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·78 lines (60 loc) · 2.08 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
69
70
71
72
73
74
75
76
77
78
cmake_minimum_required(VERSION 3.12)
# Name your project here
set(PROJECT_NAME "PortCE-Project")
project(${PROJECT_NAME})
set(SRC_DIR "./src")
set(SRC_PORTCE_DIR "./src_PortCE")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "./bin")
# Compiler
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
# Set C and C++ standards
set(CMAKE_C_STANDARD 23)
set(CMAKE_CXX_STANDARD 17)
# Packages
find_package(SDL2 REQUIRED)
file(GLOB_RECURSE SRC_FILES "${SRC_DIR}/*.c" "${SRC_DIR}/*.cpp" "${SRC_PORTCE_DIR}/*.c")
# Create an executable
add_executable(${PROJECT_NAME} ${SRC_FILES} ${SRC_PORTCE_DIR})
target_include_directories(${PROJECT_NAME} PUBLIC ${SRC_PORTCE_DIR}
"${SRC_PORTCE_DIR}/PortCE_include/"
"${SRC_PORTCE_DIR}/PortCE_include/ce"
"${SRC_PORTCE_DIR}/PortCE_include/ce/include/sys"
"${SRC_PORTCE_DIR}/PortCE_include/keypadc"
"${SRC_PORTCE_DIR}/PortCE_include/fileioc"
"${SRC_PORTCE_DIR}/PortCE_include/ce/include"
"${SRC_PORTCE_DIR}/PortCE_include/ce/include/ti"
"${SRC_PORTCE_DIR}/PortCE_include/graphx"
"${SRC_PORTCE_DIR}/PortCE_include/graphy"
"${SRC_PORTCE_DIR}/PortCE_include/lcddrvce"
)
# Compiler Flags Debug(-g -O0) Release(-O3)
set(OPT_FLAG -g -O0)
# -fsanitize= flags can be quite helpful in debugging segfaults.
set(SAN_FLAG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SAN_FLAG} -fcolor-diagnostics -fdiagnostics-color=always")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SAN_FLAG} -fcolor-diagnostics -fdiagnostics-color=always")
target_compile_options(
${PROJECT_NAME} PUBLIC ${SAN_FLAG} -fcolor-diagnostics -fdiagnostics-color=always ${OPT_FLAG}
-Wall -Wextra -Wshadow
# Can help spot undefined behaviour when porting code from the eZ80
-Wpointer-arith
-Wpointer-bool-conversion
-Wpointer-integer-compare
-Wpointer-sign
-Wpointer-to-enum-cast
-Wpointer-to-int-cast
-Wpointer-type-mismatch
# -Wcast-align
-Wcast-calling-convention
-Wcast-function-type
-Wcast-function-type-strict
-Wcast-of-sel-type
# -Wcast-qual
-Wcast-qual-unrelated
-Wchar-align
-Wcompare-distinct-pointer-types
# -Wconversion
-Wconversion-null
)
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2 SDL2_mixer -lm)