Skip to content

Commit

Permalink
Support mac platform static library compilation (#4859)
Browse files Browse the repository at this point in the history
  • Loading branch information
Baiyuetribe authored Aug 11, 2023
1 parent a24787b commit 75e10c6
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,28 @@ if(NCNN_VULKAN)
endif()

target_link_libraries(ncnn PUBLIC Vulkan::Vulkan)

# Support mac platform static library compilation
if(NOT NCNN_SHARED_LIB AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME STREQUAL "iOS")
find_library(CoreFoundation NAMES CoreFoundation)
find_library(Foundation NAMES Foundation)
find_library(QuartzCore NAMES QuartzCore)
find_library(CoreGraphics NAMES CoreGraphics)
find_library(Cocoa NAMES Cocoa)
find_library(Metal NAMES Metal)
find_library(IOKit NAMES IOKit)
find_library(IOSurface NAMES IOSurface)
list(APPEND vulkan_dependec_LINK_LIBRARIES
${Metal}
${IOKit}
${IOSurface}
${QuartzCore}
${CoreGraphics}
${Cocoa}
${Foundation}
${CoreFoundation}
)
target_link_libraries(ncnn PRIVATE ${vulkan_dependec_LINK_LIBRARIES})
endif()
target_include_directories(ncnn PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>)
target_link_libraries(ncnn PRIVATE glslang SPIRV)
endif()
Expand Down

0 comments on commit 75e10c6

Please sign in to comment.