aboutsummaryrefslogtreecommitdiff
path: root/cube
diff options
context:
space:
mode:
authorMike Weiblen <mikew@lunarg.com>2018-06-30 22:50:43 -0600
committerMike Weiblen <mikew@lunarg.com>2018-06-30 22:56:00 -0600
commit9ed609d5bf0c1a41fa7fc6931edcd2502b3ef3a7 (patch)
treeb13e14d407f198a30fb3b7e530f7e48d18946000 /cube
parent2a037f489c13bdd59d1e16739579a6b841073be8 (diff)
downloadusermoji-9ed609d5bf0c1a41fa7fc6931edcd2502b3ef3a7.tar.xz
build: Beautify cmake files
Add .cmake-format.py Add cmake-format docs to CONTRIBUTING.md Minor edits to existing files Due to a bug in cmake-format, use this script to reformat: for i in CMakeLists.txt cube/CMakeLists.txt cube/macOS/cube/cube.cmake cube/macOS/cubepp/cubepp.cmake icd/CMakeLists.txt mac_common.cmake vulkaninfo/CMakeLists.txt vulkaninfo/macOS/vulkaninfo.cmake do sed --in-place='' 's/^ *#/#/' $i cmake-format --in-place $i done Change-Id: Ie451aacd7402828ad4d62adc04048449d0ea2abe
Diffstat (limited to 'cube')
-rw-r--r--cube/CMakeLists.txt176
-rw-r--r--cube/macOS/cube/cube.cmake89
-rw-r--r--cube/macOS/cubepp/cubepp.cmake104
3 files changed, 153 insertions, 216 deletions
diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt
index c336010b..7f3dc2d8 100644
--- a/cube/CMakeLists.txt
+++ b/cube/CMakeLists.txt
@@ -15,33 +15,25 @@
# 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")
@@ -53,9 +45,7 @@ else()
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")
@@ -66,20 +56,20 @@ 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()
@@ -88,7 +78,7 @@ 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>")
@@ -98,54 +88,42 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
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")
@@ -154,103 +132,105 @@ else()
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})
diff --git a/cube/macOS/cube/cube.cmake b/cube/macOS/cube/cube.cmake
index c8529fe1..948a4650 100644
--- a/cube/macOS/cube/cube.cmake
+++ b/cube/macOS/cube/cube.cmake
@@ -20,96 +20,77 @@
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)
+# ~~~
diff --git a/cube/macOS/cubepp/cubepp.cmake b/cube/macOS/cubepp/cubepp.cmake
index f2f75b72..31ff0125 100644
--- a/cube/macOS/cubepp/cubepp.cmake
+++ b/cube/macOS/cubepp/cubepp.cmake
@@ -13,10 +13,6 @@
# 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
@@ -24,102 +20,82 @@
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)
+# ~~~