forked from vsg-dev/VulkanSceneGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
117 lines (97 loc) · 3.8 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
cmake_minimum_required(VERSION 3.7)
project(vsg
VERSION 1.0.4
DESCRIPTION "VulkanSceneGraph library"
LANGUAGES CXX
)
set(VSG_SOVERSION 12)
SET(VSG_RELEASE_CANDIDATE 0)
set(Vulkan_MIN_VERSION 1.1.70.0)
set(VSG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Root source directory of VulkanSceneGraph.")
set(VSG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "Root binary directory of VulkanSceneGraph.")
# create the version header
set(VSG_MAX_DEVICES 1 CACHE STRING "Set maximum number of vk/vsg::Device that are supported.")
set(VSG_VERSION_HEADER "${PROJECT_BINARY_DIR}/include/vsg/core/Version.h")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(vsgMacros)
vsg_setup_dir_vars()
vsg_setup_build_vars()
if (MSVC)
# Increase Number of Sections in .Obj file
add_compile_options(/bigobj)
endif()
if (VULKAN_SDK)
message("Within VulkanSceneGraph cmake, setting VULKAN_SDK env var to " ${VULKAN_SDK})
set(ENV{VULKAN_SDK} ${VULKAN_SDK})
endif()
find_package(Vulkan ${Vulkan_MIN_VERSION} REQUIRED)
find_package(Threads REQUIRED)
# Enable/disable shader compilation support that pulls in glslang
set(VSG_SUPPORTS_ShaderCompiler 1 CACHE STRING "Optional shader compiler support, 0 for off, 1 for enabled." )
if (${VSG_SUPPORTS_ShaderCompiler})
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/glslang/build_vars.cmake)
find_package(Git)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules, or set VSG_SUPPORTS_ShaderCompiler to 0.")
endif()
endif()
endif()
if (ANDROID)
find_library(AndroidLib android)
if(CMAKE_SYSTEM_VERSION GREATER 24)
find_library(AndroidNativeWindowLib nativewindow)
endif()
elseif (WIN32)
# just use native windowing
elseif (APPLE)
find_library(COCOA_LIBRARY Cocoa)
find_library(QUARTZCORE_LIBRARY QuartzCore)
else()
# just use Xcb for native windowing
find_package(PkgConfig REQUIRED)
pkg_check_modules(xcb REQUIRED IMPORTED_TARGET xcb)
endif()
# this line needs to be after the call to setup_build_vars()
configure_file("${VSG_SOURCE_DIR}/src/vsg/core/Version.h.in" "${VSG_VERSION_HEADER}")
vsg_add_target_clang_format(
FILES
${VSG_SOURCE_DIR}/include/vsg/*/*.h
${VSG_SOURCE_DIR}/src/vsg/*/*.cpp
${VSG_SOURCE_DIR}/include/vsg/platform/unix/*.h
${VSG_SOURCE_DIR}/src/vsg/platform/unix/*.cpp
${VSG_SOURCE_DIR}/include/vsg/platform/win32/*.h
${VSG_SOURCE_DIR}/src/vsg/platform/win32/*.cpp
${VSG_SOURCE_DIR}/include/vsg/platform/android/*.h
${VSG_SOURCE_DIR}/src/vsg/platform/android/*.cpp
)
vsg_add_target_clobber()
vsg_add_target_cppcheck(
SUPPRESSIONS_LIST
"${VSG_SOURCE_DIR}/cmake/cppcheck-suppression-list.txt"
FILES
${CMAKE_SOURCE_DIR}/include/vsg/*/*.h
${VSG_SOURCE_DIR}/src/vsg/*/*.cpp
-I ${VSG_SOURCE_DIR}/include/
)
vsg_add_target_uninstall()
vsg_add_target_docs(
FILES
${VSG_SOURCE_DIR}/include/vsg
)
# automatically buil_all_h build target to generate the include/vsg/all.h from the headers in the include/vsg/* directories
add_custom_target(build_all_h
COMMAND ${CMAKE_COMMAND} -DVSG_SOURCE_DIR=${VSG_SOURCE_DIR} -P ${VSG_SOURCE_DIR}/cmake/build_all_h.cmake
)
set_target_properties(build_all_h PROPERTIES FOLDER "VulkanSceneGraph")
vsg_add_option_maintainer(
PREFIX VulkanSceneGraph
RCLEVEL ${VSG_RELEASE_CANDIDATE}
)
#
# src directory contains all the source of the vsg library
#
add_subdirectory(src/vsg)
vsg_add_feature_summary()