Skip to content

Commit

Permalink
removed skbuild cmake modules. Instead, they are looked for or supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholaswogan committed Oct 27, 2023
1 parent 1e4b0df commit 3e5ae55
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 2,365 deletions.
19 changes: 16 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION "3.14")
cmake_policy(SET CMP0148 OLD) # To suppress a warning emerging from scikit-build

project(Clima LANGUAGES Fortran C VERSION "0.3.11")

Expand All @@ -8,8 +9,10 @@ set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/modules")
include(cmake/CPM.cmake)

# options
option(SKBUILD "Should be ON of being build by skbuild,
and OFF of being build by regular cmake" OFF)
if (NOT DEFINED SKBUILD)
set(SKBUILD OFF CACHE STRING )
endif()
message(STATUS "The project is built using scikit-build: ${SKBUILD}")

option(BUILD_EXECUTABLES "if ON, then will build the
Fortran executables" ON)
Expand All @@ -30,7 +33,17 @@ add_subdirectory(tests)

if (BUILD_PYTHON_CLIMA)
if (NOT SKBUILD)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
if (NOT DEFINED SKBUILD_CMAKE_MODULE_DIR)
# Here, we try to find scikit-build cmake modules
find_package(Python COMPONENTS Development)
set(SKBUILD_CMAKE_MODULE_DIR "${Python_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/skbuild/resources/cmake")
endif()
if (EXISTS ${SKBUILD_CMAKE_MODULE_DIR})
message(STATUS "Scikit-build CMake modules: ${SKBUILD_CMAKE_MODULE_DIR}")
else()
message(FATAL_ERROR "Failed to find scikit-build CMake modules in directory: ${SKBUILD_CMAKE_MODULE_DIR}")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SKBUILD_CMAKE_MODULE_DIR})
endif()

find_package(PythonExtensions REQUIRED)
Expand Down
88 changes: 0 additions & 88 deletions cmake/FindCython.cmake

This file was deleted.

125 changes: 0 additions & 125 deletions cmake/FindF2PY.cmake

This file was deleted.

104 changes: 0 additions & 104 deletions cmake/FindNumPy.cmake

This file was deleted.

Loading

0 comments on commit 3e5ae55

Please sign in to comment.