From af331d8c08f368822f9d635a399750d6e193afcf Mon Sep 17 00:00:00 2001 From: Romain BOULLARD Date: Tue, 25 Aug 2026 15:28:13 +0200 Subject: [PATCH] EAStdC --- eaassert/all/conandata.yml | 4 + eaassert/all/conanfile.py | 103 +++++++++++++++++++ eaassert/all/test_package/CMakeLists.txt | 12 +++ eaassert/all/test_package/conanfile.py | 26 +++++ eaassert/all/test_package/test_package.cpp | 31 ++++++ eaassert/config.yml | 3 + eastdc/all/conandata.yml | 4 + eastdc/all/conanfile.py | 110 ++++++++++++++++++++ eastdc/all/test_package/CMakeLists.txt | 8 ++ eastdc/all/test_package/conanfile.py | 26 +++++ eastdc/all/test_package/test_package.cpp | 40 ++++++++ eastdc/config.yml | 3 + eathread/all/conandata.yml | 4 + eathread/all/conanfile.py | 111 +++++++++++++++++++++ eathread/all/test_package/CMakeLists.txt | 8 ++ eathread/all/test_package/conanfile.py | 26 +++++ eathread/all/test_package/test_package.cpp | 31 ++++++ eathread/config.yml | 3 + 18 files changed, 553 insertions(+) create mode 100644 eaassert/all/conandata.yml create mode 100644 eaassert/all/conanfile.py create mode 100644 eaassert/all/test_package/CMakeLists.txt create mode 100644 eaassert/all/test_package/conanfile.py create mode 100644 eaassert/all/test_package/test_package.cpp create mode 100644 eaassert/config.yml create mode 100644 eastdc/all/conandata.yml create mode 100644 eastdc/all/conanfile.py create mode 100644 eastdc/all/test_package/CMakeLists.txt create mode 100644 eastdc/all/test_package/conanfile.py create mode 100644 eastdc/all/test_package/test_package.cpp create mode 100644 eastdc/config.yml create mode 100644 eathread/all/conandata.yml create mode 100644 eathread/all/conanfile.py create mode 100644 eathread/all/test_package/CMakeLists.txt create mode 100644 eathread/all/test_package/conanfile.py create mode 100644 eathread/all/test_package/test_package.cpp create mode 100644 eathread/config.yml diff --git a/eaassert/all/conandata.yml b/eaassert/all/conandata.yml new file mode 100644 index 0000000..97f0b60 --- /dev/null +++ b/eaassert/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "25082026": + url: "https://github.com/electronicarts/EAAssert/archive/e5e181255de2e883dd1f987c78ccc42ac81d3bca.zip" + sha256: "72940e194f00466d23aac969b129819f9538aa716bfacfbc1d3a5d5ad235a5b3" diff --git a/eaassert/all/conanfile.py b/eaassert/all/conanfile.py new file mode 100644 index 0000000..f667b31 --- /dev/null +++ b/eaassert/all/conanfile.py @@ -0,0 +1,103 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir + +required_conan_version = ">=1.52.0" + + +class EAAssertConan(ConanFile): + name = "eaassert" + description = "EAAssert is a lightweight EA runtime assertion library." + topics = ("eastl", "assert") + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/electronicarts/EAAssert" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires(f"eabase/01082025@{self.user}/{self.channel}", transitive_headers=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + CMakeDeps(self).generate() + + def _patch_sources(self): + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + + # The upstream CMakeLists.txt expects a EASTL git submodule for CommonCppFlags and a bare + # "EABase" target from the same submodule setup - neither of which exist when building from + # the release archive via Conan. Point it at Conan's EABase instead, and add install rules + # (upstream has none). + # CMake >= 4 dropped support for the compatibility policies VERSION 3.1 requires. + replace_in_file(self, cmakelists, "cmake_minimum_required(VERSION 3.1)", "cmake_minimum_required(VERSION 3.5)") + replace_in_file(self, cmakelists, "include(CommonCppFlags)", "") + replace_in_file( + self, + cmakelists, + "target_link_libraries(EAAssert EABase)", + "find_package(EABase REQUIRED CONFIG)\n" + "target_link_libraries(EAAssert EABase::EABase)\n" + "\n" + "include(GNUInstallDirs)\n" + "install(TARGETS EAAssert\n" + " RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}\n" + " LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}\n" + " ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})\n" + "install(DIRECTORY include/EAAssert DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})\n", + ) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + "LICENSE", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "doc")) + + def package_info(self): + self.cpp_info.libs = ["EAAssert"] + + self.cpp_info.set_property("cmake_file_name", "EAAssert") + self.cpp_info.set_property("cmake_target_name", "EAAssert::EAAssert") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "EAAssert" + self.cpp_info.filenames["cmake_find_package_multi"] = "EAAssert" + self.cpp_info.names["cmake_find_package"] = "EAAssert" + self.cpp_info.names["cmake_find_package_multi"] = "EAAssert" diff --git a/eaassert/all/test_package/CMakeLists.txt b/eaassert/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..cd1cbfc --- /dev/null +++ b/eaassert/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(EAAssert REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} EAAssert::EAAssert) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) + +# Force the assert path on regardless of build_type - we're testing the failure-callback mechanism +# itself, not whether asserts happen to be enabled for this configuration. +target_compile_definitions(${PROJECT_NAME} PRIVATE EA_ASSERT_ENABLED=1) diff --git a/eaassert/all/test_package/conanfile.py b/eaassert/all/test_package/conanfile.py new file mode 100644 index 0000000..ef5d704 --- /dev/null +++ b/eaassert/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/eaassert/all/test_package/test_package.cpp b/eaassert/all/test_package/test_package.cpp new file mode 100644 index 0000000..a8811d1 --- /dev/null +++ b/eaassert/all/test_package/test_package.cpp @@ -0,0 +1,31 @@ +#include + +#include +#include +#include + +namespace +{ +bool gCallbackInvoked = false; + +bool TestFailureCallback(const char*, const char*, int, const char*, const char*, va_list) +{ + gCallbackInvoked = true; + return false; // Don't break into the debugger. +} +} // namespace + +int main() +{ + EA::Assert::SetFailureCallback(&TestFailureCallback); + + EA_ASSERT(1 == 2); // Deliberately false, to exercise the failure callback. + + if (!gCallbackInvoked) + { + std::fprintf(stderr, "EA_ASSERT did not invoke the failure callback\n"); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/eaassert/config.yml b/eaassert/config.yml new file mode 100644 index 0000000..4e48dc1 --- /dev/null +++ b/eaassert/config.yml @@ -0,0 +1,3 @@ +versions: + "25082026": + folder: "all" diff --git a/eastdc/all/conandata.yml b/eastdc/all/conandata.yml new file mode 100644 index 0000000..01f0c0c --- /dev/null +++ b/eastdc/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "25082026": + url: "https://github.com/electronicarts/EAStdC/archive/fbcc34e89c63636054334888f3a5bd7ac2fd4b76.zip" + sha256: "023ddb703c824d2e7a9a670b8d5f4a9d9989e07b068f148448c6bb87402bd67d" diff --git a/eastdc/all/conanfile.py b/eastdc/all/conanfile.py new file mode 100644 index 0000000..f7862bd --- /dev/null +++ b/eastdc/all/conanfile.py @@ -0,0 +1,110 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir + +required_conan_version = ">=1.52.0" + + +class EAStdCConan(ConanFile): + name = "eastdc" + description = "EAStdC (EA Standard C) is a package that implements much of the functionality of standard C " \ + "and C++ libraries, but with an emphasis on speed and efficiency and, secondarily, safety." + topics = ("eastl", "stdc") + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/electronicarts/EAStdC" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires(f"eabase/01082025@{self.user}/{self.channel}", transitive_headers=True) + self.requires(f"eaassert/25082026@{self.user}/{self.channel}", transitive_headers=True) + self.requires(f"eathread/25082026@{self.user}/{self.channel}", transitive_headers=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + CMakeDeps(self).generate() + + def _patch_sources(self): + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + + # CMake >= 4 dropped support for the compatibility policies VERSION 3.1 requires. + replace_in_file(self, cmakelists, "cmake_minimum_required(VERSION 3.1)", "cmake_minimum_required(VERSION 3.5)") + replace_in_file(self, cmakelists, "include(CommonCppFlags)", "") + + # The upstream CMakeLists.txt expects bare "EABase"/"EAAssert"/"EAThread" targets from a git + # submodule setup that doesn't exist when building from the release archive via Conan. Point + # it at Conan's packages instead, and add install rules (upstream has none). + replace_in_file( + self, + cmakelists, + "target_link_libraries(EAStdC EABase)\n" + "target_link_libraries(EAStdC EAAssert)\n" + "target_link_libraries(EAStdC EAThread)\n", + "find_package(EABase REQUIRED CONFIG)\n" + "find_package(EAAssert REQUIRED CONFIG)\n" + "find_package(EAThread REQUIRED CONFIG)\n" + "target_link_libraries(EAStdC EABase::EABase EAAssert::EAAssert EAThread::EAThread)\n" + "\n" + "include(GNUInstallDirs)\n" + "install(TARGETS EAStdC\n" + " RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}\n" + " LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}\n" + " ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})\n" + "install(DIRECTORY include/EAStdC DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})\n", + ) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + "LICENSE", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "doc")) + + def package_info(self): + self.cpp_info.libs = ["EAStdC"] + + self.cpp_info.set_property("cmake_file_name", "EAStdC") + self.cpp_info.set_property("cmake_target_name", "EAStdC::EAStdC") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "EAStdC" + self.cpp_info.filenames["cmake_find_package_multi"] = "EAStdC" + self.cpp_info.names["cmake_find_package"] = "EAStdC" + self.cpp_info.names["cmake_find_package_multi"] = "EAStdC" diff --git a/eastdc/all/test_package/CMakeLists.txt b/eastdc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..b98e4f5 --- /dev/null +++ b/eastdc/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(EAStdC REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} EAStdC::EAStdC) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/eastdc/all/test_package/conanfile.py b/eastdc/all/test_package/conanfile.py new file mode 100644 index 0000000..ef5d704 --- /dev/null +++ b/eastdc/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/eastdc/all/test_package/test_package.cpp b/eastdc/all/test_package/test_package.cpp new file mode 100644 index 0000000..2505626 --- /dev/null +++ b/eastdc/all/test_package/test_package.cpp @@ -0,0 +1,40 @@ +#include + +#include +#include +#include + +void* operator new[](size_t size, + const char* /*pName*/, + int /*flags*/, + unsigned /*debugFlags*/, + const char* /*file*/, + int /*line*/) +{ + return new uint8_t[size]; +} +void* operator new[](size_t size, + size_t /*alignment*/, + size_t /*alignmentOffset*/, + const char* /*pName*/, + int /*flags*/, + unsigned /*debugFlags*/, + const char* /*file*/, + int /*line*/) +{ + return new uint8_t[size]; +} + +int main() +{ + char buffer[64]; + const int result = EA::StdC::Snprintf(buffer, sizeof(buffer), "%s-%d", "hello", 42); + + if ((result != 8) || (std::strcmp(buffer, "hello-42") != 0)) + { + std::fprintf(stderr, "EA::StdC::Snprintf produced unexpected output: \"%s\" (result=%d)\n", buffer, result); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/eastdc/config.yml b/eastdc/config.yml new file mode 100644 index 0000000..4e48dc1 --- /dev/null +++ b/eastdc/config.yml @@ -0,0 +1,3 @@ +versions: + "25082026": + folder: "all" diff --git a/eathread/all/conandata.yml b/eathread/all/conandata.yml new file mode 100644 index 0000000..50126ce --- /dev/null +++ b/eathread/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "25082026": + url: "https://github.com/electronicarts/EAThread/archive/a77e2276a3fe1489a7c6206c3f77ea10f7a5daf7.zip" + sha256: "19f6ed95e38e9580bcdcd8190a31952b9d27af7a7b27a9b86802cadb44ac4579" diff --git a/eathread/all/conanfile.py b/eathread/all/conanfile.py new file mode 100644 index 0000000..2cdc98c --- /dev/null +++ b/eathread/all/conanfile.py @@ -0,0 +1,111 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir + +required_conan_version = ">=1.52.0" + + +class EAThreadConan(ConanFile): + name = "eathread" + description = "EAThread is a C++ library that provides a platform-independent interface for threading." + topics = ("eastl", "threading") + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/electronicarts/EAThread" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires(f"eabase/01082025@{self.user}/{self.channel}", transitive_headers=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + CMakeDeps(self).generate() + + def _patch_sources(self): + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + + replace_in_file(self, cmakelists, "include(CommonCppFlags)", "") + + # The upstream CMakeLists.txt pulls EABase in via FetchContent from a pinned commit - + # replace it with Conan's EABase, and add install rules (upstream has none). + replace_in_file( + self, + cmakelists, + "FetchContent_Declare(\n" + " EABase\n" + " GIT_REPOSITORY https://github.com/electronicarts/EABase.git\n" + " GIT_TAG 123363eb82e132c0181ac53e43226d8ee76dea12\n" + " GIT_SUBMODULES \"\" # This should be temporary until we update the cyclic submodule dependencies in EABase.\n" + ")\n" + "\n" + "FetchContent_MakeAvailable(EABase)\n" + "\n" + "target_link_libraries(EAThread EABase)\n", + "find_package(EABase REQUIRED CONFIG)\n" + "target_link_libraries(EAThread EABase::EABase)\n" + "\n" + "include(GNUInstallDirs)\n" + "install(TARGETS EAThread\n" + " RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}\n" + " LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}\n" + " ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})\n" + "install(DIRECTORY include/eathread DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})\n", + ) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + "LICENSE", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "doc")) + + def package_info(self): + self.cpp_info.libs = ["EAThread"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + + self.cpp_info.set_property("cmake_file_name", "EAThread") + self.cpp_info.set_property("cmake_target_name", "EAThread::EAThread") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "EAThread" + self.cpp_info.filenames["cmake_find_package_multi"] = "EAThread" + self.cpp_info.names["cmake_find_package"] = "EAThread" + self.cpp_info.names["cmake_find_package_multi"] = "EAThread" diff --git a/eathread/all/test_package/CMakeLists.txt b/eathread/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..0c2baa0 --- /dev/null +++ b/eathread/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(EAThread REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} EAThread::EAThread) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/eathread/all/test_package/conanfile.py b/eathread/all/test_package/conanfile.py new file mode 100644 index 0000000..ef5d704 --- /dev/null +++ b/eathread/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/eathread/all/test_package/test_package.cpp b/eathread/all/test_package/test_package.cpp new file mode 100644 index 0000000..0f77c94 --- /dev/null +++ b/eathread/all/test_package/test_package.cpp @@ -0,0 +1,31 @@ +#include + +#include +#include + +namespace +{ +intptr_t Increment(void* pContext) +{ + int* const pValue = static_cast(pContext); + *pValue += 1; + return 0; +} +} // namespace + +int main() +{ + int value = 0; + + EA::Thread::Thread thread; + thread.Begin(&Increment, &value); + thread.WaitForEnd(); + + if (value != 1) + { + std::fprintf(stderr, "Thread did not run as expected (value=%d)\n", value); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/eathread/config.yml b/eathread/config.yml new file mode 100644 index 0000000..4e48dc1 --- /dev/null +++ b/eathread/config.yml @@ -0,0 +1,3 @@ +versions: + "25082026": + folder: "all"