Unverified Commit 72029502 authored by Simon Ward's avatar Simon Ward
Browse files

Add (WIN32 OR MSYS) checks

parent 5d9eb18a
......@@ -20,7 +20,7 @@ target_link_libraries(read_nexus crysfml)
link_directories(${HDF5_LIBRARY_DIR})
target_link_libraries(read_nexus ${HDF5_LIBRARIES})
if(WIN32)
if(WIN32 OR MSYS)
get_filename_component(COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME_WE)
if(COMPILER_NAME STREQUAL ifort)
# Copy hdf5.dll hdf5_f90cstub.dll hdf5_fortran.dll
......
......@@ -34,22 +34,15 @@ add_dependencies(${LIBRARY_NAME} crysfml_common)
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)
FIND_PACKAGE(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" REQUIRED)
if(WIN32 OR MSYS)
FIND_PACKAGE(PythonLibs REQUIRED)
# 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})
message(STATUS "Linking Python extension with PYTHON_LIBRARY variable: " ${PYTHON_LIBRARY})
elseif()
message(STATUS "Not linking Python extension with PYTHON_LIBRARY variable")
endif()
# Set -Wl,-undefined,dynamic_lookup to OTHER_LDFLAGS
......@@ -59,7 +52,7 @@ target_link_libraries(${LIBRARY_NAME} crysfml_common)
# Fix a problem on Mac OS X when building shared libraries
if(APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")
elseif(WIN32)
elseif(WIN32 OR MSYS)
target_link_libraries(${LIBRARY_NAME} Python3_LIB)
endif()
......@@ -71,7 +64,7 @@ set(LIBRARY_FILENAME "crysfml_api.so")
if(APPLE)
set_target_properties(${LIBRARY_NAME} PROPERTIES SUFFIX ".so")
set(LIBRARY_FILENAME "crysfml_api.so")
elseif(WIN32)
elseif(WIN32 OR MSYS)
set_target_properties(${LIBRARY_NAME} PROPERTIES SUFFIX ".pyd")
set(LIBRARY_FILENAME "crysfml_api.pyd")
endif()
......@@ -143,7 +136,7 @@ endif()
#################################
# The rules for installing the library.
install(DIRECTORY "" DESTINATION ${PYTHON_API_PREFIX}/CFML_api FILES_MATCHING PATTERN "*.py" PATTERN "Extensions" EXCLUDE)
if(WIN32)
if(WIN32 OR MSYS)
install(TARGETS ${LIBRARY_NAME} RUNTIME DESTINATION ${PYTHON_API_PREFIX}/CFML_api)
else()
install(TARGETS ${LIBRARY_NAME} LIBRARY DESTINATION ${PYTHON_API_PREFIX}/CFML_api)
......
......@@ -4,7 +4,7 @@
# The CFML_GlobalDeps module is OS and compiler dependent.
# WINDOWS
if(WIN32)
if(WIN32 OR MSYS)
# Intel Fortran compiler
if(${COMPILER_NAME} STREQUAL ifort)
if(ARCH32)
......
......@@ -2,7 +2,7 @@
# CFML_GlobalDeps
# This module is OS and compiler dependent.
if(WIN32)
if(WIN32 OR MSYS)
# Windows
if(${COMPILER_NAME} STREQUAL ifort)
# Intel Fortran compiler
......
......@@ -7,7 +7,7 @@ set(WINTER "$ENV{WINTER}")
set(WINT "$ENV{WINT}")
if (WIN32)
if (WIN32 OR MSYS)
# Windows
string(REGEX REPLACE "\\\\" "/" WINTERACTER "${WINTERACTER}")
......
......@@ -18,7 +18,7 @@ if(HDF5_LIBRARY_PATH)
elseif(UNIX)
set(LIBS1 hdf5 hdf5_fortran)
set(LIBS2 m dl sz z pthread)
elseif(WIN32)
elseif(WIN32 OR MSYS)
get_filename_component(COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME_WE)
if(COMPILER_NAME STREQUAL ifort)
set(LIBS1 hdf5 hdf5_fortran hdf5_f90cstub szip zlib)
......
......@@ -7,7 +7,7 @@ macro(set_compiler_flags)
if(COMPILER_NAME STREQUAL ifort)
if(WIN32)
if(WIN32 OR MSYS)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
if (HEAP_ARRAYS)
set(CMAKE_Fortran_FLAGS_DEBUG "/debug:full /traceback /nologo /fpp /Qopt-report=0 /heap-arrays")
......@@ -68,7 +68,7 @@ macro(set_compiler_flags)
elseif(COMPILER_NAME STREQUAL g95)
if(WIN32)
if(WIN32 OR MSYS)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(CMAKE_Fortran_FLAGS_DEBUG "-ftrace=full -std=f2003")
set(OPT_FLAGS "-O0")
......@@ -104,7 +104,7 @@ macro(set_compiler_flags)
elseif(COMPILER_NAME MATCHES "^gfortran")
if(WIN32)
if(WIN32 OR MSYS)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(CMAKE_Fortran_FLAGS_DEBUG "-fbacktrace -ffree-line-length-none")
set(OPT_FLAGS0 "-O0")
......
......@@ -6,7 +6,7 @@ macro(set_compiler_flags_08)
get_filename_component(COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME_WE)
if(WIN32)
if(WIN32 OR MSYS)
if(COMPILER_NAME STREQUAL ifort)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(OPT_FLAGS "/nologo")
......
......@@ -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",
......
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