-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use configure_file instead of preprocessing
- Loading branch information
Showing
21 changed files
with
119 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,46 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug or Release") | ||
set(CMAKE_BUILD_TYPE Release CACHE STRING "default build type") | ||
endif() | ||
|
||
project(MapTran | ||
LANGUAGES Fortran | ||
VERSION 1.1.1 | ||
VERSION 1.1.2 | ||
HOMEPAGE_URL https://github.com/geospace-code/maptran3d) | ||
enable_testing() | ||
|
||
if(NOT realbits) | ||
set(realbits 64) | ||
endif() | ||
enable_testing() | ||
include(CTest) | ||
include(FeatureSummary) | ||
|
||
include(cmake/compilers.cmake) | ||
|
||
if(realbits EQUAL 32) | ||
set(wp_real "wp=>real32") | ||
else() | ||
set(wp_real "wp=>real64") | ||
endif() | ||
|
||
# OPTIONAL link-time optimization | ||
if(CMAKE_BUILD_TYPE STREQUAL Release) | ||
include(CheckIPOSupported) | ||
check_ipo_supported(RESULT lto_ok OUTPUT _err) | ||
|
||
if(lto_ok) | ||
message(STATUS "IPO / LTO enabled") | ||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) | ||
else() | ||
message(STATUS "IPO / LTO disabled: ${_err}") | ||
endif() | ||
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) | ||
if(CMAKE_BUILD_TYPE STREQUAL Release) | ||
include(CheckIPOSupported) | ||
check_ipo_supported(RESULT lto_ok OUTPUT _err) | ||
|
||
if(lto_ok) | ||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) | ||
set(CTEST_TEST_TIMEOUT 30) | ||
|
||
# --- Maptran library | ||
add_library(maptran) | ||
target_compile_definitions(maptran PRIVATE REALBITS=${realbits}) | ||
target_include_directories(maptran INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> | ||
$<INSTALL_INTERFACE:include>) | ||
set_target_properties(maptran PROPERTIES | ||
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include) | ||
add_library(maptran::maptran ALIAS maptran) | ||
install(TARGETS maptran | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib) | ||
|
||
add_subdirectory(src) | ||
add_subdirectory(src/tests) | ||
|
||
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) | ||
add_subdirectory(src/tests) | ||
|
||
add_feature_info(ipo lto_ok "Interprocess / Link optimization ${_err}") | ||
feature_summary(WHAT ALL) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
option('realbits', type : 'combo', choices : ['64', '32', '128'], description: 'bits of precision for real') | ||
option('realbits', type : 'combo', choices : ['64', '32'], description: 'bits of precision for real') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
target_sources(maptran PRIVATE maptran.F90 aer.f90 ecef.f90 enu.f90 vallado.F90 utils.f90) | ||
if(f03nan) | ||
target_sources(maptran PRIVATE sphere.f90) | ||
else() | ||
target_sources(maptran PRIVATE no_sphere.f90) | ||
endif() | ||
configure_file(maptran.in.f90 maptran.f90) | ||
configure_file(vallado.in.f90 vallado.f90) | ||
|
||
add_library(maptran | ||
${CMAKE_CURRENT_BINARY_DIR}/maptran.f90 ${CMAKE_CURRENT_BINARY_DIR}/vallado.f90 | ||
aer.f90 ecef.f90 enu.f90 sphere.f90 utils.f90) | ||
|
||
target_include_directories(maptran INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> | ||
$<INSTALL_INTERFACE:include>) | ||
|
||
set_target_properties(maptran PROPERTIES | ||
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} | ||
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} | ||
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include) | ||
|
||
add_library(maptran::maptran ALIAS maptran) | ||
|
||
install(TARGETS maptran | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
submodule (maptran) aer | ||
|
||
implicit none (external) | ||
implicit none (type, external) | ||
|
||
contains | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
submodule (maptran) ecef | ||
|
||
implicit none (external) | ||
implicit none (type, external) | ||
|
||
contains | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
submodule (maptran) enu | ||
|
||
implicit none (external) | ||
implicit none (type, external) | ||
|
||
contains | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
srcs = files('maptran.F90', 'vallado.F90', 'aer.f90', 'ecef.f90', 'enu.f90', 'sphere.f90', 'utils.f90') | ||
configure_file( | ||
input : 'maptran.in.f90', | ||
output : 'maptran.f90', | ||
configuration : wp_conf) | ||
|
||
configure_file( | ||
input : 'vallado.in.f90', | ||
output : 'vallado.f90', | ||
configuration : wp_conf | ||
) | ||
|
||
srcs = files('aer.f90', 'ecef.f90', 'enu.f90', 'sphere.f90', 'utils.f90', | ||
meson.current_build_dir() / 'maptran.f90', | ||
meson.current_build_dir() / 'vallado.f90') |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
submodule (maptran) sphere | ||
|
||
implicit none (external) | ||
implicit none (type, external) | ||
|
||
contains | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
add_executable(test_maptran test_mod.f90 assert.F90) | ||
configure_file(assert.in.f90 assert.f90) | ||
|
||
add_executable(test_maptran test_mod.f90 ${CMAKE_CURRENT_BINARY_DIR}/assert.f90) | ||
target_link_libraries(test_maptran maptran::maptran) | ||
target_compile_definitions(test_maptran PRIVATE REALBITS=${realbits}) | ||
add_test(NAME unit:maptran COMMAND $<TARGET_FILE:test_maptran>) | ||
|
||
if(NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) | ||
return() | ||
endif() | ||
|
||
add_executable(benchmark_maptran benchmark.f90) | ||
target_link_libraries(benchmark_maptran maptran::maptran) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.