From 267c31879c6f7849386a7487a8d4effd8ad75994 Mon Sep 17 00:00:00 2001 From: gpx1000 Date: Wed, 14 Jun 2023 15:55:01 -0700 Subject: [PATCH 1/3] CMake only PR. This allows other tooling such as CLion to work with building this project. It also allows for building with XCode directly. It should make maintaining the project easier in the long run. --- CMakeLists.txt | 28 ++++ External/CMakeLists.txt | 8 + MoltenVK/CMakeLists.txt | 204 +++++++++++++++++++++++++ MoltenVKShaderConverter/CMakeLists.txt | 40 +++++ mvkGitRevDerived.h.in | 2 + 5 files changed, 282 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 External/CMakeLists.txt create mode 100644 MoltenVK/CMakeLists.txt create mode 100644 MoltenVKShaderConverter/CMakeLists.txt create mode 100644 mvkGitRevDerived.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..ddf46d741 --- /dev/null +++ b/CMakeLists.txt @@ -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}) diff --git a/External/CMakeLists.txt b/External/CMakeLists.txt new file mode 100644 index 000000000..e71cf5299 --- /dev/null +++ b/External/CMakeLists.txt @@ -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) diff --git a/MoltenVK/CMakeLists.txt b/MoltenVK/CMakeLists.txt new file mode 100644 index 000000000..cb02055d2 --- /dev/null +++ b/MoltenVK/CMakeLists.txt @@ -0,0 +1,204 @@ + + +## +## MoltenVK-iOS Files +## + +set(MOLTEN_VK_PROJECT_HEADERS + ${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/MVKCmdTransfer.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommand.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandBuffer.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandEncoderState.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandEncodingPool.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandPipelineStateFactoryShaderSource.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandPool.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandResourceFactory.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKMTLBufferAllocation.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKMTLResourceBindings.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKBuffer.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDescriptor.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDescriptorSet.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDevice.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDeviceFeatureStructs.def + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDeviceMemory.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKFramebuffer.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKImage.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKInstance.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKPipeline.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKPixelFormats.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKQueryPool.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKQueue.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKRenderPass.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKResource.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKShaderModule.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSurface.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSwapchain.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSync.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKVulkanAPIObject.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers/MVKExtensions.def + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers/MVKExtensions.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers/MVKLayers.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/CAMetalLayer+MoltenVK.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassDepthAttachmentDescriptor+MoltenVK.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassDescriptor+MoltenVK.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassStencilAttachmentDescriptor+MoltenVK.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPipelineDescriptor+MoltenVK.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLSamplerDescriptor+MoltenVK.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLTextureDescriptor+MoltenVK.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MVKGPUCapture.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/NSString+MoltenVK.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKBaseObject.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKBitArray.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKBlockObserver.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKCodec.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKEnvironment.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKFoundation.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKLogging.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKObjectPool.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKSmallVector.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKSmallVectorAllocator.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKWatermark.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKWatermarkShaderSource.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKWatermarkTextureContent.h + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan/mvk_datatypes.hpp + ) + +set(MOLTEN_VK_SOURCES + ${CMAKE_CURRENT_LIST_DIR}/../Common/MVKOSExtensions.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdDebug.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdDispatch.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdDraw.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdPipeline.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdQueries.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdRenderPass.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdTransfer.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandBuffer.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandEncoderState.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandEncodingPool.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandPool.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandResourceFactory.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKMTLBufferAllocation.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKBuffer.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDescriptor.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDescriptorSet.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDevice.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDeviceMemory.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKFramebuffer.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKImage.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKInstance.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKPipeline.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKPixelFormats.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKQueryPool.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKQueue.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKRenderPass.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKResource.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKShaderModule.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSurface.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSwapchain.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSync.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKVulkanAPIObject.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers/MVKExtensions.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers/MVKLayers.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/CAMetalLayer+MoltenVK.m + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassDepthAttachmentDescriptor+MoltenVK.m + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassDescriptor+MoltenVK.m + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassStencilAttachmentDescriptor+MoltenVK.m + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPipelineDescriptor+MoltenVK.m + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLSamplerDescriptor+MoltenVK.m + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLTextureDescriptor+MoltenVK.m + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MVKGPUCapture.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/NSString+MoltenVK.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKBaseObject.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKBlockObserver.m + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKCodec.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKEnvironment.cpp + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKFoundation.cpp + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKWatermark.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan/mvk_datatypes.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan/mvk_api.mm + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan/vulkan.mm + ) + +## +## MoltenVK-iOS +## + +add_library(MoltenVK-iOS STATIC + ${MOLTEN_VK_SOURCES} + ) + +target_include_directories(MoltenVK-iOS + PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/../Common + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan + ${CMAKE_CURRENT_LIST_DIR}/include + ) + +target_compile_features(MoltenVK-iOS PRIVATE cxx_std_17) +target_link_libraries(MoltenVK-iOS PUBLIC moltenvk_shader_converter) + +## +## MoltenVK-tvOS +## + +add_library(MoltenVK-tvOS STATIC + ${MOLTEN_VK_SOURCES} + ) + +target_include_directories(MoltenVK-tvOS + PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/../Common + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan + ${CMAKE_CURRENT_LIST_DIR}/include + ) + +target_compile_features(MoltenVK-tvOS PRIVATE cxx_std_17) +target_link_libraries(MoltenVK-tvOS PUBLIC moltenvk_shader_converter) + + +## +## MoltenVK-macOS +## + +add_executable(MoltenVK-macOS + ${MOLTEN_VK_SOURCES} + ) + +target_include_directories(MoltenVK-macOS + PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/../Common + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan + ${CMAKE_CURRENT_LIST_DIR}/include + ) + +target_compile_features(MoltenVK-macOS PRIVATE cxx_std_17) +target_link_libraries(MoltenVK-macOS PUBLIC moltenvk_shader_converter) diff --git a/MoltenVKShaderConverter/CMakeLists.txt b/MoltenVKShaderConverter/CMakeLists.txt new file mode 100644 index 000000000..b02a38f80 --- /dev/null +++ b/MoltenVKShaderConverter/CMakeLists.txt @@ -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 + ) + +find_library(FOUNDATION_LIBRARY Foundation) +message(STATUS "FOUNDATION_LIBRARY is ${FOUNDATION_LIBRARY}") +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) diff --git a/mvkGitRevDerived.h.in b/mvkGitRevDerived.h.in new file mode 100644 index 000000000..efb8b8672 --- /dev/null +++ b/mvkGitRevDerived.h.in @@ -0,0 +1,2 @@ +// Auto-generated by MoltenVK +static const char* mvkRevString = "@MVK_GIT_REV@"; \ No newline at end of file From 65052274ef84163916e4cd14b1034e886078f3bd Mon Sep 17 00:00:00 2001 From: gpx1000 Date: Mon, 18 Mar 2024 19:17:07 -0700 Subject: [PATCH 2/3] update cmake to use GLOB as per request. This is NOT the best practice for a CMake project; but it will work for our needs. --- CMakeLists.txt | 25 +++- MoltenVK/CMakeLists.txt | 188 ++----------------------- MoltenVKShaderConverter/CMakeLists.txt | 12 +- 3 files changed, 40 insertions(+), 185 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddf46d741..ed60c502b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,22 @@ -cmake_minimum_required(VERSION 3.25) +cmake_minimum_required(VERSION 3.20) project(MoltenVK) set(MVK_GIT_REV "unknown") +function(check_lists_equal list1 list2) + set(DIFF_ITEMS ) + # Check if each element in the first list is in the second list + foreach(element IN LISTS ${list1}) + if(NOT ${element} IN LISTS ${list2}) + LIST(APPEND DIFF_ITEMS ${element}) + endif() + endforeach() + + if(DIFF_ITEMS) + message(STATUS "glob found the following files ${DIFF_ITEMS} which aren't part of the SRC_LIST in ${CMAKE_CURRENT_LIST_FILE}") + endif () +endfunction() + find_package(Git) if(GIT_FOUND) execute_process( @@ -23,6 +37,9 @@ 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}) +target_include_directories(MoltenVK PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + +install ( TARGETS MoltenVK moltenvk_shader_converter EXPORT MotlenVK ) +export ( TARGETS MoltenVK moltenvk_shader_converter cereal glslang SPIRV OGLCompiler OSDependent MachineIndependent + GenericCodeGen + FILE ${CMAKE_BINARY_DIR}/MoltenVKConfig.cmake ) \ No newline at end of file diff --git a/MoltenVK/CMakeLists.txt b/MoltenVK/CMakeLists.txt index cb02055d2..c9e68ca11 100644 --- a/MoltenVK/CMakeLists.txt +++ b/MoltenVK/CMakeLists.txt @@ -1,193 +1,23 @@ - - ## ## MoltenVK-iOS Files ## -set(MOLTEN_VK_PROJECT_HEADERS - ${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/MVKCmdTransfer.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommand.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandBuffer.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandEncoderState.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandEncodingPool.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandPipelineStateFactoryShaderSource.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandPool.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandResourceFactory.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKMTLBufferAllocation.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKMTLResourceBindings.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKBuffer.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDescriptor.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDescriptorSet.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDevice.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDeviceFeatureStructs.def - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDeviceMemory.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKFramebuffer.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKImage.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKInstance.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKPipeline.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKPixelFormats.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKQueryPool.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKQueue.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKRenderPass.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKResource.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKShaderModule.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSurface.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSwapchain.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSync.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKVulkanAPIObject.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers/MVKExtensions.def - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers/MVKExtensions.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers/MVKLayers.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/CAMetalLayer+MoltenVK.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassDepthAttachmentDescriptor+MoltenVK.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassDescriptor+MoltenVK.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassStencilAttachmentDescriptor+MoltenVK.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPipelineDescriptor+MoltenVK.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLSamplerDescriptor+MoltenVK.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLTextureDescriptor+MoltenVK.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MVKGPUCapture.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/NSString+MoltenVK.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKBaseObject.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKBitArray.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKBlockObserver.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKCodec.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKEnvironment.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKFoundation.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKLogging.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKObjectPool.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKSmallVector.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKSmallVectorAllocator.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKWatermark.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKWatermarkShaderSource.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKWatermarkTextureContent.h - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan/mvk_datatypes.hpp - ) +file(GLOB_RECURSE MOLTEN_VK_PROJECT_HEADERS CONFIGURE_DEPENDS RELATIVE ${CMAKE_CURRENT_LIST_DIR}/MoltenVK *.h *.hpp) +file(GLOB MOLTEN_VK_PROJECT_HEADERS_COMMON RELATIVE CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/.. *.h *.hpp) +list(APPEND MOLTEN_VK_PROJECT_HEADERS ${MOLTEN_VK_PROJECT_HEADERS_COMMON}) -set(MOLTEN_VK_SOURCES - ${CMAKE_CURRENT_LIST_DIR}/../Common/MVKOSExtensions.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdDebug.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdDispatch.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdDraw.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdPipeline.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdQueries.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdRenderPass.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCmdTransfer.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandBuffer.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandEncoderState.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandEncodingPool.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandPool.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKCommandResourceFactory.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands/MVKMTLBufferAllocation.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKBuffer.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDescriptor.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDescriptorSet.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDevice.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKDeviceMemory.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKFramebuffer.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKImage.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKInstance.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKPipeline.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKPixelFormats.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKQueryPool.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKQueue.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKRenderPass.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKResource.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKShaderModule.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSurface.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSwapchain.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKSync.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects/MVKVulkanAPIObject.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers/MVKExtensions.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers/MVKLayers.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/CAMetalLayer+MoltenVK.m - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassDepthAttachmentDescriptor+MoltenVK.m - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassDescriptor+MoltenVK.m - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPassStencilAttachmentDescriptor+MoltenVK.m - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLRenderPipelineDescriptor+MoltenVK.m - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLSamplerDescriptor+MoltenVK.m - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MTLTextureDescriptor+MoltenVK.m - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/MVKGPUCapture.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS/NSString+MoltenVK.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKBaseObject.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKBlockObserver.m - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKCodec.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKEnvironment.cpp - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKFoundation.cpp - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility/MVKWatermark.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan/mvk_datatypes.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan/mvk_api.mm - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan/vulkan.mm - ) +file(GLOB_RECURSE MOLTEN_VK_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/MoltenVK *.mm *.m *.cpp) +list(PREPEND MOLTEN_VK_SOURCES ../Common/MVKOSExtensions.mm) ## ## MoltenVK-iOS ## -add_library(MoltenVK-iOS STATIC - ${MOLTEN_VK_SOURCES} - ) - -target_include_directories(MoltenVK-iOS - PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/../Common - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan - ${CMAKE_CURRENT_LIST_DIR}/include - ) - -target_compile_features(MoltenVK-iOS PRIVATE cxx_std_17) -target_link_libraries(MoltenVK-iOS PUBLIC moltenvk_shader_converter) - -## -## MoltenVK-tvOS -## - -add_library(MoltenVK-tvOS STATIC - ${MOLTEN_VK_SOURCES} - ) - -target_include_directories(MoltenVK-tvOS - PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/../Common - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan - ${CMAKE_CURRENT_LIST_DIR}/include - ) - -target_compile_features(MoltenVK-tvOS PRIVATE cxx_std_17) -target_link_libraries(MoltenVK-tvOS PUBLIC moltenvk_shader_converter) - - -## -## MoltenVK-macOS -## - -add_executable(MoltenVK-macOS +add_library(MoltenVK STATIC ${MOLTEN_VK_SOURCES} ) -target_include_directories(MoltenVK-macOS +target_include_directories(MoltenVK PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../Common ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API @@ -200,5 +30,5 @@ target_include_directories(MoltenVK-macOS ${CMAKE_CURRENT_LIST_DIR}/include ) -target_compile_features(MoltenVK-macOS PRIVATE cxx_std_17) -target_link_libraries(MoltenVK-macOS PUBLIC moltenvk_shader_converter) +target_compile_features(MoltenVK PRIVATE cxx_std_17) +target_link_libraries(MoltenVK PUBLIC moltenvk_shader_converter) diff --git a/MoltenVKShaderConverter/CMakeLists.txt b/MoltenVKShaderConverter/CMakeLists.txt index b02a38f80..6009b6a03 100644 --- a/MoltenVKShaderConverter/CMakeLists.txt +++ b/MoltenVKShaderConverter/CMakeLists.txt @@ -1,8 +1,7 @@ ## ## MoltenVKShaderConverter Files ## - -add_library(moltenvk_shader_converter STATIC +set(SRC_LIST ../Common/MVKOSExtensions.mm MoltenVKShaderConverter/SPIRVSupport.cpp MoltenVKShaderConverterTool/MoltenVKShaderConverterTool.cpp @@ -13,6 +12,15 @@ add_library(moltenvk_shader_converter STATIC MoltenVKShaderConverter/GLSLToSPIRVConverter.cpp MoltenVKShaderConverter/SPIRVConversion.mm MoltenVKShaderConverter/SPIRVToMSLConverter.cpp +) + +file(GLOB SRCS RELATIVE CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/MoltenVKShaderConverter *.mm *.cpp *.m) +list(PREPEND SRCS ../Common/MVKOSExtensions.mm) + +check_lists_equal(${SRCS}, ${SRC_LIST}) + +add_library(moltenvk_shader_converter STATIC + ${SRC_LIST} ) find_library(FOUNDATION_LIBRARY Foundation) From c8ab0219c1b57cbbeded9973c8f0598d6b7bfa16 Mon Sep 17 00:00:00 2001 From: gpx1000 Date: Mon, 18 Mar 2024 19:40:03 -0700 Subject: [PATCH 3/3] accept requested changes. --- MoltenVK/CMakeLists.txt | 30 ++++++--------- MoltenVKShaderConverter/CMakeLists.txt | 52 +++++++++++--------------- 2 files changed, 34 insertions(+), 48 deletions(-) diff --git a/MoltenVK/CMakeLists.txt b/MoltenVK/CMakeLists.txt index c9e68ca11..4bd61cc86 100644 --- a/MoltenVK/CMakeLists.txt +++ b/MoltenVK/CMakeLists.txt @@ -2,10 +2,6 @@ ## MoltenVK-iOS Files ## -file(GLOB_RECURSE MOLTEN_VK_PROJECT_HEADERS CONFIGURE_DEPENDS RELATIVE ${CMAKE_CURRENT_LIST_DIR}/MoltenVK *.h *.hpp) -file(GLOB MOLTEN_VK_PROJECT_HEADERS_COMMON RELATIVE CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/.. *.h *.hpp) -list(APPEND MOLTEN_VK_PROJECT_HEADERS ${MOLTEN_VK_PROJECT_HEADERS_COMMON}) - file(GLOB_RECURSE MOLTEN_VK_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/MoltenVK *.mm *.m *.cpp) list(PREPEND MOLTEN_VK_SOURCES ../Common/MVKOSExtensions.mm) @@ -13,22 +9,20 @@ list(PREPEND MOLTEN_VK_SOURCES ../Common/MVKOSExtensions.mm) ## MoltenVK-iOS ## -add_library(MoltenVK STATIC - ${MOLTEN_VK_SOURCES} - ) +add_library(MoltenVK STATIC ${MOLTEN_VK_SOURCES}) target_include_directories(MoltenVK - PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/../Common - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility - ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan - ${CMAKE_CURRENT_LIST_DIR}/include - ) + PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/../Common + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/API + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Commands + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/GPUObjects + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Layers + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/OS + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Utility + ${CMAKE_CURRENT_LIST_DIR}/MoltenVK/Vulkan + ${CMAKE_CURRENT_LIST_DIR}/include +) target_compile_features(MoltenVK PRIVATE cxx_std_17) target_link_libraries(MoltenVK PUBLIC moltenvk_shader_converter) diff --git a/MoltenVKShaderConverter/CMakeLists.txt b/MoltenVKShaderConverter/CMakeLists.txt index 6009b6a03..554e0140c 100644 --- a/MoltenVKShaderConverter/CMakeLists.txt +++ b/MoltenVKShaderConverter/CMakeLists.txt @@ -2,16 +2,16 @@ ## MoltenVKShaderConverter Files ## set(SRC_LIST - ../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 + ../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 ) file(GLOB SRCS RELATIVE CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/MoltenVKShaderConverter *.mm *.cpp *.m) @@ -19,30 +19,22 @@ list(PREPEND SRCS ../Common/MVKOSExtensions.mm) check_lists_equal(${SRCS}, ${SRC_LIST}) -add_library(moltenvk_shader_converter STATIC - ${SRC_LIST} - ) +add_library(moltenvk_shader_converter STATIC ${SRC_LIST}) -find_library(FOUNDATION_LIBRARY Foundation) -message(STATUS "FOUNDATION_LIBRARY is ${FOUNDATION_LIBRARY}") -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}") +find_library(FOUNDATION_LIBRARY Foundation REQUIRED) +find_library(METAL_LIBRARY Metal REQUIRED) +find_library(APPKIT_LIBRARY AppKit REQUIRED) +find_library(IOKIT_LIBRARY IOKit REQUIRED) +find_library(IOSURFACE_LIBRARY IOSurface REQUIRED) +find_library(QUARTZCORE_LIBRARY QuartzCore REQUIRED) 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) + ${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}) + ${CMAKE_CURRENT_LIST_DIR}/../Common + ${CMAKE_CURRENT_LIST_DIR}/../External + ${CMAKE_CURRENT_LIST_DIR}) target_compile_features(moltenvk_shader_converter PUBLIC cxx_std_17)