From 1ccfee8ee9c3e2b1456578de4ee70a91b2d424c2 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Wed, 15 Nov 2023 18:30:30 -0700 Subject: Remove *.cmake files and move MoltenVK logic into cube directory Only vkcube/vkcubepp make use of MoltenVK --- CMakeLists.txt | 16 ------- cube/CMakeLists.txt | 50 +++++++++++++++++++++- cube/macOS/cube/CMakeLists.txt | 90 ++++++++++++++++++++++++++++++++++++++++ cube/macOS/cube/cube.cmake | 86 -------------------------------------- cube/macOS/cubepp/CMakeLists.txt | 87 ++++++++++++++++++++++++++++++++++++++ cube/macOS/cubepp/cubepp.cmake | 85 ------------------------------------- mac_common.cmake | 56 ------------------------- scripts/CMakeLists.txt | 3 -- 8 files changed, 225 insertions(+), 248 deletions(-) create mode 100644 cube/macOS/cube/CMakeLists.txt delete mode 100644 cube/macOS/cube/cube.cmake create mode 100644 cube/macOS/cubepp/CMakeLists.txt delete mode 100644 cube/macOS/cubepp/cubepp.cmake delete mode 100644 mac_common.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 07f5f318..fe278cc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,18 +50,6 @@ endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) -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}) - message(FATAL_ERROR "Must define location of MoltenVK repo -- see BUILD.md") - endif() - - if(NOT MOLTENVK_REPO_ROOT) - set(MOLTENVK_REPO_ROOT $ENV{MOLTENVK_REPO_ROOT}) - endif() - message(STATUS "Using MoltenVK repo location at ${MOLTENVK_REPO_ROOT}") -endif() - find_package(VulkanHeaders QUIET CONFIG) find_package(VulkanLoader QUIET CONFIG) @@ -145,10 +133,6 @@ if (GIT_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git/HEAD") endif() endif() -if(APPLE) - include(mac_common.cmake) -endif() - if(BUILD_CUBE) add_subdirectory(cube) endif() diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index 3cb2ceea..871f0561 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -15,6 +15,52 @@ # limitations under the License. # ~~~ +if(APPLE) + set(MOLTENVK_REPO_ROOT "MOLTENVK-NOTFOUND" CACHE PATH "Absolute path to a MoltenVK repo directory") + if(NOT MOLTENVK_REPO_ROOT) + message(FATAL_ERROR "Must define location of MoltenVK repo -- see BUILD.md") + endif() + message(STATUS "Using MoltenVK repo location at ${MOLTENVK_REPO_ROOT}") + + # Source for the MoltenVK ICD library and JSON file + set(MOLTENVK_DIR ${MOLTENVK_REPO_ROOT}) + + # MoltenVK JSON File + execute_process(COMMAND mkdir -p ${PROJECT_BINARY_DIR}/staging-json) + execute_process(COMMAND sed -e "/\"library_path\":/s$:[[:space:]]*\"[[:space:]]*[\\.\\/]*$: \"..\\/..\\/..\\/Frameworks\\/$" + ${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json + OUTPUT_FILE ${PROJECT_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. + # The regex does: substitute ':"' with: + # ': "../../../Frameworks/' + # ~~~ + add_custom_target(MoltenVK_icd-staging-json ALL + COMMAND mkdir -p ${PROJECT_BINARY_DIR}/staging-json + COMMAND sed -e "/\"library_path\":/s$:[[:space:]]*\"[[:space:]]*[\\.\\/]*$: \"..\\/..\\/..\\/Frameworks\\/$" + ${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json > ${PROJECT_BINARY_DIR}/staging-json/MoltenVK_icd.json + VERBATIM + DEPENDS "${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json" + ) + set_source_files_properties(${PROJECT_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 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.") + endif() + endif() +endif() + if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON) @@ -163,7 +209,7 @@ endif() # vkcube if(APPLE) - include(macOS/cube/cube.cmake) + add_subdirectory(macOS/cube) elseif (ANDROID) add_library(vkcube MODULE) @@ -228,7 +274,7 @@ endif() # vkcubepp if(APPLE) - include(macOS/cubepp/cubepp.cmake) + add_subdirectory(macOS/cubepp) elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD") add_executable(vkcubepp cube.cpp diff --git a/cube/macOS/cube/CMakeLists.txt b/cube/macOS/cube/CMakeLists.txt new file mode 100644 index 00000000..3b4c2d30 --- /dev/null +++ b/cube/macOS/cube/CMakeLists.txt @@ -0,0 +1,90 @@ +# ~~~ +# Copyright (c) 2018 Valve Corporation +# Copyright (c) 2018 LunarG, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ~~~ + +# VkCube Application Bundle + +set(cube_RESOURCES ${PROJECT_BINARY_DIR}/staging-json/MoltenVK_icd.json + ${CMAKE_CURRENT_LIST_DIR}/Resources/VulkanIcon.icns) + +# Have Xcode handle the Storyboard +if(XCODE) + set(cube_RESOURCES ${cube_RESOURCES} ${CMAKE_CURRENT_LIST_DIR}/Resources/Main.storyboard) +endif() + +add_executable(vkcube MACOSX_BUNDLE) + +target_sources(vkcube PRIVATE + main.m + AppDelegate.m + AppDelegate.h + DemoViewController.m + DemoViewController.h + ${cube_RESOURCES} + ../../cube.vert.inc + ../../cube.frag.inc +) + +# Handle the Storyboard ourselves +if(NOT XCODE) + # Compile the storyboard file with the ibtool. + add_custom_command(TARGET vkcube POST_BUILD + COMMAND ${IBTOOL} + --errors + --warnings + --notices + --output-format human-readable-text + --compile ${CMAKE_CURRENT_BINARY_DIR}/vkcube.app/Contents/Resources/Main.storyboardc + ${CMAKE_CURRENT_LIST_DIR}/Resources/Main.storyboard + COMMENT "Compiling storyboard") +endif() + +add_dependencies(vkcube 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. +# Also include the MoltenVK helper files. +target_include_directories(vkcube PRIVATE . ${MOLTENVK_DIR}/MoltenVK/include) + +# We do this so vulkaninfo is linked to an individual library and NOT a framework. +target_link_libraries(vkcube Vulkan::Loader "-framework Cocoa -framework QuartzCore") + +# Disable warnings about sprintf +target_compile_options(vkcube PRIVATE -Wno-deprecated-declarations) + +set_target_properties(vkcube PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_LIST_DIR}/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("${PROJECT_BINARY_DIR}/staging-json/MoltenVK_icd.json" + PROPERTIES + MACOSX_PACKAGE_LOCATION + "Resources/vulkan/icd.d") + +# Copy the MoltenVK lib into the bundle. +if(XCODE) + add_custom_command(TARGET vkcube POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" + ${CMAKE_CURRENT_BINARY_DIR}/$/vkcube.app/Contents/Frameworks/libMoltenVK.dylib + DEPENDS vulkan) +else() + add_custom_command(TARGET vkcube POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" + ${CMAKE_CURRENT_BINARY_DIR}/vkcube.app/Contents/Frameworks/libMoltenVK.dylib + DEPENDS vulkan) +endif() diff --git a/cube/macOS/cube/cube.cmake b/cube/macOS/cube/cube.cmake deleted file mode 100644 index a3c5624e..00000000 --- a/cube/macOS/cube/cube.cmake +++ /dev/null @@ -1,86 +0,0 @@ -# ~~~ -# Copyright (c) 2018 Valve Corporation -# Copyright (c) 2018 LunarG, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ~~~ - -# VkCube Application Bundle - -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/VulkanIcon.icns) - -# Have Xcode handle the Storyboard -if(XCODE) - set(cube_RESOURCES ${cube_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/Main.storyboard) -endif() - -add_executable(vkcube MACOSX_BUNDLE ${cube_SRCS} ${cube_HDRS} ${cube_RESOURCES} cube.vert.inc cube.frag.inc) - -# Handle the Storyboard ourselves -if(NOT XCODE) - # Compile the storyboard file with the ibtool. - add_custom_command(TARGET vkcube POST_BUILD - COMMAND ${IBTOOL} - --errors - --warnings - --notices - --output-format human-readable-text - --compile ${CMAKE_CURRENT_BINARY_DIR}/vkcube.app/Contents/Resources/Main.storyboardc - ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cube/Resources/Main.storyboard - COMMENT "Compiling storyboard") -endif() - -add_dependencies(vkcube 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. -# Also include the MoltenVK helper files. -target_include_directories(vkcube 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(vkcube Vulkan::Loader "-framework Cocoa -framework QuartzCore") - -# Disable warnings about sprintf -target_compile_options(vkcube PRIVATE -Wno-deprecated-declarations) - -set_target_properties(vkcube 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") - -# Copy the MoltenVK lib into the bundle. -if(XCODE) - add_custom_command(TARGET vkcube POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" - ${CMAKE_CURRENT_BINARY_DIR}/$/vkcube.app/Contents/Frameworks/libMoltenVK.dylib - DEPENDS vulkan) -else() - add_custom_command(TARGET vkcube POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" - ${CMAKE_CURRENT_BINARY_DIR}/vkcube.app/Contents/Frameworks/libMoltenVK.dylib - DEPENDS vulkan) -endif() diff --git a/cube/macOS/cubepp/CMakeLists.txt b/cube/macOS/cubepp/CMakeLists.txt new file mode 100644 index 00000000..070ea180 --- /dev/null +++ b/cube/macOS/cubepp/CMakeLists.txt @@ -0,0 +1,87 @@ +# ~~~ +# Copyright (c) 2018 Valve Corporation +# Copyright (c) 2018 LunarG, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ~~~ + +# VkCube Application Bundle + +set(cubepp_RESOURCES ${PROJECT_BINARY_DIR}/staging-json/MoltenVK_icd.json + ${CMAKE_CURRENT_LIST_DIR}/Resources/VulkanIcon.icns) + +# Have Xcode handle the Storyboard +if(XCODE) + set(cubepp_RESOURCES ${cubepp_RESOURCES} ${CMAKE_CURRENT_LIST_DIR}/Resources/Main.storyboard) +endif() + +add_executable(vkcubepp MACOSX_BUNDLE) + +target_sources(vkcubepp PRIVATE + main.mm + AppDelegate.mm + AppDelegate.h + DemoViewController.h + DemoViewController.mm + ${cubepp_RESOURCES} + ../../cube.vert.inc + ../../cube.frag.inc +) + +# Handle the Storyboard ourselves +if(NOT XCODE) + # Compile the storyboard file with the ibtool. + add_custom_command(TARGET vkcubepp POST_BUILD + COMMAND ${IBTOOL} + --errors + --warnings + --notices + --output-format human-readable-text + --compile ${CMAKE_CURRENT_BINARY_DIR}/vkcubepp.app/Contents/Resources/Main.storyboardc + ${CMAKE_CURRENT_LIST_DIR}/Resources/Main.storyboard + COMMENT "Compiling storyboard") +endif() + +add_dependencies(vkcubepp MoltenVK_icd-staging-json) + +# Include demo source code dir because the MacOS vkcubepp's Objective-C source includes the "original" vkcubepp application C++ source +# code. Also include the MoltenVK helper files. +target_include_directories(vkcubepp PRIVATE ${CMAKE_CURRENT_LIST_DIR} ${MOLTENVK_DIR}/MoltenVK/include) + +# We do this so vulkaninfo is linked to an individual library and NOT a framework. +target_link_libraries(vkcubepp Vulkan::Loader "-framework Cocoa -framework QuartzCore") + +set_target_properties(vkcubepp PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_LIST_DIR}/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("${PROJECT_BINARY_DIR}/staging-json/MoltenVK_icd.json" + PROPERTIES + MACOSX_PACKAGE_LOCATION + "Resources/vulkan/icd.d") + +# Copy the MoltenVK lib into the bundle. +if(XCODE) + add_custom_command(TARGET vkcubepp POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" + ${CMAKE_CURRENT_BINARY_DIR}/$/vkcubepp.app/Contents/Frameworks/libMoltenVK.dylib + DEPENDS vulkan) +else() + add_custom_command(TARGET vkcubepp POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" + ${CMAKE_CURRENT_BINARY_DIR}/vkcubepp.app/Contents/Frameworks/libMoltenVK.dylib + DEPENDS vulkan) +endif() diff --git a/cube/macOS/cubepp/cubepp.cmake b/cube/macOS/cubepp/cubepp.cmake deleted file mode 100644 index e6a3e485..00000000 --- a/cube/macOS/cubepp/cubepp.cmake +++ /dev/null @@ -1,85 +0,0 @@ -# ~~~ -# Copyright (c) 2018 Valve Corporation -# Copyright (c) 2018 LunarG, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ~~~ - -# VkCube 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/VulkanIcon.icns) - -# Have Xcode handle the Storyboard -if(XCODE) - set(cubepp_RESOURCES ${cubepp_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/Main.storyboard) -endif() - -add_executable(vkcubepp MACOSX_BUNDLE ${cubepp_SRCS} ${cubepp_HDRS} ${cubepp_RESOURCES} cube.vert.inc cube.frag.inc) - -# Handle the Storyboard ourselves -if(NOT XCODE) - # Compile the storyboard file with the ibtool. - add_custom_command(TARGET vkcubepp POST_BUILD - COMMAND ${IBTOOL} - --errors - --warnings - --notices - --output-format human-readable-text - --compile ${CMAKE_CURRENT_BINARY_DIR}/vkcubepp.app/Contents/Resources/Main.storyboardc - ${CMAKE_CURRENT_SOURCE_DIR}/macOS/cubepp/Resources/Main.storyboard - COMMENT "Compiling storyboard") -endif() - -add_dependencies(vkcubepp MoltenVK_icd-staging-json) - -# Include demo source code dir because the MacOS vkcubepp's Objective-C source includes the "original" vkcubepp application C++ source -# code. Also include the MoltenVK helper files. -target_include_directories(vkcubepp 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(vkcubepp Vulkan::Loader "-framework Cocoa -framework QuartzCore") - -set_target_properties(vkcubepp 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") - -# Copy the MoltenVK lib into the bundle. -if(XCODE) - add_custom_command(TARGET vkcubepp POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" - ${CMAKE_CURRENT_BINARY_DIR}/$/vkcubepp.app/Contents/Frameworks/libMoltenVK.dylib - DEPENDS vulkan) -else() - add_custom_command(TARGET vkcubepp POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "${MOLTENVK_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" - ${CMAKE_CURRENT_BINARY_DIR}/vkcubepp.app/Contents/Frameworks/libMoltenVK.dylib - DEPENDS vulkan) -endif() diff --git a/mac_common.cmake b/mac_common.cmake deleted file mode 100644 index b06dce96..00000000 --- a/mac_common.cmake +++ /dev/null @@ -1,56 +0,0 @@ -# ~~~ -# Copyright (c) 2018 Valve Corporation -# Copyright (c) 2018 LunarG, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ~~~ - -# Set up common settings for building all demos on Apple platforms. - -# Source for the MoltenVK ICD library and JSON file -set(MOLTENVK_DIR ${MOLTENVK_REPO_ROOT}) - -# 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) - -# ~~~ -# 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. -# The regex does: substitute ':"' 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) - -find_library(COCOA NAMES Cocoa) - -# Locate Interface Builder Tool, needed to build things like Storyboards outside of Xcode. -if(NOT 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.") - endif() -endif() diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 13182a4b..11277440 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -124,9 +124,6 @@ endif() if (VULKAN_LOADER_INSTALL_DIR) list(APPEND CMAKE_PREFIX_PATH ${VULKAN_LOADER_INSTALL_DIR}) endif() -if (MOLTENVK_REPO_ROOT) - list(APPEND CMAKE_PREFIX_PATH ${MOLTENVK_REPO_ROOT}) -endif() if (GOOGLETEST_INSTALL_DIR) list(APPEND CMAKE_PREFIX_PATH ${GOOGLETEST_INSTALL_DIR}) endif() -- cgit v1.2.3