-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
133 lines (109 loc) · 4.26 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
cmake_minimum_required(VERSION 3.29)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Distribution")
# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
"$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,Release>:EditAndContinue>,$<$<CONFIG:Debug,Release>:ProgramDatabase>>"
)
endif()
# Set C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# The version of CPM to install if it is not already installed
set(CPM_INSTALL_VERSION 0.40.2)
# Output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") # Static libraries
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") # Shared libraries (.so/.dll)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") # Executables (.out/.exe)
if (WIN32)
message(STATUS "${CMAKE_SOURCE_DIR}/build-scripts/build-windows.bat")
if (NOT EXISTS "${CMAKE_SOURCE_DIR}/cache/lock-configure.lock")
#execute_process(
# # Add or remove arguments as needed. Use --debug for debug packages, --release for release packages, and --distribution for distribution packages
# COMMAND "${CMAKE_SOURCE_DIR}/build-windows.bat"
# RESULT_VARIABLE result
# OUTPUT_VARIABLE output
# ERROR_VARIABLE error_output
#)
#message(STATUS "${result}")
#if(NOT ${result} EQUAL 0)
# message(FATAL_ERROR "The command failed with error: ${error_output}, ${output}")
#endif()
# cmake -B ${{ steps.strings.outputs.build-output-dir }}
#-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
#-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
#-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
#-S ${{ github.workspace }}
endif()
else()
execute_process(
# Add or remove arguments as needed. Use --debug for debug packages, --release for release packages, and --distribution for distribution packages
COMMAND "${CMAKE_SOURCE_DIR}/build-scripts/build-linux.sh"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE error_output
)
if(NOT ${result} EQUAL 0)
message(FATAL_ERROR "The command failed with error: ${error_output}, ${output}")
endif()
endif()
# Platform-specific settings
if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # To export symbols from DLLs
set(CMAKE_RUNTIME_OUTPUT_NAME_SUFFIX ".exe")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
elseif(UNIX)
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS True)
# Set project name
project(TechStorm LANGUAGES CXX C)
# Set compilation definitions
if(CMAKE_BUILD_TYPE STREQUAL "Distribution")
add_compile_definitions(TS_ROOT_DIR="../") # Sets the TS_ROOT_DIR macro in a way that prevents the path on a development machine from being used in distribution.
add_compile_definitions(TS_TOP_LAYER="${CMAKE_SOURCE_DIR}")
# Your code for the Distribution configuration
else()
add_compile_definitions(TS_ROOT_DIR="${CMAKE_BINARY_DIR}")
add_compile_definitions(TS_TOP_LAYER="${CMAKE_SOURCE_DIR}")
# Your code for other configurations
endif()
include("cmake/cpm.cmake")
# Absolutely DO NOT remove this. It will break all rendering functionality
set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
CPMAddPackage(
NAME raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 5.5
OPTIONS
"BUILD_SHARED_LIBS=ON"
)
# find_package(ZLIB REQUIRED)
find_package(joltphysics REQUIRED)
find_package(libconfig REQUIRED)
find_package(Angelscript REQUIRED)
find_package(sol2 REQUIRED)
find_package(eventpp REQUIRED)
find_package(SDL2 REQUIRED CONFIG)
find_package(rmlui REQUIRED)
set(DOUBLE_PRECISION OFF)
set(GENERATE_DEBUG_SYMBOLS OFF)
set(CROSS_PLATFORM_DETERMINISTIC ON)
set(FLOATING_POINT_EXCEPTIONS_ENABLED OFF)
set(OBJECT_LAYER_BITS 32)
set(USE_SSE4_1 ON)
set(USE_SSE4_2 ON)
set(USE_AVX ON)
set(USE_AVX2 ON)
set(USE_AVX512 OFF)
set(USE_LZCNT ON)
set(USE_TZCNT ON)
set(USE_F16C ON)
set(USE_FMADD ON)
set(RMLUI_SAMPLES ON CACHE BOOL "" FORCE)
# Include subdirectories
add_subdirectory("src/engine")
add_subdirectory("src/project")
add_subdirectory("src/application")
add_subdirectory("src/tools")