Skip to content

Commit

Permalink
14 user friendly installation (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
krystophny authored Jan 2, 2025
2 parents 0264a4d + b60b1e2 commit 927eb1b
Show file tree
Hide file tree
Showing 41 changed files with 550 additions and 2,748 deletions.
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ cmake_version.f90
# File is created automatically from ?.
version.f90

# The make file is created by the cmake system, and thus not under
# version controll.
Makefile

BuildConfig.txt

# Ignore created executable.
Expand All @@ -39,6 +35,9 @@ install_manifest.txt
NEO-2-QL/.directory

# Ignore directories for building the code.
[Bb]uild/*
[Bb]uild-*/*
*/[Bb]uild_*/*
*/[Bb]uild/*
*/[Bb]uild-*/*
*/[Bb]uild_*/*
Expand All @@ -63,3 +62,7 @@ NEO-2-QL/.directory
*.toc
DOC/html/*
DOC/latex/*
*-SAVE-ERROR
build/cmake_install.cmake

.DS_Store
4 changes: 2 additions & 2 deletions Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Here is a list of libraries and tools required for building/running neo2.
* cmake
Used for configuration, has so far only been used in connection with
GNUMake.
* SuiteSparse, SuperLU
* ATLAS, OpenBLAS
* SuiteSparse
* Either OpenBLAS, MKL, or ATLAS for LAPACK/BLAS
* GSL, FGSL
* MPI
Used for parallelization.
Expand Down
115 changes: 115 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
cmake_minimum_required(VERSION 3.24)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)

project(NEO-2)
enable_language(C Fortran)

set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

if(EXISTS ${CMAKE_BINARY_DIR}/BuildConfig.cmake.in)
include (${CMAKE_BINARY_DIR}/BuildConfig.cmake.in)
endif()
include(${CMAKE_SOURCE_DIR}/COMMON/ProjectConfig.cmake.in)

if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
message("Building in release mode (default)...")
set(CMAKE_BUILD_TYPE "Release")
endif()

option(MPI_SUPPORT "Enable MPI support?" ON)
option(MPE_SUPPORT "Enable MPE for graphical MPI work load evaluation?" OFF)

### Compiler flags
message(STATUS "The Compiler ID is ${CMAKE_Fortran_COMPILER_ID}")

if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_Fortran_FLAGS_RELEASE " -O2 -cpp -ffpe-summary=invalid,zero,overflow")
elseif (CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
message(STATUS "Setting Intel flags.")
set(CMAKE_Fortran_FLAGS_RELEASE " -O2 -cpp -mkl -heap-arrays -stand f08")
endif()

if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(MY_DEBUG_FLAG_LIST
" -O0 -cpp -g"
" -ffpe-summary=invalid,zero,overflow "
" -fcheck=all "
" -fbacktrace "
" -Wall "
" -Wno-unused-variable -Wno-unused-dummy-argument -Wno-unused-label "
" -Wshadow "
)
string(REPLACE ";" "" MY_DEBUG_FLAG ${MY_DEBUG_FLAG_LIST})
set(CMAKE_Fortran_FLAGS_DEBUG "${MY_DEBUG_FLAG}")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
set(CMAKE_Fortran_FLAGS_DEBUG "-cpp -mkl -g -warn all -stand f08 ")
endif()

set (CMAKE_Fortran_FLAGS_COVERAGE "--coverage")
set (CMAKE_Fortran_FLAGS_TEST "-O2 --coverage")

### Upstream dependencies
find_package(MPI REQUIRED)
include_directories(${MPI_Fortran_INCLUDE_PATH})

if(MPI_SUPPORT)
message(STATUS "MPI-Support activated")
if (DEFINED MPI_PATH)
include_directories(${MPI_PATH}/include)
endif ()
add_definitions(-DMPI_SUPPORT)
endif()

if(MPE_SUPPORT)
message(STATUS "MPE-Support activated, MPE-Path: ${MPE_PATH}")
if (DEFINED MPE_PATH)
include_directories(${MPE_PATH}/include)
endif ()
add_definitions(-DMPE_SUPPORT)
find_library(MPE_lib mpe ${MPE_PATH}/lib)
endif()

find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)

find_package(SuiteSparse)
if(SUITESPARSE_FOUND)
# In Debian bookworm being standard in 2025, SuiteSparse v5.12 packages don't have
# their own CMake files for find_package. As soon as this changes,
# find_package(SuiteSparse) should be replaced by find_package(UMFPACK) and
# the legacy switch removed.
set(LEGACY_SUITESPARSE ON)
message(STATUS "SuiteSparse found.")
else()
# Use more recent SuiteSparse v7.6.1 from GitHub.
message(STATUS "SuiteSparse not found. Building.")
include(suitesparse)
endif()

find_package(HDF5 COMPONENTS C HL Fortran Fortran_HL REQUIRED)

find_package(GSL REQUIRED)

include_directories(${NEO2_Inc})
include_directories(${NEO2_Inc}/src)
include_directories(${NEO2_Libs}/include)
include_directories(${CMAKE_BINARY_DIR}/COMMON)
include_directories(${FGSL_INC})

### Projects to build
add_subdirectory(COMMON)
add_subdirectory(NEO-2-PAR)
add_subdirectory(NEO-2-QL)
add_subdirectory(MULTI-SPEC-TOOLS)
add_subdirectory(tools/create_surfaces)

### Optional target for docs
find_package(LATEX)
find_package(Doxygen OPTIONAL_COMPONENTS dot)
if(LATEX_FOUND AND DOXYGEN_FOUND AND NOT DOXYGEN_DOT_EXECUTABLE STREQUAL "")
message(STATUS "Documentation will be built.")
add_subdirectory(DOC EXCLUDE_FROM_ALL)
else()
message(STATUS "Documentation will not be built.")
endif()
30 changes: 30 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "default",
"description": "Default build using Ninja generator",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build"
}
],
"buildPresets": [
{
"name": "default",
"configurePreset": "default"
}
],
"testPresets": [
{
"name": "default",
"configurePreset": "default",
"output": {"outputOnFailure": true},
"execution": {"noTestsAction": "error", "stopOnFailure": true}
}
]
}
98 changes: 0 additions & 98 deletions COMMON/CMAKE_TOOLS/FindSuperLU.cmake

This file was deleted.

71 changes: 0 additions & 71 deletions COMMON/CMAKE_TOOLS/MacroCompareVersionStrings.cmake

This file was deleted.

Loading

0 comments on commit 927eb1b

Please sign in to comment.