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

Merge branch 'CFML_build_updates' into feature-python_api-build_wheels

parents 485f77b9 e8e9b15b
Pipeline #10436 failed with stages
in 8 minutes and 21 seconds
......@@ -51,45 +51,69 @@ jobs:
FC: gfortran-${{ matrix.gcc_v }}
CC: gcc-${{ matrix.gcc_v }}
run: |
pip3 wheel ./ --no-deps -w ./dist/
delocate-wheel -w fixed_wheels -v ./dist/*.whl
pip3 wheel ./ --no-deps -w ./old/
delocate-wheel -w dist -v ./old/*.whl
- uses: actions/upload-artifact@v2
with:
name: CrysFML - ${{ matrix.os }} - Python ${{ matrix.python-version }}
path: ./fixed_wheels/*.whl
# create-Windows:
# strategy:
# max-parallel: 1
# matrix:
# python-version: [ '3.6', '3.7', '3.8', '3.9', '3.10' ]
# os: [ windows-latest ]
#
# runs-on: ${{ matrix.os }}
#
# steps:
# - uses: actions/checkout@v2
#
# - name: Setup python
# uses: actions/setup-python@v1
# with:
# python-version: ${{matrix.python-version}}
#
# - name: Install cmake
# run: pip install cmake wheel
#
# - name: Install Fotran
# run: |
# choco install mingw -y
# echo 'C:\\ProgramData\\chocolatey\\bin' >> $GITHUB_PATH
#
# - name: Build CFML (Windows)
# run: pip wheel ./ --no-deps -w ./dist/
# env:
# FC: gfortran.exe
#
# - uses: actions/upload-artifact@v2
# with:
# name: CrysFML - ${{ matrix.os }} - Python ${{ matrix.python-version }}
# path: ./dist/*.whl
path: ./dist/*.whl
create-Windows:
strategy:
max-parallel: 4
matrix:
python-version: [ '3.6', '3.7']
os: [ windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: ${{matrix.python-version}}
- name: Install wheel
run: pip install wheel
- uses: msys2/setup-msys2@v2
with:
msystem: MSYS
install: cmake mingw-w64-x86_64-toolchain
update: true
path-type: inherit
- name: Build CFML
shell: msys2 {0}
id: build
run: pip wheel ./ --no-deps -w ./dist/
env:
MINGW_ARCH: MINGW64
- uses: actions/upload-artifact@v2
with:
name: CrysFML - ${{ matrix.os }} - Python ${{ matrix.python-version }}
path: ./dist/*.whl
Upload_Artifacts:
runs-on: ubuntu-latest
needs: [create-Linux, create-OSX, create-Windows]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- name: Upload Artifacts GitHub releases
# if: github.event_name == 'push'
uses: ncipollo/release-action@v1
with:
draft: falase
prerelease: true
allowUpdates: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "./dist/*.whl"
tag: ${{ env.BRANCH_NAME }}
commit: ${{ env.BRANCH_NAME }}
bodyFile: "RELEASE.md"
......@@ -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
......
......@@ -29,53 +29,33 @@ set_source_files_properties(forpy_mod.f90 PROPERTIES COMPILE_FLAG "-cpp")
# Dependencies section
#################################
# Add a dependency to crysfml_common to keep sure that the crysfml_common library will be built first.
# 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()
#
# 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()
set(Python3_USE_STATIC_LIBS, ON)
find_package(Python3 COMPONENTS Interpreter Development)
set(PYTHON_INTERPRETER_PATH ${Python3_EXECUTABLE})
# if (UNIX)
# add_library(Python3_LIB SHARED IMPORTED)
# set_property(TARGET Python3_LIB PROPERTY IMPORTED_LOCATION ${PYTHON_LIBRARY_PATH})
# elseif(WIN32)
# add_library(Python3_LIB STATIC IMPORTED)
# set_property(TARGET Python3_LIB PROPERTY IMPORTED_LOCATION ${PYTHON_LIBRARY_PATH})
# endif()
if(WIN32 OR MSYS)
target_link_libraries(${LIBRARY_NAME} Python3::Python)
endif()
# Set -Wl,-undefined,dynamic_lookup to OTHER_LDFLAGS
# Set include and linking
include_directories(${CRYSFML_COMMON_MODULE_DIRECTORY})
target_link_libraries(${LIBRARY_NAME} crysfml_common)
# Fix a problem on Mac OS X when building shared libraries
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")
endif()
# target_link_libraries(${LIBRARY_NAME} Python3_LIB)
# Set library extension
set_target_properties(${LIBRARY_NAME} PROPERTIES PREFIX "" OUTPUT_NAME ${LIBRARY_NAME})
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()
......@@ -147,7 +127,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)
......
This is a build of the CFML libraries.
\ No newline at end of file
......@@ -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")
......
......@@ -5,6 +5,7 @@ import shutil
import struct
import sys
import setuptools
import distutils.sysconfig as sysconfig
from distutils.core import setup
from distutils.command.install_data import install_data
from subprocess import CalledProcessError, check_output, check_call
......
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