Skip to content

Commit

Permalink
Merge pull request #840 from edge-classic/mingw-build-update
Browse files Browse the repository at this point in the history
Update CMake and CI for MinGW builds
  • Loading branch information
dashodanger authored Jan 15, 2025
2 parents c4a51aa + f9738ca commit 4086340
Show file tree
Hide file tree
Showing 210 changed files with 54,463 additions and 1,231 deletions.
70 changes: 33 additions & 37 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -49,42 +49,38 @@ jobs:
${{github.workspace}}/edge-classic
retention-days: ${{env.RETENTION_DAYS}}

build-mingw:
runs-on: windows-latest
build-mingw32:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- name: Download w64devkit
run: invoke-webrequest https://github.com/skeeto/w64devkit/releases/download/v2.0.0/w64devkit-x86-2.0.0.exe -outfile ${{github.workspace}}\w64devkit.exe
- name: Extract w64devkit
run: ${{github.workspace}}\w64devkit.exe -y
- name: Download SDL2-devel
run: invoke-webrequest https://github.com/libsdl-org/SDL/releases/download/release-2.30.9/SDL2-devel-2.30.9-mingw.zip -outfile ${{github.workspace}}\sdl2-devel.zip
- name: Extract SDL2-devel
run: expand-archive -path ${{github.workspace}}\sdl2-devel.zip -destinationpath ${{github.workspace}}
- name: Copy SDL2-devel contents to w64devkit
run: |
robocopy ${{github.workspace}}\SDL2-2.30.9\i686-w64-mingw32 ${{github.workspace}}\w64devkit\i686-w64-mingw32 /s ; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
robocopy ${{github.workspace}}\SDL2-2.30.9\i686-w64-mingw32 ${{github.workspace}}\w64devkit /s ; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
- name: Set environment variables and build
run: |
$env:Path = "${{github.workspace}}\w64devkit\bin;" + $env:Path
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_FLAGS="-isystem ${{github.workspace}}\w64devkit\include" -G "MinGW Makefiles"
cmake --build build --config ${{env.BUILD_TYPE}}
strip ${{github.workspace}}\edge-classic.exe
- name: Copy SDL2 DLL
run: copy-item -path ${{github.workspace}}\SDL2-2.30.9\i686-w64-mingw32\bin\SDL2.dll -destination ${{github.workspace}}
- uses: actions/upload-artifact@v4
with:
name: edge-classic-mingw
path: |
autoload
edge_base
edge_defs
edge_fixes
soundfont
edge-classic.exe
*.dll
retention-days: ${{env.RETENTION_DAYS}}
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsdl2-dev mingw-w64
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-mingw32.cmake

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- uses: actions/upload-artifact@v4
with:
name: edge-classic-mingw32
path: |
${{github.workspace}}/autoload
${{github.workspace}}/edge_base
${{github.workspace}}/edge_defs
${{github.workspace}}/edge_fixes
${{github.workspace}}/soundfont
${{github.workspace}}/edge-classic.exe
${{github.workspace}}/*.dll
retention-days: ${{env.RETENTION_DAYS}}

build-msvc:
runs-on: windows-latest
Expand Down Expand Up @@ -139,7 +135,7 @@ jobs:
retention-days: ${{env.RETENTION_DAYS}}

build-web-player:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if (EMSCRIPTEN)
include("${CMAKE_SOURCE_DIR}/cmake/Emscripten.cmake")
endif()

if (WIN32)
if (WIN32 OR MINGW)
add_definitions(-D_WIN32_WINNT=0x601)
endif()

Expand Down Expand Up @@ -122,8 +122,8 @@ else()
endif()
endif()

if (MSYS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -mwindows")
if (MINGW)
set(CMAKE_EXE_LINKER_FLAGS "-lmingw32 ${CMAKE_EXE_LINKER_FLAGS}")
endif()

endif()
Expand All @@ -134,7 +134,7 @@ if(${CMAKE_SYSTEM} MATCHES "BSD")
include_directories("/usr/local/include")
endif()

if (MSVC)
if(MINGW OR MSVC OR (WIN32 AND CLANG))
set(SDL2_DIR "${CMAKE_SOURCE_DIR}/libraries/sdl2")
endif()

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ add_subdirectory(prns)
add_subdirectory(stb)
if (NOT EMSCRIPTEN)
add_subdirectory(thread)
if (NOT MINGW)
add_subdirectory(mimalloc)
endif()
add_subdirectory(mimalloc)
endif()
add_subdirectory(tracy)
add_subdirectory(xxHash)
Expand Down
6 changes: 3 additions & 3 deletions libraries/mimalloc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD 17)
option(MI_SECURE "Use full security mitigations (like guard pages, allocation randomization, double-free mitigation, and free-list corruption detection)" OFF)
option(MI_DEBUG_FULL "Use full internal heap invariant checking in DEBUG mode (expensive)" OFF)
option(MI_PADDING "Enable padding to detect heap block overflow (always on in DEBUG or SECURE mode, or with Valgrind/ASAN)" OFF)
option(MI_OVERRIDE "Override the standard malloc interface (i.e. define entry points for 'malloc', 'free', etc)" ON)
option(MI_OVERRIDE "Override the standard malloc interface (i.e. define entry points for 'malloc', 'free', etc)" OFF)
option(MI_XMALLOC "Enable abort() call on memory allocation failure by default" OFF)
option(MI_SHOW_ERRORS "Show error and warning messages by default (only enabled by default in DEBUG mode)" OFF)
option(MI_TRACK_VALGRIND "Compile with Valgrind support (adds a small overhead)" OFF)
Expand All @@ -16,8 +16,8 @@ option(MI_TRACK_ETW "Compile with Windows event tracing (ETW) support (a
option(MI_USE_CXX "Use the C++ compiler to compile the library (instead of the C compiler)" OFF)
option(MI_OPT_ARCH "Only for optimized builds: turn on architecture specific optimizations (for arm64: '-march=armv8.1-a' (2016))" ON)
option(MI_SEE_ASM "Generate assembly files" OFF)
option(MI_OSX_INTERPOSE "Use interpose to override standard malloc on macOS" ON)
option(MI_OSX_ZONE "Use malloc zone to override standard malloc on macOS" ON)
option(MI_OSX_INTERPOSE "Use interpose to override standard malloc on macOS" OFF)
option(MI_OSX_ZONE "Use malloc zone to override standard malloc on macOS" OFF)
option(MI_WIN_REDIRECT "Use redirection module ('mimalloc-redirect') on Windows if compiling mimalloc as a DLL" ON)
option(MI_WIN_USE_FIXED_TLS "Use a fixed TLS slot on Windows to avoid extra tests in the malloc fast path" OFF)
option(MI_LOCAL_DYNAMIC_TLS "Use local-dynamic-tls, a slightly slower but dlopen-compatible thread local storage mechanism (Unix)" OFF)
Expand Down
Loading

0 comments on commit 4086340

Please sign in to comment.