forked from Element-0/ElementZero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
75 lines (61 loc) · 2.67 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
cmake_minimum_required (VERSION 3.8)
project ("WineBDLauncher")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
include (ExternalProject)
include (Utility)
generate_git_version (git_version)
option (NO_INLINE off)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS ON)
set (VCPKG_TARGET_TRIPLET "x64-windows-rel")
if (NO_INLINE)
add_compile_options (/Ob0)
endif ()
add_compile_options (-Wno-c++2a-extensions)
include_directories (Public)
add_compile_definitions (_UNICODE UNICODE NDEBUG)
add_compile_options (-Wno-invalid-offsetof -Wno-deprecated-declarations)
file (GLOB_RECURSE MinecraftHeadersFiles CONFIGURE_DEPENDS MinecraftHeaders/*)
add_custom_target (MinecraftHeaders SOURCES ${MinecraftHeadersFiles})
install (DIRECTORY MinecraftHeaders DESTINATION Include)
file (GLOB_RECURSE PublicHeadersFiles CONFIGURE_DEPENDS Public/*)
add_custom_target (PublicHeaders SOURCES ${PublicHeadersFiles})
install (DIRECTORY Public DESTINATION Include)
add_library (BedrockServer INTERFACE)
target_include_directories (BedrockServer INTERFACE MinecraftHeaders)
target_link_directories (BedrockServer INTERFACE Lib)
target_link_libraries (BedrockServer INTERFACE bedrock_server_mod)
find_package (SQLiteCpp CONFIG REQUIRED)
find_package (Boost 1.72.0 REQUIRED)
find_package(jsoncpp CONFIG REQUIRED)
find_and_install_package (sqlite3 CONFIG REQUIRED)
find_and_install_package (yaml-cpp CONFIG REQUIRED)
find_package (msgpack CONFIG REQUIRED)
function (install_pdb name)
install (FILES $<TARGET_PDB_FILE:${name}> DESTINATION Lib)
endfunction ()
function (add_mod name)
file (GLOB_RECURSE srcs CONFIGURE_DEPENDS *.cpp)
add_library (${name} SHARED ${srcs})
target_compile_definitions (${name} PRIVATE MODNAME=${name})
target_link_libraries (${name} Boost::headers yaml-cpp ModLoader BedrockServer Base)
install (TARGETS ${name} RUNTIME DESTINATION Mods ARCHIVE DESTINATION Lib)
install_pdb (${name})
set_target_properties (${name} PROPERTIES FOLDER Mods)
endfunction ()
function (add_base_mod name)
file (GLOB_RECURSE srcs CONFIGURE_DEPENDS *.cpp *.hint)
add_library (${name} SHARED ${srcs})
target_compile_definitions (${name} PRIVATE MODNAME=${name} EZVERSION=\"${git_version}\")
target_link_libraries (${name} Boost::headers yaml-cpp ModLoader BedrockServer)
install (TARGETS ${name} RUNTIME DESTINATION . ARCHIVE DESTINATION Lib)
install_pdb (${name})
set_target_properties (${name} PROPERTIES FOLDER Base)
endfunction ()
function (mod_link name)
target_link_libraries (${name} ${ARGN})
endfunction ()
add_subdirectory ("ModLoader")
add_subdirectory ("Base")
add_subdirectory ("BuiltinMods")