2015-04-14 20:55:44 +00:00
# The name of our project is "VULKAN". CMakeLists files in this project can
# refer to the root source directory of the project as ${VULKAN_SOURCE_DIR} and
# to the root binary directory of the project as ${VULKAN_BINARY_DIR}.
2015-01-10 15:15:51 +00:00
cmake_minimum_required ( VERSION 2.8.11 )
2015-04-14 20:55:44 +00:00
project ( VULKAN )
2014-08-01 19:01:47 +00:00
# set (CMAKE_VERBOSE_MAKEFILE 1)
2014-07-24 14:36:15 +00:00
2016-11-07 17:44:23 +00:00
# The API_NAME allows renaming builds to avoid conflicts with installed SDKs
2015-07-09 18:44:38 +00:00
# The MAJOR number of the version we're building, used in naming
2016-11-07 17:44:23 +00:00
# <api-name>-<major>.dll (and other files).
set ( API_NAME "Vulkan" CACHE STRING "API name to use when building" )
2016-01-06 23:34:27 +00:00
set ( MAJOR "1" )
2016-11-07 17:44:23 +00:00
string ( TOLOWER ${ API_NAME } API_LOWERCASE )
2015-07-09 18:44:38 +00:00
2016-12-07 23:13:35 +00:00
set ( CMAKE_MODULE_PATH ${ CMAKE_MODULE_PATH } "${CMAKE_CURRENT_SOURCE_DIR}/cmake" )
2016-02-25 22:44:10 +00:00
find_package ( PythonInterp 3 REQUIRED )
2015-12-15 16:25:29 +00:00
2016-12-07 18:18:19 +00:00
if ( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
2017-02-19 19:14:24 +00:00
set ( FALLBACK_CONFIG_DIRS "/etc/xdg" CACHE STRING
" S e a r c h p a t h t o u s e w h e n X D G _ C O N F I G _ D I R S i s u n s e t o r e m p t y o r t h e c u r r e n t p r o c e s s i s S U I D / S G I D . D e f a u l t i s f r e e d e s k t o p c o m p l i a n t . " )
set ( FALLBACK_DATA_DIRS "/usr/local/share:/usr/share" CACHE STRING
" S e a r c h p a t h t o u s e w h e n X D G _ D A T A _ D I R S i s u n s e t o r e m p t y o r t h e c u r r e n t p r o c e s s i s S U I D / S G I D . D e f a u l t i s f r e e d e s k t o p c o m p l i a n t . " )
2016-12-07 23:13:35 +00:00
include ( FindPkgConfig )
2016-02-20 16:13:28 +00:00
option ( BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON )
2016-04-12 19:35:51 +00:00
option ( BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON )
2016-12-07 17:19:21 +00:00
option ( BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON )
2017-04-21 20:27:08 +00:00
option ( BUILD_WSI_MIR_SUPPORT "Build Mir WSI support" OFF )
2017-01-31 17:26:07 +00:00
set ( DEMOS_WSI_SELECTION "XCB" CACHE STRING "Select WSI target for demos (XCB, XLIB, WAYLAND, MIR, DISPLAY)" )
2015-11-25 20:26:15 +00:00
2016-12-07 23:13:35 +00:00
if ( BUILD_WSI_XCB_SUPPORT )
find_package ( XCB REQUIRED )
endif ( )
if ( BUILD_WSI_XLIB_SUPPORT )
find_package ( X11 REQUIRED )
endif ( )
if ( BUILD_WSI_WAYLAND_SUPPORT )
find_package ( Wayland REQUIRED )
2017-08-21 22:36:45 +00:00
include_directories ( ${ WAYLAND_CLIENT_INCLUDE_DIR } )
2016-12-07 23:13:35 +00:00
endif ( )
if ( BUILD_WSI_MIR_SUPPORT )
find_package ( Mir REQUIRED )
endif ( )
2017-06-12 17:23:57 +00:00
# This option can be used to suppress the installation of artifacts from the
# Vulkan-LoaderAndValidationLayers repo while running "make install" for the
# VulkanTools and VulkanSamples repos. This can be used to prevent the
# overwriting of LVL artifacts when installing these downstream repos.
option ( INSTALL_LVL_FILES "Install content from LoaderAndValidationLayers repo" ON )
2016-12-07 23:13:35 +00:00
endif ( )
2015-01-10 15:15:51 +00:00
2017-01-31 14:35:19 +00:00
set ( SCRIPTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/scripts" )
2016-11-18 21:44:37 +00:00
2014-07-24 14:36:15 +00:00
# Header file for CMake settings
include_directories ( "${PROJECT_SOURCE_DIR}/include" )
2015-02-17 16:55:34 +00:00
if ( CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang" )
2015-02-13 21:04:01 +00:00
set ( COMMON_COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers" )
2015-02-05 21:14:33 +00:00
set ( COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp" )
2017-07-12 16:06:19 +00:00
# For GCC version 7.1 or greater, we need to disable the implicit fallthrough warning since
# there's no consistent way to satisfy all compilers until they all accept the C++17 standard
if ( CMAKE_COMPILER_IS_GNUCC AND NOT ( CMAKE_CXX_COMPILER_VERSION LESS 7.1 ) )
set ( COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -Wimplicit-fallthrough=0" )
endif ( )
2014-12-19 03:34:46 +00:00
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${COMMON_COMPILE_FLAGS}" )
2016-05-12 16:28:57 +00:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILE_FLAGS} -std=c++11 -fno-rtti" )
2014-08-04 00:03:57 +00:00
if ( UNIX )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden" )
2015-01-18 03:09:29 +00:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
2014-08-04 00:03:57 +00:00
endif ( )
endif ( )
2014-08-02 01:14:28 +00:00
2016-05-12 16:28:57 +00:00
if ( WIN32 )
2017-01-20 20:19:20 +00:00
# Treat warnings as errors
add_compile_options ( "$<$<CXX_COMPILER_ID:MSVC>:/WX>" )
# Disable RTTI
add_compile_options ( "$<$<CXX_COMPILER_ID:MSVC>:/GR->" )
# Warn about nested declarations
add_compile_options ( "$<$<CXX_COMPILER_ID:MSVC>:/w34456>" )
2017-03-15 20:17:46 +00:00
# Warn about potentially uninitialized variables
add_compile_options ( "$<$<CXX_COMPILER_ID:MSVC>:/w34701>" )
add_compile_options ( "$<$<CXX_COMPILER_ID:MSVC>:/w34703>" )
2016-05-12 16:28:57 +00:00
endif ( )
2016-03-15 21:39:08 +00:00
if ( NOT WIN32 )
set ( BUILDTGT_DIR build )
set ( BINDATA_DIR Bin )
set ( LIBSOURCE_DIR Lib )
else ( )
2017-10-09 16:31:21 +00:00
# is WIN32
2016-04-18 17:04:36 +00:00
option ( DISABLE_BUILD_PATH_DECORATION "Disable the decoration of the gslang and SPIRV-Tools build path with MSVC build type info" OFF )
option ( DISABLE_BUILDTGT_DIR_DECORATION "Disable the decoration of the gslang and SPIRV-Tools build path with target info" OFF )
2016-03-15 21:39:08 +00:00
# For Windows, since 32-bit and 64-bit items can co-exist, we build each in its own build directory.
# 32-bit target data goes in build32, and 64-bit target data goes into build. So, include/link the
# appropriate data at build time.
2016-04-18 17:04:36 +00:00
if ( DISABLE_BUILDTGT_DIR_DECORATION )
set ( BUILDTGT_DIR "" )
set ( BINDATA_DIR "" )
set ( LIBSOURCE_DIR "" )
elseif ( CMAKE_CL_64 )
2016-03-15 21:39:08 +00:00
set ( BUILDTGT_DIR build )
set ( BINDATA_DIR Bin )
set ( LIBSOURCE_DIR Lib )
else ( )
set ( BUILDTGT_DIR build32 )
set ( BINDATA_DIR Bin32 )
set ( LIBSOURCE_DIR Lib32 )
endif ( )
endif ( )
2015-10-10 15:43:07 +00:00
option ( BUILD_LOADER "Build loader" ON )
option ( BUILD_TESTS "Build tests" ON )
option ( BUILD_LAYERS "Build layers" ON )
option ( BUILD_DEMOS "Build demos" ON )
2015-10-27 19:21:09 +00:00
option ( BUILD_VKJSON "Build vkjson" ON )
2017-10-13 15:26:20 +00:00
option ( BUILD_ICD "Build icd" ON )
2016-04-18 17:04:36 +00:00
option ( CUSTOM_GLSLANG_BIN_ROOT "Use the user defined GLSLANG_BINARY_ROOT" OFF )
2017-10-09 16:31:21 +00:00
option ( CUSTOM_SPIRV_TOOLS_BIN_ROOT "Use the user defined SPIRV_TOOLS*BINARY_ROOT paths" OFF )
2015-10-10 15:43:07 +00:00
2016-04-18 17:04:36 +00:00
#Choose natural default paths for glslang and SPIRV-Tools binaries to support custom definition by the user on the CMake command line or in the GUI
set ( GLSLANG_BINARY_ROOT "${CMAKE_BINARY_DIR}/../glslang" CACHE STRING "User defined path to the glslang binaries for this project" )
2016-06-16 20:57:25 +00:00
set ( SPIRV_TOOLS_BINARY_ROOT "${CMAKE_BINARY_DIR}/../SPIRV-Tools" CACHE STRING "User defined path to the SPIRV-Tools binaries for this project" )
2017-10-09 16:31:21 +00:00
set ( SPIRV_TOOLS_OPT_BINARY_ROOT "${CMAKE_BINARY_DIR}/../SPIRV-Tools/opt" CACHE STRING "User defined path to the SPIRV-Tools-opt binaries for this project" )
2016-04-18 17:04:36 +00:00
# Define a variable for a default root location to the gslang, SPIRV-Tools and other external sources and cache it to allow the user to customize it as needed
set ( EXTERNAL_SOURCE_ROOT "${CMAKE_SOURCE_DIR}/external" CACHE STRING "Root path to external sources such as glslang and SPIRV-Tools" )
2016-03-15 21:39:08 +00:00
if ( WIN32 )
2016-04-18 17:04:36 +00:00
if ( CUSTOM_GLSLANG_BIN_ROOT )
set ( GSLANG_FINAL_BINARY_PATH ${ GLSLANG_BINARY_ROOT } / ${ BUILDTGT_DIR } )
else ( )
set ( GSLANG_FINAL_BINARY_PATH "${EXTERNAL_SOURCE_ROOT}/glslang/${BUILDTGT_DIR}" )
endif ( )
if ( DISABLE_BUILD_PATH_DECORATION )
set ( DEBUG_DECORATION "" )
set ( RELEASE_DECORATION "" )
else ( )
set ( DEBUG_DECORATION "Debug" )
set ( RELEASE_DECORATION "Release" )
endif ( )
# Take some steps to set up a variable pointing to the final glslang binaries given the variety of input options
set ( GLSLANG_SEARCH_PATH "${GSLANG_FINAL_BINARY_PATH}/glslang/${RELEASE_DECORATION}"
" $ { G S L A N G _ F I N A L _ B I N A R Y _ P A T H } / g l s l a n g / O S D e p e n d e n t / W i n d o w s / $ { R E L E A S E _ D E C O R A T I O N } "
" $ { G S L A N G _ F I N A L _ B I N A R Y _ P A T H } / h l s l / $ { R E L E A S E _ D E C O R A T I O N } "
" $ { G S L A N G _ F I N A L _ B I N A R Y _ P A T H } / O G L C o m p i l e r s D L L / $ { R E L E A S E _ D E C O R A T I O N } "
" $ { G S L A N G _ F I N A L _ B I N A R Y _ P A T H } / S P I R V / $ { R E L E A S E _ D E C O R A T I O N } " )
set ( GLSLANG_DEBUG_SEARCH_PATH "${GSLANG_FINAL_BINARY_PATH}/glslang/${DEBUG_DECORATION}"
" $ { G S L A N G _ F I N A L _ B I N A R Y _ P A T H } / g l s l a n g / O S D e p e n d e n t / W i n d o w s / $ { D E B U G _ D E C O R A T I O N } "
" $ { G S L A N G _ F I N A L _ B I N A R Y _ P A T H } / h l s l / $ { D E B U G _ D E C O R A T I O N } "
" $ { G S L A N G _ F I N A L _ B I N A R Y _ P A T H } / O G L C o m p i l e r s D L L / $ { D E B U G _ D E C O R A T I O N } "
" $ { G S L A N G _ F I N A L _ B I N A R Y _ P A T H } / S P I R V / $ { D E B U G _ D E C O R A T I O N } " )
if ( CUSTOM_SPIRV_TOOLS_BIN_ROOT )
2016-06-16 20:57:25 +00:00
set ( SPIRV_TOOLS_SEARCH_PATH "${SPIRV_TOOLS_BINARY_ROOT}/${BUILDTGT_DIR}/source/${RELEASE_DECORATION}" )
set ( SPIRV_TOOLS_DEBUG_SEARCH_PATH "${SPIRV_TOOLS_BINARY_ROOT}/${BUILDTGT_DIR}/source/${DEBUG_DECORATION}" )
2017-10-09 16:31:21 +00:00
set ( SPIRV_TOOLS_OPT_SEARCH_PATH "${SPIRV_TOOLS_OPT_BINARY_ROOT}/${BUILDTGT_DIR}/source/opt/${RELEASE_DECORATION}" )
set ( SPIRV_TOOLS_OPT_DEBUG_SEARCH_PATH "${SPIRV_TOOLS_OPT_BINARY_ROOT}/${BUILDTGT_DIR}/source/opt/${DEBUG_DECORATION}" )
2016-04-18 17:04:36 +00:00
else ( )
set ( SPIRV_TOOLS_SEARCH_PATH "${EXTERNAL_SOURCE_ROOT}/spirv-tools/${BUILDTGT_DIR}/source/${RELEASE_DECORATION}" )
set ( SPIRV_TOOLS_DEBUG_SEARCH_PATH "${EXTERNAL_SOURCE_ROOT}/spirv-tools/${BUILDTGT_DIR}/source/${DEBUG_DECORATION}" )
2017-10-09 16:31:21 +00:00
set ( SPIRV_TOOLS_OPT_SEARCH_PATH "${EXTERNAL_SOURCE_ROOT}/spirv-tools/${BUILDTGT_DIR}/source/opt/${RELEASE_DECORATION}" )
set ( SPIRV_TOOLS_OPT_DEBUG_SEARCH_PATH "${EXTERNAL_SOURCE_ROOT}/spirv-tools/${BUILDTGT_DIR}/source/opt/${DEBUG_DECORATION}" )
2016-04-18 17:04:36 +00:00
endif ( )
2016-03-15 21:39:08 +00:00
else ( )
2017-10-09 16:31:21 +00:00
# not WIN32
2016-04-18 17:04:36 +00:00
if ( CUSTOM_GLSLANG_BIN_ROOT )
set ( GLSLANG_SEARCH_PATH "${GLSLANG_BINARY_ROOT}/install/lib"
" $ { G L S L A N G _ B I N A R Y _ R O O T } / g l s l a n g "
" $ { G L S L A N G _ B I N A R Y _ R O O T } / g l s l a n g / O S D e p e n d e n t / U n i x "
" $ { G L S L A N G _ B I N A R Y _ R O O T } / O G L C o m p i l e r s D L L "
" $ { G L S L A N G _ B I N A R Y _ R O O T } / S P I R V "
" $ { G L S L A N G _ B I N A R Y _ R O O T } / h l s l "
" $ { G L S L A N G _ B I N A R Y _ R O O T } / S t a n d A l o n e " )
else ( )
set ( GLSLANG_SEARCH_PATH "${EXTERNAL_SOURCE_ROOT}/glslang/${BUILDTGT_DIR}/install/lib" "${CMAKE_SOURCE_DIR}/../x86_64/lib/glslang" )
endif ( )
if ( CUSTOM_SPIRV_TOOLS_BIN_ROOT )
2016-06-16 20:57:25 +00:00
set ( SPIRV_TOOLS_SEARCH_PATH "${SPIRV_TOOLS_BINARY_ROOT}/source" )
2017-10-09 16:31:21 +00:00
set ( SPIRV_TOOLS_OPT_SEARCH_PATH "${SPIRV_TOOLS_OPT_BINARY_ROOT}/source/opt" )
2016-04-18 17:04:36 +00:00
else ( )
set ( SPIRV_TOOLS_SEARCH_PATH "${EXTERNAL_SOURCE_ROOT}/spirv-tools/${BUILDTGT_DIR}/source" "${CMAKE_SOURCE_DIR}/../x86_64/lib/spirv-tools" )
2017-10-09 16:31:21 +00:00
set ( SPIRV_TOOLS_OPT_SEARCH_PATH "${EXTERNAL_SOURCE_ROOT}/spirv-tools/${BUILDTGT_DIR}/source/opt" "${CMAKE_SOURCE_DIR}/../x86_64/lib/spirv-tools" )
2016-04-18 17:04:36 +00:00
endif ( )
2016-03-15 21:39:08 +00:00
endif ( )
2015-10-10 15:43:07 +00:00
2016-04-18 17:04:36 +00:00
find_program ( GLSLANG_VALIDATOR NAMES glslangValidator
H I N T S " $ { C M A K E _ S O U R C E _ D I R } / e x t e r n a l / g l s l a n g / $ { B U I L D T G T _ D I R } / i n s t a l l / b i n "
" $ { G L S L A N G _ B I N A R Y _ R O O T } / S t a n d A l o n e "
" $ { P R O J E C T _ S O U R C E _ D I R } / e x t e r n a l / $ { B I N D A T A _ D I R } " )
find_path ( GLSLANG_SPIRV_INCLUDE_DIR SPIRV/spirv.hpp HINTS "${EXTERNAL_SOURCE_ROOT}/glslang"
" $ { C M A K E _ S O U R C E _ D I R } / . . / g l s l a n g "
D O C " P a t h t o S P I R V / s p i r v . h p p " )
find_path ( SPIRV_TOOLS_INCLUDE_DIR spirv-tools/libspirv.h HINTS "${EXTERNAL_SOURCE_ROOT}/spirv-tools/include"
" $ { E X T E R N A L _ S O U R C E _ R O O T } / S P I R V - T o o l s / i n c l u d e "
" $ { C M A K E _ S O U R C E _ D I R } / . . / s p i r v - t o o l s / i n c l u d e "
" $ { C M A K E _ S O U R C E _ D I R } / . . / S P I R V - T o o l s / i n c l u d e "
" $ { E X T E R N A L _ S O U R C E _ R O O T } / s o u r c e / s p i r v - t o o l s / e x t e r n a l / i n c l u d e "
D O C " P a t h t o s p i r v - t o o l s / l i b s p i r v . h " )
2016-03-15 21:39:08 +00:00
find_library ( GLSLANG_LIB NAMES glslang
H I N T S $ { G L S L A N G _ S E A R C H _ P A T H } )
find_library ( OGLCompiler_LIB NAMES OGLCompiler
H I N T S $ { G L S L A N G _ S E A R C H _ P A T H } )
find_library ( OSDependent_LIB NAMES OSDependent
H I N T S $ { G L S L A N G _ S E A R C H _ P A T H } )
2016-04-14 17:18:30 +00:00
find_library ( HLSL_LIB NAMES HLSL
H I N T S $ { G L S L A N G _ S E A R C H _ P A T H } )
2016-03-15 21:39:08 +00:00
find_library ( SPIRV_LIB NAMES SPIRV
H I N T S $ { G L S L A N G _ S E A R C H _ P A T H } )
2016-08-26 22:54:43 +00:00
find_library ( SPIRV_REMAPPER_LIB NAMES SPVRemapper
H I N T S $ { G L S L A N G _ S E A R C H _ P A T H } )
2016-03-15 21:39:08 +00:00
find_library ( SPIRV_TOOLS_LIB NAMES SPIRV-Tools
H I N T S $ { S P I R V _ T O O L S _ S E A R C H _ P A T H } )
2017-10-09 16:31:21 +00:00
find_library ( SPIRV_TOOLS_OPT_LIB NAMES SPIRV-Tools-opt
H I N T S $ { S P I R V _ T O O L S _ O P T _ S E A R C H _ P A T H } )
2016-03-15 21:39:08 +00:00
if ( WIN32 )
2017-10-09 16:31:21 +00:00
add_library ( glslang STATIC IMPORTED )
add_library ( OGLCompiler STATIC IMPORTED )
add_library ( OSDependent STATIC IMPORTED )
add_library ( HLSL STATIC IMPORTED )
add_library ( SPIRV STATIC IMPORTED )
add_library ( SPVRemapper STATIC IMPORTED )
add_library ( Loader STATIC IMPORTED )
add_library ( SPIRV-Tools-opt STATIC IMPORTED )
add_library ( SPIRV-Tools STATIC IMPORTED )
2016-03-15 21:39:08 +00:00
2016-07-18 15:40:37 +00:00
find_library ( GLSLANG_DLIB NAMES glslangd
2016-03-15 21:39:08 +00:00
H I N T S $ { G L S L A N G _ D E B U G _ S E A R C H _ P A T H } )
2016-07-18 15:40:37 +00:00
find_library ( OGLCompiler_DLIB NAMES OGLCompilerd
2016-03-15 21:39:08 +00:00
H I N T S $ { G L S L A N G _ D E B U G _ S E A R C H _ P A T H } )
2016-07-18 15:40:37 +00:00
find_library ( OSDependent_DLIB NAMES OSDependentd
2016-03-15 21:39:08 +00:00
H I N T S $ { G L S L A N G _ D E B U G _ S E A R C H _ P A T H } )
2016-07-18 15:40:37 +00:00
find_library ( HLSL_DLIB NAMES HLSLd
2016-04-14 17:18:30 +00:00
H I N T S $ { G L S L A N G _ D E B U G _ S E A R C H _ P A T H } )
2016-07-18 15:40:37 +00:00
find_library ( SPIRV_DLIB NAMES SPIRVd
2016-03-15 21:39:08 +00:00
H I N T S $ { G L S L A N G _ D E B U G _ S E A R C H _ P A T H } )
2016-08-26 22:54:43 +00:00
find_library ( SPIRV_REMAPPER_DLIB NAMES SPVRemapperd
H I N T S $ { G L S L A N G _ D E B U G _ S E A R C H _ P A T H } )
2016-03-15 21:39:08 +00:00
find_library ( SPIRV_TOOLS_DLIB NAMES SPIRV-Tools
H I N T S $ { S P I R V _ T O O L S _ D E B U G _ S E A R C H _ P A T H } )
2017-10-09 16:31:21 +00:00
find_library ( SPIRV_TOOLS_OPT_DLIB NAMES SPIRV-Tools-opt
H I N T S $ { S P I R V _ T O O L S _ O P T _ D E B U G _ S E A R C H _ P A T H } )
2016-03-15 21:39:08 +00:00
set_target_properties ( glslang PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { G L S L A N G _ L I B } "
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { G L S L A N G _ D L I B } " )
set_target_properties ( OGLCompiler PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { O G L C o m p i l e r _ L I B } "
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { O G L C o m p i l e r _ D L I B } " )
set_target_properties ( OSDependent PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { O S D e p e n d e n t _ L I B } "
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { O S D e p e n d e n t _ D L I B } " )
2016-04-14 17:18:30 +00:00
set_target_properties ( HLSL PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { H L S L _ L I B } "
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { H L S L _ D L I B } " )
2016-03-15 21:39:08 +00:00
set_target_properties ( SPIRV PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { S P I R V _ L I B } "
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { S P I R V _ D L I B } " )
2016-08-26 22:54:43 +00:00
set_target_properties ( SPVRemapper PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { S P I R V _ R E M A P P E R _ L I B } "
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { S P I R V _ R E M A P P E R _ D L I B } " )
2016-03-15 21:39:08 +00:00
set_target_properties ( SPIRV-Tools PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { S P I R V _ T O O L S _ L I B } "
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { S P I R V _ T O O L S _ D L I B } " )
2017-10-09 16:31:21 +00:00
set_target_properties ( SPIRV-Tools-opt PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { S P I R V _ T O O L S _ O P T _ L I B } "
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { S P I R V _ T O O L S _ O P T _ D L I B } " )
2016-03-15 21:39:08 +00:00
2017-10-09 16:31:21 +00:00
set ( SPIRV_TOOLS_LIBRARIES SPIRV-Tools-opt SPIRV-Tools )
set ( GLSLANG_LIBRARIES glslang OGLCompiler OSDependent HLSL SPIRV SPVRemapper ${ SPIRV_TOOLS_LIBRARIES } )
2016-03-15 21:39:08 +00:00
else ( )
2017-10-09 16:31:21 +00:00
# not WIN32
set ( SPIRV_TOOLS_LIBRARIES ${ SPIRV_TOOLS_OPT_LIB } ${ SPIRV_TOOLS_LIB } )
set ( GLSLANG_LIBRARIES ${ GLSLANG_LIB } ${ OGLCompiler_LIB } ${ OSDependent_LIB } ${ HLSL_LIB } ${ SPIRV_LIB } ${ SPIRV_REMAPPER_LIB } ${ SPIRV_TOOLS_LIBRARIES } )
2015-10-14 23:00:44 +00:00
endif ( )
2016-03-01 23:40:39 +00:00
set ( PYTHON_CMD ${ PYTHON_EXECUTABLE } )
2017-01-23 16:08:20 +00:00
# Define macro used for building vkxml generated files
2017-01-23 15:51:08 +00:00
macro ( run_vk_xml_generate dependency output )
add_custom_command ( OUTPUT ${ output }
C O M M A N D $ { P Y T H O N _ C M D } $ { S C R I P T S _ D I R } / l v l _ g e n v k . p y - r e g i s t r y $ { S C R I P T S _ D I R } / v k . x m l $ { o u t p u t }
D E P E N D S $ { S C R I P T S _ D I R } / v k . x m l $ { S C R I P T S _ D I R } / g e n e r a t o r . p y $ { S C R I P T S _ D I R } / $ { d e p e n d e n c y } $ { S C R I P T S _ D I R } / l v l _ g e n v k . p y $ { S C R I P T S _ D I R } / r e g . p y
)
endmacro ( )
2017-01-23 16:08:20 +00:00
# Custom target for generated vulkan helper file dependencies
add_custom_target ( generate_helper_files DEPENDS
v k _ e n u m _ s t r i n g _ h e l p e r . h
v k _ s t r u c t _ s i z e _ h e l p e r . h
v k _ s t r u c t _ s i z e _ h e l p e r . c
v k _ s a f e _ s t r u c t . h
v k _ s a f e _ s t r u c t . c p p
2017-04-04 13:38:17 +00:00
v k _ o b j e c t _ t y p e s . h
2017-02-28 16:58:04 +00:00
v k _ l a y e r _ d i s p a t c h _ t a b l e . h
v k _ d i s p a t c h _ t a b l e _ h e l p e r . h
2017-06-01 13:46:20 +00:00
v k _ e x t e n s i o n _ h e l p e r . h
2017-10-26 18:07:05 +00:00
v k _ t y p e m a p _ h e l p e r . h
2017-01-23 16:08:20 +00:00
)
# Rules to build generated helper files
2017-02-28 16:58:04 +00:00
run_vk_xml_generate ( loader_extension_generator.py vk_layer_dispatch_table.h )
run_vk_xml_generate ( dispatch_table_helper_generator.py vk_dispatch_table_helper.h )
2017-01-23 16:08:20 +00:00
run_vk_xml_generate ( helper_file_generator.py vk_safe_struct.h )
run_vk_xml_generate ( helper_file_generator.py vk_safe_struct.cpp )
run_vk_xml_generate ( helper_file_generator.py vk_struct_size_helper.h )
run_vk_xml_generate ( helper_file_generator.py vk_struct_size_helper.c )
run_vk_xml_generate ( helper_file_generator.py vk_enum_string_helper.h )
2017-04-04 13:38:17 +00:00
run_vk_xml_generate ( helper_file_generator.py vk_object_types.h )
2017-06-01 13:46:20 +00:00
run_vk_xml_generate ( helper_file_generator.py vk_extension_helper.h )
2017-10-26 18:07:05 +00:00
run_vk_xml_generate ( helper_file_generator.py vk_typemap_helper.h )
2017-01-23 16:08:20 +00:00
2015-05-21 17:07:47 +00:00
if ( NOT WIN32 )
2015-07-23 20:29:26 +00:00
include ( GNUInstallDirs )
2016-10-22 19:20:29 +00:00
2017-02-19 19:14:24 +00:00
add_definitions ( -DFALLBACK_CONFIG_DIRS= "${FALLBACK_CONFIG_DIRS}" )
add_definitions ( -DFALLBACK_DATA_DIRS= "${FALLBACK_DATA_DIRS}" )
2016-10-22 17:42:44 +00:00
add_definitions ( -DSYSCONFDIR= "${CMAKE_INSTALL_FULL_SYSCONFDIR}" )
2017-02-19 19:14:24 +00:00
2016-10-22 19:20:29 +00:00
# Make sure /etc is searched by the loader
2017-01-29 22:49:54 +00:00
if ( NOT ( CMAKE_INSTALL_FULL_SYSCONFDIR STREQUAL "/etc" ) )
2016-10-22 19:20:29 +00:00
add_definitions ( -DEXTRASYSCONFDIR= "/etc" )
endif ( )
2014-10-03 21:34:53 +00:00
endif ( )
2016-10-12 23:36:35 +00:00
if ( UNIX )
2017-06-12 17:23:57 +00:00
if ( INSTALL_LVL_FILES )
install ( DIRECTORY "${PROJECT_SOURCE_DIR}/include/vulkan" DESTINATION ${ CMAKE_INSTALL_INCLUDEDIR } )
2017-07-25 21:58:20 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/vk_layer_dispatch_table.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/vulkan" )
2017-06-12 17:23:57 +00:00
endif ( )
2017-03-14 23:11:24 +00:00
# uninstall target
configure_file (
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y )
add_custom_target ( uninstall
C O M M A N D $ { C M A K E _ C O M M A N D } - P $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e )
2016-10-12 23:36:35 +00:00
endif ( )
2017-08-31 16:44:17 +00:00
add_definitions ( -DAPI_NAME= "${API_NAME}" )
2015-04-14 20:55:44 +00:00
# loader: Generic VULKAN ICD loader
# tests: VULKAN tests
2015-10-10 15:43:07 +00:00
if ( BUILD_LOADER )
add_subdirectory ( loader )
endif ( )
2015-07-09 23:31:46 +00:00
if ( BUILD_TESTS )
add_subdirectory ( tests )
endif ( )
2015-10-10 15:43:07 +00:00
if ( BUILD_LAYERS )
add_subdirectory ( layers )
endif ( )
if ( BUILD_DEMOS )
add_subdirectory ( demos )
endif ( )
2015-10-27 19:21:09 +00:00
if ( BUILD_VKJSON )
add_subdirectory ( libs/vkjson )
endif ( )
2017-10-13 15:26:20 +00:00
if ( BUILD_ICD )
add_subdirectory ( icd )
endif ( )