Merge branch 'master' into cxx17
All checks were successful
Run UnitTests / build-and-run-unittests (push) Successful in 32s
All checks were successful
Run UnitTests / build-and-run-unittests (push) Successful in 32s
This commit is contained in:
commit
5c3e203f4a
7 changed files with 84 additions and 0 deletions
1
.github/workflows/gh-pages.yml
vendored
1
.github/workflows/gh-pages.yml
vendored
|
@ -7,6 +7,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-deploy-doxygen-docs:
|
build-deploy-doxygen-docs:
|
||||||
|
if: github.repository == 'Stephen-Seo/EntityComponentMetaSystem'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|
1
conan_usage_example/.gitignore
vendored
Normal file
1
conan_usage_example/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/CMakeUserPresets.json
|
23
conan_usage_example/CMakeLists.txt
Normal file
23
conan_usage_example/CMakeLists.txt
Normal file
|
@ -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
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:-Weffc++>
|
||||||
|
$<$<CONFIG:DEBUG>:-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)
|
6
conan_usage_example/conanfile.txt
Normal file
6
conan_usage_example/conanfile.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[requires]
|
||||||
|
ecms/1.0
|
||||||
|
|
||||||
|
[generators]
|
||||||
|
CMakeDeps
|
||||||
|
CMakeToolchain
|
17
conan_usage_example/setup_build_with_conan.sh
Executable file
17
conan_usage_example/setup_build_with_conan.sh
Executable file
|
@ -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
|
35
conan_usage_example/src/main.cpp
Normal file
35
conan_usage_example/src/main.cpp
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#include <EC/Manager.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
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<CPosition>;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
auto manager = EC::Manager<ComponentsTypeList, EmptyTypeList>{};
|
||||||
|
|
||||||
|
auto entity_id = manager.addEntity();
|
||||||
|
manager.addComponent<CPosition>(entity_id, 1.0F, 2.0F);
|
||||||
|
|
||||||
|
manager.forMatchingSignature<ComponentsTypeList>(
|
||||||
|
[] (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->y is not 2.0F! (" << pos->y
|
||||||
|
<< ")\n";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nullptr,
|
||||||
|
false);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -18,3 +18,4 @@ class ECMSConan(ConanFile):
|
||||||
# so it's recommended to set those as empty.
|
# so it's recommended to set those as empty.
|
||||||
self.cpp_info.bindirs = []
|
self.cpp_info.bindirs = []
|
||||||
self.cpp_info.libdirs = []
|
self.cpp_info.libdirs = []
|
||||||
|
self.cpp_info.includedirs = ['src']
|
||||||
|
|
Loading…
Reference in a new issue