-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gaia-ecs: new recipe #23080
Merged
Merged
gaia-ecs: new recipe #23080
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"0.8.5": | ||
url: "https://github.com/richardbiely/gaia-ecs/archive/refs/tags/v0.8.5.tar.gz" | ||
sha256: "910489B616C8FE3248864D12D03339B70685198581809EAE43A65CCD1833F224" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.scm import Version | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.files import copy, get | ||
from conan.tools.layout import basic_layout | ||
import os | ||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
|
||
class GaiaConan(ConanFile): | ||
name = "gaia-ecs" | ||
description = "A simple and powerful entity component system (ECS) written in C++17 " | ||
topics = ("gamedev", "performance", "entity", "ecs") | ||
homepage = "https://github.com/richardbiely/gaia-ecs" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
license = "MIT" | ||
package_type = "header-library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
@property | ||
def _min_cppstd(self): | ||
return "17" | ||
|
||
@property | ||
def _compilers_minimum_version(self): | ||
return { | ||
"Visual Studio": "16", | ||
"msvc": "192", | ||
"gcc": "10", | ||
"clang": "7.0", | ||
"apple-clang": "10.0", | ||
"intel-cc": "2021.2" | ||
} | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def package_id(self): | ||
self.info.clear() | ||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
check_min_cppstd(self, self._min_cppstd) | ||
|
||
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) | ||
if minimum_version and Version(self.settings.compiler.version) < minimum_version: | ||
raise ConanInvalidConfiguration( | ||
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." | ||
) | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def build(self): | ||
pass | ||
|
||
def package(self): | ||
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) | ||
copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) | ||
|
||
def package_info(self): | ||
self.cpp_info.set_property("cmake_file_name", "gaia") | ||
self.cpp_info.set_property("cmake_target_name", "gaia::gaia") | ||
self.cpp_info.bindirs = [] | ||
self.cpp_info.libdirs = [] | ||
|
||
# TODO: remove when v1 support drops | ||
self.cpp_info.names["cmake_find_package"] = "gaia" | ||
self.cpp_info.names["cmake_find_package_multi"] = "gaia" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(gaia REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE gaia::gaia) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) | ||
set(THREADS_PREFER_PTHREAD_FLAG ON) | ||
find_package(Threads REQUIRED) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import CMake, cmake_layout | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <gaia.h> | ||
|
||
int main() | ||
{ | ||
gaia::ecs::World w; | ||
gaia::ecs::Entity e = w.add(); | ||
(void) w.valid(e); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"0.8.5": | ||
folder: all |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that he test package isn't using threads directly indicates that something is missing in the
package_info
method. Perhaps:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 at this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!