forked from KhronosGroup/COLLADA2GLTF
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
133 lines (115 loc) · 4.24 KB
/
CMakeLists.txt
File metadata and controls
133 lines (115 loc) · 4.24 KB
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
124
125
126
127
128
129
130
131
132
133
cmake_minimum_required (VERSION 3.1.0)
set(PROJECT_NAME COLLADA2GLTF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
include(ExternalProject)
project(${PROJECT_NAME})
# cmake -Dtest=ON to build with tests
option(test "Build all tests." OFF)
# GLTF
include_directories(GLTF/include)
add_subdirectory(GLTF)
# Disable for other modules
set(TEST_ENABLED ${test})
set(test OFF)
# RapidJSON
include_directories(GLTF/dependencies/rapidjson/include)
# Draco
include_directories(GLTF/dependencies/draco/src)
# Pre-compiled
if(precompiled MATCHES "X86")
if(precompiled MATCHES "DEBUG")
if(MSVC)
ExternalProject_Add(
precompiled
URL https://github.com/KhronosGroup/COLLADA2GLTF/releases/download/dependencies/dependencies-windows-Debug-Win32.zip
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
set(PRECOMPILED_DIR ${CMAKE_CURRENT_BINARY_DIR}/precompiled-prefix/src/precompiled)
endif()
elseif(precompiled MATCHES "RELEASE")
if(MSVC)
ExternalProject_Add(
precompiled
URL https://github.com/KhronosGroup/COLLADA2GLTF/releases/download/dependencies/dependencies-windows-Release-Win32.zip
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
set(PRECOMPILED_DIR ${CMAKE_CURRENT_BINARY_DIR}/precompiled-prefix/src/precompiled)
endif()
endif()
elseif(precompiled MATCHES "X64")
if(precompiled MATCHES "DEBUG")
if(MSVC)
ExternalProject_Add(
precompiled
URL https://github.com/KhronosGroup/COLLADA2GLTF/releases/download/dependencies/dependencies-windows-Debug-x64.zip
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
set(PRECOMPILED_DIR ${CMAKE_CURRENT_BINARY_DIR}/precompiled-prefix/src/precompiled)
endif()
elseif(precompiled MATCHES "RELEASE")
if(MSVC)
ExternalProject_Add(
precompiled
URL https://github.com/KhronosGroup/COLLADA2GLTF/releases/download/dependencies/dependencies-windows-Release-x64.zip
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
set(PRECOMPILED_DIR ${CMAKE_CURRENT_BINARY_DIR}/precompiled-prefix/src/precompiled)
endif()
endif()
endif()
if(PRECOMPILED_DIR)
set(OpenCOLLADA
${PRECOMPILED_DIR}/COLLADABaseUtils.lib
${PRECOMPILED_DIR}/COLLADAFramework.lib
${PRECOMPILED_DIR}/COLLADASaxFrameworkLoader.lib
${PRECOMPILED_DIR}/expat.lib
${PRECOMPILED_DIR}/GeneratedSaxParser.lib
${PRECOMPILED_DIR}/LibXML.lib
${PRECOMPILED_DIR}/MathMLSolver.lib
${PRECOMPILED_DIR}/pcre.lib)
endif()
# COLLADASaxFrameworkLoader/BaseUtils/Framework, GeneratedSaxParser
include_directories(dependencies/OpenCOLLADA/OpenCOLLADA/COLLADASaxFrameworkLoader/include)
include_directories(dependencies/OpenCOLLADA/OpenCOLLADA/COLLADABaseUtils/include)
include_directories(dependencies/OpenCOLLADA/OpenCOLLADA/COLLADAFramework/include)
include_directories(dependencies/OpenCOLLADA/OpenCOLLADA/GeneratedSaxParser/include)
if(NOT OpenCOLLADA)
add_subdirectory(dependencies/OpenCOLLADA/modules/COLLADASaxFrameworkLoader)
set(OpenCOLLADA COLLADASaxFrameworkLoader)
endif()
# COLLADA2GLTF
include_directories(include)
file(GLOB LIB_HEADERS "include/*.h")
set(LIB_SOURCES src/COLLADA2GLTFWriter.cpp src/COLLADA2GLTFExtrasHandler.cpp)
add_library(${PROJECT_NAME} ${LIB_HEADERS} ${LIB_SOURCES})
target_link_libraries(${PROJECT_NAME} GLTF ${OpenCOLLADA})
# ahoy
include_directories(dependencies/ahoy/include)
add_subdirectory(dependencies/ahoy)
add_executable(${PROJECT_NAME}-bin src/main.cpp)
target_link_libraries(${PROJECT_NAME}-bin ${PROJECT_NAME} ahoy draco)
if(TEST_ENABLED)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
enable_testing()
# gtest
set(GTEST_LINKED 1)
include_directories(GLTF/dependencies/googletest/googletest/include)
add_subdirectory(GLTF/dependencies/googletest/googletest)
# Unit Tests
include_directories(test/include)
file(GLOB TEST_HEADERS "test/include/*.h")
file(GLOB TEST_SOURCES "test/src/*.cpp")
add_executable(${PROJECT_NAME}-test ${TEST_HEADERS} ${TEST_SOURCES})
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME} GLTF gtest)
add_test(COLLADA2GLTFWriterTest ${PROJECT_NAME}-test)
endif()