2017-04-20 18:38:20 +00:00
|
|
|
# Copyright 2017 The NXT Authors
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
# GLFW, only build the library
|
|
|
|
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
|
|
|
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
|
|
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
|
|
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
|
|
|
|
add_subdirectory(glfw)
|
2017-07-07 18:41:17 +00:00
|
|
|
NXTExternalTarget("third_party" glfw)
|
2017-04-20 18:38:20 +00:00
|
|
|
|
|
|
|
# GoogleTest
|
|
|
|
set(GTEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest)
|
|
|
|
set(GMOCK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest/googlemock)
|
|
|
|
add_library(gtest STATIC ${GTEST_DIR}/src/gtest-all.cc ${GMOCK_DIR}/src/gmock-all.cc)
|
|
|
|
target_include_directories(gtest SYSTEM PUBLIC ${GTEST_DIR}/include ${GMOCK_DIR}/include)
|
2017-07-22 00:00:22 +00:00
|
|
|
target_include_directories(gtest SYSTEM PRIVATE ${GTEST_DIR} ${GMOCK_DIR})
|
2017-04-20 18:38:20 +00:00
|
|
|
find_package(Threads)
|
|
|
|
target_link_libraries(gtest ${CMAKE_THREAD_LIBS_INIT})
|
2017-07-07 18:41:17 +00:00
|
|
|
NXTExternalTarget("third_party" gtest)
|
2017-04-20 18:38:20 +00:00
|
|
|
|
|
|
|
# Glad
|
2017-05-29 18:21:33 +00:00
|
|
|
add_library(glad STATIC
|
2017-04-20 18:38:20 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/glad/src/glad.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/glad/include/glad/glad.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/glad/include/KHR/khrplatform.h
|
|
|
|
)
|
2017-07-22 00:00:22 +00:00
|
|
|
target_include_directories(glad SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/glad/include)
|
2017-07-07 18:41:17 +00:00
|
|
|
NXTExternalTarget("third_party" glad)
|
2017-04-20 18:38:20 +00:00
|
|
|
|
|
|
|
# ShaderC
|
2017-07-10 23:08:46 +00:00
|
|
|
# Prevent SPIRV-Tools from using Werror as it has a warning on MSVC
|
2017-07-19 22:41:17 +00:00
|
|
|
set(SPIRV_WERROR OFF CACHE BOOL "" FORCE)
|
2017-07-10 23:08:46 +00:00
|
|
|
# Don't add unnecessary shaderc targets
|
2017-04-20 18:38:20 +00:00
|
|
|
set(SHADERC_SKIP_TESTS ON)
|
2017-07-10 23:08:46 +00:00
|
|
|
# Help shaderc find the non-standard paths for its dependencies
|
2017-04-20 18:38:20 +00:00
|
|
|
set(SHADERC_GOOGLE_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest CACHE STRING "Location of googletest source")
|
|
|
|
set(SHADERC_GLSLANG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/glslang" CACHE STRING "Location of glslang source")
|
|
|
|
set(SHADERC_SPIRV_TOOLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools CACHE STRING "Location of spirv-tools source")
|
2017-07-03 13:52:12 +00:00
|
|
|
# Help shaderc find the python executable when run inside VS.
|
|
|
|
find_package(PythonInterp REQUIRED)
|
|
|
|
set(PYTHON_EXE ${PYTHON_EXECUTABLE})
|
2017-04-20 18:38:20 +00:00
|
|
|
# Need to include this for spirv-tools to find it
|
|
|
|
add_subdirectory(spirv-headers)
|
|
|
|
add_subdirectory(shaderc)
|
2017-07-10 23:08:46 +00:00
|
|
|
# Namespace the shaderc targets in a folder to avoid cluttering the
|
|
|
|
# Visual Studio solution explorer
|
|
|
|
set_target_properties(
|
|
|
|
add-copyright
|
|
|
|
build-version
|
|
|
|
check-copyright
|
|
|
|
glslc
|
|
|
|
glslc_exe
|
|
|
|
install-headers
|
|
|
|
shaderc
|
|
|
|
shaderc_util
|
|
|
|
shaderc_combined_genfile
|
|
|
|
shaderc-online-compile testdata
|
|
|
|
SPIRV-Headers-example
|
|
|
|
SPIRV-Headers-example-1.1
|
|
|
|
PROPERTIES FOLDER "third_party/shaderc"
|
|
|
|
)
|
2017-04-20 18:38:20 +00:00
|
|
|
|
|
|
|
# SPIRV-Cross
|
2017-07-07 18:41:17 +00:00
|
|
|
add_library(spirv_cross STATIC
|
2017-04-20 18:38:20 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/GLSL.std.450.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_common.hpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_cfg.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_cfg.hpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_cpp.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_cpp.hpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_cross.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_cross.hpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_glsl.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_glsl.hpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv.hpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_msl.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_msl.hpp
|
2017-06-05 21:13:58 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_hlsl.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/spirv-cross/spirv_hlsl.hpp
|
2017-04-20 18:38:20 +00:00
|
|
|
)
|
2017-07-22 00:00:22 +00:00
|
|
|
target_include_directories(spirv_cross SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
2017-07-07 18:41:17 +00:00
|
|
|
NXTExternalTarget("third_party" spirv_cross)
|
2017-04-20 18:38:20 +00:00
|
|
|
|
|
|
|
# STB, used for stb_image
|
|
|
|
set(STB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/stb PARENT_SCOPE)
|
|
|
|
|
|
|
|
# glm matrix math library
|
|
|
|
set(GLM_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/glm PARENT_SCOPE)
|
2017-11-17 21:59:47 +00:00
|
|
|
|
|
|
|
# Vulkan headers
|
|
|
|
set(VULKAN_HEADERS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
|