-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
55 lines (49 loc) · 2.02 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
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(libKDU VERSION 1.4.2)
enable_language(ASM_MASM)
# prepare files
file(COPY "KDU/Source" DESTINATION ".")
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/Source/Hamakaze/global.h" "\n#include <kdu_override.h>")
# generate resource files
add_executable(ResourceGenerator ResourceGenerator/ResourceGenerator.cpp)
set_target_properties(ResourceGenerator PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Resources/Hamakaze.cpp"
COMMAND ResourceGenerator "${CMAKE_CURRENT_BINARY_DIR}/Resources/Hamakaze.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Source/Hamakaze/resource.rc" "Hamakaze"
DEPENDS ResourceGenerator
)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Resources/Tanikaze.cpp"
COMMAND ResourceGenerator "${CMAKE_CURRENT_BINARY_DIR}/Resources/Tanikaze.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Source/Tanikaze/resource.rc" "Tanikaze"
DEPENDS ResourceGenerator
)
# build kdu
file(GLOB_RECURSE HAMAKAZE_SOURCES
"override/*.cpp"
"public/*.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/Source/Shared/*.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/Source/Shared/*.c"
"${CMAKE_CURRENT_BINARY_DIR}/Source/Hamakaze/*.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/Source/Hamakaze/*.c"
"${CMAKE_CURRENT_BINARY_DIR}/Source/Hamakaze/*.asm"
)
list(APPEND HAMAKAZE_SOURCES
"${CMAKE_CURRENT_BINARY_DIR}/Resources/Hamakaze.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/Resources/Tanikaze.cpp"
)
list(REMOVE_ITEM HAMAKAZE_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/Source/Hamakaze/main.cpp")
set(HAMAKAZE_INCLUDE_DIRS
"override"
"${CMAKE_CURRENT_BINARY_DIR}/Source"
"${CMAKE_CURRENT_BINARY_DIR}/Source/Shared"
"${CMAKE_CURRENT_BINARY_DIR}/Source/Hamakaze"
"${CMAKE_CURRENT_BINARY_DIR}/Source/Tanikaze"
)
add_library(${PROJECT_NAME} STATIC ${HAMAKAZE_SOURCES})
target_compile_definitions(${PROJECT_NAME} PRIVATE UNICODE _UNICODE)
target_include_directories(${PROJECT_NAME}
PRIVATE ${HAMAKAZE_INCLUDE_DIRS}
PUBLIC "public"
)
# export library
install(TARGETS ${PROJECT_NAME})