-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
103 lines (79 loc) · 3.5 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
cmake_minimum_required(VERSION 3.17.3 FATAL_ERROR)
project(temp)
set(CMAKE_SUPPRESS_REGENERATION true)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLE_FAST_LOAD -DENABLE_MIDI_OUT")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /nologo")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /PDBCompress")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /PDBCompress")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /PDBCompress")
set(CMAKE_ROOT_DIRECTORY ${PROJECT_SOURCE_DIR})
set(CMAKE_BUILD_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_CONFIG_DIRECTORY ${CMAKE_BUILD_DIRECTORY}/config)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BUILD_DIRECTORY}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BUILD_DIRECTORY}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BUILD_DIRECTORY}/bin)
set(WOTWR_INSTALL_DIR C:/moon/randomizer)
set(WOTWR_PROJECTS_DIR ${CMAKE_ROOT_DIRECTORY}/projects)
message(STATUS "WOTWR install directory: ${WOTWR_INSTALL_DIR}")
message(STATUS "root directory: ${CMAKE_ROOT_DIRECTORY}")
message(STATUS "build directory: ${CMAKE_BUILD_DIRECTORY}")
message(STATUS "config directory: ${CMAKE_CONFIG_DIRECTORY}")
message(STATUS "archive directory: ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
message(STATUS "library directory: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
message(STATUS "runtime directory: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "runtime")
function(set_vc_structure_with_prefix pre root vc_files)
foreach (FILE ${vc_files})
# Get the directory of the source file
get_filename_component(PARENT_DIR "${FILE}" DIRECTORY)
# Remove common directory prefix to make the group
string(REPLACE "${root}" "" GROUP "${PARENT_DIR}")
# Make sure we are using windows slashes
string(REPLACE "/" "\\" GROUP "${GROUP}")
message(STATUS "${FILE} in ${pre}${GROUP}")
source_group("${pre}${GROUP}" FILES "${FILE}")
endforeach ()
endfunction(set_vc_structure_with_prefix)
function(set_vc_structure root vc_files)
foreach (FILE ${vc_files})
# Get the directory of the source file
get_filename_component(PARENT_DIR "${FILE}" DIRECTORY)
# Remove common directory prefix to make the group
string(REPLACE "${root}" "" GROUP "${PARENT_DIR}")
# Make sure we are using windows slashes
string(REPLACE "/" "\\" GROUP "${GROUP}")
message(STATUS "${FILE} in ${pre}${GROUP}")
source_group("${GROUP}" FILES "${FILE}")
endforeach ()
endfunction(set_vc_structure)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
find_program(GIT git)
if (NOT GIT)
message(FATAL_ERROR "Cannot find git command line tool.")
else ()
message(STATUS "Fetching submodules.")
execute_process(COMMAND ${GIT} submodule update --init --recursive)
endif ()
set(SLN_NAME WotWRandomizer)
project(${SLN_NAME})
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
set(
WOTWR_BASE_INCLUDES
"${CMAKE_ROOT_DIRECTORY}/projects"
)
add_subdirectory("projects")
add_custom_target(
INSTALL_RUNTIME
ALL
cmake -DCOMPONENT=runtime -DBUILD_TYPE=$<CONFIG> -P ${CMAKE_BUILD_DIRECTORY}/cmake_install.cmake
DEPENDS Modloader Randomizer TAS Injector InjectProxy InjectLoader RandomizerTester
)
set_target_properties(
INSTALL_RUNTIME
PROPERTIES
FOLDER CMakePredefinedTargets
)