From 22a8413c189b8e3860165fb4af6d38f6c4d55e0c Mon Sep 17 00:00:00 2001 From: ArchieMeng Date: Sun, 18 Apr 2021 23:46:38 +0800 Subject: [PATCH] update CMakeLists.txt to avoid explicit dynamic linking with system's libpythonX.Y.so --- src/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 54b22eb..3730a55 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.15) cmake_policy(SET CMP0091 NEW) set(CMAKE_POLICY_DEFAULT_CMP0091 NEW) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") @@ -5,7 +6,7 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") project(srmd-ncnn-vulkan-python) # SWIG -find_package(PythonLibs REQUIRED) +find_package(Python REQUIRED COMPONENTS Development) find_package(SWIG REQUIRED COMPONENTS python) if(SWIG_FOUND) message("SWIG found: ${SWIG_EXECUTABLE}") @@ -14,9 +15,6 @@ if(SWIG_FOUND) message(WARNING "SWIG python bindings cannot be generated") endif() endif() -include_directories(${PYTHON_INCLUDE_DIRS}) - -cmake_minimum_required(VERSION 3.9) option(USE_SYSTEM_NCNN "build with system libncnn" OFF) option(USE_SYSTEM_WEBP "build with system libwebp" OFF) @@ -275,4 +273,4 @@ include_directories(.) swig_add_library(srmd_ncnn_vulkan_wrapper LANGUAGE python SOURCES srmd.i srmd.cpp srmd_wrapper.cpp) add_dependencies(srmd_ncnn_vulkan_wrapper generate-spirv) target_compile_options(srmd_ncnn_vulkan_wrapper PUBLIC -fexceptions) -target_link_libraries(srmd_ncnn_vulkan_wrapper ${SRMD_LINK_LIBRARIES} ${PYTHON_LIBRARIES}) +target_link_libraries(srmd_ncnn_vulkan_wrapper ${SRMD_LINK_LIBRARIES} Python::Module)