From 0d5249523364de12755ebe802544a6dba873a408 Mon Sep 17 00:00:00 2001 From: LeonPS Date: Mon, 6 Jan 2025 19:15:52 +0000 Subject: [PATCH] Add new cmake presets --- .env | 5 + .../action.yml | 8 +- ..._release.yml => build_and_release_arm.yml} | 6 +- CMakePresets.json | 215 ++++++++++++++---- client/CMakeLists.txt | 3 +- 5 files changed, 187 insertions(+), 50 deletions(-) create mode 100644 .env rename .github/actions/{build_and_test => build_and_test_arm}/action.yml (80%) rename .github/workflows/{build_and_release.yml => build_and_release_arm.yml} (94%) diff --git a/.env b/.env new file mode 100644 index 00000000..52eef7c4 --- /dev/null +++ b/.env @@ -0,0 +1,5 @@ +PROJECT_NAME=zones_client +PRODUCT_NAME=Zones +VERSION=0.0.1 +BUNDLE_ID=com.zones.zones +COMPANY_NAME=Zones diff --git a/.github/actions/build_and_test/action.yml b/.github/actions/build_and_test_arm/action.yml similarity index 80% rename from .github/actions/build_and_test/action.yml rename to .github/actions/build_and_test_arm/action.yml index c1275e6d..f4183553 100644 --- a/.github/actions/build_and_test/action.yml +++ b/.github/actions/build_and_test_arm/action.yml @@ -1,4 +1,4 @@ -name: "build_and_test" +name: "build_and_test_arm" description: "Setup VCKPG, CMake, build, test and cache" runs: using: "composite" @@ -11,8 +11,8 @@ runs: - name: Run CMake consuming CMakePreset.json and run vcpkg to build dependencies uses: lukka/run-cmake@v10 with: - configurePreset: 'ninja-multi-vcpkg' + configurePreset: 'arm64-osx' configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']" - buildPreset: 'build-release' + buildPreset: 'arm64-osx-release' buildPresetAdditionalArgs: "['--parallel 4']" - testPreset: 'test-release' \ No newline at end of file + testPreset: 'arm64-osx-debug' \ No newline at end of file diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release_arm.yml similarity index 94% rename from .github/workflows/build_and_release.yml rename to .github/workflows/build_and_release_arm.yml index 317265de..75687cc0 100644 --- a/.github/workflows/build_and_release.yml +++ b/.github/workflows/build_and_release_arm.yml @@ -1,6 +1,6 @@ # Thanks to Pamplejuce for getting this on the right track, https://github.com/sudara/pamplejuce/ -name: build_and_release +name: build_and_release_arm on: workflow_dispatch: @@ -8,7 +8,7 @@ on: env: CMAKE_BUILD_PARALLEL_LEVEL: 3 BUILD_TYPE: Release - BUILD_DIR: builds/ninja-multi-vcpkg/client + BUILD_DIR: builds/arm64-osx/client jobs: build_and_package: @@ -33,7 +33,7 @@ jobs: uses: ./.github/actions/build_ui - name: Build and Test - uses: ./.github/actions/build_and_test + uses: ./.github/actions/build_and_test_arm - name: Setup Environment uses: ./.github/actions/setup_environment diff --git a/CMakePresets.json b/CMakePresets.json index 1081dc06..bfd8b3ff 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -2,77 +2,210 @@ "version": 3, "cmakeMinimumRequired": { "major": 3, - "minor": 20, + "minor": 21, "patch": 0 }, "configurePresets": [ { - "name": "ninja-multi-vcpkg", - "displayName": "Ninja Multi-Config", - "description": "Configure with vcpkg toolchain and generate Ninja project files for all configurations", + "name": "x64-msvc", + "generator": "Visual Studio 17 2022", + "architecture": "x64", "binaryDir": "${sourceDir}/builds/${presetName}", + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "cacheVariables": { + "BUILD_TESTING": true, + "BUILD_SHARED_LIBS": true, + "VCPKG_TARGET_TRIPLET": "x64-windows-static", + "CMAKE_SYSTEM_VERSION": "10.0.19041.0" + }, + "environment": { + "VCPKG_ROOT": "./vcpkg", + "DEV_LOCALHOST": "OFF" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "x64-msvc-debug", + "displayName": "x64-msvc-debug", + "inherits": "x64-msvc", + "binaryDir": "${sourceDir}/builds/${presetName}", + "environment": { + "DEV_LOCALHOST": "ON" + } + }, + { + "name": "x64-linux", "generator": "Ninja Multi-Config", + "binaryDir": "${sourceDir}/builds/${presetName}", + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": { - "type": "FILEPATH", - "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" - }, + "BUILD_TESTING": true, + "BUILD_SHARED_LIBS": true, + "VCPKG_TARGET_TRIPLET": "x64-linux" + }, + "environment": { + "VCPKG_ROOT": "./vcpkg", "DEV_LOCALHOST": "OFF" }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "x64-linux-debug", + "displayName": "x64-linux-debug", + "inherits": "x64-linux", + "binaryDir": "${sourceDir}/builds/${presetName}", "environment": { - "VCPKG_ROOT": "./vcpkg" + "DEV_LOCALHOST": "ON" } }, { - "name": "ninja-multi-vcpkg-debug", - "inherits": "ninja-multi-vcpkg", + "name": "x64-osx", + "generator": "Ninja Multi-Config", + "binaryDir": "${sourceDir}/builds/${presetName}", + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "cacheVariables": { + "BUILD_TESTING": true, + "BUILD_SHARED_LIBS": true, + "CMAKE_OSX_ARCHITECTURES": "x86_64", + "VCPKG_TARGET_TRIPLET": "x64-osx" + }, + "environment": { + "VCPKG_ROOT": "./vcpkg", + "DEV_LOCALHOST": "OFF" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "x64-osx-debug", + "displayName": "x64-osx-debug", + "inherits": "x64-osx", + "binaryDir": "${sourceDir}/builds/${presetName}", + "environment": { + "DEV_LOCALHOST": "ON" + } + }, + { + "name": "arm64-osx", + "displayName": "arm64-osx", + "inherits": "x64-osx", + "binaryDir": "${sourceDir}/builds/${presetName}", "cacheVariables": { + "CMAKE_OSX_ARCHITECTURES": "arm64", + "VCPKG_TARGET_TRIPLET": "arm64-osx" + } + }, + { + "name": "arm64-osx-debug", + "displayName": "arm64-osx-debug", + "inherits": "arm64-osx", + "binaryDir": "${sourceDir}/builds/${presetName}", + "environment": { "DEV_LOCALHOST": "ON" } } ], "buildPresets": [ { - "name": "build-debug", - "configurePreset": "ninja-multi-vcpkg-debug", - "displayName": "Build (Debug)", - "description": "Build with Ninja/vcpkg (Debug)", - "configuration": "Debug", - "environment": { - "DEV_LOCALHOST": "OFF" - } + "name": "x64-msvc-debug", + "configurePreset": "x64-msvc-debug", + "configuration": "Debug" + }, + { + "name": "x64-msvc-release", + "configurePreset": "x64-msvc", + "configuration": "Release" + }, + { + "name": "x64-linux-debug", + "configurePreset": "x64-linux-debug", + "configuration": "Debug" + }, + { + "name": "x64-linux-release", + "configurePreset": "x64-linux", + "configuration": "Release" }, { - "name": "build-release", - "configurePreset": "ninja-multi-vcpkg", - "displayName": "Build (Release)", - "description": "Build with Ninja/vcpkg (Release)", + "name": "x64-osx-debug", + "configurePreset": "x64-osx-debug", + "configuration": "Debug" + }, + { + "name": "x64-osx-release", + "configurePreset": "x64-osx", + "configuration": "Release" + }, + { + "name": "arm64-osx-debug", + "configurePreset": "arm64-osx-debug", + "configuration": "Debug" + }, + { + "name": "arm64-osx-release", + "configurePreset": "arm64-osx", "configuration": "Release" } ], "testPresets": [ { - "name": "test-ninja-vcpkg", - "configurePreset": "ninja-multi-vcpkg", - "hidden": true + "name": "x64-msvc-debug", + "configurePreset": "x64-msvc-debug", + "configuration": "Debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } }, { - "name": "test-debug", - "description": "Test (Debug)", - "displayName": "Test (Debug)", + "name": "x64-linux-debug", + "configurePreset": "x64-linux-debug", "configuration": "Debug", - "inherits": [ - "test-ninja-vcpkg" - ] - }, - { - "name": "test-release", - "description": "Test (Release)", - "displayName": "Test (Release)", - "configuration": "Release", - "inherits": [ - "test-ninja-vcpkg" - ] + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } + }, + { + "name": "x64-osx-debug", + "configurePreset": "x64-osx-debug", + "configuration": "Debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } + }, + { + "name": "arm64-osx-debug", + "configurePreset": "arm64-osx-debug", + "configuration": "Debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } } ] } \ No newline at end of file diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 57fa92d1..944bbc14 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -56,7 +56,6 @@ set(SOURCES src/controllers/WebLoadController.cpp ) -option(DEV_LOCALHOST OFF) set(ASSETS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ui/dist/) juce_add_plugin( @@ -75,7 +74,7 @@ juce_add_plugin( target_compile_definitions(${BINARY} PRIVATE - "DEV_LOCALHOST=$" + "DEV_LOCALHOST=$" JUCE_WEB_BROWSER=1 JUCE_USE_CURL=1 JUCE_USE_WIN_WEBVIEW2_WITH_STATIC_LINKING=1