Unverified Commit 5d9eb18a authored by Simon Ward's avatar Simon Ward
Browse files

More windows fudging

parent 2f87f1e2
......@@ -32,27 +32,24 @@ set_source_files_properties(forpy_mod.f90 PROPERTIES COMPILE_FLAG "-cpp")
# See https://gitlab.kitware.com/cmake/cmake/-/issues/19226 for linking
add_dependencies(${LIBRARY_NAME} crysfml_common)
set(COMPATIBLE_VERSIONS 3.10 3.9 3.8 3.7 3.6)
if (NOT PYTHON_INTERPRETER_PATH)
set(Python_ADDITIONAL_VERSIONS ${COMPATIBLE_VERSIONS})
find_package(PythonInterp REQUIRED)
set(PYTHON_INTERPRETER_PATH ${PYTHON_EXECUTABLE})
message(STATUS ${PYTHON_INTERPRETER_PATH})
else()
message(STATUS "using Python interpreter provided with PYTHON_INTERPRETER_PATH variable: " ${PYTHON_INTERPRETER_PATH})
endif()
find_package(Python3 COMPONENTS Interpreter Development)
set(PYTHON_INTERPRETER_PATH ${Python3_EXECUTABLE})
#
# set(COMPATIBLE_VERSIONS 3.10 3.9 3.8 3.7 3.6)
# if (NOT PYTHON_INTERPRETER_PATH)
# set(Python_ADDITIONAL_VERSIONS ${COMPATIBLE_VERSIONS})
# find_package(PythonInterp REQUIRED)
# set(PYTHON_INTERPRETER_PATH ${PYTHON_EXECUTABLE})
# message(STATUS ${PYTHON_INTERPRETER_PATH})
# else()
# message(STATUS "using Python interpreter provided with PYTHON_INTERPRETER_PATH variable: " ${PYTHON_INTERPRETER_PATH})
# endif()
if(WIN32)
if (NOT PYTHON_LIBRARY_PATH)
set(Python_ADDITIONAL_VERSIONS ${COMPATIBLE_VERSIONS})
find_package(PythonLibs REQUIRED)
set(PYTHON_LIBRARY_PATH ${PYTHON_LIBRARY})
message(STATUS ${PYTHON_LIBRARY_PATH})
else()
message(STATUS "Linking Python extension with provided PYTHON_LIBRARY_PATH variable: " ${PYTHON_LIBRARY_PATH})
endif()
FIND_PACKAGE(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" REQUIRED)
add_library(Python3_LIB STATIC IMPORTED)
set_property(TARGET Python3_LIB PROPERTY IMPORTED_LOCATION ${PYTHON_LIBRARY_PATH})
set_property(TARGET Python3_LIB PROPERTY IMPORTED_LOCATION ${PYTHON_LIBRARY})
message(STATUS "Linking Python extension with PYTHON_LIBRARY variable: " ${PYTHON_LIBRARY})
endif()
# Set -Wl,-undefined,dynamic_lookup to OTHER_LDFLAGS
......
......@@ -111,7 +111,7 @@ class InstallCMakeLibs(install_lib):
os.listdir(bin_dir) if
os.path.isfile(os.path.join(bin_dir, _pyd)) and
os.path.splitext(_pyd)[0].startswith(PACKAGE_NAME) and
os.path.splitext(_pyd)[1] in [".pyd", ".so"]][0]
os.path.splitext(_pyd)[1] in [".pyd", ".so", '.dll']][0]
shutil.move(pyd_path, os.path.join(os.path.split(pyd_path)[0], 'CFML_api', os.path.split(pyd_path)[1]))
# Mark the libs for installation, adding them to
......@@ -219,8 +219,8 @@ class BuildCMakeExt(build_ext):
'-H' + SOURCE_DIR,
'-B' + self.build_temp,
"-DPYTHON_EXECUTABLE:FILEPATH={}".format(sys.executable),
"-DPYTHON_LIBRARY={}".format(sysconfig.get_config_var('LIBDIR')),
"-DPYTHON_INCLUDE_DIR={}".format(sysconfig.get_python_inc()),
# "-DPYTHON_LIBRARY={}".format(sysconfig.get_config_var('LIBDIR')),
# "-DPYTHON_INCLUDE_DIR={}".format(sysconfig.get_python_inc()),
"-DARCH32=OFF",
"-DCMAKE_Fortran_COMPILER={}".format(COMPILER),
"-DPYTHON_API=ON",
......@@ -252,7 +252,7 @@ class BuildCMakeExt(build_ext):
os.listdir(bin_dir) if
os.path.isfile(os.path.join(bin_dir, _pyd)) and
os.path.splitext(_pyd)[0].startswith(PACKAGE_NAME) and
os.path.splitext(_pyd)[1] in [".pyd", ".so"]][0]
os.path.splitext(_pyd)[1] in [".pyd", ".so", '.dll']][0]
shutil.move(pyd_path, extension_path)
# After build_ext is run, the following commands will run:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment