Skip to content

Commit 5a9ad88

Browse files
committed
Merge branch 'release/0.7.0'
* release/0.7.0: FCKIT-25 Workaround PGI compiler bug in test FCKIT-24 Port to ecbuild3 Cosmetic internal change: Rename JSON to YAML FCKIT-22 Fix fckit_test_shared_ptr on Cray by avoiding a SEGV due to compiler bug FCKIT-21 Workaround GCC internal compiler bug FCKIT-20 Access MPI_INFO_NULL
2 parents 592f58b + afe606d commit 5a9ad88

33 files changed

+408
-262
lines changed

CMakeLists.txt

+38-33
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,20 @@
1010
# FCKIT
1111

1212
cmake_minimum_required( VERSION 3.6 FATAL_ERROR )
13+
if( POLICY CMP0074 )
14+
cmake_policy( SET CMP0074 NEW )
15+
# This policy allows to search for packages with <package>_ROOT variables
16+
# (only supported with CMake 3.12 and above)
17+
# This policy can be removed once cmake_minimum_required( VERSION 3.12 ) is used
18+
endif()
1319

14-
set( ENABLE_OS_TESTS OFF CACHE BOOL " " )
15-
set( ENABLE_LARGE_FILE_SUPPORT OFF CACHE BOOL " " )
16-
17-
project( fckit C CXX Fortran )
18-
19-
set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild/cmake")
20-
set( ECBUILD_DEFAULT_BUILD_TYPE Release )
21-
22-
include( ecbuild_system NO_POLICY_SCOPE )
20+
find_package( ecbuild 3.0.0 REQUIRED )
2321

24-
ecbuild_requires_macro_version( 2.7 )
22+
project( fckit LANGUAGES C CXX Fortran )
2523

2624
set(CMAKE_CXX_STANDARD 11)
2725
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2826

29-
################################################################################################
30-
# project
31-
32-
ecbuild_declare_project()
33-
3427
################################################################################################
3528
# options & dependencies
3629

@@ -43,18 +36,21 @@ ecbuild_check_fortran( FEATURES finalization )
4336

4437
set( FEATURE_FINAL_DEFAULT ON )
4538
if( CMAKE_Fortran_COMPILER_ID MATCHES "PGI" )
46-
# Compilation works, but runtime segmentation faults occur (tested with pgi/17.7)
47-
set( FEATURE_FINAL_DEFAULT OFF )
39+
if( ${CMAKE_Fortran_COMPILER_VERSION} VERSION_LESS 19.10 )
40+
# Compilation works, but runtime segmentation faults occur (tested with pgi/17.7)
41+
set( FEATURE_FINAL_DEFAULT OFF )
42+
else()
43+
list( APPEND FCKIT_QUARANTAINED_TESTS fckit_test_shared_ptr )
44+
# deallocation of list of shared_ptr only seems to deallocate first entry
45+
endif()
4846
endif()
4947

5048
ecbuild_add_option( FEATURE FINAL
5149
DESCRIPTION "Enable automatic finalisation for derived types (destructors)"
5250
DEFAULT ${FEATURE_FINAL_DEFAULT}
5351
CONDITION EC_HAVE_Fortran_FINALIZATION )
5452

55-
set( FCKIT_HAVE_FINAL 0 )
56-
if( ENABLE_FINAL )
57-
set( FCKIT_HAVE_FINAL 1 )
53+
if( fckit_HAVE_FINAL )
5854
include( final-support )
5955
check_final_support()
6056
ecbuild_info( "FCKIT_HAVE_FINAL [1]")
@@ -67,8 +63,8 @@ if( ENABLE_FINAL )
6763
ecbuild_info( " FCKIT_FINAL_BROKEN_FOR_ALLOCATABLE_ARRAY = ${FCKIT_FINAL_BROKEN_FOR_ALLOCATABLE_ARRAY}")
6864
ecbuild_info( " FCKIT_FINAL_BROKEN_FOR_AUTOMATIC_ARRAY = ${FCKIT_FINAL_BROKEN_FOR_AUTOMATIC_ARRAY}")
6965
endif()
70-
if( NOT FCKIT_HAVE_FINAL )
71-
ecbuild_info( "FCKIT_HAVE_FINAL [0]")
66+
if( NOT fckit_HAVE_FINAL )
67+
ecbuild_info( "fckit_HAVE_FINAL [0]")
7268
set( FCKIT_FINAL_FUNCTION_RESULT 0 )
7369
set( FCKIT_FINAL_UNINITIALIZED_LOCAL 0 )
7470
set( FCKIT_FINAL_UNINITIALIZED_INTENT_OUT 0 )
@@ -79,19 +75,33 @@ if( NOT FCKIT_HAVE_FINAL )
7975
set( FCKIT_FINAL_BROKEN_FOR_AUTOMATIC_ARRAY 0 )
8076
endif()
8177

78+
ecbuild_find_package( NAME eckit VERSION 0.21.0 QUIET )
8279
ecbuild_add_option( FEATURE ECKIT
8380
DESCRIPTION "Wrap ecKit functionality"
84-
REQUIRED_PACKAGES "PROJECT eckit VERSION 0.21.0" )
85-
86-
ecbuild_add_cxx11_flags()
81+
CONDITION eckit_FOUND )
82+
if( NOT fckit_HAVE_ECKIT )
83+
ecbuild_warn("ecKit could not be found. This disables various fckit features such as MPI, Configuration, Logging")
84+
endif()
8785

88-
if( HAVE_ECKIT AND NOT ECKIT_HAVE_MPI )
86+
## MPI
87+
set( fckit_HAVE_ECKIT_MPI_PARALLEL 0 )
88+
if( fckit_HAVE_ECKIT )
89+
if( NOT ECKIT_HAVE_MPI )
90+
set( fckit_HAVE_ECKIT_MPI_PARALLEL 0 )
91+
set( HAVE_MPI 0 )
92+
else()
93+
set( fckit_HAVE_ECKIT_MPI_PARALLEL 1 )
94+
set( HAVE_MPI 1 )
95+
endif()
96+
endif()
97+
set( fckit_HAVE_MPI ${HAVE_MPI} )
98+
if( fckit_HAVE_ECKIT AND NOT fckit_HAVE_MPI )
8999
ecbuild_warn("ecKit has been compiled without MPI. This causes fckit to not be able to run parallel executables.")
90100
endif()
91101

92-
if( ECKIT_VERSION VERSION_LESS "0.25" )
102+
if( eckit_VERSION VERSION_LESS "0.25" )
93103
set( ECKIT_IMPROVED_MPI 0 )
94-
if( HAVE_ECKIT )
104+
if( fckit_HAVE_ECKIT )
95105
ecbuild_warn( "eckit version does not allow support for"
96106
"- fckit_mpi_comm%set_default()"
97107
"- fckit_mpi_comm%name()"
@@ -104,10 +114,6 @@ endif()
104114
################################################################################################
105115
# export package info
106116

107-
list( APPEND FCKIT_INCLUDE_DIRS
108-
${CMAKE_CURRENT_SOURCE_DIR}/src
109-
${CMAKE_CURRENT_BINARY_DIR}/src
110-
${CMAKE_Fortran_MODULE_DIRECTORY})
111117
set( FCKIT_LIBRARIES fckit )
112118

113119
################################################################################################
@@ -118,7 +124,6 @@ set( FCTEST_GENERATOR ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/fct
118124
include( fckit_preprocess_fypp )
119125
include( add_fctest )
120126

121-
set( HAVE_FCTEST 1)
122127
add_subdirectory( src )
123128
add_subdirectory( doc )
124129

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.7.0

VERSION.cmake

-1
This file was deleted.

bamboo/flags.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#set( ECBUILD_2_COMPAT OFF CACHE BOOL "Disable ecbuild 2 compat mode for bamboo testing" )

cmake/fckit_preprocess_fypp.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function( fckit_target_preprocess_fypp _PAR_TARGET )
190190
set( source_files_properties ${source} PROPERTIES HEADER_FILE_ONLY TRUE )
191191
endforeach()
192192

193-
### BUG WORKAROUND (tested upto 3.13.2)
193+
### BUG WORKAROUND (tested upto CMake 3.13.2)
194194
# Even though source files to be preprocessed with final extension .F90 have just been
195195
# declared as HEADER_FILE_ONLY, CMake still tries to compile these files.
196196
# This does not happen for files ending with other extensions ( .fypp )

doc/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
# granted to it by virtue of its status as an intergovernmental organisation nor
77
# does it submit to any jurisdiction.
88

9+
find_package(FORD QUIET)
910
ecbuild_add_option(
1011
FEATURE DOCS
1112
DESCRIPTION "Generate reference documentation"
12-
REQUIRED_PACKAGES "FORD QUIET" )
13+
CONDITION FORD_FOUND )
1314

1415
if( HAVE_DOCS )
1516

@@ -27,7 +28,7 @@ if( HAVE_DOCS )
2728
list( APPEND FORD_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FORDFILE}.in ${CMAKE_CURRENT_SOURCE_DIR}/${FORDPREPROCESSOR}.in )
2829

2930
add_custom_command(OUTPUT "ford/index.html"
30-
COMMAND ${FORD_EXECUTABLE} --debug "${CMAKE_CURRENT_BINARY_DIR}/${FORDFILE}"
31+
COMMAND ${FORD_EXECUTABLE} --debug "${CMAKE_CURRENT_BINARY_DIR}/${FORDFILE}"
3132
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
3233
DEPENDS ${FORD_DEPENDS}
3334
COMMENT "Building HTML documentation for ${CMAKE_PROJECT_NAME} using FORD (${CMAKE_CURRENT_BINARY_DIR}/ford/index.html)" )

src/fctest_examples/CMakeLists.txt doc/fctest_examples/CMakeLists.txt

+10-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
# granted to it by virtue of its status as an intergovernmental organisation nor
77
# does it submit to any jurisdiction.
88

9-
if( HAVE_FCTEST )
9+
cmake_minimum_required( VERSION 3.6 FATAL_ERROR )
10+
11+
find_package( ecbuild 3.0.0 REQUIRED )
12+
13+
project( fctest_examples VERSION 0.0.0 LANGUAGES Fortran )
14+
15+
ecbuild_enable_fortran( REQUIRED MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/module )
16+
17+
find_package( fckit REQUIRED )
1018

1119
ecbuild_add_library( TARGET fctest_example_lib
1220
SOURCES fctest_example_lib.F90
@@ -19,7 +27,5 @@ add_fctest( TARGET fctest_example_simple
1927

2028
add_fctest( TARGET fctest_example_with_fixture
2129
LINKER_LANGUAGE Fortran
22-
SOURCES fctest_example_with_fixture.F90
23-
)
30+
SOURCES fctest_example_with_fixture.F90 )
2431

25-
endif()

doc/ford.md.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project: fcKit
22
project_website: https://software.ecmwf.int/wiki/display/FCKIT
33
project_github: https://github.com/ecmwf/fckit
4-
version: @FCKIT_VERSION@
4+
version: @fckit_VERSION@
55
summary: Fortran support library
66
author: ECMWF
77
author_website: www.ecmwf.int

fckit-import.cmake.in

+13-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
# granted to it by virtue of its status as an intergovernmental organisation nor
77
# does it submit to any jurisdiction.
88

9-
if( @PNAME@_IS_BUILD_DIR_EXPORT OR @PROJECT_NAME@_IS_BUILD_DIR_EXPORT )
10-
# @PNAME@_IS_BUILD_DIR is not defined when ECBUILD_2_COMPAT=OFF
9+
if( @PROJECT_NAME@_IS_BUILD_DIR_EXPORT )
1110
set( FCTEST_GENERATOR @PYTHON_EXECUTABLE@ @CMAKE_CURRENT_SOURCE_DIR@/tools/fctest-generate-runner.py )
1211
set( FYPP @CMAKE_CURRENT_SOURCE_DIR@/tools/fckit-eval.sh @PYTHON_EXECUTABLE@ @CMAKE_CURRENT_SOURCE_DIR@/tools/fckit-fypp.py )
1312
else()
@@ -20,9 +19,18 @@ endif()
2019

2120
@ADD_FCTEST@
2221

23-
# Required when "ECBUILD_2_COMPAT=OFF" and static linking is used
2422
set( fckit_HAVE_ECKIT @fckit_HAVE_ECKIT@ )
25-
if( fckit_HAVE_ECKIT)
23+
set( fckit_ECKIT_FOUND 0 )
24+
if( fckit_HAVE_ECKIT )
25+
set( fckit_ECKIT_FOUND 1 )
26+
27+
# Following Required when "ECBUILD_2_COMPAT=OFF" and static linking is used
2628
include( CMakeFindDependencyMacro )
27-
find_dependency( eckit HINTS ${CMAKE_CURRENT_LIST_DIR}/../eckit @eckit_DIR@ )
29+
find_dependency( eckit HINTS ${CMAKE_CURRENT_LIST_DIR}/../eckit @eckit_DIR@ @eckit_BINARY_DIR@ )
30+
endif()
31+
32+
if( fckit_FIND_REQUIRED_ECKIT AND NOT fckit_ECKIT_FOUND )
33+
message( FATAL_ERROR "fckit was not compiled with ECKIT enabled" )
2834
endif()
35+
36+
set( FCKIT_LIBRARIES @FCKIT_LIBRARIES@ )

src/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88

99
add_subdirectory(fckit)
1010
add_subdirectory(apps)
11-
add_subdirectory(fctest_examples)
1211
add_subdirectory(tests)
1312

14-
if ( ENABLE_SANDBOX )
13+
if ( HAVE_SANDBOX )
1514
add_subdirectory(sandbox)
1615
endif()

src/apps/fckit.in

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env bash
22

3-
FCKIT_VERSION_STR="@FCKIT_VERSION_STR@"
4-
FCKIT_VERSION="@FCKIT_VERSION@"
3+
FCKIT_VERSION_STR="@fckit_VERSION_STR@"
4+
FCKIT_VERSION="@fckit_VERSION@"
55

6-
FCKIT_MAJOR_VERSION=@FCKIT_MAJOR_VERSION@
7-
FCKIT_MINOR_VERSION=@FCKIT_MINOR_VERSION@
8-
FCKIT_PATCH_VERSION=@FCKIT_PATCH_VERSION@
6+
FCKIT_MAJOR_VERSION=@fckit_VERSION_MAJOR@
7+
FCKIT_MINOR_VERSION=@fckit_VERSION_MINOR@
8+
FCKIT_PATCH_VERSION=@fckit_VERSION_PATCH@
99

10-
FCKIT_GIT_SHA1="@FCKIT_GIT_SHA1@"
10+
FCKIT_GIT_SHA1="@fckit_GIT_SHA1@"
1111

1212
#################################################################
1313
# Commands
@@ -21,7 +21,7 @@ usage()
2121

2222
version()
2323
{
24-
echo "${FCKIT_VERSION}"
24+
echo "${fckit_VERSION}"
2525
}
2626

2727
print_feature()
@@ -38,7 +38,7 @@ print_feature()
3838

3939
info()
4040
{
41-
echo "fckit version (${FCKIT_VERSION}), git-sha1 ${FCKIT_GIT_SHA1}"
41+
echo "fckit version (${fckit_VERSION}), git-sha1 ${fckit_GIT_SHA1}"
4242
echo ""
4343
echo "Build:"
4444
echo " build type : @CMAKE_BUILD_TYPE@"
@@ -52,21 +52,21 @@ info()
5252
echo " flags : @EC_Fortran_FLAGS@"
5353
echo ""
5454
echo "Features:"
55-
echo " MPI : $(print_feature @ECKIT_HAVE_MPI@)"
56-
echo " final : $(print_feature @FCKIT_HAVE_FINAL@)"
57-
echo " eckit : $(print_feature @FCKIT_HAVE_ECKIT@)"
55+
echo " MPI : $(print_feature @eckit_HAVE_MPI@)"
56+
echo " final : $(print_feature @fckit_HAVE_FINAL@)"
57+
echo " eckit : $(print_feature @fckit_HAVE_ECKIT@)"
5858
echo ""
5959
echo "Dependencies: "
60-
if [ -n "@FCKIT_HAVE_ECKIT@" ]; then
61-
echo " eckit version (@ECKIT_VERSION@), git-sha1 $(short_gitsha1 @ECKIT_GIT_SHA1@)"
60+
if [ -n "@fckit_HAVE_ECKIT@" ]; then
61+
echo " eckit version (@eckit_VERSION@), git-sha1 $(short_gitsha1 @eckit_GIT_SHA1@)"
6262
else
6363
echo " None"
6464
fi
6565
}
6666

6767
gitsha1()
6868
{
69-
echo "${FCKIT_GIT_SHA1}"
69+
echo "${fckit_GIT_SHA1}"
7070
}
7171

7272
short_gitsha1()

0 commit comments

Comments
 (0)