Skip to content

Commit 991a9c7

Browse files
committed
Merge branch 'master' into 147-create-an-integrate_debug-function-which-could-generate-mtest-files-on-integration-errors
2 parents 0da1650 + 1a4fc68 commit 991a9c7

87 files changed

Lines changed: 2846 additions & 947 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/check-tbb.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Spack
17+
uses: spack/setup-spack@v2
18+
with:
19+
ref: develop # Spack version (examples: develop, releases/v0.21)
20+
buildcache: true # Configure oci://ghcr.io/spack/github-actions-buildcache
21+
color: true # Force color output (SPACK_COLOR=always)
22+
path: ${{github.workspace}}/spack # Where to clone Spack
23+
24+
- name: Install TFEL
25+
shell: spack-sh {0}
26+
run: |
27+
# spack install python py-numpy py-pybind11
28+
spack install tbb
29+
spack install tfel@master~python~python_bindings~aster~fortran~abaqus~calculix~ansys~europlexus~cyrano~lsdyna~comsol~diana-fea
30+
- name: cmake
31+
shell: spack-sh {0}
32+
run: |
33+
# spack load python py-numpy py-pybind11
34+
# loading TFEL
35+
spack load tfel
36+
spack load intel-tbb
37+
cmake -DCMAKE_BUILD_TYPE=Release . \
38+
-Denable-c-bindings=ON \
39+
-Denable-fortran-bindings=ON \
40+
-Denable-python-bindings=OFF \
41+
-Denable-portable-build=ON \
42+
-Denable-julia-bindings=OFF \
43+
-DTFEL_DIR=`spack location -i tfel`/share/tfel/cmake \
44+
-Denable-parallel-stl-algorithms=ON
45+
- name: make
46+
shell: spack-sh {0}
47+
run: |
48+
# spack load python py-numpy py-pybind11
49+
spack load tfel
50+
spack load intel-tbb
51+
make
52+
- name: make check
53+
shell: spack-sh {0}
54+
run: |
55+
# spack load python py-numpy py-pybind11 tfel
56+
spack load tfel
57+
spack load intel-tbb
58+
make check

.github/workflows/check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ jobs:
3838
-Denable-python-bindings=OFF \
3939
-Denable-portable-build=ON \
4040
-Denable-julia-bindings=OFF \
41-
-DTFEL_DIR=`spack location -i tfel`/share/tfel/cmake
41+
-DTFEL_DIR=`spack location -i tfel`/share/tfel/cmake \
42+
-Denable-parallel-stl-algorithms=OFF
4243
- name: make
4344
shell: spack-sh {0}
4445
run: |

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ set(CXX_STANDARD_REQUIRED ON)
2424
# portable-build
2525
option(enable-portable-build "produce binary that can be shared between various machine (same architecture, same gcc version, different processors" OFF)
2626

27-
# option(enable-eigen-bindings "enable eigen bindings support" OFF)
28-
# if(enable-eigen-bindings)
29-
# find_package (Eigen3 REQUIRED)
30-
# endif (enable-eigen-bindings)
27+
# OpenMP
28+
option(enable-openmp "enable openmp" OFF)
29+
if(enable-openmp)
30+
find_package(OpenMP REQUIRED)
31+
endif(enable-openmp)
3132

3233
# enable mgis-function
3334
option(enable-mgis-function "enable mgis function" ON)
3435
# enable exceptions usage
3536
option(enable-exceptions "use exceptions to report contract violation and error reporting" OFF)
3637

38+
# support for STL parallel algorithms
39+
option(enable-parallel-stl-algorithms "enable STL parallel algorithms" ON)
40+
3741
# C-bindings (placed before compiler detection)
3842
option(enable-c-bindings "enable c bindings support")
3943

INSTALL-cmake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ Options
5858
- `disable-tfel`: by default, `MGIS` tries to add support for `TFEL`,
5959
notably if `tfel-config` is found in the `PATH`. This option disables
6060
this behaviour.
61+
- `enable-mgis-function`: enable or disable compilation of the `MGIS/Function` library.
62+
By default, compilation of `MGIS/Function` is enabled.
63+
- `enable-exceptions`: use exceptions to report contract violation and error reporting.
64+
By default, contract violation leads to abort the program.
65+
- `enable-parallel-stl-algorithms`: by default, STL algorithms are used if available
6166

6267
`cmake` usefull variables
6368
=======================

bindings/c/tests/CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,23 @@ target_link_libraries(IntegrateTest3-c
7474
add_executable(IntegrateTest4-c
7575
EXCLUDE_FROM_ALL
7676
IntegrateTest4-c.c)
77-
target_link_libraries(IntegrateTest4-c
78-
PRIVATE MFrontGenericInterface-c MFrontGenericInterface m)
77+
if(MSVC)
78+
target_link_libraries(IntegrateTest4-c
79+
PRIVATE MFrontGenericInterface-c MFrontGenericInterface)
80+
else(MSVC)
81+
target_link_libraries(IntegrateTest4-c
82+
PRIVATE MFrontGenericInterface-c MFrontGenericInterface m)
83+
endif(MSVC)
7984
add_executable(IntegrateTest5-c
8085
EXCLUDE_FROM_ALL
8186
IntegrateTest5-c.c)
82-
target_link_libraries(IntegrateTest5-c
83-
PRIVATE MFrontGenericInterface-c MFrontGenericInterface m)
87+
if(MSVC)
88+
target_link_libraries(IntegrateTest5-c
89+
PRIVATE MFrontGenericInterface-c MFrontGenericInterface)
90+
else(MSVC)
91+
target_link_libraries(IntegrateTest5-c
92+
PRIVATE MFrontGenericInterface-c MFrontGenericInterface m)
93+
endif(MSVC)
8494

8595
add_test(NAME MFrontGenericBehaviourInterfaceTest-c
8696
COMMAND MFrontGenericBehaviourInterfaceTest-c

bindings/c/tests/ParameterTest-c.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ int main(const int argc, const char* const* argv) {
6969
check_status(mgis_bv_behaviour_get_source(&s, b));
7070
check_string(s, "ParameterTest.mfront", "invalid source");
7171
// version
72-
const char* v;
73-
check_status(mgis_bv_behaviour_get_tfel_version(&v, b));
74-
check_string(v, TFEL_VERSION, "invalid TFEL version");
72+
const char* tfel_version;
73+
check_status(mgis_bv_behaviour_get_tfel_version(&tfel_version, b));
74+
check_string(tfel_version, TFEL_VERSION, "invalid TFEL version");
7575
// number of real parameter
7676
mgis_size_type nparams;
7777
check_status(mgis_bv_behaviour_get_number_of_parameters(&nparams, b));

cmake/modules/FindTFEL.cmake

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,20 @@ endforeach()
4545

4646
IF(TFEL_CONFIG AND MFRONT AND MFRONT_QUERY)
4747

48-
if ((NOT DEFINED TFEL_DIR) AND (NOT DEFINED ENV{TFELHOME}))
49-
# Trying to figure out TFEL_DIR
48+
if(NOT DEFINED TFELHOME)
5049
execute_process(COMMAND ${TFEL_CONFIG} "--include-path"
5150
OUTPUT_VARIABLE TFEL_INCLUDE_PATH
5251
OUTPUT_STRIP_TRAILING_WHITESPACE
5352
)
5453
file(TO_CMAKE_PATH "${TFEL_INCLUDE_PATH}" TFEL_INCLUDE_PATH)
5554
cmake_path(GET TFEL_INCLUDE_PATH PARENT_PATH TFELHOME)
55+
endif()
56+
57+
if (NOT DEFINED TFEL_DIR)
58+
# Trying to figure out TFEL_DIR
5659
set(TFEL_DIR "${TFELHOME}/share/tfel/cmake")
5760
list(APPEND CMAKE_PREFIX_PATH "${TFEL_DIR}")
58-
endif ((NOT DEFINED TFEL_DIR) AND (NOT DEFINED ENV{TFELHOME}))
61+
endif (NOT DEFINED TFEL_DIR)
5962

6063
execute_process(COMMAND ${TFEL_CONFIG} "--cxx-standard"
6164
RESULT_VARIABLE TFEL_CXX_STANDARD_AVAILABLE
@@ -96,7 +99,8 @@ IF(TFEL_CONFIG AND MFRONT AND MFRONT_QUERY)
9699
endif()
97100

98101
foreach(lib ${tfel_libs})
99-
find_library(${lib}_LIBRARY ${lib} HINTS ${TFELHOME} PATH_SUFFIXES lib)
102+
find_library(${lib}_LIBRARY ${lib} REQUIRED
103+
HINTS ${TFELHOME} PATH_SUFFIXES bin lib)
100104
list(APPEND TFEL_LIBRARIES ${${lib}_LIBRARY})
101105
endforeach(lib)
102106

cmake/modules/clang.cmake

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
if(WIN32)
2-
tfel_enable_cxx_compiler_flag(VISIBILITY_FLAGS "EHsc")
2+
mgis_enable_cxx_compiler_flag(VISIBILITY_FLAGS "EHsc")
33
endif(WIN32)
44

5-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Weverything")
6-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-c++98-compat-pedantic")
7-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-c++20-compat-pedantic")
8-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-padded")
9-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-unsafe-buffer-usage")
10-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-documentation")
11-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-documentation-unknown-command")
12-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-exit-time-destructors")
13-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-global-constructors")
14-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-missing-braces")
15-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-unsafe-buffer-usage")
16-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wrange-loop-analysis")
17-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wmove")
18-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Winfinite-recursion")
19-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wcomma")
20-
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wmicrosoft")
21-
tfel_enable_cxx_compiler_flag2(COMPILER_WARNINGS "Wno-c++98-compat" "Wno_c__98_compat_AVAILABLE")
5+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Weverything")
6+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-c++98-compat-pedantic")
7+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-c++20-compat-pedantic")
8+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-padded")
9+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-unsafe-buffer-usage")
10+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-documentation")
11+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-documentation-unknown-command")
12+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-exit-time-destructors")
13+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-global-constructors")
14+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-missing-braces")
15+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wno-unsafe-buffer-usage")
16+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wrange-loop-analysis")
17+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wmove")
18+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Winfinite-recursion")
19+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wcomma")
20+
mgis_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wmicrosoft")
21+
mgis_enable_cxx_compiler_flag2(COMPILER_WARNINGS "Wno-c++98-compat" "Wno_c__98_compat_AVAILABLE")
2222
include(cmake/modules/common-compiler-flags.cmake)
2323

24-
tfel_enable_cxx_compiler_flag(OPTIMISATION_FLAGS_MARCH "march=native")
24+
mgis_enable_cxx_compiler_flag(OPTIMISATION_FLAGS_MARCH "march=native")
2525
if(enable-fast-math)
26-
tfel_enable_cxx_compiler_flag(OPTIMISATION_FLAGS "ffast-math")
26+
mgis_enable_cxx_compiler_flag(OPTIMISATION_FLAGS "ffast-math")
2727
else(enable-fast-math)
28-
tfel_enable_cxx_compiler_flag(OPTIMISATION_FLAGS2 "ffast-math")
28+
mgis_enable_cxx_compiler_flag(OPTIMISATION_FLAGS2 "ffast-math")
2929
endif(enable-fast-math)
3030

3131
if(NOT WIN32)
32-
tfel_enable_cxx_compiler_flag(VISIBILITY_FLAGS "fvisibility=hidden")
33-
tfel_enable_cxx_compiler_flag(VISIBILITY_FLAGS "fvisibility-inlines-hidden")
32+
mgis_enable_cxx_compiler_flag(VISIBILITY_FLAGS "fvisibility=hidden")
33+
mgis_enable_cxx_compiler_flag(VISIBILITY_FLAGS "fvisibility-inlines-hidden")
3434
set(COMPILER_DEFAULT_VISIBILITY_FLAG "-fvisibility=default")
3535
endif(NOT WIN32)
3636

@@ -76,17 +76,29 @@ endif(HAVE_FORTRAN)
7676

7777
option(enable-libcxx "use LLVM C++ Standard library" OFF)
7878
if(enable-libcxx)
79-
tfel_enable_cxx_compiler_flag(COMPILER_CXXFLAGS "stdlib=libc++")
79+
mgis_enable_cxx_compiler_flag(COMPILER_CXXFLAGS "stdlib=libc++")
8080
endif(enable-libcxx)
8181

82+
if(enable-parallel-stl-algorithms)
83+
# This is a poor test to check of libstc++ is used
84+
if(UNIX AND NOT APPLE)
85+
if(NOT enable-libcxx)
86+
find_package(TBB REQUIRED)
87+
list(APPEND MGIS_REQUIRED_ADDITIONAL_PACKAGES "TBB")
88+
list(APPEND MGIS_ADDITIONAL_LIBRARIES "TBB::tbb")
89+
endif(NOT enable-libcxx)
90+
endif(UNIX AND NOT APPLE)
91+
endif(enable-parallel-stl-algorithms)
92+
93+
8294
option(enable-sanitize-options "enable various clang sanitize options (undefined, address,...)" OFF)
8395

8496
if(enable-sanitize-options)
85-
tfel_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=address")
86-
tfel_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=thread")
87-
tfel_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=memory")
88-
# tfel_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=undefined")
89-
tfel_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=cfi")
90-
tfel_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=safe-stack")
97+
mgis_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=address")
98+
mgis_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=thread")
99+
mgis_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=memory")
100+
# mgis_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=undefined")
101+
mgis_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=cfi")
102+
mgis_enable_cxx_compiler_flag(COMPILER_FLAGS "fsanitize=safe-stack")
91103
endif(enable-sanitize-options)
92104

0 commit comments

Comments
 (0)