Skip to content

Commit

Permalink
[#599] Fix mingw 7.5.0 debug build
Browse files Browse the repository at this point in the history
  • Loading branch information
mikir committed May 20, 2024
1 parent d792eca commit d43c23c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 35 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/build_windows_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ jobs:
scripts/test.sh cpp-${PACKAGE}
- name: Run Zserio tests with extra arguments
# MinGW 7.5.0 Debug does not work, https://github.com/ndsev/zserio/issues/599
if: ${{ matrix.mingw-version != '7.5.0' || matrix.build-type != 'Debug' }}
shell: bash
run: |
export ZSERIO_EXTRA_ARGS="-withTypeInfoCode -withReflectionCode -withCodeComments -setCppAllocator polymorphic"
Expand Down Expand Up @@ -148,8 +146,6 @@ jobs:
--num-iterations 1000 --test-config READ_WRITE
- name: Run Zserio benchmarks
# MinGW Debug build does not work, https://github.com/ndsev/zserio/issues/588
if: ${{ matrix.mingw-version == '' || matrix.build-type == 'Release' }}
shell: bash
run: |
scripts/benchmark.sh cpp-${PACKAGE} --num-iterations 1
Expand Down
6 changes: 2 additions & 4 deletions cmake/toolchain-linux32-clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ set(CMAKE_LINKER "${COMPILER_PATH_PREFIX}clang++$ENV{CLANG_VERSION_SUFFIX}")
set(COMPILER_M32_FLAG "--target=i386-linux")

# set C flags
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${COMPILER_M32_FLAG}" CACHE STRING "C flags")
set(CMAKE_C_FLAGS_INIT "${COMPILER_M32_FLAG}")

# set CXX flags
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${COMPILER_M32_FLAG}" CACHE STRING "C++ flags")
set(CMAKE_CXX_FLAGS_INIT "${COMPILER_M32_FLAG}")
6 changes: 2 additions & 4 deletions cmake/toolchain-linux32-gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ set(CMAKE_CXX_COMPILER g++$ENV{GCC_VERSION_SUFFIX})
set(COMPILER_M32_FLAG "-m32")

# set C flags
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${COMPILER_M32_FLAG}" CACHE STRING "C flags")
set(CMAKE_C_FLAGS_INIT "${COMPILER_M32_FLAG}")

# set CXX flags
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${COMPILER_M32_FLAG}" CACHE STRING "C++ flags")
set(CMAKE_CXX_FLAGS_INIT "${COMPILER_M32_FLAG}")
6 changes: 2 additions & 4 deletions cmake/toolchain-linux64-clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ set(CMAKE_LINKER "${COMPILER_PATH_PREFIX}clang++$ENV{CLANG_VERSION_SUFFIX}")
set(COMPILER_M64_FLAG "--target=x86_64-linux")

# set C flags
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${COMPILER_M64_FLAG}" CACHE STRING "C flags")
set(CMAKE_C_FLAGS_INIT "${COMPILER_M64_FLAG}")

# set CXX flags
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${COMPILER_M64_FLAG}" CACHE STRING "C++ flags")
set(CMAKE_CXX_FLAGS_INIT "${COMPILER_M64_FLAG}")
6 changes: 2 additions & 4 deletions cmake/toolchain-linux64-gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ set(CMAKE_CXX_COMPILER g++$ENV{GCC_VERSION_SUFFIX})
set(COMPILER_M64_FLAG "-m64")

# set C flags
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${COMPILER_M64_FLAG}" CACHE STRING "C flags")
set(CMAKE_C_FLAGS_INIT "${COMPILER_M64_FLAG}")

# set CXX flags
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${COMPILER_M64_FLAG}" CACHE STRING "C++ flags")
set(CMAKE_CXX_FLAGS_INIT "${COMPILER_M64_FLAG}")
15 changes: 11 additions & 4 deletions cmake/toolchain-windows64-mingw.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,16 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
set(COMPILER_BIG_OBJ_FLAG "-Wa,-mbig-obj")

# set C flags
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${COMPILER_BIG_OBJ_FLAG}" CACHE STRING "C flags")
set(CMAKE_C_FLAGS_INIT "${COMPILER_BIG_OBJ_FLAG}")

# set CXX flags
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${COMPILER_BIG_OBJ_FLAG}" CACHE STRING "C++ flags")
set(CMAKE_CXX_FLAGS_INIT "${COMPILER_BIG_OBJ_FLAG}")

# set size optimization in debug to fix "file is too big" problem for old MinGW 7.5.0 (newer versions work)
set(COMPILER_SIZE_OPTIMIZATION_FLAG "-Os")

# set C flags for debug
set(CMAKE_C_FLAGS_DEBUG_INIT "${COMPILER_SIZE_OPTIMIZATION_FLAG}")

# set CXX flags for debug
set(CMAKE_CXX_FLAGS_DEBUG_INIT "${COMPILER_SIZE_OPTIMIZATION_FLAG}")
17 changes: 6 additions & 11 deletions cmake/toolchain-windows64-msvc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@ add_definitions(-D_SCL_SECURE_NO_WARNINGS)

add_definitions(-DNOMINMAX)

# set /EHsc
set(COMPILER_EXCEPTION_FLAG "/EHsc")

# set parallel compilation
set(PROCESS_MAX "$ENV{MSVC_PROCESS_MAX}")
set(COMPILER_MP_FLAG "/MP${PROCESS_MAX}")

# set big-obj flag
set(COMPILER_BIG_OBJ_FLAG "/bigobj")

# set C flags
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${COMPILER_EXCEPTION_FLAG} ${COMPILER_MP_FLAG} ${COMPILER_BIG_OBJ_FLAG}"
CACHE STRING "C flags")
# set C flags (CMake adds /EHsc by default)
set(CMAKE_C_FLAGS_INIT
"${COMPILER_MP_FLAG} ${COMPILER_BIG_OBJ_FLAG}")

# set CXX flags
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${COMPILER_EXCEPTION_FLAG} ${COMPILER_MP_FLAG} ${COMPILER_BIG_OBJ_FLAG}"
CACHE STRING "C++ flags")
# set CXX flags (CMake adds /EHsc by default)
set(CMAKE_CXX_FLAGS_INIT
"${COMPILER_MP_FLAG} ${COMPILER_BIG_OBJ_FLAG}")

0 comments on commit d43c23c

Please sign in to comment.