aboutsummaryrefslogtreecommitdiff
path: root/cube/macOS/common.cmake
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2018-04-11 13:38:11 -0600
committerMark Lobodzinski <mark@lunarg.com>2018-05-11 20:10:23 -0600
commit6e590c31d0ceaf3edc717d4e79aacc9afed46f5c (patch)
treeff9cc5efbb622567d2f1bb823e0a5eb179fdc2e3 /cube/macOS/common.cmake
parentb37d3d8477db4ea1dc7ae25539b35a0e8e365a7f (diff)
downloadusermoji-6e590c31d0ceaf3edc717d4e79aacc9afed46f5c.tar.xz
cube: Move cube directory up to top level dir
Change-Id: Ie1116b0b6de742b4f85834a4c9d1927dd641e19b
Diffstat (limited to 'cube/macOS/common.cmake')
-rw-r--r--cube/macOS/common.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/cube/macOS/common.cmake b/cube/macOS/common.cmake
new file mode 100644
index 00000000..6a35db95
--- /dev/null
+++ b/cube/macOS/common.cmake
@@ -0,0 +1,39 @@
+# Set up common settings for building all demos on Apple platforms.
+
+# Source for the MoltenVK ICD library and JSON file
+set(MOLTENVK_DIR "${PROJECT_SOURCE_DIR}/external/MoltenVK")
+
+# MoltenVK JSON File
+
+# 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 ':<whitespace>"<whitespace><all occurences of . and />' with:
+# ': "../../../Frameworks/'
+add_custom_target(MoltenVK_icd-staging-json ALL
+ COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/staging-json
+ COMMAND sed -e "/\"library_path\":/s$:[[:space:]]*\"[[:space:]]*[\\.\\/]*$: \"..\\/..\\/..\\/Frameworks\\/$"
+ ${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json >
+ ${CMAKE_CURRENT_BINARY_DIR}/staging-json/MoltenVK_icd.json
+ VERBATIM
+ DEPENDS "${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json"
+)
+set_source_files_properties(${CMAKE_CURRENT_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
+ 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()