vulkaninfo: fix device ext list having bad items
[platform/upstream/Vulkan-Tools.git] / mac_common.cmake
1 # ~~~
2 # Copyright (c) 2018 Valve Corporation
3 # Copyright (c) 2018 LunarG, Inc.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ~~~
17
18 # Set up common settings for building all demos on Apple platforms.
19
20 # Source for the MoltenVK ICD library and JSON file
21 set(MOLTENVK_DIR ${MOLTENVK_REPO_ROOT})
22
23 # MoltenVK JSON File
24
25 execute_process(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/staging-json)
26 execute_process(COMMAND sed -e "/\"library_path\":/s$:[[:space:]]*\"[[:space:]]*[\\.\\/]*$: \"..\\/..\\/..\\/Frameworks\\/$"
27                         ${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json
28                 OUTPUT_FILE ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json)
29
30 # ~~~
31 # Modify the ICD JSON file to adjust the library path.
32 # The ICD JSON file goes in the Resources/vulkan/icd.d directory, so adjust the
33 # library_path to the relative path to the Frameworks directory in the bundle.
34 # The regex does: substitute ':<whitespace>"<whitespace><all occurences of . and />' with:
35 # ': "../../../Frameworks/'
36 # ~~~
37 add_custom_target(MoltenVK_icd-staging-json ALL
38                   COMMAND mkdir -p ${CMAKE_BINARY_DIR}/staging-json
39                   COMMAND sed -e "/\"library_path\":/s$:[[:space:]]*\"[[:space:]]*[\\.\\/]*$: \"..\\/..\\/..\\/Frameworks\\/$"
40                           ${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json > ${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json
41                   VERBATIM
42                   DEPENDS "${MOLTENVK_DIR}/MoltenVK/icd/MoltenVK_icd.json")
43 set_source_files_properties(${CMAKE_BINARY_DIR}/staging-json/MoltenVK_icd.json PROPERTIES GENERATED TRUE)
44
45 find_library(COCOA NAMES Cocoa)
46
47 # Locate Interface Builder Tool, needed to build things like Storyboards outside of Xcode.
48 if(NOT ${CMAKE_GENERATOR} MATCHES "^Xcode.*")
49     # Make sure we can find the 'ibtool' program. If we can NOT find it we skip generation of this project.
50     find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin")
51     if(${IBTOOL} STREQUAL "IBTOOL-NOTFOUND")
52         message(SEND_ERROR "ibtool can not be found and is needed to compile the .xib files. "
53                            "It should have been installed with the Apple developer tools. "
54                            "The default system paths were searched in addition to ${OSX_DEVELOPER_ROOT}/usr/bin.")
55     endif()
56 endif()