Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into pr/36
Browse files Browse the repository at this point in the history
  • Loading branch information
luan committed Oct 8, 2023
2 parents 40f1edc + 6eaec63 commit e51724d
Show file tree
Hide file tree
Showing 60 changed files with 860 additions and 11,897 deletions.
36 changes: 26 additions & 10 deletions .github/workflows/analysis-sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@ name: Analysis - SonarCloud
on:
pull_request_target:
types: [opened, synchronize, reopened]
paths:
- 'src/**'
- 'source/**'
- 'cmake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'vcpkg.json'
push:
paths:
- 'src/**'
- 'source/**'
- 'cmake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'vcpkg.json'
branches:
- main

Expand All @@ -20,6 +34,13 @@ jobs:
runs-on: ubuntu-22.04

steps:
- name: Cancel Previous Runs
if: github.ref != 'refs/heads/main'
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
cancel_others: true

- uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
with:
Expand All @@ -36,12 +57,6 @@ jobs:
run: >
sudo apt-get update && sudo apt-get install ccache linux-headers-$(uname -r)
- name: Switch to gcc-11
run: |
sudo apt install gcc-11 g++-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
sudo update-alternatives --set gcc /usr/bin/gcc-11
- name: CCache
id: ccache
uses: actions/cache@main
Expand All @@ -64,23 +79,24 @@ jobs:
run: |
vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ')
echo "vcpkg commit ID: $vcpkgCommitId"
echo "::set-output name=vcpkgGitCommitId::$vcpkgCommitId"
echo "VCPKG_GIT_COMMIT_ID=$vcpkgCommitId" >> $GITHUB_ENV
- name: Get vcpkg commit id from vcpkg.json
uses: lukka/run-vcpkg@main
with:
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git"
vcpkgGitCommitId: ${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }}
vcpkgGitCommitId: ${{ env.VCPKG_GIT_COMMIT_ID }}

- name: Install additional libraries
run: sudo apt-get install libasio-dev nlohmann-json3-dev libfmt-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev libglib2.0-dev at-spi2-core libwxgtk3.0-gtk3-dev libarchive-dev freeglut3-dev libxmu-dev libdbus-1-dev libxtst-dev

- name: Install sonar-scanner
uses: SonarSource/sonarcloud-github-c-cpp@v1
uses: SonarSource/sonarcloud-github-c-cpp@v2

- name: Generate compilation database
run: |
mkdir -p build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DOPTIONS_ENABLE_CCACHE=ON -S . -B build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DOPTIONS_ENABLE_CCACHE=ON -DSPEED_UP_BUILD_UNITY=OFF -S . -B build
- name: Run PR sonar-scanner
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
Expand Down
46 changes: 30 additions & 16 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,21 @@ on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'src/**'
- 'source/**'
- 'cmake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'vcpkg.json'
push:
paths:
- 'src/**'
- 'source/**'
- 'cmake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'vcpkg.json'
branches:
- main

Expand All @@ -22,25 +36,26 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
buildtype: [Release, Debug]
os: [ ubuntu-22.04 ]
buildtype: [ linux-release ]
include:
- os: ubuntu-22.04
triplet: x64-linux

steps:
- name: Cancel Previous Runs
if: github.ref != 'refs/heads/main'
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
cancel_others: true

- name: Checkout repository
uses: actions/checkout@main

- name: Install Linux Dependencies
run: >
sudo apt-get update && sudo apt-get install ccache linux-headers-$(uname -r)
- name: Switch to gcc-11
run: |
sudo apt install gcc-11 g++-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
sudo update-alternatives --set gcc /usr/bin/gcc-11
- name: CCache
uses: hendrikmuhs/ccache-action@main
Expand All @@ -55,12 +70,13 @@ jobs:
run: |
vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ')
echo "vcpkg commit ID: $vcpkgCommitId"
echo "::set-output name=vcpkgGitCommitId::$vcpkgCommitId"
echo "VCPKG_GIT_COMMIT_ID=$vcpkgCommitId" >> $GITHUB_ENV
- name: Get vcpkg commit id from vcpkg.json
uses: lukka/run-vcpkg@main
with:
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git"
vcpkgGitCommitId: ${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }}
vcpkgGitCommitId: ${{ env.VCPKG_GIT_COMMIT_ID }}

- name: Get latest CMake and ninja
uses: lukka/get-cmake@main
Expand All @@ -69,15 +85,13 @@ jobs:
run: sudo apt-get install libasio-dev nlohmann-json3-dev libfmt-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev libglib2.0-dev at-spi2-core libwxgtk3.0-gtk3-dev libarchive-dev freeglut3-dev libxmu-dev libdbus-1-dev libxtst-dev

- name: Run CMake Cache and Build
uses: lukka/run-cmake@v3
uses: lukka/run-cmake@main
with:
cmakeListsTxtPath: ${{ github.workspace }}/CMakeLists.txt
useVcpkgToolchainFile: true
buildDirectory: ${{ github.workspace }}/build/
cmakeBuildType: ${{ matrix.buildtype }}
configurePreset: ${{ matrix.buildtype }}
buildPreset: ${{ matrix.buildtype }}

- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@main
with:
name: ${{ matrix.os }}-${{ matrix.buildtype }}
path: |
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/build-windows-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: Build - Windows - CMake

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'src/**'
- 'source/**'
- 'cmake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'vcpkg.json'
push:
paths:
- 'src/**'
- 'source/**'
- 'cmake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'vcpkg.json'
branches:
- main

env:
CMAKE_BUILD_PARALLEL_LEVEL: 2
MAKEFLAGS: '-j 2'
jobs:
job:
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
name: ${{ matrix.os }}-${{ matrix.buildtype }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022]
buildtype: [ windows-release ]
include:
- os: windows-2022
triplet: x64-windows-static
packages: >
sccache
steps:
- name: Cancel Previous Runs
if: github.ref != 'refs/heads/main'
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
cancel_others: true

- name: Checkout repository
uses: actions/checkout@main

- name: CCache
uses: hendrikmuhs/ccache-action@main
with:
max-size: "1G"
variant: "sccache"
key: ccache-${{ matrix.os }}-${{ matrix.buildtype }}
restore-keys: |
ccache-${{ matrix.os }}
- name: Restore artifacts and install vcpkg
id: vcpkg-step
run: |
$json=Get-Content vcpkg.json -Raw | ConvertFrom-Json
$vcpkgCommitId=$json.'builtin-baseline'
Write-Host "vcpkg commit ID: $vcpkgCommitId"
echo "VCPKG_GIT_COMMIT_ID=$vcpkgCommitId" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Get vcpkg commit id from vcpkg.json
uses: lukka/run-vcpkg@main
with:
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git"
vcpkgGitCommitId: ${{ env.VCPKG_GIT_COMMIT_ID }}

- name: Get latest CMake and ninja
uses: lukka/get-cmake@main

- name: Run CMake
uses: lukka/run-cmake@main
with:
configurePreset: ${{ matrix.buildtype }}
buildPreset: ${{ matrix.buildtype }}

- name: Create and Upload Artifact
uses: actions/upload-artifact@main
with:
name: canary-${{ matrix.buildtype }}-${{ github.sha }}
path: |
${{ github.workspace }}/*.exe
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
---
name: Build - Windows
name: Build - Windows - Solution

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'src/**'
- 'source/**'
- 'cmake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'vcpkg.json'
- 'vcproj/**'
push:
paths:
- 'src/**'
- 'source/**'
- 'cmake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'vcpkg.json'
- 'vcproj/**'
branches:
- main
- master

jobs:
job:
Expand All @@ -25,11 +40,18 @@ jobs:
packages: >
sccache
steps:
- name: Cancel Previous Runs
if: github.ref != 'refs/heads/main'
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
cancel_others: true

- name: Setup MSBuild.exe
uses: microsoft/[email protected]

- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@main

- name: Install vcpkg
run: |
Expand All @@ -42,7 +64,7 @@ jobs:
run: msbuild.exe /p:VcpkgEnableManifest=true /p:Configuration=Release /p:Platform=x64 /p:VcpkgRoot=$env:GITHUB_WORKSPACE/vcpkg vcproj/RME.sln

- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@main
with:
name: ${{ matrix.os }}-${{ matrix.buildtype }}
path: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ cmake-build-debug/
*.exe
*.pdb
*.rar
vcpkg_installed/
*.ilk
remeres.exe.manifest
28 changes: 27 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.22)

project(cmake)

Expand All @@ -25,12 +25,22 @@ set(CMAKE_CXX_STANDARD 20)
set(GNUCXX_MINIMUM_VERSION 11)
set(MSVC_MINIMUM_VERSION "19.32")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

# Make will print more details
set(CMAKE_VERBOSE_MAKEFILE OFF)

# Generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# *****************************************************************************
# Options
# *****************************************************************************
option(OPTIONS_ENABLE_CCACHE "Enable ccache" OFF)
option(OPTIONS_ENABLE_SCCACHE "Use sccache to speed up compilation process" OFF)
option(OPTIONS_ENABLE_IPO "Check and Enable interprocedural optimization (IPO/LTO)" ON)

# *****************************************************************************
# Set Sanity Check
Expand Down Expand Up @@ -90,6 +100,22 @@ if(OPTIONS_ENABLE_SCCACHE)
endif()
endif()

# === IPO ===
option(OPTIONS_ENABLE_IPO "Check and Enable interprocedural optimization (IPO/LTO)" ON)
if(OPTIONS_ENABLE_IPO)
log_option_enabled("ipo")

include(CheckIPOSupported)
check_ipo_supported(RESULT result OUTPUT output)
if(result)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
log_war("IPO is not supported: ${output}")
endif()
else()
log_option_disabled("ipo")
endif()

# *****************************************************************************
# Add source project
# *****************************************************************************
Expand Down
Loading

0 comments on commit e51724d

Please sign in to comment.