-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
80 lines (65 loc) · 2.52 KB
/
CMakeLists.txt
File metadata and controls
80 lines (65 loc) · 2.52 KB
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
cmake_minimum_required(VERSION 3.21)
set(CMAKE_POLICY_VERSION_MINIMUM 3.21)
project(
PSX-Minecraft
LANGUAGES C CXX ASM
VERSION 0.1.0
DESCRIPTION "PSX Minecraft"
HOMEPAGE_URL "https://github.com/EngineersBox/PSX-Minecraft"
)
# 0 = Debug, 3 = Release
set(COMPILE_OPTIMISATION_LEVEL 0)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fshort-enums -Wno-expansion-to-defined")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O${COMPILE_OPTIMISATION_LEVEL} -g")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fanalyzer")
set(CMAKE_C_INCLUDE_WHAT_YOU_USE "include-what-you-use;-w;-Xiwyu;--verbose=7")
include(${PROJECT_SOURCE_DIR}/bundles.cmake)
ConstructAssetBundles()
# Include source content
file(GLOB_RECURSE PSXMC_SOURCES CONFIGURE_DEPENDS "src/*.[cs]")
file(GLOB_RECURSE PSXMC_HEADERS CONFIGURE_DEPENDS "src/*.h")
set(PSXMC_INCLUDE_DIRS "")
foreach (_headerFile ${PSXMC_HEADERS})
get_filename_component(_dir ${_headerFile} PATH)
list(APPEND PSXMC_INCLUDE_DIRS ${_dir})
endforeach()
list(REMOVE_DUPLICATES PSXMC_INCLUDE_DIRS)
message("Include dirs:")
foreach (_include_dir ${PSXMC_INCLUDE_DIRS})
message("- ${_include_dir}")
endforeach()
# Mark executable
psn00bsdk_add_executable(PSXMC GPREL ${PSXMC_SOURCES})
target_include_directories(PSXMC PRIVATE ${PSXMC_INCLUDE_DIRS})
psn00bsdk_add_cd_image(
iso # Target name
PSXMC # Output file name (= <NAME>.bin + <NAME>.cue)
iso.xml # Path to CD layout file
DEPENDS PSXMC system.cnf ${ASSET_BUNDLE_ARCHIVES}
)
# Include dependencies
include(FetchContent)
FetchContent_Declare(
metalang99
URL https://github.com/Hirrolot/metalang99/archive/refs/tags/v1.13.5.tar.gz
)
FetchContent_Declare(
interface99
URL https://github.com/Hirrolot/interface99/archive/refs/tags/v1.0.2.tar.gz
)
FetchContent_MakeAvailable(metalang99)
FetchContent_MakeAvailable(interface99)
target_link_libraries(PSXMC PRIVATE metalang99)
target_link_libraries(PSXMC PRIVATE interface99)
# Disable full macro expansion backtraces for Metalang99.
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(PSXMC PRIVATE -fmacro-backtrace-limit=1)
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(PSXMC PRIVATE -ftrack-macro-expansion=0)
endif()
target_compile_definitions(PSXMC PUBLIC -DFPT_BITS=32 -DFPT_WBITS=20)
include(${PROJECT_SOURCE_DIR}/compile_flags.cmake)
set_property(TARGET PSXMC PROPERTY C_STANDARD 23)
install(FILES ${PROJECT_BINARY_DIR}/PSXMC.exe TYPE BIN)