Skip to content

Commit

Permalink
fortran/meshfem2d now fully compilable without specfempp cmakelists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
lsawade committed Feb 12, 2025
1 parent b139965 commit f3e1bd2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 9 additions & 3 deletions fortran/meshfem2d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ option(WITH_SCOTCH "Build with SCOTCH support" OFF)

# Set output file directories
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran/meshfem2d/modules)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/archive)

message("-- CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
message("-- CMAKE_Fortran_MODULE_DIRECTORY: ${CMAKE_Fortran_MODULE_DIRECTORY}")
message("-- CMAKE_ARCHIVE_OUTPUT_DIRECTORY: ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
message("-- CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")

# Custom variables
set(SETUP_DIR ${CMAKE_BINARY_DIR}/fortran/meshfem2d/setup)
set(SETUP_DIR ${CMAKE_CURRENT_BINARY_DIR}/setup)

# Set include directories
include_directories("${CMAKE_BINARY_DIR}/fortran/meshfem2d/modules")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/modules")
include_directories(${SETUP_DIR})

# Setting values dependent on options
Expand Down
12 changes: 6 additions & 6 deletions fortran/meshfem2d/setup/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ message("-- Configuring meshfem2D headers...")

enable_language(Fortran)

set(SETUP_DIR ${CMAKE_CURRENT_BINARY_DIR})

# ===================== config.h.in START =====================

Expand All @@ -13,7 +14,6 @@ include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
include(CheckCCompilerFlag)
# include(CheckFortranCompiler)
include(CheckFortranCompilerFlag)

# Check for headers
Expand Down Expand Up @@ -150,24 +150,24 @@ endif()

# Generate config.h file
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_BINARY_DIR}/fortran/meshfem2d/setup/config.h @ONLY)
${SETUP_DIR}/config.h @ONLY)

# ===================== config.h.in END =====================

# ===================== config.fh.in START ==================
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.fh.in
${CMAKE_BINARY_DIR}/fortran/meshfem2d/setup/config.fh @ONLY)
${SETUP_DIR}/config.fh @ONLY)
# ===================== config.fh.in END ====================


# ===================== constants.h.in START ================
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/constants.h.in
${CMAKE_BINARY_DIR}/fortran/meshfem2d/setup/constants.h @ONLY)
${SETUP_DIR}/constants.h @ONLY)
# ===================== constants.h.in END ==================

# ===================== precision.h.in START ================
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/precision.h.in
${CMAKE_BINARY_DIR}/fortran/meshfem2d/setup/precision.h @ONLY)
${SETUP_DIR}/precision.h @ONLY)
# ===================== precision.h.in END ==================


Expand All @@ -194,7 +194,7 @@ set(GIT_DATE_VERSION "2023-03-21 19:54:51 +0100")

# Configure the config.h file
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.fh.in
${CMAKE_BINARY_DIR}/fortran/meshfem2d/setup/version.fh @ONLY)
${SETUP_DIR}/version.fh @ONLY)


# ===================== version.h.in START ================

0 comments on commit f3e1bd2

Please sign in to comment.