forked from gameplay3d/gameplay-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
123 lines (101 loc) · 3.2 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
120
121
122
123
cmake_minimum_required(VERSION 2.8)
project(GamePlay-deps)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ANDROID)
SET(LINUX 1)
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ANDROID)
if(NOT ANDROID AND NOT IOS)
# Skip any introspection for cross-compiling targets
include(${PROJECT_SOURCE_DIR}/cmake/TargetArch.cmake)
set(ARCH "unknown")
target_architecture(ARCH)
endif(NOT ANDROID AND NOT IOS)
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/out/external-deps")
if(NOT ANDROID AND NOT IOS)
# Android and iOS toolchains will set their own output path
IF(APPLE)
set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/out/external-deps/lib/macosx/${ARCH}")
ELSE()
string(TOLOWER ${CMAKE_SYSTEM_NAME} LOWER_SYSTEM_NAME)
set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/out/external-deps/lib/${LOWER_SYSTEM_NAME}/${ARCH}")
ENDIF(APPLE)
endif(NOT ANDROID AND NOT IOS)
IF(NOT WIN32)
# For Windows, let the user pick since we need to generate both Debug and
# Release variants of all the libs.
SET(CMAKE_BUILD_TYPE "Release")
ENDIF(NOT WIN32)
file(MAKE_DIRECTORY ${LIBRARY_OUTPUT_PATH})
message(STATUS "Directory: ${LIBRARY_OUTPUT_PATH}")
add_subdirectory(libjson-7.6.1)
add_subdirectory(tinyxml2-2.1.0)
add_subdirectory(lua-5.2.3)
if (NOT APPLE)
add_subdirectory(openal-1.16.0)
endif(NOT APPLE)
if (NOT APPLE AND NOT ANDROID)
add_subdirectory(glew-1.10.0)
endif (NOT APPLE AND NOT ANDROID)
# zlib must be built before png and curl
add_subdirectory(zlib-1.2.8)
add_subdirectory(png-1.6.15)
if(NOT WIN32 AND BUILD_EXTRA_LIBS)
add_subdirectory(curl-7.39.0)
endif(NOT WIN32 AND BUILD_EXTRA_LIBS)
# Ogg needs to be built before vorbis
add_subdirectory(ogg-1.3.2)
add_subdirectory(vorbis-1.3.4)
add_subdirectory(bullet-2.82-r2704)
add_subdirectory(base64-1.0.0)
set(BUILD_TARGETS
BulletDynamics
LinearMath
BulletCollision
vorbisfile
vorbisenc
vorbis
ogg
png_static
zlibstatic
lua
tinyxml2static
json
base64
)
if (NOT APPLE)
list(APPEND BUILD_TARGETS GLEW)
IF(WIN32)
list(APPEND BUILD_TARGETS OpenAL32)
ELSE(WIN32)
list(APPEND BUILD_TARGETS openal)
ENDIF(WIN32)
endif(NOT APPLE)
IF(BUILD_EXTRA_LIBS)
if(NOT WIN32)
list(APPEND BUILD_TARGETS libcurl)
endif(NOT WIN32)
ENDIF(BUILD_EXTRA_LIBS)
if(WIN32)
set(GAMEPLAY_DEPS gameplay-deps.lib)
else(WIN32)
set(GAMEPLAY_DEPS libgameplay-deps.a)
endif(WIN32)
if(LINUX OR ANDROID)
add_custom_command(
OUTPUT ${GAMEPLAY_DEPS}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/gnu-amalgamate.sh ${CMAKE_AR} ${LIBRARY_OUTPUT_PATH}
)
elseif(APPLE)
add_custom_command(
OUTPUT ${GAMEPLAY_DEPS}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/xcode-amalgamate.sh ${LIBRARY_OUTPUT_PATH}
)
else()
# Windows
add_custom_command(
OUTPUT ${GAMEPLAY_DEPS}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/msvc-amalgamate.bat ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}
)
endif(LINUX OR ANDROID)
add_custom_target(gameplay-deps ALL DEPENDS ${GAMEPLAY_DEPS})
add_dependencies(gameplay-deps ${BUILD_TARGETS})
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${LIBRARY_OUTPUT_PATH}/${GAMEPLAY_DEPS})