This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
70 lines (58 loc) · 2.59 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
cmake_minimum_required(VERSION 3.10)
project(phoenix-shared-interface LANGUAGES CXX VERSION 0.0.1)
include(support/BuildSupport.cmake)
set(CMAKE_CXX_STANDARD 17)
if (NOT MSVC)
# Make sure everything is relocatable.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif ()
option(PXC_ENABLE_ASAN "phoenix-shared: Enable sanitizers in debug builds." ON)
set(ZK_ENABLE_DEPRECATION OFF)
add_subdirectory(vendor/ZenKit)
list(APPEND PXC_SOURCES
src/Animation.cc
src/BspTree.cc
src/Buffer.cc
src/Cutscene.cc
src/DaedalusScript.cc
src/Vm.cc
src/Font.cc
src/Logging.cc
src/Material.cc
src/Mesh.cc
src/Model.cc
src/ModelHierarchy.cc
src/ModelMesh.cc
src/ModelScript.cc
src/MorphMesh.cc
src/MultiResolutionMesh.cc
src/Texture.cc
src/Vfs.cc
src/World.cc)
bs_select_cflags(${PXC_ENABLE_ASAN} PXC_COMPILE_FLAGS PXC_LINK_FLAGS)
if (EMSCRIPTEN)
list(APPEND PXC_SOURCES src/Main.cc)
list(APPEND PXC_COMPILE_FLAGS -fexceptions)
list(APPEND PXC_LINK_FLAGS -sWASM=1 -sMODULARIZE -sEXPORTED_FUNCTIONS=_malloc,_free -sEXPORTED_RUNTIME_METHODS=ccall,cwrap,addFunction,AsciiToString,setValue,getValue -sSINGLE_FILE=1 -sALLOW_MEMORY_GROWTH=1 -sALLOW_TABLE_GROWTH=1 -fexceptions)
add_executable(phoenix-shared)
else ()
add_library(phoenix-shared SHARED)
endif ()
set_target_properties(phoenix-shared PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN 1)
target_sources(phoenix-shared PRIVATE ${PXC_SOURCES})
target_include_directories(phoenix-shared PUBLIC include)
target_compile_options(phoenix-shared PRIVATE ${PXC_COMPILE_FLAGS})
target_compile_definitions(phoenix-shared PRIVATE PXC_EXPORTS=1)
target_link_options(phoenix-shared PRIVATE ${PXC_LINK_FLAGS})
target_link_libraries(phoenix-shared zenkit)
set_target_properties(phoenix-shared PROPERTIES DEBUG_POSTFIX "d" VERSION ${PROJECT_VERSION})
if (MINGW)
# We need to "bake" standard C/C++ libraries and windows pthread into DLL
# Otherwise we need to distribute up to 3 dlls within the same folder.
# If we don't do any of this, we'll get the following error (or a similar one):
# -> The procedure entry point _ZNKSt7codecvtlwc9_MbstatetE10do_unshiftERS0_PcS3_RS3_ could not be located in the dynamic link library [...]\build\test_lib.exe
# -> Dll couldn't be loaded as dependencies are missing.
target_link_options(phoenix-shared PUBLIC "-static")
endif()
install(TARGETS phoenix-shared ARCHIVE LIBRARY RUNTIME)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/phoenix" TYPE INCLUDE)