Skip to content

Commit

Permalink
Merge pull request #105 from biojppm/fix/exceptions
Browse files Browse the repository at this point in the history
run tests without exceptions or rtti
  • Loading branch information
biojppm authored Mar 28, 2023
2 parents 9f6fcac + 223a841 commit ae31e95
Show file tree
Hide file tree
Showing 15 changed files with 541 additions and 177 deletions.
51 changes: 43 additions & 8 deletions .github/setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,34 @@ function c4_cfg_test()
if [ ! -z "$CMAKE_FLAGS" ] ; then
_addcmkflags $CMAKE_FLAGS
fi
# do this before setting CMAKE_C_FLAGS
case "$CXX_" in
vs*)
# WATCHOUT: leave a leading space in the _FLAGS options!
# This is needed because bash will expand a leading
# /DWIN32 to the fs root, ie to something like
# C:/Git/DWIN32. The leading space prevents this.
#
# see https://github.com/bmatzelle/gow/issues/196
CFLAGS=" /DWIN32 /D_WINDOWS $CFLAGS"
CXXFLAGS=" /DWIN32 /D_WINDOWS /EHsc /GR $CXXFLAGS"
;;
xcode) ;;
arm*|"") # make sure arm* comes before *g++ or *gcc*
;;
*g++*|*gcc*|*clang*)
CFLAGS="-std=c99 -m$bits $CFLAGS"
CXXFLAGS="-m$bits $CXXFLAGS"
;;
em++)
CFLAGS="-s DISABLE_EXCEPTION_CATCHING=0 $CFLAGS"
CXXFLAGS="-s DISABLE_EXCEPTION_CATCHING=0 $CXXFLAGS"
;;
*)
echo "unknown compiler"
exit 1
;;
esac

echo "building with additional cmake flags: $CMFLAGS"

Expand All @@ -273,13 +301,15 @@ function c4_cfg_test()
cmake -S $PROJ_DIR -B $build_dir -DCMAKE_INSTALL_PREFIX="$install_dir" \
-G 'Visual Studio 17 2022' -A $(_c4vsarchtype $id) \
$(_c4_add_ehsc_to_vs_arm32 $id) \
-DCMAKE_BUILD_TYPE=$BT $CMFLAGS
-DCMAKE_BUILD_TYPE=$BT $CMFLAGS \
-DCMAKE_C_FLAGS=" $CFLAGS" -DCMAKE_CXX_FLAGS=" $CXXFLAGS"
;;
vs2019)
cmake -S $PROJ_DIR -B $build_dir -DCMAKE_INSTALL_PREFIX="$install_dir" \
-G 'Visual Studio 16 2019' -A $(_c4vsarchtype $id) \
$(_c4_add_ehsc_to_vs_arm32 $id) \
-DCMAKE_BUILD_TYPE=$BT $CMFLAGS
-DCMAKE_BUILD_TYPE=$BT $CMFLAGS \
-DCMAKE_C_FLAGS=" $CFLAGS" -DCMAKE_CXX_FLAGS=" $CXXFLAGS"
;;
vs2017)
case "$bits" in
Expand All @@ -289,7 +319,8 @@ function c4_cfg_test()
esac
cmake -S $PROJ_DIR -B $build_dir -DCMAKE_INSTALL_PREFIX="$install_dir" \
$(_c4_add_ehsc_to_vs_arm32 $id) \
-DCMAKE_BUILD_TYPE=$BT -G "$g" $CMFLAGS
-DCMAKE_BUILD_TYPE=$BT -G "$g" \
-DCMAKE_C_FLAGS=" $CFLAGS" -DCMAKE_CXX_FLAGS=" $CXXFLAGS"
;;
xcode)
g=Xcode
Expand All @@ -301,24 +332,28 @@ function c4_cfg_test()
;;
esac
cmake -S $PROJ_DIR -B $build_dir -DCMAKE_INSTALL_PREFIX="$install_dir" \
-DCMAKE_BUILD_TYPE=$BT -G "$g" -DCMAKE_OSX_ARCHITECTURES=$a $CMFLAGS
-DCMAKE_BUILD_TYPE=$BT -G "$g" \
-DCMAKE_OSX_ARCHITECTURES=$a $CMFLAGS \
-DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS"
;;
arm*|"") # make sure arm* comes before *g++ or *gcc*
cmake -S $PROJ_DIR -B $build_dir -DCMAKE_INSTALL_PREFIX="$install_dir" \
-DCMAKE_BUILD_TYPE=$BT $CMFLAGS
-DCMAKE_BUILD_TYPE=$BT $CMFLAGS \
-DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS"
;;
*g++*|*gcc*|*clang*)
export CC_=$(echo "$CXX_" | sed 's:clang++:clang:g' | sed 's:g++:gcc:g')
_c4_choose_clang_tidy $CXX_
cmake -S $PROJ_DIR -B $build_dir -DCMAKE_INSTALL_PREFIX="$install_dir" \
-DCMAKE_BUILD_TYPE=$BT $CMFLAGS \
-DCMAKE_C_COMPILER=$CC_ -DCMAKE_CXX_COMPILER=$CXX_ \
-DCMAKE_C_FLAGS="-std=c99 -m$bits" -DCMAKE_CXX_FLAGS="-m$bits"
-DCMAKE_BUILD_TYPE=$BT $CMFLAGS \
-DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS"
cmake --build $build_dir --target help | sed 1d | sort
;;
em++)
emcmake cmake -S $PROJ_DIR -B $build_dir -DCMAKE_INSTALL_PREFIX="$install_dir" \
-DCMAKE_BUILD_TYPE=$BT $CMFLAGS -DCMAKE_CXX_FLAGS="-s DISABLE_EXCEPTION_CATCHING=0"
-DCMAKE_BUILD_TYPE=$BT $CMFLAGS \
-DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS"
;;
*)
echo "unknown compiler"
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,46 @@ jobs:
- {name: shared32-run, run: source .github/setenv.sh && c4_run_test shared32}
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}

#----------------------------------------------------------------------------
clang_noexceptions:
name: clang_noexceptions/${{matrix.cxx}}/c++${{matrix.std}}/${{matrix.bt}}
continue-on-error: true
if: always() # https://stackoverflow.com/questions/62045967/github-actions-is-there-a-way-to-continue-on-error-while-still-getting-correct
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
include:
- {std: 20, cxx: clang++-10 , bt: Debug , os: ubuntu-20.04, bitlinks: shared64 static32}
- {std: 20, cxx: clang++-10 , bt: Release, os: ubuntu-20.04, bitlinks: shared64 static32}
- {std: 11, cxx: clang++-6.0, bt: Debug , os: ubuntu-20.04, bitlinks: shared64 static32}
- {std: 11, cxx: clang++-6.0, bt: Release, os: ubuntu-20.04, bitlinks: shared64 static32}
env: {CXXFLAGS: "-fno-exceptions -fno-rtti", STD: "${{matrix.std}}", CXX_: "${{matrix.cxx}}", BT: "${{matrix.bt}}", BITLINKS: "${{matrix.bitlinks}}", VG: "${{matrix.vg}}", SAN: "${{matrix.san}}", LINT: "${{matrix.lint}}", OS: "${{matrix.os}}"}
steps:
- {name: checkout, uses: actions/checkout@v3, with: {submodules: recursive}}
- {name: install requirements, run: source .github/reqs.sh && c4_install_test_requirements $OS}
- {name: show info, run: source .github/setenv.sh && c4_show_info}
- name: shared64-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared64
- {name: shared64-build, run: source .github/setenv.sh && c4_build_test shared64}
- {name: shared64-run, run: source .github/setenv.sh && c4_run_test shared64}
- {name: shared64-pack, run: source .github/setenv.sh && c4_package shared64}
- name: static64-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test static64
- {name: static64-build, run: source .github/setenv.sh && c4_build_test static64}
- {name: static64-run, run: source .github/setenv.sh && c4_run_test static64}
- {name: static64-pack, run: source .github/setenv.sh && c4_package static64}
- name: static32-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test static32
- {name: static32-build, run: source .github/setenv.sh && c4_build_test static32}
- {name: static32-run, run: source .github/setenv.sh && c4_run_test static32}
- {name: static32-pack, run: source .github/setenv.sh && c4_package static32}
- name: shared32-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared32
- {name: shared32-build, run: source .github/setenv.sh && c4_build_test shared32}
- {name: shared32-run, run: source .github/setenv.sh && c4_run_test shared32}
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}

#----------------------------------------------------------------------------
clang_extended:
name: clang_extended/${{matrix.cxx}}/c++${{matrix.std}}/${{matrix.bt}}/vg${{matrix.vg}}
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,46 @@ jobs:
- {name: shared32-run, run: source .github/setenv.sh && c4_run_test shared32}
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}

#----------------------------------------------------------------------------
gcc_noexceptions:
name: gcc_noexceptions/${{matrix.cxx}}/c++${{matrix.std}}/${{matrix.bt}}
continue-on-error: true
if: always() # https://stackoverflow.com/questions/62045967/github-actions-is-there-a-way-to-continue-on-error-while-still-getting-correct
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
include:
- {std: 11, cxx: g++-7 , bt: Debug , os: ubuntu-20.04, bitlinks: shared64 static32}
- {std: 11, cxx: g++-7 , bt: Release, os: ubuntu-20.04, bitlinks: shared64 static32}
- {std: 20, cxx: g++-10 , bt: Debug , os: ubuntu-20.04, bitlinks: shared64 static32}
- {std: 20, cxx: g++-10 , bt: Release, os: ubuntu-20.04, bitlinks: shared64 static32}
env: {CXXFLAGS: "-fno-exceptions -fno-rtti", STD: "${{matrix.std}}", CXX_: "${{matrix.cxx}}", BT: "${{matrix.bt}}", BITLINKS: "${{matrix.bitlinks}}", VG: "${{matrix.vg}}", SAN: "${{matrix.san}}", LINT: "${{matrix.lint}}", OS: "${{matrix.os}}"}
steps:
- {name: checkout, uses: actions/checkout@v3, with: {submodules: recursive}}
- {name: install requirements, run: source .github/reqs.sh && c4_install_test_requirements $OS}
- {name: show info, run: source .github/setenv.sh && c4_show_info}
- name: shared64-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared64
- {name: shared64-build, run: source .github/setenv.sh && c4_build_test shared64}
- {name: shared64-run, run: source .github/setenv.sh && c4_run_test shared64}
- {name: shared64-pack, run: source .github/setenv.sh && c4_package shared64}
- name: static64-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test static64
- {name: static64-build, run: source .github/setenv.sh && c4_build_test static64}
- {name: static64-run, run: source .github/setenv.sh && c4_run_test static64}
- {name: static64-pack, run: source .github/setenv.sh && c4_package static64}
- name: static32-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test static32
- {name: static32-build, run: source .github/setenv.sh && c4_build_test static32}
- {name: static32-run, run: source .github/setenv.sh && c4_run_test static32}
- {name: static32-pack, run: source .github/setenv.sh && c4_package static32}
- name: shared32-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared32
- {name: shared32-build, run: source .github/setenv.sh && c4_build_test shared32}
- {name: shared32-run, run: source .github/setenv.sh && c4_run_test shared32}
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}

#----------------------------------------------------------------------------
gcc_extended:
name: gcc_extended/${{matrix.cxx}}/c++${{matrix.std}}/${{matrix.bt}}/vg${{matrix.vg}}
Expand Down
Loading

0 comments on commit ae31e95

Please sign in to comment.