From 30674e7740241a77f332ecafc3e15254f8fa3edf Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 6 Feb 2020 17:10:50 +0700 Subject: [PATCH 1/3] update enduro2d module --- modules/enduro2d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/enduro2d b/modules/enduro2d index f8721f3..9bec3ae 160000 --- a/modules/enduro2d +++ b/modules/enduro2d @@ -1 +1 @@ -Subproject commit f8721f365a91353ff3c96b63fa8186d8bd98406b +Subproject commit 9bec3ae2f29deaf03df4ffb6780cd8b9d1c04d8e From f933d7b4f35b9925079cbebc94f654afb915a247 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 6 Feb 2020 17:24:11 +0700 Subject: [PATCH 2/3] update CI scripts --- .appveyor.yml | 54 ++++++- .travis.yml | 145 ++++++++++++++---- LICENSE.md | 2 +- scripts/build_all.bat | 6 +- scripts/build_debug.sh | 8 +- .../{build_debug.bat => build_debug_x64.bat} | 8 +- scripts/build_debug_x86.bat | 13 ++ scripts/build_release.sh | 8 +- ...uild_release.bat => build_release_x64.bat} | 8 +- scripts/build_release_x86.bat | 13 ++ scripts/gen_msvc2017_project.bat | 3 +- scripts/gen_msvc2019_project.bat | 13 ++ scripts/gen_xcode_project.sh | 3 +- scripts/update_modules.sh | 3 - sources/main.cpp | 2 +- 15 files changed, 230 insertions(+), 59 deletions(-) rename scripts/{build_debug.bat => build_debug_x64.bat} (53%) create mode 100644 scripts/build_debug_x86.bat rename scripts/{build_release.bat => build_release_x64.bat} (53%) create mode 100644 scripts/build_release_x86.bat create mode 100644 scripts/gen_msvc2019_project.bat delete mode 100755 scripts/update_modules.sh diff --git a/.appveyor.yml b/.appveyor.yml index c1de90e..000b857 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,11 +1,53 @@ -version: "{build}" +environment: + global: + E2D_WITHOUT_AUDIO: true + E2D_WITHOUT_GRAPHICS: true + image: - Visual Studio 2017 - - Visual Studio 2019 Preview + - Visual Studio 2019 + platform: - - Win32 + - x86 - x64 -build_script: + +configuration: + - Debug + - Release + +for: + +- + matrix: + only: + - platform: x86 + configuration: Debug + build_script: + - scripts\build_debug_x86.bat + +- + matrix: + only: + - platform: x64 + configuration: Debug + build_script: + - scripts\build_debug_x64.bat + +- + matrix: + only: + - platform: x86 + configuration: Release + build_script: + - scripts\build_release_x86.bat + +- + matrix: + only: + - platform: x64 + configuration: Release + build_script: + - scripts\build_release_x64.bat + +before_build: - git submodule update --init --recursive - - scripts\build_all.bat -test: off diff --git a/.travis.yml b/.travis.yml index 13ef9f3..938b60b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,49 +1,138 @@ language: cpp + +env: + global: + - E2D_WITHOUT_AUDIO=true + - E2D_WITHOUT_GRAPHICS=true + matrix: include: + + # + # linux (g++-7) + # + - os: linux - dist: trusty - addons: { apt: { sources: ubuntu-toolchain-r-test, packages: ["xorg-dev", "g++-7"] } } - env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" + dist: xenial + stage: linux + name: debug, g++-7 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7"] } } + env: CC=gcc-7 CXX=g++-7 + script: ./scripts/build_debug.sh + - os: linux - dist: trusty - addons: { apt: { sources: ubuntu-toolchain-r-test, packages: ["xorg-dev", "g++-8"] } } - env: MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" + dist: xenial + stage: linux + name: release, g++-7 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7"] } } + env: CC=gcc-7 CXX=g++-7 + script: ./scripts/build_release.sh + + # + # linux (g++-8) + # + - os: linux - dist: trusty - addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-trusty-5.0"], packages: ["xorg-dev", "clang-5.0", "g++-7"] } } - env: MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0" + dist: xenial + stage: linux + name: debug, g++-8 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-8"] } } + env: CC=gcc-8 CXX=g++-8 + script: ./scripts/build_debug.sh + - os: linux - dist: trusty - addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-trusty-6.0"], packages: ["xorg-dev", "clang-6.0", "g++-7"] } } - env: MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0" + dist: xenial + stage: linux + name: release, g++-8 + addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-8"] } } + env: CC=gcc-8 CXX=g++-8 + script: ./scripts/build_release.sh + + # + # linux (clang++-5.0) + # + - os: linux - dist: trusty - addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-trusty-7"], packages: ["xorg-dev", "clang-7", "g++-7"] } } - env: MATRIX_EVAL="CC=clang-7 && CXX=clang++-7" + dist: xenial + stage: linux + name: debug, clang++-5.0 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-5.0"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7", "clang-5.0"] } } + env: CC=clang-5.0 CXX=clang++-5.0 + script: ./scripts/build_debug.sh + - os: linux - dist: trusty - addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-trusty-8"], packages: ["xorg-dev", "clang-8", "g++-7"] } } - env: MATRIX_EVAL="CC=clang-8 && CXX=clang++-8" + dist: xenial + stage: linux + name: release, clang++-5.0 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-5.0"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7", "clang-5.0"] } } + env: CC=clang-5.0 CXX=clang++-5.0 + script: ./scripts/build_release.sh + + # + # linux (clang++-6.0) + # + + - os: linux + dist: xenial + stage: linux + name: debug, clang++-6.0 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-6.0"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7", "clang-6.0"] } } + env: CC=clang-6.0 CXX=clang++-6.0 + script: ./scripts/build_debug.sh + + - os: linux + dist: xenial + stage: linux + name: release, clang++-6.0 + addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-6.0"], packages: ["libx11-dev", "libgl1-mesa-dev", "xorg-dev", "g++-7", "clang-6.0"] } } + env: CC=clang-6.0 CXX=clang++-6.0 + script: ./scripts/build_release.sh + + # + # macosx (xcode10) + # + - os: osx osx_image: xcode10 - compiler: clang + stage: macosx + name: debug, xcode10 + addons: { homebrew: { packages: ["git-lfs"] } } + script: ./scripts/build_debug.sh + + - os: osx + osx_image: xcode10 + stage: macosx + name: release, xcode10 + addons: { homebrew: { packages: ["git-lfs"] } } + script: ./scripts/build_release.sh + + # + # macosx (xcode11) + # + + - os: osx + osx_image: xcode11 + stage: macosx + name: debug, xcode11 + addons: { homebrew: { packages: ["git-lfs"] } } + script: ./scripts/build_debug.sh + + - os: osx + osx_image: xcode11 + stage: macosx + name: release, xcode11 + addons: { homebrew: { packages: ["git-lfs"] } } + script: ./scripts/build_release.sh + before_install: - - eval "${MATRIX_EVAL}" - - if [ "$TRAVIS_OS_NAME" == 'osx' ]; then - brew update; - brew upgrade cmake; - brew install git-lfs; - fi - if [ "$TRAVIS_OS_NAME" == 'linux' ]; then mkdir $HOME/cmake; export PATH="$HOME/cmake/bin:$PATH"; travis_retry wget -q https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.sh; sh cmake-3.11.4-Linux-x86_64.sh --prefix=$HOME/cmake --exclude-subdir --skip-license; fi -script: + +before_script: - git submodule update --init --recursive - git lfs install - git lfs pull - - git submodule foreach git lfs pull - - ./scripts/build_all.sh diff --git a/LICENSE.md b/LICENSE.md index 7b1f40a..782d80e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) +Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/scripts/build_all.bat b/scripts/build_all.bat index 4d063dc..9e778dc 100644 --- a/scripts/build_all.bat +++ b/scripts/build_all.bat @@ -1,7 +1,9 @@ @echo off set SCRIPT_DIR=%~dp0% -call %SCRIPT_DIR%\build_debug.bat || goto :error -call %SCRIPT_DIR%\build_release.bat || goto :error +call %SCRIPT_DIR%\build_debug_x86.bat || goto :error +call %SCRIPT_DIR%\build_debug_x64.bat || goto :error +call %SCRIPT_DIR%\build_release_x86.bat || goto :error +call %SCRIPT_DIR%\build_release_x64.bat || goto :error goto :EOF diff --git a/scripts/build_debug.sh b/scripts/build_debug.sh index aa76684..25f0dee 100755 --- a/scripts/build_debug.sh +++ b/scripts/build_debug.sh @@ -1,8 +1,8 @@ #!/bin/bash set -e BUILD_DIR=`dirname "$BASH_SOURCE"`/../build -mkdir -p $BUILD_DIR/debug -cd $BUILD_DIR/debug +mkdir -p $BUILD_DIR/Debug +pushd $BUILD_DIR/Debug cmake -DCMAKE_BUILD_TYPE=Debug ../.. -cmake --build . -- -j8 -cd ../.. +cmake --build . +popd diff --git a/scripts/build_debug.bat b/scripts/build_debug_x64.bat similarity index 53% rename from scripts/build_debug.bat rename to scripts/build_debug_x64.bat index 285bbb2..87d49aa 100644 --- a/scripts/build_debug.bat +++ b/scripts/build_debug_x64.bat @@ -1,10 +1,10 @@ @echo off set BUILD_DIR=%~dp0%\..\build -mkdir %BUILD_DIR%\debug || goto :error -cd %BUILD_DIR%\debug || goto :error -cmake ../.. || goto :error +mkdir %BUILD_DIR%\Debug\x64 || goto :error +pushd %BUILD_DIR%\Debug\x64 || goto :error +cmake ..\..\.. -A x64 || goto :error cmake --build . --config Debug || goto :error -cd ..\.. || goto :error +popd || goto :error goto :EOF diff --git a/scripts/build_debug_x86.bat b/scripts/build_debug_x86.bat new file mode 100644 index 0000000..a11fce3 --- /dev/null +++ b/scripts/build_debug_x86.bat @@ -0,0 +1,13 @@ +@echo off +set BUILD_DIR=%~dp0%\..\build +mkdir %BUILD_DIR%\Debug\x86 || goto :error +pushd %BUILD_DIR%\Debug\x86 || goto :error +cmake ..\..\.. -A Win32 || goto :error +cmake --build . --config Debug || goto :error +popd || goto :error + +goto :EOF + +:error +echo Failed with error #%errorlevel%. +exit /b %errorlevel% diff --git a/scripts/build_release.sh b/scripts/build_release.sh index 38ad788..eeae4bf 100755 --- a/scripts/build_release.sh +++ b/scripts/build_release.sh @@ -1,8 +1,8 @@ #!/bin/bash set -e BUILD_DIR=`dirname "$BASH_SOURCE"`/../build -mkdir -p $BUILD_DIR/release -cd $BUILD_DIR/release +mkdir -p $BUILD_DIR/Release +pushd $BUILD_DIR/Release cmake -DCMAKE_BUILD_TYPE=Release ../.. -cmake --build . -- -j8 -cd ../.. +cmake --build . +popd diff --git a/scripts/build_release.bat b/scripts/build_release_x64.bat similarity index 53% rename from scripts/build_release.bat rename to scripts/build_release_x64.bat index 400a355..f5f88b0 100644 --- a/scripts/build_release.bat +++ b/scripts/build_release_x64.bat @@ -1,10 +1,10 @@ @echo off set BUILD_DIR=%~dp0%\..\build -mkdir %BUILD_DIR%\release || goto :error -cd %BUILD_DIR%\release || goto :error -cmake ../.. || goto :error +mkdir %BUILD_DIR%\Release\x64 || goto :error +pushd %BUILD_DIR%\Release\x64 || goto :error +cmake ..\..\.. -A x64 || goto :error cmake --build . --config Release || goto :error -cd ..\.. || goto :error +popd || goto :error goto :EOF diff --git a/scripts/build_release_x86.bat b/scripts/build_release_x86.bat new file mode 100644 index 0000000..97c9e80 --- /dev/null +++ b/scripts/build_release_x86.bat @@ -0,0 +1,13 @@ +@echo off +set BUILD_DIR=%~dp0%\..\build +mkdir %BUILD_DIR%\Release\x86 || goto :error +pushd %BUILD_DIR%\Release\x86 || goto :error +cmake ..\..\.. -A Win32 || goto :error +cmake --build . --config Release || goto :error +popd || goto :error + +goto :EOF + +:error +echo Failed with error #%errorlevel%. +exit /b %errorlevel% diff --git a/scripts/gen_msvc2017_project.bat b/scripts/gen_msvc2017_project.bat index e10f813..9890941 100644 --- a/scripts/gen_msvc2017_project.bat +++ b/scripts/gen_msvc2017_project.bat @@ -1,9 +1,10 @@ @echo off set BUILD_DIR=%~dp0%\..\build mkdir %BUILD_DIR%\msvc2017 || goto :error -cd %BUILD_DIR%\msvc2017 || goto :error +pushd %BUILD_DIR%\msvc2017 || goto :error cmake -G "Visual Studio 15 2017" ..\.. || goto :error start enduro2d-bootstrap.sln || goto :error +popd || goto :error goto :EOF diff --git a/scripts/gen_msvc2019_project.bat b/scripts/gen_msvc2019_project.bat new file mode 100644 index 0000000..be5651a --- /dev/null +++ b/scripts/gen_msvc2019_project.bat @@ -0,0 +1,13 @@ +@echo off +set BUILD_DIR=%~dp0%\..\build +mkdir %BUILD_DIR%\msvc2019 || goto :error +pushd %BUILD_DIR%\msvc2019 || goto :error +cmake -G "Visual Studio 16 2019" ..\.. || goto :error +start enduro2d-bootstrap.sln || goto :error +popd || goto :error + +goto :EOF + +:error +echo Failed with error #%errorlevel%. +exit /b %errorlevel% diff --git a/scripts/gen_xcode_project.sh b/scripts/gen_xcode_project.sh index 323a694..e15aeac 100755 --- a/scripts/gen_xcode_project.sh +++ b/scripts/gen_xcode_project.sh @@ -2,6 +2,7 @@ set -e BUILD_DIR=`dirname "$BASH_SOURCE"`/../build mkdir -p $BUILD_DIR/xcode -cd $BUILD_DIR/xcode +pushd $BUILD_DIR/xcode cmake -G Xcode ../.. open enduro2d-bootstrap.xcodeproj +popd diff --git a/scripts/update_modules.sh b/scripts/update_modules.sh deleted file mode 100755 index 8ff9e6f..0000000 --- a/scripts/update_modules.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -git submodule update --init --recursive -git submodule update --remote diff --git a/sources/main.cpp b/sources/main.cpp index 3ff90ad..9202f91 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -1,7 +1,7 @@ /******************************************************************************* * This file is part of the "Enduro2D" * For conditions of distribution and use, see copyright notice in LICENSE.md - * Copyright (C) 2018-2019 Matvey Cherevko + * Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com) ******************************************************************************/ #include From 6c19724a36d17d56f9ae0782171b29e18658dd07 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 6 Feb 2020 17:52:01 +0700 Subject: [PATCH 3/3] fix main after update --- sources/main.cpp | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/sources/main.cpp b/sources/main.cpp index 9202f91..fa502e7 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -9,10 +9,13 @@ using namespace e2d; namespace { - class game_system final : public ecs::system { + class game_system final : public systems::update_system { public: - void process(ecs::registry& owner) override { - E2D_UNUSED(owner); + void process( + ecs::registry& owner, + const systems::update_event& event) override + { + E2D_UNUSED(owner, event); const keyboard& k = the().keyboard(); if ( k.is_key_just_released(keyboard_key::f12) ) { @@ -32,14 +35,36 @@ namespace class game final : public starter::application { public: bool initialize() final { - ecs::registry_filler(the().registry()) - .system(world::priority_update); + { + ecs::registry_filler(the().registry()) + .feature(ecs::feature() + .add_system()); + } + + { + prefab scene_prefab; + scene_prefab.prototype() + .component(named() + .name("scene")) + .component(); + + prefab camera_prefab; + camera_prefab.prototype() + .component(named() + .name("camera")) + .component(camera() + .background({1.f, 0.4f, 0.f, 1.f})) + .component(); + + gobject scene_go = the().instantiate(scene_prefab); + gobject camera_go = the().instantiate(camera_prefab); + + node_iptr scene_node = scene_go.component()->node(); + node_iptr camera_node = camera_go.component()->node(); + + scene_node->add_child(camera_node); + } - const gobject_iptr camera_i = the().instantiate(); - camera_i->entity_filler() - .component(camera() - .background({1.f, 0.4f, 0.f, 1.f})) - .component(node::create(camera_i)); return true; } };