-
Notifications
You must be signed in to change notification settings - Fork 464
WIP: CMake only PR. #1947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
WIP: CMake only PR. #1947
Changes from 1 commit
267c318
488cedd
6505227
c8ab021
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| cmake_minimum_required(VERSION 3.25) | ||
| project(MoltenVK) | ||
|
|
||
| set(MVK_GIT_REV "unknown") | ||
|
|
||
| find_package(Git) | ||
| if(GIT_FOUND) | ||
| execute_process( | ||
| COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD | ||
| OUTPUT_VARIABLE MVK_GIT_REV | ||
| ERROR_QUIET | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| ) | ||
| message( STATUS "GIT hash: ${MVK_GIT_REV}") | ||
| else() | ||
| message(STATUS "GIT not found") | ||
| endif() | ||
|
|
||
| configure_file(${CMAKE_CURRENT_LIST_DIR}/mvkGitRevDerived.h.in | ||
| ${CMAKE_CURRENT_BINARY_DIR}/mvkGitRevDerived.h) | ||
|
|
||
| add_subdirectory(External) | ||
| add_subdirectory(MoltenVKShaderConverter) | ||
| add_subdirectory(MoltenVK) | ||
|
|
||
| target_include_directories(MoltenVK-iOS PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) | ||
| target_include_directories(MoltenVK-tvOS PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) | ||
| target_include_directories(MoltenVK-macOS PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| set(SKIP_PORTABILITY_TEST ON) | ||
| set(JUST_INSTALL_CEREAL ON) | ||
|
|
||
| add_subdirectory(cereal) | ||
| add_subdirectory(glslang) | ||
| set(SPIRV_TOOLS_BUILD_STATIC ON) | ||
| add_subdirectory(SPIRV-Cross) | ||
| add_subdirectory(Vulkan-Headers) | ||
billhollings marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The contents of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In regards to external deps, for a cmake approach, was CPM considered? |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,204 @@ | ||||||
|
|
||||||
|
|
||||||
| ## | ||||||
| ## MoltenVK-iOS Files | ||||||
| ## | ||||||
|
|
||||||
| set(MOLTEN_VK_PROJECT_HEADERS | ||||||
gpx1000 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| ${CMAKE_CURRENT_LIST_DIR}/../Common/MVKCommonEnvironment.h | ||||||
| ${CMAKE_CURRENT_LIST_DIR}/../Common/MVKOSExtensions.h | ||||||
| ${CMAKE_CURRENT_LIST_DIR}/../Common/MVKStrings.h | ||||||
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API/mvk_datatypes.h | ||||||
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API/mvk_vulkan.h | ||||||
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API/vk_mvk_moltenvk.h | ||||||
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdDebug.h | ||||||
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdDraw.h | ||||||
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdPipeline.h | ||||||
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdQueries.h | ||||||
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdRenderPass.h | ||||||
|
||||||
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdRenderPass.h | |
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdRendering.h |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdRenderPass.mm | |
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdRendering.mm |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/CAMetalLayer+MoltenVK.m | |
| ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/CAMetalLayer+MoltenVK.mm |
gpx1000 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MoltenVK-iOS target builds a macOS binary.
gpx1000 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MoltenVK-tvOS target builds a macOS binary.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MoltenVK-macOS target builds the MoltenVKShaderConverter tool, not a MoltenVK static library.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get any of the MoltenVK-* targets to build, I also had to add the following build settings:
CURRENT_PROJECT_VERSION=1.2.9
GCC_PREPROCESSOR_DEFINITIONS=MVK_FRAMEWORK_VERSION=${CURRENT_PROJECT_VERSION}
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| ## | ||
| ## MoltenVKShaderConverter Files | ||
| ## | ||
|
|
||
| add_library(moltenvk_shader_converter STATIC | ||
| ../Common/MVKOSExtensions.mm | ||
| MoltenVKShaderConverter/SPIRVSupport.cpp | ||
| MoltenVKShaderConverterTool/MoltenVKShaderConverterTool.cpp | ||
| MoltenVKShaderConverterTool/OSSupport.mm | ||
| MoltenVKShaderConverterTool/main.cpp | ||
| MoltenVKShaderConverter/FileSupport.mm | ||
| MoltenVKShaderConverter/GLSLConversion.mm | ||
| MoltenVKShaderConverter/GLSLToSPIRVConverter.cpp | ||
| MoltenVKShaderConverter/SPIRVConversion.mm | ||
| MoltenVKShaderConverter/SPIRVToMSLConverter.cpp | ||
| ) | ||
billhollings marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| find_library(FOUNDATION_LIBRARY Foundation) | ||
| message(STATUS "FOUNDATION_LIBRARY is ${FOUNDATION_LIBRARY}") | ||
gpx1000 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| find_library(METAL_LIBRARY Metal) | ||
| message(STATUS "METAL_LIBRARY is ${METAL_LIBRARY}") | ||
| find_library(APPKIT_LIBRARY AppKit) | ||
| message(STATUS "APPKIT_LIBRARY is ${APPKIT_LIBRARY}") | ||
| find_library(IOKIT_LIBRARY IOKit) | ||
| message(STATUS "IOKIT_LIBRARY is ${IOKIT_LIBRARY}") | ||
| find_library(IOSURFACE_LIBRARY IOSurface) | ||
| message(STATUS "IOSURFACE_LIBRARY is ${IOSURFACE_LIBRARY}") | ||
| find_library(QUARTZCORE_LIBRARY QuartzCore) | ||
| message(STATUS "QUARTZCORE_LIBRARY is ${QUARTZCORE_LIBRARY}") | ||
|
|
||
|
|
||
| target_link_libraries(moltenvk_shader_converter PUBLIC ${FOUNDATION_LIBRARY} ${METAL_LIBRARY} ${APPKIT_LIBRARY} | ||
| ${IOKIT_LIBRARY} ${IOSURFACE_LIBRARY} ${QUARTZCORE_LIBRARY} | ||
| cereal spirv-cross-msl glslang SPIRV-Tools-opt spirv-cross-reflect SPIRV) | ||
|
|
||
| target_include_directories(moltenvk_shader_converter PUBLIC MoltenVKShaderConverter include | ||
| ${CMAKE_CURRENT_LIST_DIR}/../Common | ||
| ${CMAKE_CURRENT_LIST_DIR}/../External | ||
| ${CMAKE_CURRENT_LIST_DIR}) | ||
| target_compile_features(moltenvk_shader_converter PUBLIC cxx_std_17) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| // Auto-generated by MoltenVK | ||
| static const char* mvkRevString = "@MVK_GIT_REV@"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to avoid cluttering the top level directory if possible. Can we find a different home for this file? Maybe under
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll move it there.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should be moved to a new |
||
Uh oh!
There was an error while loading. Please reload this page.