Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #26 from profminton/master
Browse files Browse the repository at this point in the history
Fixed some issues with how libraries are linked in the wheels
  • Loading branch information
carlislewishard authored and GitHub committed Sep 17, 2023
2 parents ed1e3ee + 4fad1a0 commit 1eabc64
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 2,056 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dump*
!tests/**
*ipynb_checkpoints
**/.DS_Store
version.txt
!version.txt
!LICENSE.txt
!requirements.txt
!pyproject.toml
Expand Down
60 changes: 40 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,34 @@ SET(SKBUILD_SCRIPTS_DIR "${CMAKE_SOURCE_DIR}/bin" CACHE STRING "Install location
FILE(READ "version.txt" VERSION)
PROJECT(${SKBUILD_PROJECT_NAME} LANGUAGES C Fortran VERSION ${VERSION})

# Use the old method to get Python packages, as that's what scikit-build uses
IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.27")
CMAKE_POLICY(SET CMP0148 OLD)
ENDIF ()

INCLUDE(GNUInstallDirs)
IF (SKBUILD)
SET(INSTALL_BINDIR ${SKBUILD_PLATLIB_DIR}/${SKBUILD_PROJECT_NAME})
SET(INSTALL_LIBDIR ${SKBUILD_PLATLIB_DIR}/${SKBUILD_PROJECT_NAME})
SET(INSTALL_INCLUDEDIR ${INSTALL_LIBDIR})
IF (APPLE)
SET(CMAKE_INSTALL_RPATH "@loader_path")
ELSEIF (LINUX)
SET(CMAKE_INSTALL_RPATH $ORIGIN)
ENDIF ()
ELSE ()
SET(INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR})
SET(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
SET(INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
ENDIF ()

# Have the .mod files placed in the include folder
SET(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod)

# Add our local modules to the module path
FILE(TO_CMAKE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" LOCAL_MODULE_PATH)
LIST(APPEND CMAKE_MODULE_PATH ${LOCAL_MODULE_PATH})

IF (CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
SET(COMPILER_OPTIONS "Intel" CACHE STRING "Compiler identified as Intel")
ELSEIF (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
Expand All @@ -41,37 +69,29 @@ ENDIF()
# Ensure scikit-build modules
FIND_PACKAGE(Python COMPONENTS Interpreter Development.Module REQUIRED)

# Add our local modules to the module path
FILE(TO_CMAKE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" LOCAL_MODULE_PATH)
LIST(APPEND CMAKE_MODULE_PATH ${LOCAL_MODULE_PATH})

# Define some directories that are important to the build
SET(SRC "${CMAKE_SOURCE_DIR}/src")
SET(LIB "${CMAKE_SOURCE_DIR}/lib")
SET(BIN "${CMAKE_SOURCE_DIR}/bin")
SET(MOD "${CMAKE_SOURCE_DIR}/include")
SET(PY "${CMAKE_SOURCE_DIR}/swiftest")

#####################################
# Tell how to install this executable
#####################################
IF(WIN32)
SET(CMAKE_INSTALL_PREFIX "C:\\Program Files\\swiftest")
FILE(TO_CMAKE_PATH ${CMAKE_INSTALL_PREFIX} CMAKE_INSTALL_PREFIX)
ELSE()
SET(CMAKE_INSTALL_PREFIX /usr/local)
ENDIF(WIN32)

# Make sure paths are correct for Unix or Windows style
FILE(TO_CMAKE_PATH ${SRC} SRC)
FILE(TO_CMAKE_PATH ${LIB} LIB)
FILE(TO_CMAKE_PATH ${BIN} BIN)
FILE(TO_CMAKE_PATH ${MOD} MOD)
FILE(TO_CMAKE_PATH ${PY} PY)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN})

# Have the .mod files placed in the lib folder
SET(CMAKE_Fortran_MODULE_DIRECTORY ${MOD})

# Set the name of the swiftest library
SET(SWIFTEST_LIBRARY swiftest)
SET(SWIFTEST_LIBRARY ${SKBUILD_PROJECT_NAME})

# The source for the SWIFTEST binary and have it placed in the bin folder
ADD_SUBDIRECTORY(${SRC} ${BIN})

ADD_SUBDIRECTORY(${SRC} ${CMAKE_INSTALL_BINDIR})
ADD_SUBDIRECTORY(${PY})

# Add a distclean target to the Makefile
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/set_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ HOMEBREW_PREFIX="$(brew --prefix)"
LD_LIBRARY_PATH="/usr/local/lib:${PREFIX}/lib:${HOMEBREW_PREFIX}/lib"
LDFLAGS="-Wl,-rpath,${ROOT_DIR}/lib -Wl,-no_compact_unwind -L${PREFIX}/lib -L${HOMEBREW_PREFIX}/lib"
CPATH="/usr/local/include:${PREFIX}/include:${HOMEBREW_PREFIX}/include:${ROOT_DIR}/include"
CPPFLAGS="-isystem ${PREFIX}/include -isystem /usr/local/include"
CPPFLAGS="-isystem ${PREFIX}/include -isystem /usr/local/include -Xclang -fopenmp"
LIBS="-lomp"
FCFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
FFFLAGS="${FCFLAGS}"
Expand Down
88 changes: 0 additions & 88 deletions cmake/Modules/FindCython.cmake

This file was deleted.

Loading

0 comments on commit 1eabc64

Please sign in to comment.