mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-12 15:26:14 +07:00
try to build on github
This commit is contained in:
36
.github/workflows/darwin.yml
vendored
Normal file
36
.github/workflows/darwin.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: darwin
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
E2D_WITHOUT_AUDIO: true
|
||||
E2D_WITHOUT_GRAPHICS: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{matrix.config.os}}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/macos
|
||||
- { os: "macos-10.15", xcode: "10.3", arch: "x64" }
|
||||
- { os: "macos-12", xcode: "14.2", arch: "x64" }
|
||||
name: "xcode-${{matrix.config.xcode}}"
|
||||
steps:
|
||||
- name: Setup
|
||||
run: brew install cmake ninja
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
submodules: true
|
||||
- name: Select Xcode
|
||||
run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app"
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --preset macos-${{matrix.config.arch}}
|
||||
cmake --build --preset macos-${{matrix.config.arch}}-release
|
||||
- name: Test
|
||||
run: |
|
||||
ctest --preset macos-${{matrix.config.arch}}-release
|
||||
36
.github/workflows/linux.yml
vendored
Normal file
36
.github/workflows/linux.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: linux
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
E2D_WITHOUT_AUDIO: true
|
||||
E2D_WITHOUT_GRAPHICS: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{matrix.config.os}}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/linux
|
||||
- { os: "ubuntu-20.04", cc: "gcc-7", cxx: "g++-7" }
|
||||
- { os: "ubuntu-20.04", cc: "clang-7", cxx: "clang++-7" }
|
||||
- { os: "ubuntu-22.04", cc: "gcc-12", cxx: "g++-12" }
|
||||
- { os: "ubuntu-22.04", cc: "clang-14", cxx: "clang++-14" }
|
||||
name: "${{matrix.config.cxx}}"
|
||||
steps:
|
||||
- name: Setup
|
||||
run: sudo apt-get -y install cmake ninja-build libx11-dev libgl1-mesa-dev xorg-dev ${{matrix.config.cc}} ${{matrix.config.cxx}}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
submodules: true
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --preset linux-${{matrix.config.cc}}
|
||||
cmake --build --preset linux-${{matrix.config.cc}}-release
|
||||
- name: Test
|
||||
run: |
|
||||
ctest --preset linux-${{matrix.config.cc}}-release
|
||||
38
.github/workflows/windows.yml
vendored
Normal file
38
.github/workflows/windows.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: windows
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
E2D_WITHOUT_AUDIO: true
|
||||
E2D_WITHOUT_GRAPHICS: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{matrix.config.os}}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/win
|
||||
- { os: "windows-2019", vc: "msvc2019", arch: "x86" }
|
||||
- { os: "windows-2019", vc: "msvc2019", arch: "x64" }
|
||||
- { os: "windows-2022", vc: "msvc2022", arch: "x86" }
|
||||
- { os: "windows-2022", vc: "msvc2022", arch: "x64" }
|
||||
name: "${{matrix.config.vc}} ${{matrix.config.arch}}"
|
||||
steps:
|
||||
- name: Setup
|
||||
run: choco install cmake ninja
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
submodules: true
|
||||
- name: Select MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}
|
||||
cmake --build --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release
|
||||
- name: Test
|
||||
run: |
|
||||
ctest --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release
|
||||
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@@ -17,6 +17,12 @@
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.trimTrailingWhitespace": true
|
||||
},
|
||||
"[yaml]": {
|
||||
"files.encoding": "utf8",
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.trimTrailingWhitespace": true
|
||||
},
|
||||
"clangd.arguments": [
|
||||
"--all-scopes-completion",
|
||||
"--background-index",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
||||
|
||||
if(NOT DEFINED PROJECT_NAME)
|
||||
set(E2D_BUILD_AS_STANDALONE ON)
|
||||
|
||||
344
CMakePresets.json
Normal file
344
CMakePresets.json
Normal file
@@ -0,0 +1,344 @@
|
||||
{
|
||||
"version": 3,
|
||||
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 21,
|
||||
"patch": 0
|
||||
},
|
||||
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "ninja-base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja Multi-Config",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"installDir": "${sourceDir}/install/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-base",
|
||||
"hidden": true,
|
||||
"inherits": "ninja-base",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Linux"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-7",
|
||||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "clang-7",
|
||||
"CMAKE_CXX_COMPILER": "clang++-7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-14",
|
||||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "clang-14",
|
||||
"CMAKE_CXX_COMPILER": "clang++-14"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-7",
|
||||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "gcc-7",
|
||||
"CMAKE_CXX_COMPILER": "g++-7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-12",
|
||||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "gcc-12",
|
||||
"CMAKE_CXX_COMPILER": "g++-12"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-base",
|
||||
"hidden": true,
|
||||
"inherits": "ninja-base",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Darwin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64",
|
||||
"inherits": "macos-base",
|
||||
"architecture": {
|
||||
"value": "arm64",
|
||||
"strategy": "external"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-san",
|
||||
"inherits": "macos-arm64",
|
||||
"cacheVariables": {
|
||||
"E2D_BUILD_WITH_ASAN": true,
|
||||
"E2D_BUILD_WITH_UBSAN": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-x64",
|
||||
"inherits": "macos-base",
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-san",
|
||||
"inherits": "macos-x64",
|
||||
"cacheVariables": {
|
||||
"E2D_BUILD_WITH_ASAN": true,
|
||||
"E2D_BUILD_WITH_UBSAN": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-base",
|
||||
"hidden": true,
|
||||
"inherits": "ninja-base",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2019",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x86",
|
||||
"strategy": "external"
|
||||
},
|
||||
"toolset": {
|
||||
"value": "v142,host=x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2019",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"toolset": {
|
||||
"value": "v142,host=x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2022",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x86",
|
||||
"strategy": "external"
|
||||
},
|
||||
"toolset": {
|
||||
"value": "v143,host=x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2022",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"toolset": {
|
||||
"value": "v143,host=x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "linux-clang-7-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "linux-clang-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-7-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "linux-clang-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-14-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "linux-clang-14"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-14-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "linux-clang-14"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-7-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "linux-gcc-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-7-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "linux-gcc-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-12-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "linux-gcc-12"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-12-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "linux-gcc-12"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "macos-arm64-san"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "macos-arm64"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "macos-x64-san"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "macos-x64"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2019-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "windows-x86-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2019-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "windows-x86-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2019-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "windows-x64-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2019-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "windows-x64-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2022-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "windows-x86-msvc2022"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2022-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "windows-x86-msvc2022"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2022-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "windows-x64-msvc2022"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2022-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "windows-x64-msvc2022"
|
||||
}
|
||||
],
|
||||
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "test-base",
|
||||
"hidden": true,
|
||||
"output": {
|
||||
"verbosity": "verbose"
|
||||
},
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-7-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-clang-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-14-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-clang-14"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-7-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-gcc-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-12-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-gcc-12"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-arm64"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-x64"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2019-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x86-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2019-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x64-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2022-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x86-msvc2022"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2022-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x64-msvc2022"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -9,7 +9,6 @@ using namespace e2d;
|
||||
|
||||
TEST_CASE("images") {
|
||||
DEFER_HPP([](){
|
||||
filesystem::remove_file("image_save_test.jpg");
|
||||
filesystem::remove_file("image_save_test.png");
|
||||
filesystem::remove_file("image_save_test.tga");
|
||||
filesystem::remove_file("image_save_test.dds");
|
||||
@@ -46,7 +45,6 @@ TEST_CASE("images") {
|
||||
|
||||
SECTION("stb") {
|
||||
{
|
||||
REQUIRE(filesystem::remove_file("image_save_test.jpg"));
|
||||
REQUIRE(filesystem::remove_file("image_save_test.png"));
|
||||
REQUIRE(filesystem::remove_file("image_save_test.tga"));
|
||||
const u8 img_data[] = {
|
||||
@@ -69,11 +67,6 @@ TEST_CASE("images") {
|
||||
0, 0, 255, 0, 0, 255,
|
||||
};
|
||||
image img(v2u(2,15), image_data_format::rgb8, buffer(img_data, sizeof(img_data)));
|
||||
REQUIRE(images::try_save_image(
|
||||
img,
|
||||
image_file_format::jpg,
|
||||
make_write_file("image_save_test.jpg", false)));
|
||||
REQUIRE(filesystem::file_exists("image_save_test.jpg"));
|
||||
REQUIRE(images::try_save_image(
|
||||
img,
|
||||
image_file_format::png,
|
||||
@@ -88,13 +81,6 @@ TEST_CASE("images") {
|
||||
{
|
||||
image img;
|
||||
|
||||
REQUIRE(images::try_load_image(img, make_read_file("image_save_test.jpg")));
|
||||
REQUIRE(img.size() == v2u(2,15));
|
||||
REQUIRE(img.format() == image_data_format::rgb8);
|
||||
REQUIRE(math::approximately(img.pixel32(0,2), color32::red(), 10u));
|
||||
REQUIRE(math::approximately(img.pixel32(0,7), color32::green(), 10u));
|
||||
REQUIRE(math::approximately(img.pixel32(0,12), color32::blue(), 10u));
|
||||
|
||||
REQUIRE(images::try_load_image(img, make_read_file("image_save_test.png")));
|
||||
REQUIRE(img.size() == v2u(2,15));
|
||||
REQUIRE(img.format() == image_data_format::rgb8);
|
||||
@@ -110,7 +96,6 @@ TEST_CASE("images") {
|
||||
REQUIRE(math::approximately(img.pixel32(0,12), color32::blue(), 0u));
|
||||
}
|
||||
{
|
||||
REQUIRE(filesystem::remove_file("image_save_test.jpg"));
|
||||
REQUIRE(filesystem::remove_file("image_save_test.png"));
|
||||
REQUIRE(filesystem::remove_file("image_save_test.tga"));
|
||||
const u8 img_data[] = {
|
||||
@@ -134,11 +119,6 @@ TEST_CASE("images") {
|
||||
};
|
||||
image img(v2u(2,15), image_data_format::rgb8, buffer(img_data, sizeof(img_data)));
|
||||
buffer buf;
|
||||
REQUIRE(images::try_save_image(
|
||||
img,
|
||||
image_file_format::jpg,
|
||||
buf));
|
||||
REQUIRE(filesystem::try_write_all(buf, "image_save_test.jpg", false));
|
||||
REQUIRE(images::try_save_image(
|
||||
img,
|
||||
image_file_format::png,
|
||||
@@ -154,14 +134,6 @@ TEST_CASE("images") {
|
||||
image img;
|
||||
buffer buf;
|
||||
|
||||
REQUIRE(filesystem::try_read_all(buf, "image_save_test.jpg"));
|
||||
REQUIRE(images::try_load_image(img, buf));
|
||||
REQUIRE(img.size() == v2u(2,15));
|
||||
REQUIRE(img.format() == image_data_format::rgb8);
|
||||
REQUIRE(math::approximately(img.pixel32(0,2), color32::red(), 10u));
|
||||
REQUIRE(math::approximately(img.pixel32(0,7), color32::green(), 10u));
|
||||
REQUIRE(math::approximately(img.pixel32(0,12), color32::blue(), 10u));
|
||||
|
||||
REQUIRE(filesystem::try_read_all(buf, "image_save_test.png"));
|
||||
REQUIRE(images::try_load_image(img, buf));
|
||||
REQUIRE(img.size() == v2u(2,15));
|
||||
@@ -192,7 +164,6 @@ TEST_CASE("images") {
|
||||
image_data_format format;
|
||||
};
|
||||
const img_info test_infos[] = {
|
||||
{"bin/images/stb/ship.jpg", 64 * 128 * 3, image_data_format::rgb8},
|
||||
{"bin/images/stb/ship.png", 64 * 128 * 4, image_data_format::rgba8},
|
||||
{"bin/images/stb/ship.tga", 64 * 128 * 4, image_data_format::rgba8}};
|
||||
for ( const auto& info : test_infos ) {
|
||||
|
||||
Reference in New Issue
Block a user