-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
96 lines (77 loc) · 2.43 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
cmake_minimum_required(VERSION 3.18.0)
# list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/cmake)
project(TotalGB
VERSION 0.0.1
DESCRIPTION "Simple, fast, very inaccurate GB / GBC emulator!"
HOMEPAGE_URL "https://github.com/ITotalJustice/TotalGB"
LANGUAGES C
)
message("SYSTEM: ${CMAKE_SYSTEM_NAME}")
message("COMPILER: ${CMAKE_C_COMPILER_ID}")
# SEE: https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html#supported-compilers
list(APPEND cmake_supported_compiler_features
AppleClang
Clang
GNU
MSVC
SunPro
Intel
)
if (${CMAKE_C_COMPILER_ID} IN_LIST cmake_supported_compiler_features)
set(COMPILER_FEATURES ON)
message("compiler features are enabled for this compiler")
else()
set(COMPILER_FEATURES OFF)
message("compiler features are NOT enabled for this compiler")
endif()
option(GB_SINGLE_FILE "include all src in single.c" OFF)
option(GB_DEBUG "enable debug" OFF)
option(GB_DEV "enables debug and sanitizers" OFF)
option(GB_ENABLE_FORCE_INLINE "enables force inline, disabled in debug mode" ON)
option(GBC_ENABLE "build with GBC support" ON)
option(SGB_ENABLE "build with SGB support" OFF)
option(GB_ENABLE_BUILTIN_PALETTE "build with builtin palettes" ON)
option(PLATFORM_SDL2 "" OFF)
option(PLATFORM_GAMECUBE "" OFF)
option(PLATFORM_LIBRETRO "" OFF)
find_program(CLANGD_INSTALLED clangd)
if (CLANGD_INSTALLED)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
message("found clangd: generating compile_commands.json to ${CMAKE_BINARY_DIR}/compile_commands.json")
else()
message("cant find clangd: not generating compile_commands.json")
endif()
if (GB_DEV)
set(GB_DEBUG ON)
endif()
if (NINTENDO_SWITCH)
enable_language(CXX) # needed for linking
set(BUILD_SHARED_LIBS OFF)
endif()
if (PLATFORM_LIBRETRO)
if (SWITCH)
set(BUILD_SHARED_LIBS OFF)
elseif (VITA)
set(BUILD_SHARED_LIBS OFF)
elseif (PSP)
set(BUILD_SHARED_LIBS OFF)
elseif (PS2)
set(BUILD_SHARED_LIBS OFF)
elseif (WIIU)
set(BUILD_SHARED_LIBS OFF)
elseif (WII)
set(BUILD_SHARED_LIBS OFF)
elseif (GAMECUBE)
set(BUILD_SHARED_LIBS OFF)
elseif (3DS)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
endif()
endif()
set (ANDROID_TESTING OFF)
if (ANDROID OR ANDROID_TESTING)
add_subdirectory(android)
endif()
add_subdirectory(src)