-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
119 lines (106 loc) · 3.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
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
cmake_minimum_required(VERSION 3.10)
set(LIB_NAME cc_live2d)
project(${LIB_NAME})
add_library(${LIB_NAME} STATIC)
add_dependencies(${LIB_NAME} cocos2d)
use_cocos2dx_compile_define(${LIB_NAME})
use_cocos2dx_compile_options(${LIB_NAME})
add_subdirectory(Core)
target_link_libraries(${LIB_NAME} Live2DCubismCore)
set(SRC_DIR Framework/src)
target_sources(${LIB_NAME}
PRIVATE
CubismOffscreenSurface_CC.cpp
CubismOffscreenSurface_CC.h
CubismRenderer_CC.cpp
CubismRenderer_CC.h
L2DFramework.cpp
L2DFramework.h
L2DModel.cpp
L2DModel.h
LAppAllocator.cpp
LAppAllocator.hpp
LAppDefine.cpp
LAppDefine.hpp
LAppModel.cpp
LAppModel.hpp
LAppPal.cpp
LAppPal.hpp
${SRC_DIR}/CubismCdiJson.cpp
${SRC_DIR}/CubismCdiJson.hpp
${SRC_DIR}/CubismDefaultParameterId.cpp
${SRC_DIR}/CubismDefaultParameterId.hpp
${SRC_DIR}/CubismFramework.cpp
${SRC_DIR}/CubismFramework.hpp
${SRC_DIR}/CubismFrameworkConfig.hpp
${SRC_DIR}/CubismModelSettingJson.cpp
${SRC_DIR}/CubismModelSettingJson.hpp
${SRC_DIR}/CubismJsonHolder.hpp
${SRC_DIR}/ICubismAllocator.hpp
${SRC_DIR}/ICubismModelSetting.hpp
${SRC_DIR}/Live2DCubismCore.hpp
)
# Add sub directories.
add_subdirectory(${SRC_DIR}/Effect)
add_subdirectory(${SRC_DIR}/Id)
add_subdirectory(${SRC_DIR}/Math)
add_subdirectory(${SRC_DIR}/Model)
add_subdirectory(${SRC_DIR}/Motion)
add_subdirectory(${SRC_DIR}/Physics)
target_sources(${LIB_NAME}
PRIVATE
${SRC_DIR}/Rendering/CubismRenderer.cpp
${SRC_DIR}/Rendering/CubismRenderer.hpp
)
add_subdirectory(${SRC_DIR}/Type)
add_subdirectory(${SRC_DIR}/Utils)
# Add include path.
target_include_directories(${LIB_NAME}
PUBLIC
${SRC_DIR}
PRIVATE
${SRC_DIR}/Rendering
Core/include
)
set(INCLUDES
${COCOS2DX_ROOT_PATH}/cocos
${COCOS2DX_ROOT_PATH}/cocos/base
${COCOS2DX_ROOT_PATH}/cocos/platform
${COCOS2DX_ROOT_PATH}/extensions
${COCOS2DX_ROOT_PATH}/external
${COCOS2DX_ROOT_PATH}/external/glfw3/include/win32
${COCOS2DX_ROOT_PATH}/external/glfw/include/GLFW
${COCOS2DX_ROOT_PATH}/external/jni.hpp/include
${COCOS2DX_ROOT_PATH}/external/win32-specific/gles/include/OGLES
)
if(BUILD_LUA_LIBS)
list(APPEND INCLUDES
${COCOS2DX_ROOT_PATH}/external/lua/luajit/include
${COCOS2DX_ROOT_PATH}/external/lua/tolua)
endif()
foreach(dir ${INCLUDES})
if(EXISTS ${dir})
include_directories(${dir})
endif()
endforeach()
if(BUILD_LUA_LIBS)
target_compile_definitions(${LIB_NAME} PUBLIC _USRLUASTATIC)
target_sources(${LIB_NAME}
PRIVATE
lua_live2d_auto.cpp
lua_live2d_auto.hpp
)
endif()
if(XCODE OR VS)
cocos_mark_code_files(${LIB_NAME})
endif()
target_compile_definitions(${LIB_NAME} PUBLIC CSM_TARGET_COCOS)
if(CC_USE_GFX)
target_compile_definitions(${LIB_NAME} PUBLIC CC_USE_GFX)
endif()
set_target_properties(${LIB_NAME}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}
)