Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: gcc improvements #1750

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/scripts/build_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail

# configure
cmake --preset $TARGET_PRESET

# change into the build directory
pushd build

ninja

popd
29 changes: 26 additions & 3 deletions .github/workflows/build_new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
msystem: clang64
install: mingw-w64-clang-x86_64-clang
target-cmake-preset: windows-ci-mingw-native
- name: windows-x64-gcc
os: windows-latest
compiler: g++
shell: 'msys2 {0}'
msystem: mingw64
install: mingw-w64-x86_64-toolchain
target-cmake-preset: windows-ci-mingw-native
- name: windows-clang-cl-x64
os: windows-latest
windres: rc
Expand Down Expand Up @@ -48,6 +55,12 @@ jobs:
shell: sh
install: cmake ccache xcbeautify
target-cmake-preset: macos-ci-universal
- name: ubuntu
os: ubuntu-latest
compiler: g++
shell: bash
install: cmake ccache ninja-build libsdl2-dev libgtk-3-dev libao-dev libopenal-dev
target-cmake-preset: ubuntu-ci
name: ${{ matrix.program }}-${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
defaults:
Expand All @@ -71,12 +84,22 @@ jobs:
with:
fetch-tags: true
fetch-depth: 0
- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update -y -qq
sudo apt-get install ${{ matrix.platform.install }}
- name: Install macOS Dependencies
if: runner.os == 'macOS'
run: |
brew install ${{ matrix.platform.install }}
- name: "Build: Linux"
if: runner.os == 'Linux'
run: .github/scripts/build_ubuntu.sh
env:
TARGET_PRESET: ${{ matrix.platform.target-cmake-preset }}
- name: "Build: Windows"
if: runner.os != 'macOS'
if: runner.os != 'macOS' && runner.os != 'Linux'
run: .github/scripts/build_windows.sh
env:
CROSS_COMPILE: ${{ matrix.platform.native-cmake-preset != '' }}
Expand Down Expand Up @@ -112,7 +135,7 @@ jobs:
MACOS_NOTARIZATION_PASSWORD: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
MACOS_NOTARIZATION_TEAMID: ${{ secrets.MACOS_NOTARIZATION_TEAMID }}
- name: Upload Build (Windows)
if: runner.os != 'macOS'
if: runner.os != 'macOS' && runner.os != 'Linux'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.program }}-${{ matrix.platform.name }}
Expand All @@ -124,7 +147,7 @@ jobs:
name: ${{ matrix.program }}-${{ matrix.platform.name }}
path: build/desktop-ui/RelWithDebInfo/
- name: Upload Debug Symbols (Windows)
if: runner.os != 'macOS'
if: runner.os != 'macOS' && runner.os != 'Linux'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.program }}-${{ matrix.platform.name }}-PDBs
Expand Down
14 changes: 14 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,20 @@
"cacheVariables": {
"ARES_CROSSCOMPILING": true
}
},
{
"name": "ubuntu-ci",
"displayName": "Ubuntu CI (x64 gcc)",
"description": "Single-arch binary for building on Github Actions",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": {"type": "STRING", "value": "RelWithDebInfo"},
"ENABLE_CCACHE": true,
"ARES_BUILD_LOCAL": false,
"ARES_BUILD_OPTIONAL_TARGETS": true,
"ARES_PRECOMPILE_HEADERS": false
}
}
],
"buildPresets": [
Expand Down
7 changes: 7 additions & 0 deletions ares/n64/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ elseif(OS_LINUX OR OS_FREEBSD OR OS_OPENBSD)
include(cmake/os-linux.cmake)
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(WARNING "
Building N64 with optimizations under GCC currently results in broken graphical output, see \
https://github.com/ares-emulator/ares/issues/1737 . Building with clang instead will work around this issue. \
")
endif()

ares_add_sources(
CORE #
n64
Expand Down
7 changes: 7 additions & 0 deletions desktop-ui/cmake/os-windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ target_sources(desktop-ui PRIVATE resource/ares.rc resource/ares.Manifest)

set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT desktop-ui)

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(
desktop-ui
PRIVATE mingw32
)
endif()

if(ARES_ENABLE_LIBRASHADER)
if(TARGET libretro::slang_shaders)
add_custom_command(
Expand Down
9 changes: 9 additions & 0 deletions mia/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ if(ARES_BUILD_OPTIONAL_TARGETS)
target_sources(mia-ui PRIVATE resource/mia.rc resource/mia.Manifest)
endif()

if(OS_WINDOWS)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(
mia-ui
PRIVATE nall
)
endif()
endif()

set_target_properties(
mia-ui
PROPERTIES
Expand Down
10 changes: 10 additions & 0 deletions tests/i8080/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ add_executable(i8080 i8080.cpp ../../ares/component/processor/i8080/i8080.cpp)
target_include_directories(i8080 PRIVATE ${CMAKE_SOURCE_DIR})

target_link_libraries(i8080 PRIVATE ares::ares)

if(OS_WINDOWS)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(
i8080
PRIVATE nall
)
endif()
endif()

set_target_properties(i8080 PROPERTIES FOLDER tests PREFIX "")
target_enable_subproject(i8080 "i8080 processor test harness")
ares_configure_executable(i8080)
Loading