Skip to content
Snippets Groups Projects
Commit 1ab8ee8d authored by Lars Bilke's avatar Lars Bilke
Browse files

[CMake] Added version requirements file in json-format.

The file is read by CMake (via new a json parser submodule) and
the web site generator and provides info on required clang and
gcc versions. This info will be expanded in future commits.

Goal is to have a single source of truth for versions infos and
maybe other requirements.

On CMake you access the info via `ogs.`-prefixed variables:

    ${ogs.minimum_version.gcc}

In Hugo you access the info via the new dataFile-shortcode:

    {{< dataFile "versions.minimum_version.gcc" >}}
parent 92440880
No related branches found
No related tags found
No related merge requests found
......@@ -46,3 +46,6 @@
[submodule "ThirdParty/ogs6py"]
path = ThirdParty/ogs6py
url = https://github.com/joergbuchwald/ogs6py.git
[submodule "ThirdParty/json-cmake"]
path = ThirdParty/json-cmake
url = https://github.com/ufz/json-cmake.git
......@@ -61,6 +61,7 @@ endif()
option(OGS_USE_CVODE "Use the Sundials CVODE module?" OFF)
# ---- CMake includes ----
include(Versions)
include(PreFind)
include(CheckTypeSizes)
include(Functions)
......
Subproject commit 9708cb091f6b89b94d71ae98f8b9e68ea04c47dd
......@@ -95,18 +95,18 @@ if(COMPILER_IS_GCC OR COMPILER_IS_CLANG OR COMPILER_IS_INTEL)
endif()
if(COMPILER_IS_GCC)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "7.3")
message(FATAL_ERROR "GCC minimum required version is 7.3! You are \
using ${CMAKE_CXX_COMPILER_VERSION}.")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${ogs.minimum_version.gcc})
message(FATAL_ERROR "GCC minimum required version is ${OGS_GCC_MINIMUM_VERSION}! \
You are using ${CMAKE_CXX_COMPILER_VERSION}.")
endif()
add_compile_options(-fext-numeric-literals)
include(GCCSanitizer)
endif()
if(COMPILER_IS_CLANG)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5")
message(FATAL_ERROR "Aborting: Clang 3.5 is required! Found version \
${CMAKE_CXX_COMPILER_VERSION}")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${ogs.minimum_version.clang})
message(FATAL_ERROR "Aborting: Clang ${OGS_CLANG_MINIMUM_VERSION} \
is required! Found version ${CMAKE_CXX_COMPILER_VERSION}")
endif()
include(ClangSanitizer)
endif()
......
......@@ -15,6 +15,7 @@ set(REQUIRED_SUBMODULES
ThirdParty/googletest
ThirdParty/iphreeqc/src
ThirdParty/jedbrown-cmake-modules
ThirdParty/json-cmake
ThirdParty/tclap
ThirdParty/tetgen
ThirdParty/vtkdiff
......
include(${PROJECT_SOURCE_DIR}/ThirdParty/json-cmake/JSONParser.cmake)
file(READ ${PROJECT_SOURCE_DIR}/web/data/versions.json jsonFileString)
sbeParseJson(ogs jsonFileString)
# Provides variables, e.g. ogs.minimum_version.gcc
# Output all variables with
# foreach(var ${ogs})
# message("${var} = ${${var}}")
# endforeach()
......@@ -31,11 +31,11 @@ As we use lots of features of the C++11-standard we support **Visual Studio 2015
:::
::: {.linux}
If you have a recent linux distribution you should also have a recent gcc. Please check that you have at least **gcc 6.2**:
If you have a recent linux distribution you should also have a recent gcc. Please check that you have at least **gcc {{< dataFile "versions.minimum_version.gcc" >}}**:
```bash
$ gcc --version
gcc (GCC) 6.2.0
gcc (GCC) {{< dataFile "versions.minimum_version.gcc" >}}.0
```
:::
......
{
"minimum_version": {
"gcc": "7.3",
"clang": "3.5"
}
}
{{- with .Get 0 -}}
{{- $map := split . "." }}
{{- $url := index $.Site.Data $map -}}
{{- if $url -}}
{{- $url -}}
{{- else -}}
{{- errorf "No data for key %s" . -}}
{{- end -}}
{{- end -}}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment