-
Notifications
You must be signed in to change notification settings - Fork 61
/
CMakeLists.txt
103 lines (82 loc) · 3.18 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
cmake_minimum_required(VERSION 3.2)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
project(saba)
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set (SABA_BULLET_ROOT "" CACHE PATH "Bullet Root Directory")
option (SABA_ENABLE_TEST "Enable Google test." on)
option (SABA_ENABLE_GL_TEST "OpenGL test." off)
option (SABA_USE_GLSLANG "glsl Preprocessor : glslang lib" off)
option (SABA_INSTALL "Saba install." off)
set (SABA_GLFW_ROOT "" CACHE PATH "GLFW Root Directory")
option (SABA_FORCE_GLFW_BUILD "Force glfw build." off)
option (SABA_ENABLE_EXAMPLE_VULKAN "Build vulakn's example." off)
set (BULLET_ROOT ${SABA_BULLET_ROOT})
MESSAGE( STATUS "BULLET_ROOT=${BULLET_ROOT}")
find_package (OpenGL REQUIRED)
find_package (Bullet REQUIRED)
if (NOT SABA_FORCE_GLFW_BUILD)
set (GLFW_ROOT ${SABA_GLFW_ROOT})
find_package (GLFW)
endif ()
if (NOT GLFW_FOUND)
set (SABA_FORCE_GLFW_BUILD on CACHE BOOL "" FORCE)
endif ()
if (SABA_FORCE_GLFW_BUILD)
include_directories (${PROJECT_SOURCE_DIR}/external/glfw/include)
else ()
include_directories (${GLFW_INCLUDE_DIR})
endif ()
if (SABA_ENABLE_TEST)
enable_testing()
endif()
if (SABA_ENABLE_EXAMPLE_VULKAN)
find_package(Vulkan REQUIRED)
endif()
set(CMAKE_CXX_STANDARD 14)
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/viewer)
include_directories(${PROJECT_SOURCE_DIR}/external/gl3w/include)
include_directories(${PROJECT_SOURCE_DIR}/external/gli/include)
include_directories(${PROJECT_SOURCE_DIR}/external/glm/include)
include_directories(${PROJECT_SOURCE_DIR}/external/stb/include)
include_directories(${PROJECT_SOURCE_DIR}/external/spdlog/include)
include_directories(${PROJECT_SOURCE_DIR}/external/tinyobjloader/include)
include_directories(${PROJECT_SOURCE_DIR}/external/imgui/include)
include_directories(${PROJECT_SOURCE_DIR}/external/json/include)
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/external/lua)
include_directories(${PROJECT_SOURCE_DIR}/external/sol2/include)
include_directories(${PROJECT_SOURCE_DIR}/external/tinyxfileloader/include)
include_directories(${PROJECT_SOURCE_DIR}/external/tinyddsloader/include)
include_directories(${BULLET_INCLUDE_DIRS})
if(WIN32)
ADD_DEFINITIONS(-DUNICODE)
ADD_DEFINITIONS(-D_UNICODE)
endif(WIN32)
if(MSVC)
ADD_DEFINITIONS(/MP)
endif()
add_subdirectory(external)
add_subdirectory(src)
add_subdirectory(viewer)
add_subdirectory(gtests)
add_executable(saba_viewer saba_viewer.cpp)
set (saba_viewer_LIBRARIES SabaViewer)
if (UNIX)
list (APPEND saba_viewer_LIBRARIES ${CMAKE_DL_LIBS})
endif ()
target_link_libraries(saba_viewer ${saba_viewer_LIBRARIES})
add_custom_command(TARGET saba_viewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/viewer/Saba/Viewer/resource
${CMAKE_CURRENT_BINARY_DIR}/resource
)
add_executable(mmd2obj mmd2obj.cpp)
target_link_libraries(mmd2obj Saba)
add_subdirectory(example)
# Install
if (SABA_INSTALL)
install (DIRECTORY src/Saba DESTINATION include FILES_MATCHING PATTERN "*.h")
install (TARGETS saba_viewer RUNTIME DESTINATION bin)
install (DIRECTORY viewer/Saba/Viewer/resource DESTINATION bin)
install (TARGETS mmd2obj RUNTIME DESTINATION bin)
endif()