-
Notifications
You must be signed in to change notification settings - Fork 40
/
CMakeLists.txt
108 lines (94 loc) · 3.13 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
cmake_minimum_required(VERSION 3.2)
# Build options
option(Android "Android" OFF)
option(Emscripten "Build as WASM" OFF)
option(Extern_Config "Do not embed config file" ON)
set(EMSCRIPTEN_PATH "CHANGE ME PLEASE!!!/emsdk")
project(OpenClaw)
#if(NOT CMAKE_BUILD_TYPE)
# set(CMAKE_BUILD_TYPE Release)
#endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -g")
# CMake compiled directories with dependencies
add_subdirectory(Box2D)
add_subdirectory(libwap)
add_subdirectory(./ThirdParty/Tinyxml)
if (WIN32)
add_subdirectory(MidiProc)
endif (WIN32)
#if(Android)
# add_subdirectory(./ThirdParty/SDL2-2.0.5)
# include_directories(./ThirdParty/SDL2-2.0.5/include/)
# link_directories(./ThirdParty/SDL2-2.0.5/libs/armeabi/)
# add_subdirectory(./ThirdParty/SDL2_gfx-1.0.1)
#endif(Android)
# Directories with headers
include_directories(./Box2D/)
include_directories(./libwap/)
include_directories(./ThirdParty/)
include_directories(./ThirdParty/Tinyxml/)
if (Emscripten)
include_directories("${EMSCRIPTEN_PATH}/upstream/emscripten/system/include/emscripten/")
endif (Emscripten)
# Directories with libs
link_directories(./libwap)
link_directories(./Box2D)
if (WIN32)
link_directories(./ThirdParty/SDL2/lib/x86)
link_directories(./Build_Release)
endif (WIN32)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../Build_Release)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ../android/libs/armeabi-v7a)
# Cmake target definitions
if(Android)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DANDROID")
add_library(openclaw SHARED "")
else (Android)
add_executable(openclaw "")
endif(Android)
add_subdirectory(OpenClaw)
# Linker settings
list(APPEND TARGET_LIBS
libwap
tinyxml
Box2D
)
if (Emscripten)
if (Extern_Config)
set(CONFIG_PRELOAD_FILE "")
else (Extern_Config)
set(CONFIG_PRELOAD_FILE "--preload-file ../Build_Release/[email protected]")
endif (Extern_Config)
set_target_properties(openclaw PROPERTIES LINK_FLAGS "-s FETCH -s WASM=1 -s BINARYEN_METHOD='native-wasm' -s EXPORTED_FUNCTIONS='[_main]' -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='[\"pcx\",\"png\",\"tga\"]' -s USE_SDL_TTF=2 -s USE_SDL_GFX=2 -s ASYNCIFY=1 -s TOTAL_MEMORY=268435456 ${CONFIG_PRELOAD_FILE} --preload-file ../Build_Release/[email protected] --preload-file ../Build_Release/[email protected] --preload-file ../Build_Release/[email protected] --preload-file ../Build_Release/[email protected]")
else (Emscripten)
list(APPEND TARGET_LIBS
SDL2
SDL2_mixer
SDL2_ttf
SDL2_image
SDL2_gfx
)
if (WIN32)
list(APPEND TARGET_LIBS
Rpcrt4
)
else (WIN32)
# TODO: Is it really important???
list(APPEND TARGET_LIBS
stdc++
m
)
endif (WIN32)
if (Android)
list(APPEND TARGET_LIBS
GLESv2
GLESv1_CM
dl
log
android
)
endif (Android)
endif (Emscripten)
target_link_libraries(openclaw ${TARGET_LIBS})