Skip to content

Commit b91ff35

Browse files
committed
Merge branch 'master' of https://github.com/fortran-lang/stdlib into hash_maps
2 parents a567329 + 8eaa778 commit b91ff35

File tree

7 files changed

+99
-48
lines changed

7 files changed

+99
-48
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Unreleased
1+
# Version 0.2.0
22

3-
Features available from the latest git source
3+
Full release notes available at [v0.2.0] tag.
4+
5+
[v0.2.0]: https://github.com/fortran-lang/stdlib/releases/tag/v0.2.0
46

57
- new module `stdlib_hash_32bit`
68
[#573](https://github.com/fortran-lang/stdlib/pull/573)

CMakeLists.txt

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
cmake_minimum_required(VERSION 3.14.0)
2+
3+
# Include overwrites before setting up the project
4+
set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/config/DefaultFlags.cmake)
5+
26
project(fortran_stdlib
37
LANGUAGES Fortran
48
DESCRIPTION "Community driven and agreed upon de facto standard library for Fortran"
@@ -22,31 +26,9 @@ include(${PROJECT_SOURCE_DIR}/cmake/stdlib.cmake)
2226
# --- CMake specific configuration and package data export
2327
add_subdirectory(config)
2428

25-
# --- compiler options
26-
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
27-
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0)
28-
message(FATAL_ERROR "GCC Version 9 or newer required")
29-
endif()
30-
add_compile_options(-fimplicit-none)
31-
add_compile_options(-ffree-line-length-132)
32-
add_compile_options(-fno-range-check) # Needed for gfortran 9 and
33-
# earlier for hash functions
34-
add_compile_options(-Wall)
35-
add_compile_options(-Wextra)
36-
add_compile_options(-Wimplicit-procedure)
37-
# -pedantic-errors triggers a false positive for optional arguments of elemental functions,
38-
# see test_optval and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95446
39-
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 11.0)
40-
add_compile_options(-pedantic-errors)
41-
endif()
42-
add_compile_options(-std=f2018)
43-
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
44-
if(WIN32)
45-
set(fortran_flags /stand:f18 /warn:declarations,general,usage,interfaces,unused)
46-
else()
47-
set(fortran_flags -stand f18 -warn declarations,general,usage,interfaces,unused)
48-
endif()
49-
add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:${fortran_flags}>")
29+
# --- compiler selection
30+
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0)
31+
message(FATAL_ERROR "GCC Version 9 or newer required")
5032
endif()
5133

5234
# --- compiler feature checks

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
0.2.0

config/DefaultFlags.cmake

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
2+
set(
3+
CMAKE_Fortran_FLAGS_INIT
4+
"-fimplicit-none"
5+
"-ffree-line-length-132"
6+
)
7+
set(
8+
CMAKE_Fortran_FLAGS_RELEASE_INIT
9+
)
10+
set(
11+
CMAKE_Fortran_FLAGS_DEBUG_INIT
12+
"-Wall"
13+
"-Wextra"
14+
"-Wimplicit-procedure"
15+
"-std=f2018"
16+
)
17+
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
18+
set(
19+
CMAKE_Fortran_FLAGS_INIT
20+
)
21+
set(
22+
CMAKE_Fortran_FLAGS_RELEASE_INIT
23+
)
24+
if(WIN32)
25+
set(
26+
CMAKE_Fortran_FLAGS_DEBUG_INIT
27+
"/stand:f18"
28+
"/warn:declarations,general,usage,interfaces,unused"
29+
)
30+
else()
31+
set(
32+
CMAKE_Fortran_FLAGS_DEBUG_INIT
33+
"-stand f18"
34+
"-warn declarations,general,usage,interfaces,unused"
35+
)
36+
endif()
37+
else()
38+
set(
39+
CMAKE_Fortran_FLAGS_INIT
40+
)
41+
set(
42+
CMAKE_Fortran_FLAGS_RELEASE_INIT
43+
)
44+
set(
45+
CMAKE_Fortran_FLAGS_DEBUG_INIT
46+
)
47+
endif()
48+
string(REPLACE ";" " " CMAKE_Fortran_FLAGS_INIT "${CMAKE_Fortran_FLAGS_INIT}")
49+
string(REPLACE ";" " " CMAKE_Fortran_FLAGS_RELEASE_INIT "${CMAKE_Fortran_FLAGS_RELEASE_INIT}")
50+
string(REPLACE ";" " " CMAKE_Fortran_FLAGS_DEBUG_INIT "${CMAKE_Fortran_FLAGS_DEBUG_INIT}")

src/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ set(SRC
9898

9999
add_library(${PROJECT_NAME} ${SRC})
100100

101+
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0)
102+
target_compile_options(
103+
${PROJECT_NAME}
104+
PRIVATE
105+
$<$<COMPILE_LANGUAGE:Fortran>:-fno-range-check>
106+
)
107+
endif()
108+
101109
set(LIB_MOD_DIR ${CMAKE_CURRENT_BINARY_DIR}/mod_files/)
102110
# We need the module directory before we finish the configure stage since the
103111
# build interface might resolve before the module directory is generated by CMake
Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
#ADDTEST(hash_functions)
22

3-
set(SRC
4-
nmhash_scalar.c
5-
pengyhash.c
6-
SpookyV2.cpp
7-
SpookyV2Test.cpp
8-
waterhash.c
9-
generate_hash_arrays.cpp
10-
)
11-
123
enable_language(CXX)
134
enable_language(C)
145

15-
add_library(libc_hash ${SRC})
16-
17-
set(CMAKE_FORTRAN_LINK_EXECUTABLE "<CMAKE_Fortran_COMPILER> <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
18-
19-
add_executable(test_hash_functions test_hash_functions.f90)
20-
target_link_libraries(test_hash_functions "${PROJECT_NAME}" "test-drive::test-drive" "libc_hash")
21-
add_test(NAME hash_functions
22-
COMMAND $<TARGET_FILE:test_hash_functions> ${CMAKE_CURRENT_BINARY_DIR}
23-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
24-
25-
set_target_properties(test_hash_functions PROPERTIES LINKER_LANGUAGE FORTRAN)
6+
ADDTEST(hash_functions)
7+
target_sources(
8+
test_hash_functions
9+
PRIVATE
10+
nmhash_scalar.c
11+
pengyhash.c
12+
SpookyV2.cpp
13+
SpookyV2Test.cpp
14+
waterhash.c
15+
generate_hash_arrays.cpp
16+
)
17+
if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
18+
set_target_properties(test_hash_functions PROPERTIES LINKER_LANGUAGE Fortran)
19+
endif()
20+
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0)
21+
target_compile_options(
22+
test_hash_functions
23+
PRIVATE
24+
$<$<COMPILE_LANGUAGE:Fortran>:-fno-range-check>
25+
)
26+
endif()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
ADDTEST(32_bit_hash_performance)
22
ADDTEST(64_bit_hash_performance)
3+
4+
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0)
5+
target_compile_options(
6+
test_64_bit_hash_performance
7+
PRIVATE
8+
$<$<COMPILE_LANGUAGE:Fortran>:-fno-range-check>
9+
)
10+
endif()

0 commit comments

Comments
 (0)