diff --git a/.github/workflows/cmake-windows.yml b/.github/workflows/cmake-windows.yml index 36436f1c11..3d2b96b9e0 100644 --- a/.github/workflows/cmake-windows.yml +++ b/.github/workflows/cmake-windows.yml @@ -50,25 +50,6 @@ jobs: # } steps: - - name: Update MinGW to 10.2 - if: ${{ matrix.config.platform == 'mingw' }} - run: | - for($i=0; ; $i++) { - choco upgrade mingw --version=10.2.0 --force - if (!$?) { - if ($i -le 3) { - continue - } - throw "choco upgrade mingw failed" - } - break - } - $gcc_version = &gcc -v 2>&1 | Out-String - $gcc_version - if ($gcc_version -NotMatch 'gcc version 10.2.0') { - throw "invalid gcc version detected" - } - - name: Checkout repository uses: actions/checkout@v4 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index c025e95e5f..0b83bd736e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,10 +205,10 @@ if(MSVC) # list(APPEND PRIVATE_COMPILE_OPTIONS /WX) elseif(OC_COMPILER_IS_GCC OR OC_COMPILER_IS_CLANG) oc_add_compile_options(GLOBAL - FLAGS -Wall -Wextra -pedantic - -Wwrite-strings -Wunused -Wunreachable-code -Wcast-align -Wpointer-arith - -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes + FLAGS -Wall -Wextra -pedantic + -Wwrite-strings -Wunused -Wunreachable-code -Wcast-align -Wpointer-arith -Wmissing-declarations -fno-common + CFLAGS -Wmissing-prototypes -Wstrict-prototypes ) if(NOT OC_CLANG_TIDY_ENABLED) @@ -448,6 +448,9 @@ if(MINGW) # force the use mingw_printf because the default doesn't support '%zu' list(APPEND PRIVATE_COMPILE_DEFINITIONS "__USE_MINGW_ANSI_STDIO=(1)") list(APPEND TEST_COMPILE_DEFINITIONS "__USE_MINGW_ANSI_STDIO=(1)") + if(BUILD_MBEDTLS) + list(APPEND MBEDTLS_COMPILE_DEFINITIONS "__USE_MINGW_ANSI_STDIO=(1)") + endif() endif() if(MSVC) diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index b787f5f075..759e825c15 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -8,6 +8,9 @@ function(oc_add_app_executable) add_executable(${OC_ADD_APP_EXECUTABLE_TARGET} ${OC_ADD_APP_EXECUTABLE_SOURCES}) target_compile_options(${OC_ADD_APP_EXECUTABLE_TARGET} PRIVATE ${PRIVATE_COMPILE_OPTIONS}) + if(MINGW) + target_compile_definitions(${OC_ADD_APP_EXECUTABLE_TARGET} PRIVATE "__USE_MINGW_ANSI_STDIO=(1)") + endif() target_link_libraries(${OC_ADD_APP_EXECUTABLE_TARGET} PUBLIC ${OC_ADD_APP_EXECUTABLE_DEPENDENCIES}) set(TARGET_STORAGE_FOLDER ${PROJECT_BINARY_DIR}/${OC_ADD_APP_EXECUTABLE_TARGET}_creds)