From 2fab118bdc5afd5967ff876cc574bebef0ba0f67 Mon Sep 17 00:00:00 2001 From: Ryan Volz Date: Wed, 20 Nov 2019 16:10:05 -0500 Subject: 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 --- host/python/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'host/python') 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} -- cgit v1.2.3