Skip to content

Commit

Permalink
Update CMakeLists.txt to avoid explicitly linking system libpython.so
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchieMeng committed Apr 18, 2021
1 parent eb47d76 commit 8633eb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0091 NEW)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

project(realsr-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}")
Expand All @@ -15,10 +16,6 @@ if(SWIG_FOUND)
endif()
endif()

cmake_minimum_required(VERSION 3.9)

set(CMAKE_BUILD_TYPE Release)

option(USE_SYSTEM_NCNN "build with system libncnn" OFF)
option(USE_SYSTEM_WEBP "build with system libwebp" OFF)
option(USE_STATIC_MOLTENVK "link moltenvk static library" OFF)
Expand Down Expand Up @@ -78,7 +75,6 @@ macro(compile_shader SHADER_SRC)
endmacro()

include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(.)

if(OPENMP_FOUND)
Expand Down Expand Up @@ -320,4 +316,4 @@ set_property(SOURCE realsr.i PROPERTY CPLUSPLUS ON DEPENDS generate-spirv)
swig_add_library(realsr_ncnn_vulkan_wrapper LANGUAGE python SOURCES realsr.i realsr.cpp realsr_wrapped.cpp)
add_dependencies(realsr_ncnn_vulkan_wrapper generate-spirv)
target_compile_options(realsr_ncnn_vulkan_wrapper PUBLIC -fexceptions)
target_link_libraries(realsr_ncnn_vulkan_wrapper ${REALSR_LINK_LIBRARIES} ${PYTHON_LIBRARIES})
target_link_libraries(realsr_ncnn_vulkan_wrapper ${REALSR_LINK_LIBRARIES} Python::Module)
2 changes: 1 addition & 1 deletion src/realsr_ncnn_vulkan.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def get_tilesize(self):

t = time()
im = Image.open("../images/0.png")
upscaler = RealSR(0, scale=4)
upscaler = RealSR(0)
out_im = upscaler.process(im)
out_im.save("temp.png")
print(f"Elapsed time: {time() - t}s")

0 comments on commit 8633eb3

Please sign in to comment.