diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 0a60a38..67c15f4 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -62,8 +62,8 @@ jobs: with: submodules: recursive - - name: Reset ccache stats - run: ccache --zero-stats + - name: SetUp Bigfoot Artifactory + run: conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages --force - name: Run Conan packaging run: | @@ -82,9 +82,6 @@ jobs: conan upload ${{ matrix.package.name }}/${{ matrix.package.version }}@bigfootdev/${{ env.BRANCH_NAME }} \ --only-recipe --remote=bigfootpackages - - name: Show ccache stats - run: ccache --show-stats - conan-packages-tier2: needs: conan-packages-tier1 runs-on: ubuntu-latest @@ -98,6 +95,8 @@ jobs: matrix: package: [ { name: "eastl", version: "3.27.01", location: "all", needs_pkg: "eabase" }, + { name: "eaassert", version: "25082026", location: "all", needs_pkg: "eabase" }, + { name: "eathread", version: "25082026", location: "all", needs_pkg: "eabase" }, { name: "vulkan-utility-libraries", version: "1.4.341.0", location: "all" }, { name: "spirv-tools", version: "1.4.341.0", location: "all" }, @@ -117,8 +116,8 @@ jobs: with: submodules: recursive - - name: Reset ccache stats - run: ccache --zero-stats + - name: SetUp Bigfoot Artifactory + run: conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages --force - name: Run Conan packaging run: | @@ -137,9 +136,6 @@ jobs: conan upload ${{ matrix.package.name }}/${{ matrix.package.version }}@bigfootdev/${{ env.BRANCH_NAME }} \ --only-recipe --remote=bigfootpackages - - name: Show ccache stats - run: ccache --show-stats - conan-packages-tier3: needs: conan-packages-tier2 runs-on: ubuntu-latest @@ -152,6 +148,8 @@ jobs: strategy: matrix: package: [ + { name: "eastdc", version: "25082026", location: "all", needs_pkg: "eabase, eaassert, eathread" }, + { name: "glslang", version: "1.4.341.0", location: "all" }, { name: "vulkan-validationlayers", version: "1.4.341.0", location: "all" }, ] @@ -168,8 +166,8 @@ jobs: with: submodules: recursive - - name: Reset ccache stats - run: ccache --zero-stats + - name: SetUp Bigfoot Artifactory + run: conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages --force - name: Run Conan packaging run: | @@ -188,9 +186,6 @@ jobs: conan upload ${{ matrix.package.name }}/${{ matrix.package.version }}@bigfootdev/${{ env.BRANCH_NAME }} \ --only-recipe --remote=bigfootpackages - - name: Show ccache stats - run: ccache --show-stats - conan-packages-tier4: needs: conan-packages-tier3 runs-on: ubuntu-latest @@ -218,8 +213,8 @@ jobs: with: submodules: recursive - - name: Reset ccache stats - run: ccache --zero-stats + - name: SetUp Bigfoot Artifactory + run: conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages --force - name: Run Conan packaging run: | @@ -236,7 +231,4 @@ jobs: CONAN_LOGIN_USERNAME=${ARTIFACTORY_USER} \ CONAN_PASSWORD=${ARTIFACTORY_PASSWORD} \ conan upload ${{ matrix.package.name }}/${{ matrix.package.version }}@bigfootdev/${{ env.BRANCH_NAME }} \ - --only-recipe --remote=bigfootpackages - - - name: Show ccache stats - run: ccache --show-stats \ No newline at end of file + --only-recipe --remote=bigfootpackages \ No newline at end of file diff --git a/eaassert/all/conandata.yml b/eaassert/all/conandata.yml new file mode 100644 index 0000000..1ded3d4 --- /dev/null +++ b/eaassert/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "25082026": + url: "https://github.com/electronicarts/EAAssert/archive/e5e181255de2e883dd1f987c78ccc42ac81d3bca.zip" + sha256: "72940e194f00466d23aac969b129819f9538aa716bfacfbc1d3a5d5ad235a5b3" +patches: + "25082026": + - patch_file: "patches/25082026-0001-use-conan.patch" + patch_description: "bump cmake_minimum_required past what CMake >= 4 accepts, drop the submodule-only CommonCppFlags include, use cci's EABase, add install definitions" + patch_type: "conan" diff --git a/eaassert/all/conanfile.py b/eaassert/all/conanfile.py new file mode 100644 index 0000000..e702d89 --- /dev/null +++ b/eaassert/all/conanfile.py @@ -0,0 +1,81 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, 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 export_sources(self): + export_conandata_patches(self) + + 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 build(self): + apply_conandata_patches(self) + 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/patches/25082026-0001-use-conan.patch b/eaassert/all/patches/25082026-0001-use-conan.patch new file mode 100644 index 0000000..a632dd0 --- /dev/null +++ b/eaassert/all/patches/25082026-0001-use-conan.patch @@ -0,0 +1,39 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a60892b..02619df 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,7 +1,7 @@ + #------------------------------------------------------------------------------------------- + # Copyright (C) Electronic Arts Inc. All rights reserved. + #------------------------------------------------------------------------------------------- +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.5) + project(EAAssert CXX) + + #------------------------------------------------------------------------------------------- +@@ -13,7 +13,6 @@ option(EAASSERT_BUILD_TESTS "Enable generation of build files for tests" OFF) + # Compiler Flags + #------------------------------------------------------------------------------------------- + set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/test/packages/EASTL/scripts/CMake") +-include(CommonCppFlags) + + #------------------------------------------------------------------------------------------- + # Library definition +@@ -41,5 +40,16 @@ target_include_directories(EAAssert PUBLIC include) + #------------------------------------------------------------------------------------------- + # Package Dependencies + #------------------------------------------------------------------------------------------- +-target_link_libraries(EAAssert EABase) ++find_package(EABase REQUIRED CONFIG) ++target_link_libraries(EAAssert EABase::EABase) ++ ++#------------------------------------------------------------------------------------------- ++# Installation ++#------------------------------------------------------------------------------------------- ++include(GNUInstallDirs) ++install(TARGETS EAAssert ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(DIRECTORY include/EAAssert DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + 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..95884b1 --- /dev/null +++ b/eastdc/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "25082026": + url: "https://github.com/electronicarts/EAStdC/archive/fbcc34e89c63636054334888f3a5bd7ac2fd4b76.zip" + sha256: "023ddb703c824d2e7a9a670b8d5f4a9d9989e07b068f148448c6bb87402bd67d" +patches: + "25082026": + - patch_file: "patches/25082026-0001-use-conan.patch" + patch_description: "bump cmake_minimum_required past what CMake >= 4 accepts, drop the submodule-only CommonCppFlags include, use cci's EABase/EAAssert/EAThread, add install definitions" + patch_type: "conan" diff --git a/eastdc/all/conanfile.py b/eastdc/all/conanfile.py new file mode 100644 index 0000000..3510508 --- /dev/null +++ b/eastdc/all/conanfile.py @@ -0,0 +1,84 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, 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 export_sources(self): + export_conandata_patches(self) + + 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 build(self): + apply_conandata_patches(self) + 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/patches/25082026-0001-use-conan.patch b/eastdc/all/patches/25082026-0001-use-conan.patch new file mode 100644 index 0000000..cd588e6 --- /dev/null +++ b/eastdc/all/patches/25082026-0001-use-conan.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9bf3131..36ab616 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,7 +1,7 @@ + #------------------------------------------------------------------------------------------- + # Copyright (C) Electronic Arts Inc. All rights reserved. + #------------------------------------------------------------------------------------------- +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.5) + project(EAStdC CXX) + + #------------------------------------------------------------------------------------------- +@@ -13,7 +13,6 @@ option(EASTDC_BUILD_TESTS "Enable generation of build files for tests" OFF) + # Compiler Flags + #------------------------------------------------------------------------------------------- + set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/test/packages/EASTL/scripts/CMake") +-include(CommonCppFlags) + + #------------------------------------------------------------------------------------------- + # Library definition +@@ -41,7 +40,18 @@ target_include_directories(EAStdC PUBLIC include) + #------------------------------------------------------------------------------------------- + # Dependencies + #------------------------------------------------------------------------------------------- +-target_link_libraries(EAStdC EABase) +-target_link_libraries(EAStdC EAAssert) +-target_link_libraries(EAStdC EAThread) ++find_package(EABase REQUIRED CONFIG) ++find_package(EAAssert REQUIRED CONFIG) ++find_package(EAThread REQUIRED CONFIG) ++target_link_libraries(EAStdC EABase::EABase EAAssert::EAAssert EAThread::EAThread) ++ ++#------------------------------------------------------------------------------------------- ++# Installation ++#------------------------------------------------------------------------------------------- ++include(GNUInstallDirs) ++install(TARGETS EAStdC ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(DIRECTORY include/EAStdC DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + 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..7a8dfa9 --- /dev/null +++ b/eathread/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "25082026": + url: "https://github.com/electronicarts/EAThread/archive/a77e2276a3fe1489a7c6206c3f77ea10f7a5daf7.zip" + sha256: "19f6ed95e38e9580bcdcd8190a31952b9d27af7a7b27a9b86802cadb44ac4579" +patches: + "25082026": + - patch_file: "patches/25082026-0001-use-conan.patch" + patch_description: "drop the submodule-only CommonCppFlags include and the FetchContent EABase pull, use cci's EABase, add install definitions" + patch_type: "conan" + - patch_file: "patches/25082026-0002-fix-char8t-thread-naming.patch" + patch_description: "unix thread-naming code used char8_t as a stand-in for plain char (a pre-C++20 convention) - fails to compile against char*-based strncpy/prctl/pthread_setname_np now that char8_t is a real, distinct type" + patch_type: "portability" diff --git a/eathread/all/conanfile.py b/eathread/all/conanfile.py new file mode 100644 index 0000000..b4f48c6 --- /dev/null +++ b/eathread/all/conanfile.py @@ -0,0 +1,83 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, 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 export_sources(self): + export_conandata_patches(self) + + 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 build(self): + apply_conandata_patches(self) + 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/patches/25082026-0001-use-conan.patch b/eathread/all/patches/25082026-0001-use-conan.patch new file mode 100644 index 0000000..6cbdc59 --- /dev/null +++ b/eathread/all/patches/25082026-0001-use-conan.patch @@ -0,0 +1,40 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7884456..6d51ebc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,7 +14,6 @@ option(EATHREAD_BUILD_TESTS "Enable generation of build files for tests" OFF) + # Compiler Flags (TODO: do we really need this?) + #------------------------------------------------------------------------------------------- + set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/scripts/Cmake" CACHE INTERNAL "Inject path to CommonCppFlags") +-include(CommonCppFlags) + + #------------------------------------------------------------------------------------------- + # Library definition +@@ -36,16 +35,18 @@ target_include_directories(EAThread PUBLIC include) + #------------------------------------------------------------------------------------------- + # Package Dependencies + #------------------------------------------------------------------------------------------- +-FetchContent_Declare( +- EABase +- GIT_REPOSITORY https://github.com/electronicarts/EABase.git +- GIT_TAG 123363eb82e132c0181ac53e43226d8ee76dea12 +- GIT_SUBMODULES "" # This should be temporary until we update the cyclic submodule dependencies in EABase. +-) ++find_package(EABase REQUIRED CONFIG) ++target_link_libraries(EAThread EABase::EABase) + +-FetchContent_MakeAvailable(EABase) +- +-target_link_libraries(EAThread EABase) ++#------------------------------------------------------------------------------------------- ++# Installation ++#------------------------------------------------------------------------------------------- ++include(GNUInstallDirs) ++install(TARGETS EAThread ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(DIRECTORY include/eathread DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + if(EATHREAD_BUILD_TESTS) + add_subdirectory(test) diff --git a/eathread/all/patches/25082026-0002-fix-char8t-thread-naming.patch b/eathread/all/patches/25082026-0002-fix-char8t-thread-naming.patch new file mode 100644 index 0000000..c26b044 --- /dev/null +++ b/eathread/all/patches/25082026-0002-fix-char8t-thread-naming.patch @@ -0,0 +1,31 @@ +diff --git a/source/unix/eathread_unix.cpp b/source/unix/eathread_unix.cpp +index 5be260a..f716caf 100644 +--- a/source/unix/eathread_unix.cpp ++++ b/source/unix/eathread_unix.cpp +@@ -402,7 +402,7 @@ + // This function is not currently used if the thread name can be set from any other thread + #if !EATHREAD_OTHER_THREAD_NAMING_SUPPORTED + +- void SetCurrentThreadName(const char8_t* pName) ++ void SetCurrentThreadName(const char* pName) + { + #if defined(EA_PLATFORM_LINUX) + // http://manpages.courier-mta.org/htmlman2/prctl.2.html +@@ -417,7 +417,7 @@ + // (/proc/$PID/task/$TID/comm on newer kernels, /proc/$PID/task/$TID/stat's second field + // on older kernels), and hence distinguish which thread might be responsible for the high + // CPU load or similar problems. +- char8_t nameBuf[16]; // Limited to 16 bytes, null terminated if < 16 bytes ++ char nameBuf[16]; // Limited to 16 bytes, null terminated if < 16 bytes + strncpy(nameBuf, pName, sizeof(nameBuf)); + nameBuf[15] = 0; + prctl(PR_SET_NAME, (unsigned long)nameBuf, 0, 0, 0); +@@ -434,7 +434,7 @@ + if(pthread_setname_np_ptr) + { + // Mac OS X does not expose the length limit of the name, so hardcode it. +- char8_t nameBuf[63]; // It is not clear what the size limit actually is, though 63 is known to work because it was seen on the Internet. ++ char nameBuf[63]; // It is not clear what the size limit actually is, though 63 is known to work because it was seen on the Internet. + strncpy(nameBuf, pName, sizeof(nameBuf)); + nameBuf[62] = 0; + pthread_setname_np_ptr(nameBuf); 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"