From e71ad710978d1c4f6e5523290f660f416ff47270 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 15 Jul 2024 17:24:07 +0900 Subject: [PATCH 1/4] Fix conanfile.py, add example usage conan project --- conan_usage_example/CMakeLists.txt | 23 ++++++++++++ conan_usage_example/conanfile.txt | 6 ++++ conan_usage_example/setup_build_with_conan.sh | 17 +++++++++ conan_usage_example/src/main.cpp | 35 +++++++++++++++++++ conanfile.py | 1 + 5 files changed, 82 insertions(+) create mode 100644 conan_usage_example/CMakeLists.txt create mode 100644 conan_usage_example/conanfile.txt create mode 100755 conan_usage_example/setup_build_with_conan.sh create mode 100644 conan_usage_example/src/main.cpp diff --git a/conan_usage_example/CMakeLists.txt b/conan_usage_example/CMakeLists.txt new file mode 100644 index 0000000..21b55a8 --- /dev/null +++ b/conan_usage_example/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.7) +project(ECMS_Conan_Example) + +set(ECMS_Conan_Example_SOURCES + src/main.cpp +) + +add_compile_options( + -Wall -Wextra -Wpedantic -Wno-missing-braces + $<$:-Weffc++> + $<$:-Og> +) + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Debug', none was specified.") + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") +endif() + +find_package(ecms CONFIG REQUIRED) + +add_executable(ECMS_Conan_Example ${ECMS_Conan_Example_SOURCES}) +target_link_libraries(ECMS_Conan_Example ecms::ecms) diff --git a/conan_usage_example/conanfile.txt b/conan_usage_example/conanfile.txt new file mode 100644 index 0000000..a434e29 --- /dev/null +++ b/conan_usage_example/conanfile.txt @@ -0,0 +1,6 @@ +[requires] +ecms/1.0 + +[generators] +CMakeDeps +CMakeToolchain diff --git a/conan_usage_example/setup_build_with_conan.sh b/conan_usage_example/setup_build_with_conan.sh new file mode 100755 index 0000000..be2c725 --- /dev/null +++ b/conan_usage_example/setup_build_with_conan.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +cd "$(dirname "$0")" + +set -ve + +if ! [[ -e "${HOME}/.conan2/profiles/default" ]]; then + conan profile detect +fi + +if ! grep stephens_forgejo "${HOME}/.conan2/remotes.json" >&/dev/null; then + conan remote add stephens_forgejo "https://git.seodisparate.com/api/packages/stephenseo/conan" +fi + +conan install . -r stephens_forgejo --output-folder=buildConan +cmake -S . -B buildConan -DCMAKE_TOOLCHAIN_FILE=buildConan/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release +cmake --build buildConan diff --git a/conan_usage_example/src/main.cpp b/conan_usage_example/src/main.cpp new file mode 100644 index 0000000..dc6a8d5 --- /dev/null +++ b/conan_usage_example/src/main.cpp @@ -0,0 +1,35 @@ +#include + +#include + +struct CPosition { + CPosition(float x = 0.0F, float y = 0.0F) : x(x), y(y) {} + float x, y; +}; + +using EmptyTypeList = EC::Meta::TypeList<>; +using ComponentsTypeList = EC::Meta::TypeList; + +int main() { + auto manager = EC::Manager{}; + + auto entity_id = manager.addEntity(); + manager.addComponent(entity_id, 1.0F, 2.0F); + + manager.forMatchingSignature( + [] (std::size_t, void *, CPosition *pos) + { + if (pos->x != 1.0F) { + std::clog << "WARNING: pos->x is not 1.0F! (" << pos->x + << ")\n"; + } + if (pos->y != 2.0F) { + std::clog << "WARNING: pos->x is not 2.0F! (" << pos->y + << ")\n"; + } + }, + nullptr, + false); + + return 0; +} diff --git a/conanfile.py b/conanfile.py index bda3e1e..b346bae 100644 --- a/conanfile.py +++ b/conanfile.py @@ -18,3 +18,4 @@ class ECMSConan(ConanFile): # so it's recommended to set those as empty. self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] + self.cpp_info.includedirs = ['src'] From feccaaa91bcb5e329b23d0f154e2266baf5dd98b Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 15 Jul 2024 17:25:50 +0900 Subject: [PATCH 2/4] Add .gitignore for conan_usage_example/ --- conan_usage_example/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 conan_usage_example/.gitignore diff --git a/conan_usage_example/.gitignore b/conan_usage_example/.gitignore new file mode 100644 index 0000000..0c2999d --- /dev/null +++ b/conan_usage_example/.gitignore @@ -0,0 +1 @@ +/CMakeUserPresets.json From f469ced106304e7ee4e5f0193a3382ac2b788d68 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 15 Jul 2024 17:32:45 +0900 Subject: [PATCH 3/4] Fix minor typo --- conan_usage_example/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conan_usage_example/src/main.cpp b/conan_usage_example/src/main.cpp index dc6a8d5..fd5a538 100644 --- a/conan_usage_example/src/main.cpp +++ b/conan_usage_example/src/main.cpp @@ -24,7 +24,7 @@ int main() { << ")\n"; } if (pos->y != 2.0F) { - std::clog << "WARNING: pos->x is not 2.0F! (" << pos->y + std::clog << "WARNING: pos->y is not 2.0F! (" << pos->y << ")\n"; } }, From 2df5b6af0bfa94d6e23d5aa9f7e262cf7eb1b87f Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Thu, 14 Nov 2024 17:20:23 +0900 Subject: [PATCH 4/4] Ensure gh-pages only runs on origin Github repo --- .github/workflows/gh-pages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 7f08984..50d66c5 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -7,6 +7,7 @@ on: jobs: build-deploy-doxygen-docs: + if: github.repository == 'Stephen-Seo/EntityComponentMetaSystem' runs-on: ubuntu-latest concurrency: group: ${{ github.workflow }}-${{ github.ref }}