diff options
author | Ryan Volz <rvolz@mit.edu> | 2019-11-20 16:10:05 -0500 |
---|---|---|
committer | atrnati <54334261+atrnati@users.noreply.github.com> | 2020-02-07 09:12:15 -0600 |
commit | 2fab118bdc5afd5967ff876cc574bebef0ba0f67 (patch) | |
tree | e708c29298a391c5754fa7f9f0ef208948f3c804 | |
parent | 488a33cd9c6781816784f6d38527d16d3077e5ba (diff) | |
download | uhd-2fab118bdc5afd5967ff876cc574bebef0ba0f67.tar.gz uhd-2fab118bdc5afd5967ff876cc574bebef0ba0f67.tar.bz2 uhd-2fab118bdc5afd5967ff876cc574bebef0ba0f67.zip |
python: Set python module suffix to conform with PEP 3149.
This adds the python implementation, major and minor version numbers,
and any additional flags (debug, pymalloc, wide unicode) to the
extension module suffix as specified in PEP 3149.
Hat tip to @isuruf:
https://github.com/conda-forge/staged-recipes/pull/10076#discussion_r348721448
-rw-r--r-- | host/python/CMakeLists.txt | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/host/python/CMakeLists.txt b/host/python/CMakeLists.txt index 7ca247f18..9c5503881 100644 --- a/host/python/CMakeLists.txt +++ b/host/python/CMakeLists.txt @@ -34,7 +34,16 @@ add_library(pyuhd SHARED pyuhd.cpp) if(WIN32) set_target_properties(pyuhd PROPERTIES PREFIX "lib" SUFFIX ".pyd") else() - set_target_properties(pyuhd PROPERTIES PREFIX "lib" SUFFIX ".so") + execute_process( + COMMAND "${PYTHON_EXECUTABLE}" -c + "from distutils.sysconfig import get_config_var; print(get_config_var('EXT_SUFFIX'))" + OUTPUT_VARIABLE PYTHON_EXTENSION_SUFFIX + ) + string(STRIP ${PYTHON_EXTENSION_SUFFIX} PYTHON_EXTENSION_SUFFIX) + if(${PYTHON_EXTENSION_SUFFIX} STREQUAL "None") + set(PYTHON_EXTENSION_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX}) + endif() + set_target_properties(pyuhd PROPERTIES PREFIX "lib" SUFFIX ${PYTHON_EXTENSION_SUFFIX}) endif(WIN32) target_include_directories(pyuhd PUBLIC ${PYTHON_NUMPY_INCLUDE_DIR} |