--- /dev/null
+# Configuration for cmake-format (v0.3.6, circa Apr 2018)
+# https://github.com/cheshirekow/cmake_format
+
+# How wide to allow formatted cmake files
+line_width = 132
+
+# How many spaces to tab for indent
+tab_size = 4
+
+# If arglists are longer than this, break them always
+max_subargs_per_line = 3
+
+# If true, separate flow control names from their parentheses with a space
+separate_ctrl_name_with_space = False
+
+# If true, separate function names from parentheses with a space
+separate_fn_name_with_space = False
+
+# If a statement is wrapped to more than one line, than dangle the closing
+# parenthesis on it's own line
+dangle_parens = False
+
+# What character to use for bulleted lists
+bullet_char = u'*'
+
+# What character to use as punctuation after numerals in an enumerated list
+enum_char = u'.'
+
+# What style line endings to use in the output.
+line_ending = u'unix'
+
+# Format command names consistently as 'lower' or 'upper' case
+command_case = u'lower'
+
option(BUILD_CUBE "Build cube" ON)
option(BUILD_VULKANINFO "Build vulkaninfo" ON)
option(BUILD_ICD "Build icd" ON)
-# Installing the Mock ICD to system directories is probably not desired since
-# this ICD is not a very complete implementation.
+# Installing the Mock ICD to system directories is probably not desired since this ICD is not a very complete implementation.
# Require the user to ask that it be installed if they really want it.
option(INSTALL_ICD "Install icd" OFF)
# "Helper" targets that don't have interesting source code should set their FOLDER property to this
set(TOOLS_TARGET_FOLDER "Helper Targets")
+# ~~~
# Find Vulkan Headers and Loader
# Search order:
# User-supplied CMAKE_PREFIX_PATH containing paths to the header and/or loader install dirs
# CMake option MOTLENVK_REPO_ROOT
# Env vars MOLTENVK_REPO_ROOT
# Fallback to FindVulkan operation using SDK install or system installed components.
+# ~~~
set(VULKAN_HEADERS_INSTALL_DIR "HEADERS-NOTFOUND" CACHE PATH "Absolute path to a Vulkan-Headers install directory")
set(VULKAN_LOADER_INSTALL_DIR "LOADER-NOTFOUND" CACHE PATH "Absolute path to a Vulkan-Loader install directory")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH};${VULKAN_HEADERS_INSTALL_DIR};${VULKAN_LOADER_INSTALL_DIR};
- $ENV{VULKAN_HEADERS_INSTALL_DIR};$ENV{VULKAN_LOADER_INSTALL_DIR})
+ $ENV{VULKAN_HEADERS_INSTALL_DIR};$ENV{VULKAN_LOADER_INSTALL_DIR})
-if (APPLE)
+if(APPLE)
set(MOLTENVK_REPO_ROOT "MOLTENVK-NOTFOUND" CACHE PATH "Absolute path to a MoltenVK repo directory")
- if (NOT MOLTENVK_REPO_ROOT AND NOT DEFINED ENV{MOLTENVK_REPO_ROOT})
+ if(NOT MOLTENVK_REPO_ROOT AND NOT DEFINED ENV{MOLTENVK_REPO_ROOT})
message(FATAL_ERROR "Must define location of MoltenVK repo -- see BUILD.md")
endif()
- if (NOT MOLTENVK_REPO_ROOT)
+ if(NOT MOLTENVK_REPO_ROOT)
set(MOLTENVK_REPO_ROOT $ENV{MOLTENVK_REPO_ROOT})
endif()
message(STATUS "Using MoltenVK repo location at ${MOLTENVK_REPO_ROOT}")
# Install-related settings
include(GNUInstallDirs)
# Set a better default install location for Windows only if the user did not provide one.
-if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
- set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE )
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
+ set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE)
endif()
# uninstall target
-if (NOT TARGET uninstall)
- configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
- IMMEDIATE @ONLY)
-
- add_custom_target(uninstall
- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
+if(NOT TARGET uninstall)
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ IMMEDIATE
+ @ONLY)
+
+ add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
set_target_properties(uninstall PROPERTIES FOLDER ${TOOLS_TARGET_FOLDER})
endif()
if(APPLE)
- # CMake versions 3 or later need CMAKE_MACOSX_RPATH defined.
- # This avoids the CMP0042 policy message.
+ # CMake versions 3 or later need CMAKE_MACOSX_RPATH defined. This avoids the CMP0042 policy message.
set(CMAKE_MACOSX_RPATH 1)
# The "install" target for MacOS fixes up bundles in place.
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
endif()
-if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
set(COMMON_COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp")
- # 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))
+ # 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()
- if (APPLE)
+ if(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_COMPILE_FLAGS}")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${COMMON_COMPILE_FLAGS}")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILE_FLAGS} -std=c++11 -fno-rtti")
- if (UNIX)
+ if(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()
-## How to Contribute to Vulkan Source Repositories
+# How to Contribute to Vulkan Source Repositories
-### **The Repository**
+## **The Repository**
The source code for The Vulkan-Tools components is sponsored by Khronos and LunarG.
* [Khronos Vulkan-Tools](https://github.com/KhronosGroup/Vulkan-Tools)
a good reason is "This violates the style guide, but it improves type safety."
* Run **clang-format** on your changes to maintain consistent formatting
- * There are `.clang-format files` present in the repository to define clang-format settings
+ * There are `.clang-format` files present in the repository to define clang-format settings
which are found and used automatically by clang-format.
- * **clang-format** binaries are available from the LLVM orginization, here: https://clang.llvm.org/. Our CI system (Travis-CI)
+ * **clang-format** binaries are available from the LLVM orginization, here: [LLVM](https://clang.llvm.org/). Our CI system (Travis-CI)
currently uses clang-format version 5.0.0 to check that the lines of code you have changed are formatted properly. It is
recommended that you use the same version to format your code prior to submission.
* A sample git workflow may look like:
* Run tests that explicitly exercise your changes.
* Feel free to subject your code changes to other tests as well!
+#### Coding Conventions for [CMake](http://cmake.org) files
+
+* When editing configuration files for CMake, follow the style conventions of the surrounding code.
+ * The column limit is 132.
+ * The indent is 4 spaces.
+ * CMake functions are lower-case.
+ * Variable and keyword names are upper-case.
+* The format is defined by
+ [cmake-format](https://github.com/cheshirekow/cmake_format)
+ using the `.cmake-format.py` file in the repository to define the settings.
+ See the cmake-format page for information about its simple markup for comments.
+* Disable reformatting of a block of comment lines by inserting
+ a `# ~~~` comment line before and after that block.
+* Disable any formatting of a block of lines by surrounding that block with
+ `# cmake-format: off` and `# cmake-format: on` comment lines.
+* To install: `sudo pip install cmake_format`
+* To run: `cmake-format --in-place $FILENAME`
+* **IMPORTANT (June 2018)** cmake-format v0.3.6 has a
+ [bug]( https://github.com/cheshirekow/cmake_format/issues/50)
+ that can corrupt the formatting of comment lines in CMake files.
+ A workaround is to use the following command _before_ running cmake-format:
+ `sed --in-place='' 's/^ *#/#/' $FILENAME`
### **Contributor License Agreement (CLA)**
# limitations under the License.
# ~~~
-set(CUBE_INCLUDE_DIRS
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}/..
- ${VulkanHeaders_INCLUDE_DIR}
-)
+set(CUBE_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.. ${VulkanHeaders_INCLUDE_DIR})
find_package(PythonInterp 3 REQUIRED)
set(PYTHON_CMD ${PYTHON_EXECUTABLE})
set(SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/scripts")
-
if(GLSLANG_INSTALL_DIR)
message(STATUS "Using GLSLANG_INSTALL_DIR to look for glslangValidator")
- find_program(GLSLANG_VALIDATOR names glslangValidator
- HINTS "${GLSLANG_INSTALL_DIR}/bin"
- )
+ find_program(GLSLANG_VALIDATOR names glslangValidator HINTS "${GLSLANG_INSTALL_DIR}/bin")
elseif(GLSLANG_REPO_ROOT)
message(STATUS "Using glslang_repo_root to look for glslangValidator")
find_program(GLSLANG_VALIDATOR names glslangValidator
- HINTS "${GLSLANG_REPO_ROOT}/build/standalone/release"
- HINTS "${GLSLANG_REPO_ROOT}/build/standalone/debug"
- HINTS "${GLSLANG_REPO_ROOT}/build/StandAlone"
- HINTS "${GLSLANG_REPO_ROOT}/dbuild/StandAlone"
- HINTS "${GLSLANG_REPO_ROOT}/build32/standalone/release"
- HINTS "${GLSLANG_REPO_ROOT}/build32/standalone/debug"
- )
+ HINTS "${GLSLANG_REPO_ROOT}/build/standalone/release"
+ HINTS "${GLSLANG_REPO_ROOT}/build/standalone/debug"
+ HINTS "${GLSLANG_REPO_ROOT}/build/StandAlone"
+ HINTS "${GLSLANG_REPO_ROOT}/dbuild/StandAlone"
+ HINTS "${GLSLANG_REPO_ROOT}/build32/standalone/release"
+ HINTS "${GLSLANG_REPO_ROOT}/build32/standalone/debug")
else()
set(GLSLANG_VALIDATOR_NAME "glslangValidator")
message(STATUS "Using cmake find_program to look for glslangValidator")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
execute_process(COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-osx-Release.zip)
endif()
- find_program(GLSLANG_VALIDATOR NAMES ${GLSLANG_VALIDATOR_NAME}
- HINTS "${PROJECT_SOURCE_DIR}/glslang/bin"
- )
+ find_program(GLSLANG_VALIDATOR NAMES ${GLSLANG_VALIDATOR_NAME} HINTS "${PROJECT_SOURCE_DIR}/glslang/bin")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
option(BUILD_WSI_MIR_SUPPORT "Build Mir WSI support" OFF)
set(CUBE_WSI_SELECTION "XCB" CACHE STRING "Select WSI target for cube (XCB, XLIB, WAYLAND, MIR, DISPLAY)")
- if (BUILD_WSI_XCB_SUPPORT)
+ if(BUILD_WSI_XCB_SUPPORT)
find_package(XCB REQUIRED)
endif()
- if (BUILD_WSI_XLIB_SUPPORT)
+ if(BUILD_WSI_XLIB_SUPPORT)
find_package(X11 REQUIRED)
endif()
- if (BUILD_WSI_WAYLAND_SUPPORT)
+ if(BUILD_WSI_WAYLAND_SUPPORT)
find_package(Wayland REQUIRED)
include_directories(${WAYLAND_CLIENT_INCLUDE_DIR})
endif()
- if (BUILD_WSI_MIR_SUPPORT)
+ if(BUILD_WSI_MIR_SUPPORT)
find_package(Mir REQUIRED)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN)
set(DisplayServer Win32)
- if (NOT MSVC_VERSION LESS 1900)
+ if(NOT MSVC_VERSION LESS 1900)
# Enable control flow guard
message(STATUS "Building cube with control flow guard")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/guard:cf>")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- if (NOT CUBE_WSI_SELECTION)
+ if(NOT CUBE_WSI_SELECTION)
set(CUBE_WSI_SELECTION "XCB")
endif()
- if (CUBE_WSI_SELECTION STREQUAL "XCB")
- if (NOT BUILD_WSI_XCB_SUPPORT)
- message( FATAL_ERROR "Selected XCB for cube build but not building Xcb support" )
+ if(CUBE_WSI_SELECTION STREQUAL "XCB")
+ if(NOT BUILD_WSI_XCB_SUPPORT)
+ message(FATAL_ERROR "Selected XCB for cube build but not building Xcb support")
endif()
- set(CUBE_INCLUDE_DIRS
- ${XCB_INCLUDE_DIRS}
- ${CUBE_INCLUDE_DIRS}
- )
+ set(CUBE_INCLUDE_DIRS ${XCB_INCLUDE_DIRS} ${CUBE_INCLUDE_DIRS})
link_libraries(${XCB_LIBRARIES})
add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
elseif(CUBE_WSI_SELECTION STREQUAL "XLIB")
- if (NOT BUILD_WSI_XLIB_SUPPORT)
- message( FATAL_ERROR "Selected XLIB for cube build but not building Xlib support" )
+ if(NOT BUILD_WSI_XLIB_SUPPORT)
+ message(FATAL_ERROR "Selected XLIB for cube build but not building Xlib support")
endif()
- set(CUBE_INCLUDE_DIRS
- ${X11_INCLUDE_DIR}
- ${CUBE_INCLUDE_DIRS}
- )
+ set(CUBE_INCLUDE_DIRS ${X11_INCLUDE_DIR} ${CUBE_INCLUDE_DIRS})
link_libraries(${X11_LIBRARIES})
add_definitions(-DVK_USE_PLATFORM_XLIB_KHR)
elseif(CUBE_WSI_SELECTION STREQUAL "WAYLAND")
- if (NOT BUILD_WSI_WAYLAND_SUPPORT)
- message( FATAL_ERROR "Selected Wayland for cube build but not building Wayland support" )
+ if(NOT BUILD_WSI_WAYLAND_SUPPORT)
+ message(FATAL_ERROR "Selected Wayland for cube build but not building Wayland support")
endif()
- set(CUBE_INCLUDE_DIRS
- ${WAYLAND_CLIENT_INCLUDE_DIR}
- ${CUBE_INCLUDE_DIRS}
- )
+ set(CUBE_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR} ${CUBE_INCLUDE_DIRS})
link_libraries(${WAYLAND_CLIENT_LIBRARIES})
add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR)
elseif(CUBE_WSI_SELECTION STREQUAL "MIR")
- if (NOT BUILD_WSI_MIR_SUPPORT)
- message( FATAL_ERROR "Selected MIR for cube build but not building Mir support" )
+ if(NOT BUILD_WSI_MIR_SUPPORT)
+ message(FATAL_ERROR "Selected MIR for cube build but not building Mir support")
endif()
add_definitions(-DVK_USE_PLATFORM_MIR_KHR)
- set(CUBE_INCLUDE_DIRS
- ${MIR_INCLUDE_DIR}
- ${CUBE_INCLUDE_DIRS}
- )
+ set(CUBE_INCLUDE_DIRS ${MIR_INCLUDE_DIR} ${CUBE_INCLUDE_DIRS})
elseif(CUBE_WSI_SELECTION STREQUAL "DISPLAY")
add_definitions(-DVK_USE_PLATFORM_DISPLAY_KHR)
else()
- message( FATAL_ERROR "Unrecognized value for CUBE_WSI_SELECTION: ${CUBE_WSI_SELECTION}" )
- endif()
+ message(FATAL_ERROR "Unrecognized value for CUBE_WSI_SELECTION: ${CUBE_WSI_SELECTION}")
+ endif()
link_libraries(${API_LOWERCASE} m)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
message(FATAL_ERROR "Unsupported Platform!")
endif()
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
if(WIN32)
# Use static MSVCRT libraries
- foreach(configuration in CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
- CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+ foreach(configuration
+ in
+ CMAKE_C_FLAGS_DEBUG
+ CMAKE_C_FLAGS_MINSIZEREL
+ CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_RELWITHDEBINFO
+ CMAKE_CXX_FLAGS_DEBUG
+ CMAKE_CXX_FLAGS_MINSIZEREL
+ CMAKE_CXX_FLAGS_RELEASE
+ CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${configuration} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${configuration} "${${configuration}}")
endif()
endforeach()
- file(COPY cube.vcxproj.user DESTINATION ${CMAKE_BINARY_DIR}/cube)
+ file(COPY cube.vcxproj.user DESTINATION ${CMAKE_BINARY_DIR}/cube)
endif()
-add_custom_command(
- COMMENT "Compiling cube vertex shader"
- OUTPUT cube.vert.inc
- COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_BINARY_DIR}/cube.vert.inc ${PROJECT_SOURCE_DIR}/cube/cube.vert
- MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.vert
- DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.vert ${GLSLANG_VALIDATOR}
-)
-add_custom_command(
- COMMENT "Compiling cube fragment shader"
- OUTPUT cube.frag.inc
- COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_BINARY_DIR}/cube.frag.inc ${PROJECT_SOURCE_DIR}/cube/cube.frag
- MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.frag
- DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.frag ${GLSLANG_VALIDATOR}
-)
+add_custom_command(COMMENT "Compiling cube vertex shader"
+ OUTPUT cube.vert.inc
+ COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_BINARY_DIR}/cube.vert.inc
+ ${PROJECT_SOURCE_DIR}/cube/cube.vert
+ MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.vert
+ DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.vert ${GLSLANG_VALIDATOR})
+add_custom_command(COMMENT "Compiling cube fragment shader"
+ OUTPUT cube.frag.inc
+ COMMAND ${GLSLANG_VALIDATOR} -V -x -o ${CMAKE_CURRENT_BINARY_DIR}/cube.frag.inc
+ ${PROJECT_SOURCE_DIR}/cube/cube.frag
+ MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/cube/cube.frag
+ DEPENDS ${PROJECT_SOURCE_DIR}/cube/cube.frag ${GLSLANG_VALIDATOR})
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
-
if(WIN32)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES")
endif()
-include_directories(
- ${CUBE_INCLUDE_DIRS}
- )
-
+include_directories(${CUBE_INCLUDE_DIRS})
-######################################################################################
+# ----------------------------------------------------------------------------
# cube
if(APPLE)
include(macOS/cube/cube.cmake)
elseif(NOT WIN32)
- if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
- add_executable(cube cube.c ${PROJECT_SOURCE_DIR}/cube/cube.vert ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc)
+ if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
+ add_executable(
+ cube cube.c ${PROJECT_SOURCE_DIR}/cube/cube.vert ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc)
target_link_libraries(cube ${LIBVK})
endif()
else()
- if (CMAKE_CL_64)
- set (LIB_DIR "Win64")
+ if(CMAKE_CL_64)
+ set(LIB_DIR "Win64")
else()
- set (LIB_DIR "Win32")
+ set(LIB_DIR "Win32")
endif()
- add_executable(cube WIN32 cube.c ${PROJECT_SOURCE_DIR}/cube/cube.vert ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc)
+ add_executable(
+ cube WIN32 cube.c ${PROJECT_SOURCE_DIR}/cube/cube.vert ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc)
target_link_libraries(cube ${LIBVK})
endif()
if(APPLE)
- set_target_properties(cube PROPERTIES
- INSTALL_RPATH "@loader_path/../lib"
- )
+ set_target_properties(cube PROPERTIES INSTALL_RPATH "@loader_path/../lib")
install(TARGETS cube DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
else()
install(TARGETS cube RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
-######################################################################################
+# ----------------------------------------------------------------------------
# cubepp
if(APPLE)
include(macOS/cubepp/cubepp.cmake)
elseif(NOT WIN32)
- if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
- add_executable(cubepp cube.cpp ${PROJECT_SOURCE_DIR}/cube/cube.vert ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc)
+ if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
+ add_executable(
+ cubepp cube.cpp ${PROJECT_SOURCE_DIR}/cube/cube.vert ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc)
target_link_libraries(cubepp ${LIBVK})
endif()
else()
- if (CMAKE_CL_64)
- set (LIB_DIR "Win64")
+ if(CMAKE_CL_64)
+ set(LIB_DIR "Win64")
else()
- set (LIB_DIR "Win32")
+ set(LIB_DIR "Win32")
endif()
- add_executable(cubepp WIN32 cube.cpp ${PROJECT_SOURCE_DIR}/cube/cube.vert ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc)
+ add_executable(
+ cubepp WIN32 cube.cpp ${PROJECT_SOURCE_DIR}/cube/cube.vert ${PROJECT_SOURCE_DIR}/cube/cube.frag cube.vert.inc cube.frag.inc)
target_link_libraries(cubepp ${LIBVK})
endif()
if(APPLE)
- set_target_properties(cubepp PROPERTIES
- INSTALL_RPATH "@loader_path/../lib"
- )
+ set_target_properties(cubepp PROPERTIES INSTALL_RPATH "@loader_path/../lib")
install(TARGETS cubepp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
else()
install(TARGETS cubepp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
set(cube_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/main.m
${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/AppDelegate.m
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/DemoViewController.m
-)
-set(cube_HDRS
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/AppDelegate.h
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/DemoViewController.h
-)
-set(cube_RESOURCES
- ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/LunarGIcon.icns
-)
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/DemoViewController.m)
+
+set(cube_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/AppDelegate.h ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/DemoViewController.h)
+
+set(cube_RESOURCES ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/LunarGIcon.icns)
# Have Xcode handle the Storyboard
if(${CMAKE_GENERATOR} MATCHES "^Xcode.*")
- set(cube_RESOURCES ${cube_RESOURCES}
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/Main.storyboard
- )
+ set(cube_RESOURCES ${cube_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/Main.storyboard)
endif()
-add_executable(cube MACOSX_BUNDLE
- ${cube_SRCS}
- ${cube_HDRS}
- ${cube_RESOURCES}
- cube.vert.inc cube.frag.inc
-)
+add_executable(cube MACOSX_BUNDLE ${cube_SRCS} ${cube_HDRS} ${cube_RESOURCES} cube.vert.inc cube.frag.inc)
# Handle the Storyboard ourselves
if(NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*")
# Compile the storyboard file with the ibtool.
add_custom_command(TARGET cube POST_BUILD
- COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
- --compile ${CMAKE_CURRENT_BINARY_DIR}/cube.app/Contents/Resources/Main.storyboardc
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/Main.storyboard
- COMMENT "Compiling storyboard"
- )
+ COMMAND ${IBTOOL} --errors --warnings --notices
+ --output-format human-readable-text
+ --compile ${CMAKE_CURRENT_BINARY_DIR}/cube.app/Contents/Resources/Main.storyboardc
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/Main.storyboard
+ COMMENT "Compiling storyboard")
endif()
add_dependencies(cube MoltenVK_icd-staging-json)
-# Include demo source code dir because the MacOS cube's Objective-C source includes
-# the "original" cube application C source code.
+# Include demo source code dir because the MacOS cube's Objective-C source includes the "original" cube application C source code.
# Also include the MoltenVK helper files.
-target_include_directories(cube PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${MOLTENVK_DIR}/MoltenVK/include
-)
+target_include_directories(cube PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${MOLTENVK_DIR}/MoltenVK/include)
# We do this so vulkaninfo is linked to an individual library and NOT a framework.
target_link_libraries(cube ${Vulkan_LIBRARY} "-framework Cocoa -framework QuartzCore")
-set_target_properties(cube PROPERTIES
- MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Info.plist
-)
+set_target_properties(cube PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Info.plist)
-# The RESOURCE target property cannot be used in conjunction with the MACOSX_PACKAGE_LOCATION
-# property. We need fine-grained control over the Resource directory, so we have to specify
-# the destination of all the resource files on a per-destination-directory basis.
-# If all the files went into the top-level Resource directory, then we could simply set
-# the RESOURCE property to a list of all the resource files.
-set_source_files_properties(${cube_RESOURCES} PROPERTIES
- MACOSX_PACKAGE_LOCATION "Resources"
-)
-set_source_files_properties("${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json" PROPERTIES
- MACOSX_PACKAGE_LOCATION "Resources/vulkan/icd.d"
-)
+# The RESOURCE target property cannot be used in conjunction with the MACOSX_PACKAGE_LOCATION property. We need fine-grained
+# control over the Resource directory, so we have to specify the destination of all the resource files on a per-destination-
+# directory basis. If all the files went into the top-level Resource directory, then we could simply set the RESOURCE property to a
+# list of all the resource files.
+set_source_files_properties(${cube_RESOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
+set_source_files_properties("${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json"
+ PROPERTIES
+ MACOSX_PACKAGE_LOCATION
+ "Resources/vulkan/icd.d")
# Copy the MoltenVK lib into the bundle.
if(${CMAKE_GENERATOR} MATCHES "^Xcode.*")
add_custom_command(TARGET cube POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
- ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/cube.app/Contents/Frameworks/libMoltenVK.dylib
- DEPENDS vulkan
- )
+ COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
+ ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/cube.app/Contents/Frameworks/libMoltenVK.dylib
+ DEPENDS vulkan)
else()
add_custom_command(TARGET cube POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
- ${CMAKE_CURRENT_BINARY_DIR}/cube.app/Contents/Frameworks/libMoltenVK.dylib
- DEPENDS vulkan
- )
+ COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
+ ${CMAKE_CURRENT_BINARY_DIR}/cube.app/Contents/Frameworks/libMoltenVK.dylib
+ DEPENDS vulkan)
endif()
# Fix up the library search path in the executable to find (loader) libraries in the bundle.
install(CODE "
include(BundleUtilities)
fixup_bundle(${CMAKE_INSTALL_PREFIX}/cube/cube.app \"\" \"\")
- " COMPONENT Runtime
-)
+ "
+ COMPONENT Runtime)
+# ~~~
# Not sure this is needed. When activated, it makes a symlink from
# libvulkan.dylib to libvulkan.1.dylib (which in turn symlinks to libvulkan.1.0.xx.dylib.)
# install(FILES
# "${CMAKE_BINARY_DIR}/loader/libvulkan.dylib"
# DESTINATION "demos/cube.app/Contents/MacOS"
# COMPONENT Runtime)
+# ~~~
# 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.
-#
-#
-# This file formatted using cmake-format.
-# https://github.com/cheshirekow/cmake_format
# ~~~
# Cube Application Bundle
set(cubepp_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/main.mm
${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/AppDelegate.mm
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/DemoViewController.mm
-)
-set(cubepp_HDRS
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/AppDelegate.h
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/DemoViewController.h
-)
-set(cubepp_RESOURCES
- ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/LunarGIcon.icns
-)
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/DemoViewController.mm)
+
+set(cubepp_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/AppDelegate.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/DemoViewController.h)
+
+set(cubepp_RESOURCES ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/LunarGIcon.icns)
# Have Xcode handle the Storyboard
if(${CMAKE_GENERATOR} MATCHES "^Xcode.*")
- set(cubepp_RESOURCES ${cubepp_RESOURCES}
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/Main.storyboard
- )
+ set(cubepp_RESOURCES ${cubepp_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/Main.storyboard)
endif()
-add_executable(cubepp MACOSX_BUNDLE
- ${cubepp_SRCS}
- ${cubepp_HDRS}
- ${cubepp_RESOURCES}
- cube.vert.inc cube.frag.inc
-)
+add_executable(cubepp MACOSX_BUNDLE ${cubepp_SRCS} ${cubepp_HDRS} ${cubepp_RESOURCES} cube.vert.inc cube.frag.inc)
# Handle the Storyboard ourselves
if(NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*")
# Compile the storyboard file with the ibtool.
add_custom_command(TARGET cubepp POST_BUILD
- COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
- --compile ${CMAKE_CURRENT_BINARY_DIR}/cubepp.app/Contents/Resources/Main.storyboardc
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/Main.storyboard
- COMMENT "Compiling storyboard"
- )
+ COMMAND ${IBTOOL} --errors --warnings --notices
+ --output-format human-readable-text
+ --compile ${CMAKE_CURRENT_BINARY_DIR}/cubepp.app/Contents/Resources/Main.storyboardc
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/Main.storyboard
+ COMMENT "Compiling storyboard")
endif()
add_dependencies(cubepp MoltenVK_icd-staging-json)
-# Include demo source code dir because the MacOS cubepp's Objective-C source includes
-# the "original" cubepp application C++ source code.
-# Also include the MoltenVK helper files.
-target_include_directories(cubepp PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${MOLTENVK_DIR}/MoltenVK/include
-)
+# Include demo source code dir because the MacOS cubepp's Objective-C source includes the "original" cubepp application C++ source
+# code. Also include the MoltenVK helper files.
+target_include_directories(cubepp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${MOLTENVK_DIR}/MoltenVK/include)
# We do this so vulkaninfo is linked to an individual library and NOT a framework.
target_link_libraries(cubepp ${Vulkan_LIBRARY} "-framework Cocoa -framework QuartzCore")
-set_target_properties(cubepp PROPERTIES
- MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Info.plist
-)
-
-# The RESOURCE target property cannot be used in conjunction with the MACOSX_PACKAGE_LOCATION
-# property. We need fine-grained control over the Resource directory, so we have to specify
-# the destination of all the resource files on a per-destination-directory basis.
-# If all the files went into the top-level Resource directory, then we could simply set
-# the RESOURCE property to a list of all the resource files.
-set_source_files_properties(${cubepp_RESOURCES} PROPERTIES
- MACOSX_PACKAGE_LOCATION "Resources"
-)
-set_source_files_properties("${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json" PROPERTIES
- MACOSX_PACKAGE_LOCATION "Resources/vulkan/icd.d"
-)
+set_target_properties(cubepp PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Info.plist)
+
+# The RESOURCE target property cannot be used in conjunction with the MACOSX_PACKAGE_LOCATION property. We need fine-grained
+# control over the Resource directory, so we have to specify the destination of all the resource files on a per-destination-
+# directory basis. If all the files went into the top-level Resource directory, then we could simply set the RESOURCE property to a
+# list of all the resource files.
+set_source_files_properties(${cubepp_RESOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
+set_source_files_properties("${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json"
+ PROPERTIES
+ MACOSX_PACKAGE_LOCATION
+ "Resources/vulkan/icd.d")
# Direct the MoltenVK library to the right place.
-install(FILES "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
- DESTINATION "demos/cubepp.app/Contents/Frameworks"
- COMPONENT Runtime
-)
+install(FILES "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib" DESTINATION "demos/cubepp.app/Contents/Frameworks"
+ COMPONENT Runtime)
# Copy the MoltenVK lib into the bundle.
if(${CMAKE_GENERATOR} MATCHES "^Xcode.*")
add_custom_command(TARGET cubepp POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
- ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/cubepp.app/Contents/Frameworks/libMoltenVK.dylib
- DEPENDS vulkan
- )
+ COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
+ ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/cubepp.app/Contents/Frameworks/libMoltenVK.dylib
+ DEPENDS vulkan)
else()
add_custom_command(TARGET cubepp POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
- ${CMAKE_CURRENT_BINARY_DIR}/cubepp.app/Contents/Frameworks/libMoltenVK.dylib
- DEPENDS vulkan
- )
+ COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
+ ${CMAKE_CURRENT_BINARY_DIR}/cubepp.app/Contents/Frameworks/libMoltenVK.dylib
+ DEPENDS vulkan)
endif()
# Fix up the library search path in the executable to find (loader) libraries in the bundle.
install(CODE "
include(BundleUtilities)
fixup_bundle(${CMAKE_INSTALL_PREFIX}/cube/cubepp.app \"\" \"\")
- " COMPONENT Runtime
-)
+ "
+ COMPONENT Runtime)
+# ~~~
# Not sure this is needed. When activated, it makes a symlink from
# libvulkan.dylib to libvulkan.1.dylib (which in turn symlinks to libvulkan.1.0.xx.dylib.)
# install(FILES
# "${CMAKE_BINARY_DIR}/loader/libvulkan.dylib"
# DESTINATION "demos/cubepp.app/Contents/MacOS"
# COMPONENT Runtime)
+# ~~~
# limitations under the License.
# ~~~
-cmake_minimum_required (VERSION 2.8.11)
+cmake_minimum_required(VERSION 2.8.11)
find_package(PythonInterp 3 REQUIRED)
set(SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/scripts")
-set (PYTHON_CMD ${PYTHON_EXECUTABLE})
+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}/kvt_genvk.py -registry ${VulkanRegistry_DIR}/vk.xml -scripts ${VulkanRegistry_DIR} ${output}
- DEPENDS ${VulkanRegistry_DIR}/vk.xml ${VulkanRegistry_DIR}/generator.py ${SCRIPTS_DIR}/${dependency} ${SCRIPTS_DIR}/kvt_genvk.py ${VulkanRegistry_DIR}/reg.py
- )
+ COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/kvt_genvk.py -registry ${VulkanRegistry_DIR}/vk.xml -scripts
+ ${VulkanRegistry_DIR} ${output}
+ DEPENDS ${VulkanRegistry_DIR}/vk.xml
+ ${VulkanRegistry_DIR}/generator.py
+ ${SCRIPTS_DIR}/${dependency}
+ ${SCRIPTS_DIR}/kvt_genvk.py
+ ${VulkanRegistry_DIR}/reg.py)
endmacro()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR -DVK_USE_PLATFORM_ANDROID_KHX)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- if (BUILD_WSI_XCB_SUPPORT)
+ if(BUILD_WSI_XCB_SUPPORT)
add_definitions(-DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XCB_KHX)
endif()
- if (BUILD_WSI_XLIB_SUPPORT)
- add_definitions(-DVK_USE_PLATFORM_XLIB_KHR -DVK_USE_PLATFORM_XLIB_KHX -DVK_USE_PLATFORM_XLIB_XRANDR_EXT)
+ if(BUILD_WSI_XLIB_SUPPORT)
+ add_definitions(-DVK_USE_PLATFORM_XLIB_KHR -DVK_USE_PLATFORM_XLIB_KHX -DVK_USE_PLATFORM_XLIB_XRANDR_EXT)
endif()
- if (BUILD_WSI_WAYLAND_SUPPORT)
- add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR -DVK_USE_PLATFORM_WAYLAND_KHX)
+ if(BUILD_WSI_WAYLAND_SUPPORT)
+ add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR -DVK_USE_PLATFORM_WAYLAND_KHX)
endif()
- if (BUILD_WSI_MIR_SUPPORT)
+ if(BUILD_WSI_MIR_SUPPORT)
add_definitions(-DVK_USE_PLATFORM_MIR_KHR -DVK_USE_PLATFORM_MIR_KHX)
include_directories(${MIR_INCLUDE_DIR})
endif()
# Copy or link the JSON files to the binary directory for ease of use in the build tree.
set(ICD_JSON_FILES VkICD_mock_icd)
-if (WIN32)
+if(WIN32)
# extra setup for out-of-tree builds
- if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
- if (CMAKE_GENERATOR MATCHES "^Visual Studio.*")
- foreach (config_file ${ICD_JSON_FILES})
- FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/windows/${config_file}.json src_json)
- FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/${config_file}.json dst_json)
- add_custom_target(${config_file}-json ALL
- COMMAND copy ${src_json} ${dst_json}
- VERBATIM
- )
+ if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
+ if(CMAKE_GENERATOR MATCHES "^Visual Studio.*")
+ foreach(config_file ${ICD_JSON_FILES})
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/windows/${config_file}.json src_json)
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/${config_file}.json dst_json)
+ add_custom_target(${config_file}-json ALL COMMAND copy ${src_json} ${dst_json} VERBATIM)
set_target_properties(${config_file}-json PROPERTIES FOLDER ${TOOLS_TARGET_FOLDER})
endforeach(config_file)
else()
- foreach (config_file ${ICD_JSON_FILES})
- FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/windows/${config_file}.json src_json)
- FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/${config_file}.json dst_json)
- add_custom_target(${config_file}-json ALL
- COMMAND copy ${src_json} ${dst_json}
- VERBATIM
- )
+ foreach(config_file ${ICD_JSON_FILES})
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/windows/${config_file}.json src_json)
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/${config_file}.json dst_json)
+ add_custom_target(${config_file}-json ALL COMMAND copy ${src_json} ${dst_json} VERBATIM)
endforeach(config_file)
endif()
endif()
elseif(APPLE)
# extra setup for out-of-tree builds
- if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
- if (CMAKE_GENERATOR MATCHES "^Xcode.*")
- add_custom_target(mk_icd_config_dir ALL COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
- foreach (config_file ${ICD_JSON_FILES})
+ if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
+ if(CMAKE_GENERATOR MATCHES "^Xcode.*")
+ add_custom_target(mk_icd_config_dir ALL
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
+ foreach(config_file ${ICD_JSON_FILES})
add_custom_target(${config_file}-json ALL
- DEPENDS mk_icd_config_dir
- COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/macos/${config_file}.json $<CONFIG>
- VERBATIM
- )
+ DEPENDS mk_icd_config_dir
+ COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/macos/${config_file}.json $<CONFIG>
+ VERBATIM)
endforeach(config_file)
else()
- foreach (config_file ${ICD_JSON_FILES})
+ foreach(config_file ${ICD_JSON_FILES})
add_custom_target(${config_file}-json ALL
- COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/macos/${config_file}.json
- VERBATIM
- )
+ COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/macos/${config_file}.json
+ VERBATIM)
endforeach(config_file)
endif()
endif()
else()
# extra setup for out-of-tree builds
- if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
- foreach (config_file ${ICD_JSON_FILES})
- add_custom_target(${config_file}-json ALL
- COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json
- VERBATIM
- )
+ if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
+ foreach(config_file ${ICD_JSON_FILES})
+ add_custom_target(${config_file}-json ALL COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json VERBATIM)
endforeach(config_file)
endif()
endif()
# Custom target for generated vulkan helper file dependencies
set(icd_generate_helper_files_DEPENDS)
-add_custom_target(icd_generate_helper_files DEPENDS
- vk_typemap_helper.h
- )
+add_custom_target(icd_generate_helper_files DEPENDS vk_typemap_helper.h)
set_target_properties(icd_generate_helper_files PROPERTIES FOLDER ${TOOLS_TARGET_FOLDER})
run_vk_xml_generate(vulkan_tools_helper_file_generator.py vk_typemap_helper.h)
# For ICD with a direct dependency on a project with the same name, use it.
-if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
- foreach (config_file ${ICD_JSON_FILES})
+if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
+ foreach(config_file ${ICD_JSON_FILES})
add_dependencies(${config_file}-json ${config_file})
endforeach(config_file)
endif()
-add_custom_target(generate_icd_files DEPENDS
- mock_icd.h
- mock_icd.cpp
- )
+add_custom_target(generate_icd_files DEPENDS mock_icd.h mock_icd.cpp)
set_target_properties(generate_icd_files PROPERTIES FOLDER ${TOOLS_TARGET_FOLDER})
-if (WIN32)
+if(WIN32)
macro(add_vk_icd target)
- FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/VkICD_${target}.def DEF_FILE)
- add_custom_target(copy-${target}-def-file ALL
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEF_FILE} VkICD_${target}.def
- VERBATIM
- )
- 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} icd_generate_helper_files generate_icd_files)
- #target_link_Libraries(VkICD_${target} VkICD_utils)
- if(INSTALL_ICD)
- install(TARGETS VkICD_${target} DESTINATION ${CMAKE_INSTALL_LIBDIR})
- endif()
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/VkICD_${target}.def DEF_FILE)
+ add_custom_target(copy-${target}-def-file ALL
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEF_FILE} VkICD_${target}.def
+ VERBATIM)
+ 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} icd_generate_helper_files generate_icd_files)
+ # target_link_Libraries(VkICD_${target} VkICD_utils)
+ if(INSTALL_ICD)
+ install(TARGETS VkICD_${target} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ endif()
endmacro()
elseif(APPLE)
macro(add_vk_icd target)
- add_library(VkICD_${target} SHARED ${ARGN})
- #target_link_Libraries(VkICD_${target} VkICD_utils)
- add_dependencies(VkICD_${target} icd_generate_helper_files generate_icd_files)
- set_target_properties(VkICD_${target} PROPERTIES LINK_FLAGS "-Wl")
- if(INSTALL_ICD)
- install(TARGETS VkICD_${target} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
- endif()
+ add_library(VkICD_${target} SHARED ${ARGN})
+ # target_link_Libraries(VkICD_${target} VkICD_utils)
+ add_dependencies(VkICD_${target} icd_generate_helper_files generate_icd_files)
+ set_target_properties(VkICD_${target} PROPERTIES LINK_FLAGS "-Wl")
+ if(INSTALL_ICD)
+ install(TARGETS VkICD_${target} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ endif()
endmacro()
else()
macro(add_vk_icd target)
- add_library(VkICD_${target} SHARED ${ARGN})
- #target_link_Libraries(VkICD_${target} VkICD_utils)
- add_dependencies(VkICD_${target} icd_generate_helper_files generate_icd_files)
- set_target_properties(VkICD_${target} PROPERTIES LINK_FLAGS "-Wl,-export-dynamic,-Bsymbolic,--exclude-libs,ALL")
- if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND INSTALL_ICD)
- install(TARGETS VkICD_${target} DESTINATION ${CMAKE_INSTALL_LIBDIR})
- endif()
+ add_library(VkICD_${target} SHARED ${ARGN})
+ # target_link_Libraries(VkICD_${target} VkICD_utils)
+ add_dependencies(VkICD_${target} icd_generate_helper_files generate_icd_files)
+ set_target_properties(VkICD_${target} PROPERTIES LINK_FLAGS "-Wl,-export-dynamic,-Bsymbolic,--exclude-libs,ALL")
+ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND INSTALL_ICD)
+ install(TARGETS VkICD_${target} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ endif()
endmacro()
endif()
include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${VulkanHeaders_INCLUDE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${PROJECT_BINARY_DIR}
- ${CMAKE_BINARY_DIR}
-)
-
-if (WIN32)
- set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS")
- set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS")
- set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS")
- set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS")
- set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
- set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
- # Turn off transitional "changed behavior" warning message for Visual Studio versions prior to 2015.
- # The changed behavior is that constructor initializers are now fixed to clear the struct members.
+ ${CMAKE_CURRENT_SOURCE_DIR} ${VulkanHeaders_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_BINARY_DIR} ${CMAKE_BINARY_DIR})
+
+if(WIN32)
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS")
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS")
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS")
+ set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
+ # Turn off transitional "changed behavior" warning message for Visual Studio versions prior to 2015. The changed behavior is
+ # that constructor initializers are now fixed to clear the struct members.
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,19>>:/wd4351>")
else()
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare")
endif()
run_vk_xml_generate(mock_icd_generator.py mock_icd.h)
add_vk_icd(mock_icd mock_icd.cpp mock_icd.h)
-# JSON file(s) install targets.
-# For Linux, need to remove the "./" from the library path before installing to system directories.
+# JSON file(s) install targets. For Linux, need to remove the "./" from the library path before installing to system directories.
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND INSTALL_ICD)
- foreach (config_file ${ICD_JSON_FILES})
+ foreach(config_file ${ICD_JSON_FILES})
add_custom_target(${config_file}-staging-json ALL
- COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/staging-json
- COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json ${CMAKE_CURRENT_BINARY_DIR}/staging-json
- COMMAND sed -i -e "/\"library_path\":/s$./libVkICD$libVkICD$" ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${config_file}.json
- VERBATIM
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json
- )
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${config_file}.json DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/vulkan/icd.d)
+ COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/staging-json
+ COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json ${CMAKE_CURRENT_BINARY_DIR}/staging-json
+ COMMAND sed -i -e "/\"library_path\":/s$./libVkICD$libVkICD$"
+ ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${config_file}.json
+ VERBATIM
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${config_file}.json DESTINATION
+ ${CMAKE_INSTALL_DATAROOTDIR}/vulkan/icd.d)
endforeach(config_file)
endif()
# Windows uses the JSON file as-is.
if(WIN32 AND INSTALL_ICD)
- foreach (config_file ${ICD_JSON_FILES})
+ foreach(config_file ${ICD_JSON_FILES})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/windows/${config_file}.json DESTINATION ${CMAKE_INSTALL_LIBDIR})
endforeach(config_file)
endif()
# MoltenVK JSON File
execute_process(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/staging-json)
-execute_process(
- COMMAND sed -e "/\"library_path\":/s$:[[:space:]]*\"[[:space:]]*[\\.\\/]*$: \"..\\/..\\/..\\/Frameworks\\/$" ${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
-)
+execute_process(COMMAND sed -e "/\"library_path\":/s$:[[:space:]]*\"[[:space:]]*[\\.\\/]*$: \"..\\/..\\/..\\/Frameworks\\/$"
+ ${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json
+ OUTPUT_FILE ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json)
+# ~~~
# Modify the ICD JSON file to adjust the library path.
# The ICD JSON file goes in the Resources/vulkan/icd.d directory, so adjust the
-# library_path to the relative path to the Frameworks directory in the bundle..
+# library_path to the relative path to the Frameworks directory in the bundle.
# The regex does: substitute ':<whitespace>"<whitespace><all occurences of . and />' with:
# ': "../../../Frameworks/'
+# ~~~
add_custom_target(MoltenVK_icd-staging-json ALL
- COMMAND mkdir -p ${CMAKE_BINARY_DIR}/staging-json
- COMMAND sed -e "/\"library_path\":/s$:[[:space:]]*\"[[:space:]]*[\\.\\/]*$: \"..\\/..\\/..\\/Frameworks\\/$"
- ${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json >
- ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
- VERBATIM
- DEPENDS "${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json"
-)
-set_source_files_properties(${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json PROPERTIES
- GENERATED TRUE
-)
+ COMMAND mkdir -p ${CMAKE_BINARY_DIR}/staging-json
+ COMMAND sed -e "/\"library_path\":/s$:[[:space:]]*\"[[:space:]]*[\\.\\/]*$: \"..\\/..\\/..\\/Frameworks\\/$"
+ ${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json > ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
+ VERBATIM
+ DEPENDS "${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json")
+set_source_files_properties(${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json PROPERTIES GENERATED TRUE)
find_library(COCOA NAMES Cocoa)
# Locate Interface Builder Tool, needed to build things like Storyboards outside of Xcode.
-if (NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*")
- # Make sure we can find the 'ibtool' program. If we can NOT find it we
- # skip generation of this project
+if(NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*")
+ # Make sure we can find the 'ibtool' program. If we can NOT find it we skip generation of this project.
find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin")
- if (${IBTOOL} STREQUAL "IBTOOL-NOTFOUND")
- message(SEND_ERROR
- "ibtool can not be found and is needed to compile the .xib files. "
- "It should have been installed with the Apple developer tools. "
- "The default system paths were searched in addition to ${OSX_DEVELOPER_ROOT}/usr/bin."
- )
+ if(${IBTOOL} STREQUAL "IBTOOL-NOTFOUND")
+ message(SEND_ERROR "ibtool can not be found and is needed to compile the .xib files. "
+ "It should have been installed with the Apple developer tools. "
+ "The default system paths were searched in addition to ${OSX_DEVELOPER_ROOT}/usr/bin.")
endif()
endif()
if(WIN32)
add_executable(vulkaninfo vulkaninfo.c vulkaninfo.rc)
elseif(APPLE)
- add_executable(vulkaninfo vulkaninfo.c
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo/metal_view.m
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo/metal_view.h
- )
+ add_executable(vulkaninfo
+ vulkaninfo.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo/metal_view.m
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo/metal_view.h)
else()
add_executable(vulkaninfo vulkaninfo.c)
endif()
option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
set(VULKANINFO_WSI_SELECTION "XCB" CACHE STRING "Select WSI target for vulkaninfo (XCB, XLIB)")
- if (BUILD_WSI_XCB_SUPPORT)
+ if(BUILD_WSI_XCB_SUPPORT)
find_package(XCB REQUIRED)
endif()
- if (BUILD_WSI_XLIB_SUPPORT)
+ if(BUILD_WSI_XLIB_SUPPORT)
find_package(X11 REQUIRED)
endif()
- if (VULKANINFO_WSI_SELECTION STREQUAL "XCB")
- if (NOT BUILD_WSI_XCB_SUPPORT)
- message( FATAL_ERROR "Selected XCB for vulkaninfo build but not building Xcb support" )
+ if(VULKANINFO_WSI_SELECTION STREQUAL "XCB")
+ if(NOT BUILD_WSI_XCB_SUPPORT)
+ message(FATAL_ERROR "Selected XCB for vulkaninfo build but not building Xcb support")
endif()
target_include_directories(vulkaninfo PRIVATE ${XCB_INCLUDE_DIRS})
target_link_libraries(vulkaninfo ${XCB_LIBRARIES})
target_compile_definitions(vulkaninfo PRIVATE -DVK_USE_PLATFORM_XCB_KHR)
- elseif (VULKANINFO_WSI_SELECTION STREQUAL "XLIB")
- if (NOT BUILD_WSI_XLIB_SUPPORT)
- message( FATAL_ERROR "Selected XLIB for vulkaninfo build but not building Xlib support" )
+ elseif(VULKANINFO_WSI_SELECTION STREQUAL "XLIB")
+ if(NOT BUILD_WSI_XLIB_SUPPORT)
+ message(FATAL_ERROR "Selected XLIB for vulkaninfo build but not building Xlib support")
endif()
target_include_directories(vulkaninfo PRIVATE ${X11_INCLUDE_DIR})
target_link_libraries(vulkaninfo ${X11_LIBRARIES})
target_compile_definitions(vulkaninfo PUBLIC -DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS)
# Use static MSVCRT libraries
- foreach(configuration in CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
- CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+ foreach(configuration
+ in
+ CMAKE_C_FLAGS_DEBUG
+ CMAKE_C_FLAGS_MINSIZEREL
+ CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_RELWITHDEBINFO
+ CMAKE_CXX_FLAGS_DEBUG
+ CMAKE_CXX_FLAGS_MINSIZEREL
+ CMAKE_CXX_FLAGS_RELEASE
+ CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${configuration} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${configuration} "${${configuration}}")
endif()
endif()
if(APPLE)
- set_target_properties(vulkaninfo PROPERTIES
- INSTALL_RPATH "@loader_path/../lib"
- )
+ set_target_properties(vulkaninfo PROPERTIES INSTALL_RPATH "@loader_path/../lib")
install(TARGETS vulkaninfo DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
else()
install(TARGETS vulkaninfo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
# Vulkaninfo Application Bundle
-# We already have a "vulkaninfo" target, so create a new target with a different name
-# and use the OUTPUT_NAME property to rename the target to the desired name.
-# The standalone binary is called "vulkaninfo" and the bundle is called "vulkaninfo.app".
-# Note that the executable is a script that launches Terminal to see the output.
-add_executable(vulkaninfo-bundle MACOSX_BUNDLE
- vulkaninfo.c
- ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo.sh
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/Resources/LunarGIcon.icns
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo/metal_view.m
- ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo/metal_view.h
-)
-set_target_properties(vulkaninfo-bundle PROPERTIES
- OUTPUT_NAME vulkaninfo
- MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/Info.plist
-)
+# We already have a "vulkaninfo" target, so create a new target with a different name and use the OUTPUT_NAME property to rename the
+# target to the desired name. The standalone binary is called "vulkaninfo" and the bundle is called "vulkaninfo.app". Note that the
+# executable is a script that launches Terminal to see the output.
+add_executable(vulkaninfo-bundle
+ MACOSX_BUNDLE
+ vulkaninfo.c
+ ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo.sh
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/Resources/LunarGIcon.icns
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo/metal_view.m
+ ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo/metal_view.h)
+set_target_properties(
+ vulkaninfo-bundle PROPERTIES OUTPUT_NAME vulkaninfo MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macOS/Info.plist)
# We do this so vulkaninfo is linked to an individual library and NOT a framework.
target_link_libraries(vulkaninfo-bundle ${Vulkan_LIBRARY} "-framework AppKit -framework QuartzCore")
target_include_directories(vulkaninfo-bundle PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo ${VulkanHeaders_INCLUDE_DIR})
add_dependencies(vulkaninfo-bundle MoltenVK_icd-staging-json)
-set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo.sh PROPERTIES
- MACOSX_PACKAGE_LOCATION "MacOS"
-)
-set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/macOS/Resources/LunarGIcon.icns PROPERTIES
- MACOSX_PACKAGE_LOCATION "Resources"
-)
-set_source_files_properties(${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json PROPERTIES
- MACOSX_PACKAGE_LOCATION "Resources/vulkan/icd.d"
-)
+set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/macOS/vulkaninfo.sh PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS")
+set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/macOS/Resources/LunarGIcon.icns
+ PROPERTIES
+ MACOSX_PACKAGE_LOCATION
+ "Resources")
+set_source_files_properties(${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
+ PROPERTIES
+ MACOSX_PACKAGE_LOCATION
+ "Resources/vulkan/icd.d")
# Direct the MoltenVK library to the right place.
-install(FILES "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
- DESTINATION "demos/vulkaninfo.app/Contents/Frameworks"
- COMPONENT Runtime
-)
+install(FILES "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib" DESTINATION "demos/vulkaninfo.app/Contents/Frameworks"
+ COMPONENT Runtime)
# Xcode projects need some extra help with what would be install steps.
if(${CMAKE_GENERATOR} MATCHES "^Xcode.*")
add_custom_command(TARGET vulkaninfo-bundle POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
- ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/vulkaninfo.app/Contents/Frameworks/libMoltenVK.dylib
- DEPENDS vulkan
- )
+ COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
+ ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/vulkaninfo.app/Contents/Frameworks/libMoltenVK.dylib
+ DEPENDS vulkan)
else()
add_custom_command(TARGET vulkaninfo-bundle POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
- ${CMAKE_CURRENT_BINARY_DIR}/vulkaninfo.app/Contents/Frameworks/libMoltenVK.dylib
- DEPENDS vulkan
- )
+ COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/macOS/libMoltenVK.dylib"
+ ${CMAKE_CURRENT_BINARY_DIR}/vulkaninfo.app/Contents/Frameworks/libMoltenVK.dylib
+ DEPENDS vulkan)
endif()
-# Fix up the library search path in the executable to find (loader) libraries in the bundle.
-# When fixup_bundle() is passed a bundle in the first argument, it looks at the Info.plist file
-# to determine the BundleExecutable. In this case, the executable is a script, which can't be fixed up.
-# Instead pass it the explicit name of the executable.
-install(CODE "
+# Fix up the library search path in the executable to find (loader) libraries in the bundle. When fixup_bundle() is passed a bundle
+# in the first argument, it looks at the Info.plist file to determine the BundleExecutable. In this case, the executable is a
+# script, which can't be fixed up. Instead pass it the explicit name of the executable.
+install(
+ CODE
+ "
include(BundleUtilities)
fixup_bundle(${CMAKE_INSTALL_PREFIX}/vulkaninfo/vulkaninfo.app/Contents/MacOS/vulkaninfo \"\" \"\")
- " COMPONENT Runtime
-)
+ "
+ COMPONENT Runtime)