project (VULKAN)
# set (CMAKE_VERBOSE_MAKEFILE 1)
-# The API_NAME allows renaming builds to avoid conflicts with installed SDKs
-# The MAJOR number of the version we're building, used in naming
-# <api-name>-<major>.dll (and other files).
-set(API_NAME "Vulkan" CACHE STRING "API name to use when building")
-set(MAJOR "1")
-string(TOLOWER ${API_NAME} API_LOWERCASE)
-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-find_package(PythonInterp 3 REQUIRED)
# If CMAKE 3.7+, use FindVulkan
if (NOT CMAKE_VERSION VERSION_LESS 3.7.0)
find_package(Vulkan)
endif()
-option(USE_CCACHE "Use ccache" OFF)
-if (USE_CCACHE)
- find_program(CCACHE_FOUND ccache)
- if(CCACHE_FOUND)
- set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
- set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
- endif(CCACHE_FOUND)
-endif()
-
if(APPLE)
# CMake versions 3 or later need CMAKE_MACOSX_RPATH defined.
# This avoids the CMP0042 policy message.
# Enable cmake folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
-set(LVL_TARGET_FOLDER lvl_cmake_targets)
-
-# Move to ICD
-set(SCRIPTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/scripts")
+set(TOOLS_TARGET_FOLDER lvl_cmake_targets)
# Header file for CMake settings
include_directories("${PROJECT_SOURCE_DIR}/include")
endif()
endif()
-if(WIN32)
- # 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>")
- # Warn about potentially uninitialized variables
- add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/w34701>")
- add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/w34703>")
- # Warn about different indirection types.
- add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/w34057>")
- # Warn about signed/unsigned mismatch.
- add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/w34245>")
-endif()
-
-if(NOT WIN32)
- set (BUILDTGT_DIR build)
- set (BINDATA_DIR Bin)
- set (LIBSOURCE_DIR Lib)
-else()
- # is WIN32
- 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)
- option(ENABLE_WIN10_ONECORE "Link the loader with OneCore umbrella libraries" OFF)
-
- # 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.
- if (DISABLE_BUILDTGT_DIR_DECORATION)
- set (BUILDTGT_DIR "")
- set (BINDATA_DIR "")
- set (LIBSOURCE_DIR "")
- elseif (CMAKE_CL_64)
- 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()
-
option(BUILD_CUBE "Build cube" ON)
option(BUILD_VULKANINFO "Build vulkaninfo" ON)
option(BUILD_ICD "Build icd" ON)
-find_program(GLSLANG_VALIDATOR NAMES glslangValidator
- HINTS "${EXTERNAL_SOURCE_ROOT}/glslang/${BUILDTGT_DIR}/install/bin"
- "${GLSLANG_BINARY_ROOT}/StandAlone"
- "${PROJECT_SOURCE_DIR}/external/${BINDATA_DIR}")
-
-find_library(Vulkan_LIBRARY NAMES vulkan-1 vulkan
- HINTS ${VK_SDK_PATH} )
-
-
-set (PYTHON_CMD ${PYTHON_EXECUTABLE})
-
-# Move to icd dir
-# Define macro used for building vkxml generated files
-macro(run_vk_xml_generate dependency output)
- add_custom_command(OUTPUT ${output}
- COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/lvl_genvk.py -registry ${SCRIPTS_DIR}/vk.xml ${output}
- DEPENDS ${SCRIPTS_DIR}/vk.xml ${SCRIPTS_DIR}/generator.py ${SCRIPTS_DIR}/${dependency} ${SCRIPTS_DIR}/lvl_genvk.py ${SCRIPTS_DIR}/reg.py
- )
-endmacro()
-
if(UNIX)
if(INSTALL_LVL_FILES)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/vulkan" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
-add_definitions(-DAPI_NAME="${API_NAME}")
-
if(BUILD_CUBE)
add_subdirectory(cube)
endif()
${CMAKE_CURRENT_BINARY_DIR}/..
)
+find_program(GLSLANG_VALIDATOR NAMES glslangValidator
+ HINTS "${EXTERNAL_SOURCE_ROOT}/glslang/${BUILDTGT_DIR}/install/bin"
+ "$ENV{VK_SDK_PATH}/bin"
+ "${GLSLANG_BINARY_ROOT}/StandAlone"
+ "${PROJECT_SOURCE_DIR}/external/${BINDATA_DIR}")
+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
include(FindPkgConfig)
option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf")
endif()
- set(CUBE_INCLUDE_DIRS
- "${PROJECT_SOURCE_DIR}/icd/common"
- ${CUBE_INCLUDE_DIRS}
- )
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
message( FATAL_ERROR "Unrecognized value for CUBE_WSI_SELECTION: ${CUBE_WSI_SELECTION}" )
endif()
- include_directories ("${PROJECT_SOURCE_DIR}/icd/common")
link_libraries(${API_LOWERCASE} m)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_definitions(-DVK_USE_PLATFORM_MACOS_MVK)
cmake_minimum_required (VERSION 2.8.11)
+
+find_package(PythonInterp 3 REQUIRED)
+
+set(SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/scripts")
+
+set (PYTHON_CMD ${PYTHON_EXECUTABLE})
+
+# Define macro used for building vk.xml generated files
+macro(run_vk_xml_generate dependency output)
+ add_custom_command(OUTPUT ${output}
+ COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/lvl_genvk.py -registry ${SCRIPTS_DIR}/vk.xml ${output}
+ DEPENDS ${SCRIPTS_DIR}/vk.xml ${SCRIPTS_DIR}/generator.py ${SCRIPTS_DIR}/${dependency} ${SCRIPTS_DIR}/lvl_genvk.py ${SCRIPTS_DIR}/reg.py
+ )
+endmacro()
+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DVK_USE_PLATFORM_WIN32_KHX -DWIN32_LEAN_AND_MEAN)
set(DisplayServer Win32)
COMMAND copy ${src_json} ${dst_json}
VERBATIM
)
- set_target_properties(${config_file}-json PROPERTIES FOLDER ${LVL_TARGET_FOLDER})
+ set_target_properties(${config_file}-json PROPERTIES FOLDER ${TOOLS_TARGET_FOLDER})
endforeach(config_file)
else()
foreach (config_file ${ICD_JSON_FILES})
mock_icd.h
mock_icd.cpp
)
-set_target_properties(generate_icd_files PROPERTIES FOLDER ${LVL_TARGET_FOLDER})
+set_target_properties(generate_icd_files PROPERTIES FOLDER ${TOOLS_TARGET_FOLDER})
if (WIN32)
macro(add_vk_icd target)
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEF_FILE} VkICD_${target}.def
VERBATIM
)
- set_target_properties(copy-${target}-def-file PROPERTIES FOLDER ${LVL_TARGET_FOLDER})
+ set_target_properties(copy-${target}-def-file PROPERTIES FOLDER ${TOOLS_TARGET_FOLDER})
add_library(VkICD_${target} SHARED ${ARGN} VkICD_${target}.def)
add_dependencies(VkICD_${target} generate_helper_files generate_icd_files)
#target_link_Libraries(VkICD_${target} VkICD_utils)