aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Volz <rvolz@mit.edu>2019-11-01 10:32:24 -0400
committeratrnati <54334261+atrnati@users.noreply.github.com>2020-02-07 09:12:15 -0600
commitec96cc37a245b1f1ddd8348d86ac9636b2f7228a (patch)
treee80173cb74b4a3567b80459cacfe4e4236d55800
parenta76623d8e51aaaa49cde42e553670987e4cb4de1 (diff)
downloaduhd-ec96cc37a245b1f1ddd8348d86ac9636b2f7228a.tar.gz
uhd-ec96cc37a245b1f1ddd8348d86ac9636b2f7228a.tar.bz2
uhd-ec96cc37a245b1f1ddd8348d86ac9636b2f7228a.zip
python: Fix internal library name (incl. suffix) to match filename.
Instead of renaming the library file, this sets the suffix in CMake so that the filename turns out as desired and also linker references know the correct name.
-rw-r--r--host/python/CMakeLists.txt14
1 files changed, 7 insertions, 7 deletions
diff --git a/host/python/CMakeLists.txt b/host/python/CMakeLists.txt
index 2b2a35d2e..0b31e4f3a 100644
--- a/host/python/CMakeLists.txt
+++ b/host/python/CMakeLists.txt
@@ -30,6 +30,12 @@ execute_process(
# Build pyuhd library
add_library(pyuhd SHARED pyuhd.cpp)
+# python expects extension modules with a particular suffix
+if(WIN32)
+ set_target_properties(pyuhd PROPERTIES PREFIX "lib" SUFFIX ".pyd")
+else()
+ set_target_properties(pyuhd PROPERTIES PREFIX "lib" SUFFIX ".so")
+endif(WIN32)
target_include_directories(pyuhd PUBLIC
${PYTHON_NUMPY_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/lib
@@ -38,14 +44,8 @@ target_include_directories(pyuhd PUBLIC
target_link_libraries(pyuhd ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} uhd)
# Copy pyuhd library to the staging directory
-if(WIN32)
- set(PYUHD_LIBRARY_NAME libpyuhd.pyd)
-else()
- set(PYUHD_LIBRARY_NAME libpyuhd${CMAKE_SHARED_MODULE_SUFFIX})
-endif(WIN32)
-
add_custom_command(TARGET pyuhd
- POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:pyuhd> ${CMAKE_CURRENT_BINARY_DIR}/uhd/${PYUHD_LIBRARY_NAME})
+ POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:pyuhd> ${CMAKE_CURRENT_BINARY_DIR}/uhd/$<TARGET_FILE_NAME:pyuhd>)
set(PYUHD_FILES
${CMAKE_CURRENT_SOURCE_DIR}/__init__.py