Skip to content

Commit

Permalink
ci.cmake one file
Browse files Browse the repository at this point in the history
version from file, install Find*.cmake
  • Loading branch information
scivision committed Mar 15, 2021
1 parent 5d81b65 commit 550ea07
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 25 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
cmake_minimum_required(VERSION 3.13...3.20)

file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/VERSION PROJECT_VERSION
REGEX "^([0-9]+\.[0-9]+\.[0-9]+)" LIMIT_INPUT 16 LENGTH_MAXIMUM 16 LIMIT_COUNT 1)

project(h5fortran
LANGUAGES C Fortran
VERSION 3.6.3
VERSION ${PROJECT_VERSION}
DESCRIPTION "thin, light object-oriented HDF5 Fortran interface"
HOMEPAGE_URL https://github.com/geospace-code/h5fortran)

Expand Down Expand Up @@ -63,6 +66,12 @@ if(${PROJECT_NAME}_BUILD_TESTING)
add_subdirectory(src/tests)
endif()

# additional Find*.cmake necesary
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindHDF5.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindSZIP.cmake
DESTINATION lib/cmake/Modules)

include(cmake/pkgconf.cmake)
include(cmake/install.cmake)

Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.6.4
32 changes: 31 additions & 1 deletion ci.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,41 @@ endif()

set(CTEST_USE_LAUNCHERS 1)

# --- find generator
function(find_generator)

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
find_program(ninja NAMES ninja ninja-build samu)

if(ninja)
execute_process(COMMAND ${ninja} --version
OUTPUT_VARIABLE ninja_version OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE err
TIMEOUT 5)
if(err EQUAL 0 AND ninja_version VERSION_GREATER_EQUAL 1.10)
set(CTEST_CMAKE_GENERATOR Ninja)
endif()
endif(ninja)
endif()

if(NOT DEFINED CTEST_CMAKE_GENERATOR)
set(CTEST_BUILD_FLAGS -j) # not --parallel as this goes to generator directly
if(WIN32)
set(CTEST_CMAKE_GENERATOR "MinGW Makefiles")
else()
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
endif()
endif()

set(CTEST_CMAKE_GENERATOR ${CTEST_CMAKE_GENERATOR} PARENT_SCOPE)

endfunction(find_generator)

if(NOT DEFINED CTEST_CMAKE_GENERATOR)
if(DEFINED ENV{CMAKE_GENERATOR})
set(CTEST_CMAKE_GENERATOR $ENV{CMAKE_GENERATOR})
else()
include(cmake/find_generator.cmake)
find_generator()
endif()
endif()

Expand Down
22 changes: 0 additions & 22 deletions cmake/find_generator.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project('h5fortran', 'fortran',
meson_version : '>=0.57.0',
version : '3.6.3',
version : files('VERSION'),
default_options : ['default_library=static', 'buildtype=release', 'warning_level=3'])

fc = meson.get_compiler('fortran')
Expand Down

0 comments on commit 550ea07

Please sign in to comment.