From 695ba5237c70b3cf605db75e22baffd3de2d8e43 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Fri, 13 Jun 2025 12:37:25 +0200 Subject: [PATCH 01/35] emsdk: added new recipe --- recipes/emsdk/all/conandata.yml | 4 + recipes/emsdk/all/conanfile.py | 145 ++++++++++++++++++++ recipes/emsdk/all/test_package/conanfile.py | 16 +++ recipes/emsdk/all/test_package/profile | 15 ++ recipes/emsdk/config.yml | 3 + 5 files changed, 183 insertions(+) create mode 100644 recipes/emsdk/all/conandata.yml create mode 100644 recipes/emsdk/all/conanfile.py create mode 100644 recipes/emsdk/all/test_package/conanfile.py create mode 100644 recipes/emsdk/all/test_package/profile create mode 100644 recipes/emsdk/config.yml diff --git a/recipes/emsdk/all/conandata.yml b/recipes/emsdk/all/conandata.yml new file mode 100644 index 0000000..6b61e80 --- /dev/null +++ b/recipes/emsdk/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "4.0.10": + url: "https://github.com/emscripten-core/emsdk/archive/4.0.10.tar.gz" + sha256: "2497b55ddbba9bf9be2d18cfca3e973d40a0cfaa8d18f6caacb882a65b2faf1c" diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py new file mode 100644 index 0000000..cedd2cc --- /dev/null +++ b/recipes/emsdk/all/conanfile.py @@ -0,0 +1,145 @@ +import os +from pathlib import Path + +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import chdir, copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=2.1" + + +class EmSDKConan(ConanFile): + name = "emsdk" + description = "Emscripten SDK. Emscripten is an Open Source LLVM to JavaScript compiler" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/kripken/emscripten" + topics = ("emsdk", "emscripten", "sdk", "emcc", "em++", "nodejs") + license = "MIT" + package_type = "application" + settings = "os", "arch" + upload_policy = "skip" + build_policy = "missing" + + def layout(self): + basic_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + @property + def _relative_paths(self): + return ["bin", os.path.join("bin", "upstream", "emscripten")] + + @property + def _paths(self): + return [os.path.join(self.package_folder, path) for path in self._relative_paths] + + @property + def _emsdk(self): + return os.path.join(self.package_folder, "bin") + + @property + def _emscripten(self): + return os.path.join(self.package_folder, "bin", "upstream", "emscripten") + + @property + def _em_config(self): + return os.path.join(self.package_folder, "bin", ".emscripten") + + @property + def _em_cache(self): + return os.path.join(self.package_folder, "bin", ".emscripten_cache") + + @property + def _node_path(self): + subfolders = [path for path in (Path(self.package_folder) / "bin" / "node").iterdir() if path.is_dir()] + if len(subfolders) != 1: + return None + return os.path.join("bin", "node", subfolders[0].name, "bin") + + def generate(self): + env = Environment() + env.prepend_path("PATH", self._paths) + env.define_path("EMSDK", self._emsdk) + env.define_path("EMSCRIPTEN", self._emscripten) + env.define_path("EM_CONFIG", self._em_config) + env.define_path("EM_CACHE", self._em_cache) + env.vars(self, scope="emsdk").save_script("emsdk_env_file") + + # To avoid issues when cross-compiling or with not common arch in profiles we need to set EMSDK_ARCH + # This is important for the emsdk install command + env = VirtualBuildEnv(self) + # Special consideration for armv8 as emsdk expects "arm64" + arch = "arm64" if str(self.settings.arch) == "armv8" else str(self.settings.arch) + env.environment().define("EMSDK_ARCH", arch) + env.generate() + + def build(self): + with chdir(self, self.source_folder): + emsdk = "emsdk.bat" if self.settings_build.os == "Windows" else "./emsdk" + self.run(f"{emsdk} install latest") + self.run(f"{emsdk} activate latest") + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) + if not cross_building(self): + self.run("embuilder build MINIMAL", env=["conanemsdk", "conanrun"]) # force cache population + # Avoid cache failures in case this package is uploaded as paths in sanity.txt are absolute + os.remove(os.path.join(self._em_cache, "sanity.txt")) + + def _define_tool_var(self, value): + suffix = ".bat" if self.settings.os == "Windows" else "" + path = os.path.join(self._emscripten, f"{value}{suffix}") + return path + + def package_info(self): + self.cpp_info.bindirs = self._relative_paths + [self._node_path] + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + # If we are not building for Emscripten, probably we don't want to inject following environment variables, + # but it might be legit use cases... until we find them, let's be conservative. + if not hasattr(self, "settings_target") or self.settings_target is None: + return + + if self.settings_target.os != "Emscripten": + self.output.warning( + f"You've added {self.name}/{self.version} as a build requirement, while os={self.settings_target.os} != Emscripten" + ) + return + + toolchain = os.path.join( + self.package_folder, "bin", "upstream", "emscripten", "cmake", "Modules", "Platform", "Emscripten.cmake" + ) + self.conf_info.prepend("tools.cmake.cmaketoolchain:user_toolchain", toolchain) + + self.buildenv_info.define_path("EMSDK", self._emsdk) + self.buildenv_info.define_path("EMSCRIPTEN", self._emscripten) + self.buildenv_info.define_path("EM_CONFIG", self._em_config) + self.buildenv_info.define_path("EM_CACHE", self._em_cache) + + compiler_executables = { + "c": self._define_tool_var("emcc"), + "cpp": self._define_tool_var("em++"), + } + self.conf_info.update("tools.build:compiler_executables", compiler_executables) + self.buildenv_info.define_path("CC", compiler_executables["c"]) + self.buildenv_info.define_path("CXX", compiler_executables["cpp"]) + self.buildenv_info.define_path("AR", self._define_tool_var("emar")) + self.buildenv_info.define_path("NM", self._define_tool_var("emnm")) + self.buildenv_info.define_path("RANLIB", self._define_tool_var("emranlib")) + self.buildenv_info.define_path("STRIP", self._define_tool_var("emstrip")) + + self.cpp_info.builddirs = [ + os.path.join("bin", "releases", "src"), + os.path.join("bin", "upstream", "emscripten", "cmake", "Modules"), + os.path.join("bin", "upstream", "emscripten", "cmake", "Modules", "Platform"), + os.path.join("bin", "upstream", "emscripten", "system", "lib", "libunwind", "cmake", "Modules"), + os.path.join("bin", "upstream", "emscripten", "system", "lib", "libunwind", "cmake"), + os.path.join("bin", "upstream", "emscripten", "tests", "cmake", "target_library"), + os.path.join("bin", "upstream", "lib", "cmake", "llvm"), + ] diff --git a/recipes/emsdk/all/test_package/conanfile.py b/recipes/emsdk/all/test_package/conanfile.py new file mode 100644 index 0000000..a0948be --- /dev/null +++ b/recipes/emsdk/all/test_package/conanfile.py @@ -0,0 +1,16 @@ +from conan import ConanFile +from conan.tools.build import can_run + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def requirements(self): + self.requires(self.tested_reference_str) + + def test(self): + # Check the package provides working binaries + if can_run(self): + self.run("emcc -v", env="conanrun") + self.run("em++ -v", env="conanrun") + self.run("node -v", env="conanrun") diff --git a/recipes/emsdk/all/test_package/profile b/recipes/emsdk/all/test_package/profile new file mode 100644 index 0000000..f561423 --- /dev/null +++ b/recipes/emsdk/all/test_package/profile @@ -0,0 +1,15 @@ +[settings] +build_type=Release +compiler=emcc +compiler.cppstd=17 +compiler.libcxx=libc++ +compiler.version=4.0.10 +os=Emscripten + +[tool_requires] +emsdk/4.0.10 +ninja/[*] + +[conf] +# Set Ninja as default generator as it is faster and will sove issues on Windows +tools.cmake.cmaketoolchain:generator=Ninja diff --git a/recipes/emsdk/config.yml b/recipes/emsdk/config.yml new file mode 100644 index 0000000..b53578f --- /dev/null +++ b/recipes/emsdk/config.yml @@ -0,0 +1,3 @@ +versions: + "4.0.10": + folder: all From 8f275717827d20e291017d10b7575a1701d4e027 Mon Sep 17 00:00:00 2001 From: Carlos Zoido Date: Mon, 16 Jun 2025 14:54:41 +0200 Subject: [PATCH 02/35] wip --- .github/workflows/main.yml | 38 ++++++++++++++++++++++++++++++++++++++ requirements.txt | 2 ++ tools/build-all.py | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 requirements.txt create mode 100644 tools/build-all.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..03f0872 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,38 @@ +name: Test all toolchains + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + create: + name: Create and test Conan recipes + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Conan + run: | + python -m pip install --upgrade pip + pip install "conan>=2.2,<3" PyYAML + + - name: Cache local Conan repo + uses: actions/cache@v3 + with: + path: ~/.conan2/p + key: ${{ runner.os }}-conan2-${{ hashFiles('recipes/**') }} + restore-keys: | + ${{ runner.os }}-conan2- + + - name: Build and test recipes + run: | + python .github/scripts/build_all_recipes.py diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b03d058 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +conan>=2 +PyYAML diff --git a/tools/build-all.py b/tools/build-all.py new file mode 100644 index 0000000..6e32640 --- /dev/null +++ b/tools/build-all.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +import pathlib +import subprocess +import sys + +try: + import yaml +except ImportError: + sys.exit("PyYAML is not installed") + +recipes_root = pathlib.Path("recipes") +if not recipes_root.is_dir(): + sys.exit(0) + +for recipe_dir in sorted(recipes_root.iterdir()): + cfg_file = recipe_dir / "config.yml" + if not cfg_file.is_file(): + continue + + data = yaml.safe_load(cfg_file.read_text()) or {} + for version in data.get("versions", {}): + subprocess.run( + [ + "conan", + "create", + str(recipe_dir), + "--version", + version, + "--build", + "missing", + ], + check=True, + ) From 12820bd09d1fd9489304c5235ed357d7b692346a Mon Sep 17 00:00:00 2001 From: Carlos Zoido Date: Mon, 16 Jun 2025 15:24:53 +0200 Subject: [PATCH 03/35] wip --- .github/workflows/main.yml | 15 ++--- .../test_package/profile => profiles/emsdk | 2 +- tools/build-all.py | 61 +++++++++++-------- 3 files changed, 43 insertions(+), 35 deletions(-) rename recipes/emsdk/all/test_package/profile => profiles/emsdk (92%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 03f0872..22f549f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,12 @@ -name: Test all toolchains +name: Test all recipes on: push: - branches: [main] + branches: + - main pull_request: - branches: [main] + branches: + - main workflow_dispatch: jobs: @@ -20,10 +22,10 @@ jobs: with: python-version: "3.11" - - name: Install Conan + - name: Install requirements run: | python -m pip install --upgrade pip - pip install "conan>=2.2,<3" PyYAML + pip install -r requirements.txt - name: Cache local Conan repo uses: actions/cache@v3 @@ -34,5 +36,4 @@ jobs: ${{ runner.os }}-conan2- - name: Build and test recipes - run: | - python .github/scripts/build_all_recipes.py + run: python tools/build-all.py diff --git a/recipes/emsdk/all/test_package/profile b/profiles/emsdk similarity index 92% rename from recipes/emsdk/all/test_package/profile rename to profiles/emsdk index f561423..64f0f46 100644 --- a/recipes/emsdk/all/test_package/profile +++ b/profiles/emsdk @@ -1,7 +1,7 @@ [settings] build_type=Release compiler=emcc -compiler.cppstd=17 +compiler.cppstd=17 compiler.libcxx=libc++ compiler.version=4.0.10 os=Emscripten diff --git a/tools/build-all.py b/tools/build-all.py index 6e32640..e555855 100644 --- a/tools/build-all.py +++ b/tools/build-all.py @@ -1,33 +1,40 @@ -#!/usr/bin/env python3 import pathlib import subprocess -import sys +import yaml -try: - import yaml -except ImportError: - sys.exit("PyYAML is not installed") -recipes_root = pathlib.Path("recipes") -if not recipes_root.is_dir(): - sys.exit(0) +def load_versions(recipe_dir: pathlib.Path) -> dict[str, dict]: + """ + Return the mapping {version -> info} defined in `config.yml`. + If the file does not exist, return an empty dict. + """ + cfg = recipe_dir / "config.yml" + if not cfg.is_file(): + return {} + data = yaml.safe_load(cfg.read_text()) or {} + return data.get("versions", {}) -for recipe_dir in sorted(recipes_root.iterdir()): - cfg_file = recipe_dir / "config.yml" - if not cfg_file.is_file(): - continue - data = yaml.safe_load(cfg_file.read_text()) or {} - for version in data.get("versions", {}): - subprocess.run( - [ - "conan", - "create", - str(recipe_dir), - "--version", - version, - "--build", - "missing", - ], - check=True, - ) +for recipe_dir in sorted(pathlib.Path("recipes").iterdir()): + versions = load_versions(recipe_dir) + for version, info in versions.items(): + folder = info.get("folder", ".") + recipe_path = recipe_dir / folder + conanfile = recipe_path / "conanfile.py" + print(f"::group::{recipe_dir.name}/{version}") + try: + subprocess.run( + [ + "conan", + "create", + str(recipe_path), + "--version", + version, + "--build", + "missing", + "--build-require", + ], + check=True, + ) + finally: + print("::endgroup::") From 1768ae6fc16b9fd54d86a3a22199d06e278e95ca Mon Sep 17 00:00:00 2001 From: Carlos Zoido Date: Mon, 16 Jun 2025 16:20:47 +0200 Subject: [PATCH 04/35] wip --- profiles/emsdk | 1 + profiles/emsdk-base | 15 +++++++ recipes/emsdk/all/test_package/conanfile.py | 4 +- requirements.txt | 2 +- tools/build-all.py | 49 +++++++++++---------- 5 files changed, 44 insertions(+), 27 deletions(-) create mode 100644 profiles/emsdk-base diff --git a/profiles/emsdk b/profiles/emsdk index 64f0f46..68c9754 100644 --- a/profiles/emsdk +++ b/profiles/emsdk @@ -5,6 +5,7 @@ compiler.cppstd=17 compiler.libcxx=libc++ compiler.version=4.0.10 os=Emscripten +arch=armv8 [tool_requires] emsdk/4.0.10 diff --git a/profiles/emsdk-base b/profiles/emsdk-base new file mode 100644 index 0000000..b1b7f65 --- /dev/null +++ b/profiles/emsdk-base @@ -0,0 +1,15 @@ +[settings] +build_type=Release +compiler=emcc +compiler.cppstd=17 +compiler.libcxx=libc++ +compiler.version=4.0.10 +os=Emscripten +arch=armv8 + +[tool_requires] +ninja/[*] + +[conf] +# Set Ninja as default generator as it is faster and will sove issues on Windows +tools.cmake.cmaketoolchain:generator=Ninja diff --git a/recipes/emsdk/all/test_package/conanfile.py b/recipes/emsdk/all/test_package/conanfile.py index a0948be..9c3661e 100644 --- a/recipes/emsdk/all/test_package/conanfile.py +++ b/recipes/emsdk/all/test_package/conanfile.py @@ -5,8 +5,8 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): # Check the package provides working binaries diff --git a/requirements.txt b/requirements.txt index b03d058..1e05e18 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -conan>=2 +conan @ git+https://github.com/conan-io/conan.git@develop2 PyYAML diff --git a/tools/build-all.py b/tools/build-all.py index e555855..246adca 100644 --- a/tools/build-all.py +++ b/tools/build-all.py @@ -2,39 +2,40 @@ import subprocess import yaml +RECIPES = pathlib.Path("recipes") +PROFILES = pathlib.Path("profiles") -def load_versions(recipe_dir: pathlib.Path) -> dict[str, dict]: - """ - Return the mapping {version -> info} defined in `config.yml`. - If the file does not exist, return an empty dict. - """ + +def load_versions(recipe_dir: pathlib.Path) -> dict: cfg = recipe_dir / "config.yml" if not cfg.is_file(): return {} - data = yaml.safe_load(cfg.read_text()) or {} - return data.get("versions", {}) + return yaml.safe_load(cfg.read_text() or "").get("versions", {}) -for recipe_dir in sorted(pathlib.Path("recipes").iterdir()): +for recipe_dir in sorted(RECIPES.iterdir()): versions = load_versions(recipe_dir) + profile = PROFILES / recipe_dir.name + for version, info in versions.items(): - folder = info.get("folder", ".") - recipe_path = recipe_dir / folder - conanfile = recipe_path / "conanfile.py" + recipe_path = recipe_dir / info.get("folder", ".") + cmd = [ + "conan", + "create", + str(recipe_path), + "--version", + version, + "--build", + "missing", + "--build-test", + f"{recipe_dir}/*", + "--build-require", + "-pr:h", + f"{profile}-base", + ] print(f"::group::{recipe_dir.name}/{version}") try: - subprocess.run( - [ - "conan", - "create", - str(recipe_path), - "--version", - version, - "--build", - "missing", - "--build-require", - ], - check=True, - ) + print(f"executing: {' '.join(cmd)}") + subprocess.run(cmd, check=True) finally: print("::endgroup::") From 8bfa242fccce89c1a7e5d69941cfe06e7dd4ef12 Mon Sep 17 00:00:00 2001 From: Carlos Zoido Date: Mon, 16 Jun 2025 16:28:30 +0200 Subject: [PATCH 05/35] wip --- profiles/emsdk-base | 2 +- tools/build-all.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/profiles/emsdk-base b/profiles/emsdk-base index b1b7f65..b966b8a 100644 --- a/profiles/emsdk-base +++ b/profiles/emsdk-base @@ -5,7 +5,7 @@ compiler.cppstd=17 compiler.libcxx=libc++ compiler.version=4.0.10 os=Emscripten -arch=armv8 +arch=wasm64 [tool_requires] ninja/[*] diff --git a/tools/build-all.py b/tools/build-all.py index 246adca..f86967d 100644 --- a/tools/build-all.py +++ b/tools/build-all.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +import json import pathlib import subprocess import yaml @@ -19,6 +21,13 @@ def load_versions(recipe_dir: pathlib.Path) -> dict: for version, info in versions.items(): recipe_path = recipe_dir / info.get("folder", ".") + + inspect_json = subprocess.check_output( + ["conan", "inspect", str(recipe_path / "conanfile.py"), "--format=json"], + text=True, + ) + recipe_name = json.loads(inspect_json)["name"] + cmd = [ "conan", "create", @@ -28,14 +37,15 @@ def load_versions(recipe_dir: pathlib.Path) -> dict: "--build", "missing", "--build-test", - f"{recipe_dir}/*", + f"{recipe_name}/*", "--build-require", "-pr:h", f"{profile}-base", ] + print(f"::group::{recipe_dir.name}/{version}") try: - print(f"executing: {' '.join(cmd)}") + print("executing:", " ".join(cmd)) subprocess.run(cmd, check=True) finally: print("::endgroup::") From 240b479a75edd8341605523f8119b438d8cb489a Mon Sep 17 00:00:00 2001 From: Carlos Zoido Date: Mon, 16 Jun 2025 16:33:26 +0200 Subject: [PATCH 06/35] wip --- .github/workflows/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 22f549f..ddd5c68 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,8 +2,6 @@ name: Test all recipes on: push: - branches: - - main pull_request: branches: - main From e01773ac5ea9983cdb8ef71fd6c82524a160d70a Mon Sep 17 00:00:00 2001 From: Carlos Zoido Date: Mon, 16 Jun 2025 16:36:13 +0200 Subject: [PATCH 07/35] wip --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ddd5c68..b6924b1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,4 +34,6 @@ jobs: ${{ runner.os }}-conan2- - name: Build and test recipes - run: python tools/build-all.py + run: | + conan profile detect + python tools/build-all.py From 4c44611762dd5a4770cc867f65629f092fd73682 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Mon, 16 Jun 2025 18:03:39 +0200 Subject: [PATCH 08/35] wip --- .clang-format | 287 ++++++++++++++++++ .github/workflows/main.yml | 1 + conan_config/profiles/emsdk/asmjs | 11 + conan_config/profiles/emsdk/base | 26 ++ conan_config/profiles/emsdk/native | 13 + conan_config/profiles/emsdk/wasm32 | 13 + conan_config/profiles/emsdk/wasm64 | 16 + profiles/emsdk | 16 - profiles/emsdk-base | 15 - recipes/emsdk/all/conanfile.py | 8 +- recipes/emsdk/all/test_package/CMakeLists.txt | 4 + recipes/emsdk/all/test_package/conanfile.py | 24 +- recipes/emsdk/all/test_package/profile | 4 + .../emsdk/all/test_package/test_package.cpp | 6 + tools/build-all.py | 6 +- 15 files changed, 407 insertions(+), 43 deletions(-) create mode 100644 .clang-format create mode 100644 conan_config/profiles/emsdk/asmjs create mode 100644 conan_config/profiles/emsdk/base create mode 100644 conan_config/profiles/emsdk/native create mode 100644 conan_config/profiles/emsdk/wasm32 create mode 100644 conan_config/profiles/emsdk/wasm64 delete mode 100644 profiles/emsdk delete mode 100644 profiles/emsdk-base create mode 100644 recipes/emsdk/all/test_package/CMakeLists.txt create mode 100644 recipes/emsdk/all/test_package/profile create mode 100644 recipes/emsdk/all/test_package/test_package.cpp diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..3027918 --- /dev/null +++ b/.clang-format @@ -0,0 +1,287 @@ +--- +Language: Cpp +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: true + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseArrows: false + AlignCaseColons: false +AlignConsecutiveTableGenBreakingDAGArgColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenCondOperatorColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenDefinitionColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowBreakBeforeNoexceptSpecifier: Never +AllowShortBlocksOnASingleLine: Never +AllowShortCaseExpressionOnASingleLine: true +AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: false +AllowShortNamespacesOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AttributeMacros: + - __capability +BinPackArguments: true +BinPackParameters: BinPack +BitFieldColonSpacing: Both +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterExternBlock: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Leave +BreakAfterJavaFieldAnnotations: false +BreakAfterReturnType: None +BreakArrays: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always +BreakBeforeBraces: Attach +BreakBeforeInlineASMColon: OnlyMultiline +BreakBeforeTernaryOperators: true +BreakBinaryOperations: Never +BreakConstructorInitializers: BeforeColon +BreakFunctionDefinitionParameters: false +BreakInheritanceList: BeforeColon +BreakStringLiterals: true +BreakTemplateDeclarations: MultiLine +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' + Priority: 1 + SortPriority: 0 + CaseSensitive: false +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseBlocks: false +IndentCaseLabels: false +IndentExportBlock: true +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true +IndentPPDirectives: None +IndentRequiresClause: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false +InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLines: + AtEndOfFile: false + AtStartOfBlock: true + AtStartOfFile: true +KeepFormFeed: false +LambdaBodyIndentation: Signature +LineEnding: DeriveLF +MacroBlockBegin: '' +MacroBlockEnd: '' +MainIncludeChar: Quote +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: BinPack +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakBeforeMemberAccess: 150 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakScopeResolution: 500 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +PPIndentWidth: -1 +QualifierAlignment: Leave +ReferenceAlignment: Pointer +ReflowComments: Always +RemoveBracesLLVM: false +RemoveEmptyLinesInUnwrappedLines: false +RemoveParentheses: Leave +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SkipMacroDefinitionBody: false +SortIncludes: CaseSensitive +SortJavaStaticImport: Before +SortUsingDeclarations: LexicographicNumeric +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false +SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterPlacementOperator: true + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: Never +SpacesInContainerLiterals: true +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParens: Never +SpacesInParensOptions: + ExceptDoubleParentheses: false + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false +SpacesInSquareBrackets: false +Standard: Latest +StatementAttributeLikeMacros: + - Q_EMIT +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TableGenBreakInsideDAGArg: DontBreak +TabWidth: 8 +UseTab: Never +VerilogBreakBetweenInstancePorts: true +WhitespaceSensitiveMacros: + - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE +WrapNamespaceBodyWithEmptyLines: Leave +... diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b6924b1..1c9b727 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,4 +36,5 @@ jobs: - name: Build and test recipes run: | conan profile detect + conan config install conan_config python tools/build-all.py diff --git a/conan_config/profiles/emsdk/asmjs b/conan_config/profiles/emsdk/asmjs new file mode 100644 index 0000000..a542ea0 --- /dev/null +++ b/conan_config/profiles/emsdk/asmjs @@ -0,0 +1,11 @@ +include(./base) + +[settings] +arch=asm.js + +[tool_requires] +emsdk/[*] + +[conf] +tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=2GB', '-sINITIAL_MEMORY=64MB'] +tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=2GB', '-sINITIAL_MEMORY=64MB'] diff --git a/conan_config/profiles/emsdk/base b/conan_config/profiles/emsdk/base new file mode 100644 index 0000000..2fcd35b --- /dev/null +++ b/conan_config/profiles/emsdk/base @@ -0,0 +1,26 @@ +# Note: To use a local emsdk installation use -pr:h -pr:h native + +[settings] +build_type=Release +compiler=emcc +compiler.cppstd=17 +compiler.libcxx=libc++ +compiler.version=4.0.10 +os=Emscripten + +[tool_requires] +ninja/[*] + +[conf] +tools.build:exelinkflags+=['-sALLOW_MEMORY_GROWTH=1'] +tools.build:sharedlinkflags+=['-sALLOW_MEMORY_GROWTH=1'] + +# Set Ninja as default generator as it is faster and will sove issues on Windows +tools.cmake.cmaketoolchain:generator=Ninja + +# Verbosity to see emcc invocations +tools.build:verbosity=verbose +tools.compilation:verbosity=verbose + +# Distinguish between architectures +tools.cmake.cmake_layout:build_folder_vars=['settings.build_type', 'settings.arch'] diff --git a/conan_config/profiles/emsdk/native b/conan_config/profiles/emsdk/native new file mode 100644 index 0000000..d28f839 --- /dev/null +++ b/conan_config/profiles/emsdk/native @@ -0,0 +1,13 @@ +[platform_tool_requires] +emsdk/4.0.10 + +[conf] +tools.build:compiler_executables={'c':'emcc', 'cpp':'em++'} + +[buildenv] +CC=emcc +CXX=em++ +AR=emar +NM=emnm +RANLIB=emranlib +STRIP=emstrip diff --git a/conan_config/profiles/emsdk/wasm32 b/conan_config/profiles/emsdk/wasm32 new file mode 100644 index 0000000..cc82766 --- /dev/null +++ b/conan_config/profiles/emsdk/wasm32 @@ -0,0 +1,13 @@ +include(./base) + +[settings] +arch=wasm + +[tool_requires] +emsdk/[*] + +[conf] +tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=4GB', '-sINITIAL_MEMORY=64MB'] +tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=4GB', '-sINITIAL_MEMORY=64MB'] + +#tools.build:exelinkflags+=['-sMIN_NODE_VERSION=230000'] diff --git a/conan_config/profiles/emsdk/wasm64 b/conan_config/profiles/emsdk/wasm64 new file mode 100644 index 0000000..5550b5c --- /dev/null +++ b/conan_config/profiles/emsdk/wasm64 @@ -0,0 +1,16 @@ +include(./base) + +[settings] +arch=wasm64 + +[tool_requires] +emsdk/[*] + +[conf] +# In this early stage of wasm64, ALLOW_MEMORY_GROWTH is not having effect. Also it may not be the most efficient solution. +# wasm64 for now needs to declare INITIAL_MEMORY as the maximum memory +tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=16GB', '-sINITIAL_MEMORY=16GB', '-sASSERTIONS'] +tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=16GB', '-sINITIAL_MEMORY=16GB', '-sASSERTIONS'] + +#tools.build:exelinkflags+=['-sMIN_NODE_VERSION=221600'] +#tools.build:sharedlinkflags+=['-sMIN_NODE_VERSION=221600'] diff --git a/profiles/emsdk b/profiles/emsdk deleted file mode 100644 index 68c9754..0000000 --- a/profiles/emsdk +++ /dev/null @@ -1,16 +0,0 @@ -[settings] -build_type=Release -compiler=emcc -compiler.cppstd=17 -compiler.libcxx=libc++ -compiler.version=4.0.10 -os=Emscripten -arch=armv8 - -[tool_requires] -emsdk/4.0.10 -ninja/[*] - -[conf] -# Set Ninja as default generator as it is faster and will sove issues on Windows -tools.cmake.cmaketoolchain:generator=Ninja diff --git a/profiles/emsdk-base b/profiles/emsdk-base deleted file mode 100644 index b966b8a..0000000 --- a/profiles/emsdk-base +++ /dev/null @@ -1,15 +0,0 @@ -[settings] -build_type=Release -compiler=emcc -compiler.cppstd=17 -compiler.libcxx=libc++ -compiler.version=4.0.10 -os=Emscripten -arch=wasm64 - -[tool_requires] -ninja/[*] - -[conf] -# Set Ninja as default generator as it is faster and will sove issues on Windows -tools.cmake.cmaketoolchain:generator=Ninja diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index cedd2cc..0005b25 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -85,10 +85,10 @@ def build(self): def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) copy(self, "*", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) - if not cross_building(self): - self.run("embuilder build MINIMAL", env=["conanemsdk", "conanrun"]) # force cache population - # Avoid cache failures in case this package is uploaded as paths in sanity.txt are absolute - os.remove(os.path.join(self._em_cache, "sanity.txt")) + # if not cross_building(self): + # self.run("embuilder build MINIMAL", env=["conanemsdk", "conanrun"]) # force cache population + # # Avoid cache failures in case this package is uploaded as paths in sanity.txt are absolute + # os.remove(os.path.join(self._em_cache, "sanity.txt")) def _define_tool_var(self, value): suffix = ".bat" if self.settings.os == "Windows" else "" diff --git a/recipes/emsdk/all/test_package/CMakeLists.txt b/recipes/emsdk/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..26682be --- /dev/null +++ b/recipes/emsdk/all/test_package/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +add_executable(test_package test_package.cpp) diff --git a/recipes/emsdk/all/test_package/conanfile.py b/recipes/emsdk/all/test_package/conanfile.py index 9c3661e..b1a4813 100644 --- a/recipes/emsdk/all/test_package/conanfile.py +++ b/recipes/emsdk/all/test_package/conanfile.py @@ -1,16 +1,30 @@ 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", "VirtualBuildEnv" def build_requirements(self): self.tool_requires(self.tested_reference_str) + def layout(self): + cmake_layout(self) + + def build(self): + if self.settings.os == "Emscripten": + cmake = CMake(self) + cmake.configure() + cmake.build() + def test(self): # Check the package provides working binaries - if can_run(self): - self.run("emcc -v", env="conanrun") - self.run("em++ -v", env="conanrun") - self.run("node -v", env="conanrun") + self.run("emcc -v") + self.run("em++ -v") + self.run("node -v") + + if self.settings.os == "Emscripten": + test_file = os.path.join(self.cpp.build.bindirs[0], "test_package.js") + self.run(f"node {test_file}") diff --git a/recipes/emsdk/all/test_package/profile b/recipes/emsdk/all/test_package/profile new file mode 100644 index 0000000..06ca34a --- /dev/null +++ b/recipes/emsdk/all/test_package/profile @@ -0,0 +1,4 @@ +include(emsdk/base) + +[settings] +arch=wasm diff --git a/recipes/emsdk/all/test_package/test_package.cpp b/recipes/emsdk/all/test_package/test_package.cpp new file mode 100644 index 0000000..4576fd8 --- /dev/null +++ b/recipes/emsdk/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + std::cout << "Hello from emscripten!\n"; + return 0; +} diff --git a/tools/build-all.py b/tools/build-all.py index f86967d..86331a5 100644 --- a/tools/build-all.py +++ b/tools/build-all.py @@ -5,7 +5,6 @@ import yaml RECIPES = pathlib.Path("recipes") -PROFILES = pathlib.Path("profiles") def load_versions(recipe_dir: pathlib.Path) -> dict: @@ -17,7 +16,6 @@ def load_versions(recipe_dir: pathlib.Path) -> dict: for recipe_dir in sorted(RECIPES.iterdir()): versions = load_versions(recipe_dir) - profile = PROFILES / recipe_dir.name for version, info in versions.items(): recipe_path = recipe_dir / info.get("folder", ".") @@ -40,7 +38,9 @@ def load_versions(recipe_dir: pathlib.Path) -> dict: f"{recipe_name}/*", "--build-require", "-pr:h", - f"{profile}-base", + str(recipe_path / "test_package" / "profile"), + "-c", + "tools.build.cross_building:can_run=True", ] print(f"::group::{recipe_dir.name}/{version}") From e62addaaf57c68999bcf6ce2bf1ef57d33a649cf Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Tue, 17 Jun 2025 09:19:03 +0200 Subject: [PATCH 09/35] Removed requirements --- .clang-format | 287 --------------------------------- README.md | 11 +- recipes/emsdk/all/conanfile.py | 8 +- 3 files changed, 9 insertions(+), 297 deletions(-) delete mode 100644 .clang-format diff --git a/.clang-format b/.clang-format deleted file mode 100644 index 3027918..0000000 --- a/.clang-format +++ /dev/null @@ -1,287 +0,0 @@ ---- -Language: Cpp -AccessModifierOffset: -2 -AlignAfterOpenBracket: Align -AlignArrayOfStructures: None -AlignConsecutiveAssignments: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionDeclarations: false - AlignFunctionPointers: false - PadOperators: true -AlignConsecutiveBitFields: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionDeclarations: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveDeclarations: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionDeclarations: true - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveMacros: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionDeclarations: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveShortCaseStatements: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCaseArrows: false - AlignCaseColons: false -AlignConsecutiveTableGenBreakingDAGArgColons: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionDeclarations: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveTableGenCondOperatorColons: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionDeclarations: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveTableGenDefinitionColons: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionDeclarations: false - AlignFunctionPointers: false - PadOperators: false -AlignEscapedNewlines: Right -AlignOperands: Align -AlignTrailingComments: - Kind: Always - OverEmptyLines: 0 -AllowAllArgumentsOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowBreakBeforeNoexceptSpecifier: Never -AllowShortBlocksOnASingleLine: Never -AllowShortCaseExpressionOnASingleLine: true -AllowShortCaseLabelsOnASingleLine: false -AllowShortCompoundRequirementOnASingleLine: true -AllowShortEnumsOnASingleLine: true -AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: Never -AllowShortLambdasOnASingleLine: All -AllowShortLoopsOnASingleLine: false -AllowShortNamespacesOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AttributeMacros: - - __capability -BinPackArguments: true -BinPackParameters: BinPack -BitFieldColonSpacing: Both -BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterControlStatement: Never - AfterEnum: false - AfterExternBlock: false - AfterFunction: false - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - BeforeCatch: false - BeforeElse: false - BeforeLambdaBody: false - BeforeWhile: false - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true - SplitEmptyNamespace: true -BreakAdjacentStringLiterals: true -BreakAfterAttributes: Leave -BreakAfterJavaFieldAnnotations: false -BreakAfterReturnType: None -BreakArrays: true -BreakBeforeBinaryOperators: None -BreakBeforeConceptDeclarations: Always -BreakBeforeBraces: Attach -BreakBeforeInlineASMColon: OnlyMultiline -BreakBeforeTernaryOperators: true -BreakBinaryOperations: Never -BreakConstructorInitializers: BeforeColon -BreakFunctionDefinitionParameters: false -BreakInheritanceList: BeforeColon -BreakStringLiterals: true -BreakTemplateDeclarations: MultiLine -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: false -DisableFormat: false -EmptyLineAfterAccessModifier: Never -EmptyLineBeforeAccessModifier: LogicalBlock -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: true -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -IfMacros: - - KJ_IF_MAYBE -IncludeBlocks: Preserve -IncludeCategories: - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - SortPriority: 0 - CaseSensitive: false - - Regex: '^(<|"(gtest|gmock|isl|json)/)' - Priority: 3 - SortPriority: 0 - CaseSensitive: false - - Regex: '.*' - Priority: 1 - SortPriority: 0 - CaseSensitive: false -IncludeIsMainRegex: '(Test)?$' -IncludeIsMainSourceRegex: '' -IndentAccessModifiers: false -IndentCaseBlocks: false -IndentCaseLabels: false -IndentExportBlock: true -IndentExternBlock: AfterExternBlock -IndentGotoLabels: true -IndentPPDirectives: None -IndentRequiresClause: true -IndentWidth: 2 -IndentWrappedFunctionNames: false -InsertBraces: false -InsertNewlineAtEOF: false -InsertTrailingCommas: None -IntegerLiteralSeparator: - Binary: 0 - BinaryMinDigits: 0 - Decimal: 0 - DecimalMinDigits: 0 - Hex: 0 - HexMinDigits: 0 -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLines: - AtEndOfFile: false - AtStartOfBlock: true - AtStartOfFile: true -KeepFormFeed: false -LambdaBodyIndentation: Signature -LineEnding: DeriveLF -MacroBlockBegin: '' -MacroBlockEnd: '' -MainIncludeChar: Quote -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 2 -ObjCBreakBeforeNestedBlockParam: true -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PackConstructorInitializers: BinPack -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakBeforeMemberAccess: 150 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakOpenParenthesis: 0 -PenaltyBreakScopeResolution: 500 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 1000000 -PenaltyIndentedWhitespace: 0 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right -PPIndentWidth: -1 -QualifierAlignment: Leave -ReferenceAlignment: Pointer -ReflowComments: Always -RemoveBracesLLVM: false -RemoveEmptyLinesInUnwrappedLines: false -RemoveParentheses: Leave -RemoveSemicolon: false -RequiresClausePosition: OwnLine -RequiresExpressionIndentation: OuterScope -SeparateDefinitionBlocks: Leave -ShortNamespaceLines: 1 -SkipMacroDefinitionBody: false -SortIncludes: CaseSensitive -SortJavaStaticImport: Before -SortUsingDeclarations: LexicographicNumeric -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceAroundPointerQualifiers: Default -SpaceBeforeAssignmentOperators: true -SpaceBeforeCaseColon: false -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeJsonColon: false -SpaceBeforeParens: ControlStatements -SpaceBeforeParensOptions: - AfterControlStatements: true - AfterForeachMacros: true - AfterFunctionDefinitionName: false - AfterFunctionDeclarationName: false - AfterIfMacros: true - AfterOverloadedOperator: false - AfterPlacementOperator: true - AfterRequiresInClause: false - AfterRequiresInExpression: false - BeforeNonEmptyParentheses: false -SpaceBeforeRangeBasedForLoopColon: true -SpaceBeforeSquareBrackets: false -SpaceInEmptyBlock: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: Never -SpacesInContainerLiterals: true -SpacesInLineCommentPrefix: - Minimum: 1 - Maximum: -1 -SpacesInParens: Never -SpacesInParensOptions: - ExceptDoubleParentheses: false - InCStyleCasts: false - InConditionalStatements: false - InEmptyParentheses: false - Other: false -SpacesInSquareBrackets: false -Standard: Latest -StatementAttributeLikeMacros: - - Q_EMIT -StatementMacros: - - Q_UNUSED - - QT_REQUIRE_VERSION -TableGenBreakInsideDAGArg: DontBreak -TabWidth: 8 -UseTab: Never -VerilogBreakBetweenInstancePorts: true -WhitespaceSensitiveMacros: - - BOOST_PP_STRINGIZE - - CF_SWIFT_NAME - - NS_SWIFT_NAME - - PP_STRINGIZE - - STRINGIZE -WrapNamespaceBodyWithEmptyLines: Leave -... diff --git a/README.md b/README.md index 39b463e..6c6feba 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ utilities, for example the Emscripten SDK or other compilers. These recipes are maintained independently of [Conan Center Index](https://github.com/conan-io/conan-center-index) with flexible maintenance scopes. ---- ## 🌟 Why a separate repo? @@ -18,8 +17,6 @@ tailoring recipes as needed. It also supports bleeding-edge or niche toolchains that don't belong in the main index, offering maximum flexibility and control. ---- - ## πŸš€ Getting started @@ -40,19 +37,21 @@ This repository is still under active development, and no Conan remote with pre- If you wish to contribute to **conan-toolchains**, follow these steps to clone the repository -and install the required development dependencies. +and install the recommended development dependencies. ``` git clone git@github.com:conan-io/conan-toolchains.git cd conan-toolchains -# Recommended: Setup your virtual environment before installing dependencies -pip install pre-commit ``` +### Contributing recommendation + We use [pre-commit](https://pre-commit.com/) to enforce code style and formatting. To activate the pre-commit hooks: ``` +# Recommended: Setup your virtual environment before installing dependencies +pip install pre-commit pre-commit install ``` diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 0005b25..cedd2cc 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -85,10 +85,10 @@ def build(self): def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) copy(self, "*", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) - # if not cross_building(self): - # self.run("embuilder build MINIMAL", env=["conanemsdk", "conanrun"]) # force cache population - # # Avoid cache failures in case this package is uploaded as paths in sanity.txt are absolute - # os.remove(os.path.join(self._em_cache, "sanity.txt")) + if not cross_building(self): + self.run("embuilder build MINIMAL", env=["conanemsdk", "conanrun"]) # force cache population + # Avoid cache failures in case this package is uploaded as paths in sanity.txt are absolute + os.remove(os.path.join(self._em_cache, "sanity.txt")) def _define_tool_var(self, value): suffix = ".bat" if self.settings.os == "Windows" else "" From 334f3768967d4e82aacec9ad99d4b0c7749c76a0 Mon Sep 17 00:00:00 2001 From: Carlos Zoido Date: Tue, 17 Jun 2025 09:26:14 +0200 Subject: [PATCH 10/35] try to fix output --- tools/build-all.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/build-all.py b/tools/build-all.py index 86331a5..0e320df 100644 --- a/tools/build-all.py +++ b/tools/build-all.py @@ -43,9 +43,10 @@ def load_versions(recipe_dir: pathlib.Path) -> dict: "tools.build.cross_building:can_run=True", ] - print(f"::group::{recipe_dir.name}/{version}") + print(f"::group::{recipe_name}/{version}", flush=True) + try: - print("executing:", " ".join(cmd)) + print("executing:", " ".join(cmd), flush=True) subprocess.run(cmd, check=True) finally: - print("::endgroup::") + print("::endgroup::", flush=True) From 48823f69efa983b0d5b506194d9892ea959b556a Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Tue, 17 Jun 2025 09:58:22 +0200 Subject: [PATCH 11/35] Updated profiles, readme and ci --- .github/workflows/main.yml | 14 ++++++++++++++ conan_config/profiles/emsdk/{base => .base} | 0 conan_config/profiles/emsdk/.emsdk_base | 4 ++++ conan_config/profiles/emsdk/asmjs | 5 +---- conan_config/profiles/emsdk/wasm32 | 5 +---- conan_config/profiles/emsdk/wasm64 | 5 +---- .../all/{test_package/profile => .ci_profile} | 2 +- tools/build-all.py | 7 ++++++- 8 files changed, 28 insertions(+), 14 deletions(-) rename conan_config/profiles/emsdk/{base => .base} (100%) create mode 100644 conan_config/profiles/emsdk/.emsdk_base rename recipes/emsdk/all/{test_package/profile => .ci_profile} (51%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c9b727..c5f7a50 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,8 +33,22 @@ jobs: restore-keys: | ${{ runner.os }}-conan2- + - name: Get changed recipes + id: changed-recipes + uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46 + with: + files: | + recipes/** + files_ignore: recipes/*.{md,txt} + - name: Build and test recipes + if: steps.changed-recipes.outputs.any_changed == 'true' + env: + BUILD_RECIPES: ${{ steps.changed-recipes.outputs.all_changed_files }} run: | conan profile detect conan config install conan_config + for recipe in ${BUILD_RECIPES}; do + echo "$recipe was changed" + done python tools/build-all.py diff --git a/conan_config/profiles/emsdk/base b/conan_config/profiles/emsdk/.base similarity index 100% rename from conan_config/profiles/emsdk/base rename to conan_config/profiles/emsdk/.base diff --git a/conan_config/profiles/emsdk/.emsdk_base b/conan_config/profiles/emsdk/.emsdk_base new file mode 100644 index 0000000..76b2949 --- /dev/null +++ b/conan_config/profiles/emsdk/.emsdk_base @@ -0,0 +1,4 @@ +include(./.base) + +[tool_requires] +emsdk/[*] diff --git a/conan_config/profiles/emsdk/asmjs b/conan_config/profiles/emsdk/asmjs index a542ea0..7e376fa 100644 --- a/conan_config/profiles/emsdk/asmjs +++ b/conan_config/profiles/emsdk/asmjs @@ -1,11 +1,8 @@ -include(./base) +include(./.emsdk_base) [settings] arch=asm.js -[tool_requires] -emsdk/[*] - [conf] tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=2GB', '-sINITIAL_MEMORY=64MB'] tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=2GB', '-sINITIAL_MEMORY=64MB'] diff --git a/conan_config/profiles/emsdk/wasm32 b/conan_config/profiles/emsdk/wasm32 index cc82766..046c47d 100644 --- a/conan_config/profiles/emsdk/wasm32 +++ b/conan_config/profiles/emsdk/wasm32 @@ -1,11 +1,8 @@ -include(./base) +include(./.emsdk_base) [settings] arch=wasm -[tool_requires] -emsdk/[*] - [conf] tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=4GB', '-sINITIAL_MEMORY=64MB'] tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=4GB', '-sINITIAL_MEMORY=64MB'] diff --git a/conan_config/profiles/emsdk/wasm64 b/conan_config/profiles/emsdk/wasm64 index 5550b5c..6676285 100644 --- a/conan_config/profiles/emsdk/wasm64 +++ b/conan_config/profiles/emsdk/wasm64 @@ -1,11 +1,8 @@ -include(./base) +include(./.emsdk_base) [settings] arch=wasm64 -[tool_requires] -emsdk/[*] - [conf] # In this early stage of wasm64, ALLOW_MEMORY_GROWTH is not having effect. Also it may not be the most efficient solution. # wasm64 for now needs to declare INITIAL_MEMORY as the maximum memory diff --git a/recipes/emsdk/all/test_package/profile b/recipes/emsdk/all/.ci_profile similarity index 51% rename from recipes/emsdk/all/test_package/profile rename to recipes/emsdk/all/.ci_profile index 06ca34a..1687a38 100644 --- a/recipes/emsdk/all/test_package/profile +++ b/recipes/emsdk/all/.ci_profile @@ -1,4 +1,4 @@ -include(emsdk/base) +include(emsdk/.base) [settings] arch=wasm diff --git a/tools/build-all.py b/tools/build-all.py index 0e320df..360d363 100644 --- a/tools/build-all.py +++ b/tools/build-all.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import os import json import pathlib import subprocess @@ -6,6 +7,10 @@ RECIPES = pathlib.Path("recipes") +BUILD_RECIPES = os.getenv("BUILD_RECIPES") +print(BUILD_RECIPES) +print(type(BUILD_RECIPES)) + def load_versions(recipe_dir: pathlib.Path) -> dict: cfg = recipe_dir / "config.yml" @@ -38,7 +43,7 @@ def load_versions(recipe_dir: pathlib.Path) -> dict: f"{recipe_name}/*", "--build-require", "-pr:h", - str(recipe_path / "test_package" / "profile"), + str(recipe_path / ".ci_profile"), "-c", "tools.build.cross_building:can_run=True", ] From 06b9bd6a09ab4c60d3012de856be0f30d3e9924e Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Tue, 17 Jun 2025 10:40:50 +0200 Subject: [PATCH 12/35] Updated CI, build only changed recipes --- .../scripts/build_recipes.py | 22 +++++++++++++------ .github/workflows/main.yml | 5 +---- pyproject.toml | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) rename tools/build-all.py => .github/scripts/build_recipes.py (67%) diff --git a/tools/build-all.py b/.github/scripts/build_recipes.py similarity index 67% rename from tools/build-all.py rename to .github/scripts/build_recipes.py index 360d363..4447292 100644 --- a/tools/build-all.py +++ b/.github/scripts/build_recipes.py @@ -1,25 +1,33 @@ #!/usr/bin/env python3 import os import json -import pathlib +from pathlib import Path import subprocess import yaml +from collections import defaultdict -RECIPES = pathlib.Path("recipes") -BUILD_RECIPES = os.getenv("BUILD_RECIPES") -print(BUILD_RECIPES) -print(type(BUILD_RECIPES)) +def get_updated_recipes(): + updated_paths = os.getenv("BUILD_RECIPES", "").split(" ") + recipe_files = defaultdict(set) + for path in updated_paths: + parts = Path(path).parts + if len(parts) >= 2 and parts[0] == "recipes": + recipe_name = parts[1] + file = "/".join(parts[2:]) + recipe_files[recipe_name].add(file) + return set(recipe_files.keys()) -def load_versions(recipe_dir: pathlib.Path) -> dict: +def load_versions(recipe_dir: Path) -> dict: cfg = recipe_dir / "config.yml" if not cfg.is_file(): return {} return yaml.safe_load(cfg.read_text() or "").get("versions", {}) -for recipe_dir in sorted(RECIPES.iterdir()): +for recipe_name in get_updated_recipes(): + recipe_dir = Path("recipes") / recipe_name versions = load_versions(recipe_dir) for version, info in versions.items(): diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c5f7a50..f4219ee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,4 @@ jobs: run: | conan profile detect conan config install conan_config - for recipe in ${BUILD_RECIPES}; do - echo "$recipe was changed" - done - python tools/build-all.py + python .github/scripts/build_recipes.py diff --git a/pyproject.toml b/pyproject.toml index 1f4380e..1c05400 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.ruff] output-format = "full" -src = ["recipes"] +src = ["recipes", ".github/scripts"] fix = true show-fixes = true line-length = 120 From 43ab52f25de618563fbca760b88ded1d7ab2f526 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Tue, 17 Jun 2025 11:25:50 +0200 Subject: [PATCH 13/35] Updated readme --- README.md | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6c6feba..18304d9 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,25 @@ tailoring recipes as needed. It also supports bleeding-edge or niche toolchains that don't belong in the main index, offering maximum flexibility and control. -## πŸš€ Getting started +## 🧰 Built-in Profiles + +This repository includes several **pre-configured Conan profiles** designed to make toolchain setup effortless: + +To install the respective profiles: + +```sh +$ conan config install https://github.com/conan-io/conan-toolchains.git -sf conan_config +``` + +Profiles could be later listed: +```sh +$ conan profile list +``` +Toolchain profiles will be located under `/`. +Profiles starting with dot (`.`) are considered *base* which are used for other profiles and should not be used directly. + +## πŸš€ Getting started ### Setup `conan-toolchains` as a [local recipe index](https://docs.conan.io/2/devops/devops_local_recipes_index.html#devops-local-recipes-index) repository @@ -35,22 +52,13 @@ This repository is still under active development, and no Conan remote with pre- ## Contributing +We welcome and appreciate contributions to **conan-toolchains**! -If you wish to contribute to **conan-toolchains**, follow these steps to clone the repository -and install the recommended development dependencies. - -``` -git clone git@github.com:conan-io/conan-toolchains.git -cd conan-toolchains -``` - -### Contributing recommendation - -We use [pre-commit](https://pre-commit.com/) to enforce code style and formatting. To -activate the pre-commit hooks: +We recommend using [pre-commit](https://pre-commit.com/) to enforce code style and formatting. To +activate the pre-commit hooks contributors could optionally run the following commands: ``` -# Recommended: Setup your virtual environment before installing dependencies +# Setup your virtual environment before installing dependencies pip install pre-commit pre-commit install ``` From ecb363ab8268d12b2e0117351bfa50e1c6adadec Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Thu, 19 Jun 2025 16:28:46 +0200 Subject: [PATCH 14/35] Moved general config to base CI profile --- .github/scripts/.ci_base_profile | 10 ++++++++++ .github/scripts/build_recipes.py | 4 ++-- conan_config/profiles/emsdk/.base | 7 ------- 3 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 .github/scripts/.ci_base_profile diff --git a/.github/scripts/.ci_base_profile b/.github/scripts/.ci_base_profile new file mode 100644 index 0000000..abbe63f --- /dev/null +++ b/.github/scripts/.ci_base_profile @@ -0,0 +1,10 @@ +[conf] +tools.build.cross_building:can_run=True + +# Verbosity +tools.build:verbosity=verbose +tools.compilation:verbosity=verbose + +# Package Manager Configuration +*/system:tools.system.package_manager:mode=install +*/system:tools.system.package_manager:sudo=True diff --git a/.github/scripts/build_recipes.py b/.github/scripts/build_recipes.py index 4447292..bedf439 100644 --- a/.github/scripts/build_recipes.py +++ b/.github/scripts/build_recipes.py @@ -52,8 +52,8 @@ def load_versions(recipe_dir: Path) -> dict: "--build-require", "-pr:h", str(recipe_path / ".ci_profile"), - "-c", - "tools.build.cross_building:can_run=True", + "-pr:a", + ".ci_base_profile", ] print(f"::group::{recipe_name}/{version}", flush=True) diff --git a/conan_config/profiles/emsdk/.base b/conan_config/profiles/emsdk/.base index 2fcd35b..a13907b 100644 --- a/conan_config/profiles/emsdk/.base +++ b/conan_config/profiles/emsdk/.base @@ -17,10 +17,3 @@ tools.build:sharedlinkflags+=['-sALLOW_MEMORY_GROWTH=1'] # Set Ninja as default generator as it is faster and will sove issues on Windows tools.cmake.cmaketoolchain:generator=Ninja - -# Verbosity to see emcc invocations -tools.build:verbosity=verbose -tools.compilation:verbosity=verbose - -# Distinguish between architectures -tools.cmake.cmake_layout:build_folder_vars=['settings.build_type', 'settings.arch'] From fa69614ba4c9bb0ce619e2a977037f893e9e4ea0 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Thu, 19 Jun 2025 16:40:50 +0200 Subject: [PATCH 15/35] Fix error --- .github/scripts/build_recipes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/build_recipes.py b/.github/scripts/build_recipes.py index bedf439..377b43d 100644 --- a/.github/scripts/build_recipes.py +++ b/.github/scripts/build_recipes.py @@ -53,7 +53,7 @@ def load_versions(recipe_dir: Path) -> dict: "-pr:h", str(recipe_path / ".ci_profile"), "-pr:a", - ".ci_base_profile", + str(Path(__file__).parent / ".ci_base_profile"), ] print(f"::group::{recipe_name}/{version}", flush=True) From d08d2411e489f94fc46f3f2c3819884922cdf2e8 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Thu, 19 Jun 2025 16:59:12 +0200 Subject: [PATCH 16/35] Fix error --- .github/scripts/.ci_base_profile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/scripts/.ci_base_profile b/.github/scripts/.ci_base_profile index abbe63f..e43e60a 100644 --- a/.github/scripts/.ci_base_profile +++ b/.github/scripts/.ci_base_profile @@ -1,3 +1,5 @@ +include(default) + [conf] tools.build.cross_building:can_run=True From 44f11d9c8580577cbcdce2640201569fec8d708d Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Tue, 24 Jun 2025 15:21:49 +0200 Subject: [PATCH 17/35] Added user_toolchain example on native profile --- conan_config/profiles/emsdk/native | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conan_config/profiles/emsdk/native b/conan_config/profiles/emsdk/native index d28f839..3a57246 100644 --- a/conan_config/profiles/emsdk/native +++ b/conan_config/profiles/emsdk/native @@ -3,6 +3,8 @@ emsdk/4.0.10 [conf] tools.build:compiler_executables={'c':'emcc', 'cpp':'em++'} +# Add native Emscripten toolchain +# tools.cmake.cmaketoolchain:user_toolchain=["/path/to/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"] [buildenv] CC=emcc From c080b28fb0ac51621fb37189b59be594c1ef6ece Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Wed, 25 Jun 2025 15:10:46 +0200 Subject: [PATCH 18/35] Restore build_folder_vars --- conan_config/profiles/emsdk/.base | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conan_config/profiles/emsdk/.base b/conan_config/profiles/emsdk/.base index a13907b..5c8b6d3 100644 --- a/conan_config/profiles/emsdk/.base +++ b/conan_config/profiles/emsdk/.base @@ -17,3 +17,6 @@ tools.build:sharedlinkflags+=['-sALLOW_MEMORY_GROWTH=1'] # Set Ninja as default generator as it is faster and will sove issues on Windows tools.cmake.cmaketoolchain:generator=Ninja + +# Distinguish between architectures +tools.cmake.cmake_layout:build_folder_vars=['settings.build_type', 'settings.arch'] From 81f7789345edc7111ee50e920d095548700598d3 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Wed, 25 Jun 2025 15:15:21 +0200 Subject: [PATCH 19/35] Added threads comment --- conan_config/profiles/emsdk/.base | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conan_config/profiles/emsdk/.base b/conan_config/profiles/emsdk/.base index 5c8b6d3..0085c0e 100644 --- a/conan_config/profiles/emsdk/.base +++ b/conan_config/profiles/emsdk/.base @@ -5,6 +5,8 @@ build_type=Release compiler=emcc compiler.cppstd=17 compiler.libcxx=libc++ +# Choose between both types of multithreading support (or none) +# compiler.threads= compiler.version=4.0.10 os=Emscripten @@ -15,7 +17,7 @@ ninja/[*] tools.build:exelinkflags+=['-sALLOW_MEMORY_GROWTH=1'] tools.build:sharedlinkflags+=['-sALLOW_MEMORY_GROWTH=1'] -# Set Ninja as default generator as it is faster and will sove issues on Windows +# Set Ninja as default generator as it is faster and will avoid Windows issues tools.cmake.cmaketoolchain:generator=Ninja # Distinguish between architectures From 6ff37921130c14f427c8b9987d2f05111d0b135c Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Wed, 25 Jun 2025 15:21:37 +0200 Subject: [PATCH 20/35] Removed unneded min node version --- conan_config/profiles/emsdk/wasm32 | 2 -- conan_config/profiles/emsdk/wasm64 | 3 --- 2 files changed, 5 deletions(-) diff --git a/conan_config/profiles/emsdk/wasm32 b/conan_config/profiles/emsdk/wasm32 index 046c47d..5d6063f 100644 --- a/conan_config/profiles/emsdk/wasm32 +++ b/conan_config/profiles/emsdk/wasm32 @@ -6,5 +6,3 @@ arch=wasm [conf] tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=4GB', '-sINITIAL_MEMORY=64MB'] tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=4GB', '-sINITIAL_MEMORY=64MB'] - -#tools.build:exelinkflags+=['-sMIN_NODE_VERSION=230000'] diff --git a/conan_config/profiles/emsdk/wasm64 b/conan_config/profiles/emsdk/wasm64 index 6676285..b4b1178 100644 --- a/conan_config/profiles/emsdk/wasm64 +++ b/conan_config/profiles/emsdk/wasm64 @@ -8,6 +8,3 @@ arch=wasm64 # wasm64 for now needs to declare INITIAL_MEMORY as the maximum memory tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=16GB', '-sINITIAL_MEMORY=16GB', '-sASSERTIONS'] tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=16GB', '-sINITIAL_MEMORY=16GB', '-sASSERTIONS'] - -#tools.build:exelinkflags+=['-sMIN_NODE_VERSION=221600'] -#tools.build:sharedlinkflags+=['-sMIN_NODE_VERSION=221600'] From c5746ce97ec1748aedc8b0685e0338476e48eefa Mon Sep 17 00:00:00 2001 From: Carlos Zoido Date: Tue, 1 Jul 2025 10:49:48 +0200 Subject: [PATCH 21/35] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1e05e18..e8138e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -conan @ git+https://github.com/conan-io/conan.git@develop2 +conan>=2.18 PyYAML From 3c475c91b680efbc09c2c1786c4b2c33950c12c8 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Tue, 1 Jul 2025 11:06:01 +0200 Subject: [PATCH 22/35] Removed asmjs profile --- conan_config/profiles/emsdk/asmjs | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 conan_config/profiles/emsdk/asmjs diff --git a/conan_config/profiles/emsdk/asmjs b/conan_config/profiles/emsdk/asmjs deleted file mode 100644 index 7e376fa..0000000 --- a/conan_config/profiles/emsdk/asmjs +++ /dev/null @@ -1,8 +0,0 @@ -include(./.emsdk_base) - -[settings] -arch=asm.js - -[conf] -tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=2GB', '-sINITIAL_MEMORY=64MB'] -tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=2GB', '-sINITIAL_MEMORY=64MB'] From 9736f290bcc2889b050a97ba608304a5d4e3ad6c Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Wed, 2 Jul 2025 11:37:27 +0200 Subject: [PATCH 23/35] Applied some review suggestions --- README.md | 2 +- conan_config/profiles/emsdk/.base | 4 +- conan_config/profiles/emsdk/.emsdk_base | 2 +- conan_config/profiles/emsdk/README.md | 116 ++++++++++++++++++ conan_config/profiles/emsdk/{native => local} | 3 +- recipes/emsdk/all/conanfile.py | 11 +- 6 files changed, 123 insertions(+), 15 deletions(-) create mode 100644 conan_config/profiles/emsdk/README.md rename conan_config/profiles/emsdk/{native => local} (85%) diff --git a/README.md b/README.md index 18304d9..8b5f4ce 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ tailoring recipes as needed. It also supports bleeding-edge or niche toolchains that don't belong in the main index, offering maximum flexibility and control. -## 🧰 Built-in Profiles +## 🧰 Reference Profiles This repository includes several **pre-configured Conan profiles** designed to make toolchain setup effortless: diff --git a/conan_config/profiles/emsdk/.base b/conan_config/profiles/emsdk/.base index 0085c0e..5ec9bcf 100644 --- a/conan_config/profiles/emsdk/.base +++ b/conan_config/profiles/emsdk/.base @@ -1,5 +1,3 @@ -# Note: To use a local emsdk installation use -pr:h -pr:h native - [settings] build_type=Release compiler=emcc @@ -17,7 +15,7 @@ ninja/[*] tools.build:exelinkflags+=['-sALLOW_MEMORY_GROWTH=1'] tools.build:sharedlinkflags+=['-sALLOW_MEMORY_GROWTH=1'] -# Set Ninja as default generator as it is faster and will avoid Windows issues +# Set Ninja as default generator as it will avoid Windows issues tools.cmake.cmaketoolchain:generator=Ninja # Distinguish between architectures diff --git a/conan_config/profiles/emsdk/.emsdk_base b/conan_config/profiles/emsdk/.emsdk_base index 76b2949..2c08254 100644 --- a/conan_config/profiles/emsdk/.emsdk_base +++ b/conan_config/profiles/emsdk/.emsdk_base @@ -1,4 +1,4 @@ include(./.base) [tool_requires] -emsdk/[*] +emsdk/4.0.10 diff --git a/conan_config/profiles/emsdk/README.md b/conan_config/profiles/emsdk/README.md new file mode 100644 index 0000000..0a06f54 --- /dev/null +++ b/conan_config/profiles/emsdk/README.md @@ -0,0 +1,116 @@ +# EMSDK - Emscripten Compiler Profiles for Conan + +This repository provides a collection of pre-built Conan profiles that can be +used as a reference for **cross-compiling projects to WebAssembly (WASM)**. + +πŸ“˜ For detailed information and usage examples, refer to the official [Conan +documentation](https://docs.conan.io/2/examples/cross_build/emscripten.html#setting-up-conan-profile-for-webassembly-wasm). + +πŸ’‘ Issues and suggestions are welcome via the `conan-toolchains` repository. +Contributions are encouraged! + + +## 🧭 Introduction + +As of **Conan 2.18**, the `emcc` compiler (from +[Emscripten](https://emscripten.org/docs/)) is natively supported. This allows +accurate modeling of the compiler’s built-in features. + +The current `emcc` compiler model includes the following settings: + +``` +emcc: + version: [ANY] + libcxx: [null, libstdc++, libstdc++11, libc++] + threads: [null, posix, wasm_workers] + cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23, 26, gnu26] + cstd: [null, 99, gnu99, 11, gnu11, 17, gnu17, 23, gnu23] +``` + +> ℹ️ Note: `emcc` is a front-end for the `clang` compiler, so it shares many of the same settings and options. + +However, there are a few **important caveats** to consider when using Emscripten with Conan. + + +## ⚠️ Caveats + +### πŸ”„ ABI Incompatibility + +There is **no ABI compatibility guarantee** between different `emcc` versions. +Refer to the [Emscripten Changelog](https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md) for details. + +In Conan v2, the `compiler.version` setting mostly acts as **syntactic sugar**. While it doesn't influence compilation directly, it: + +- Enables Conan to apply version-specific flags, compile and link flags. +- Ensures distinct **package IDs** for different compiler versions. + +To prevent ABI issues, make sure your **Conan profile's `compiler.version`** +matches the **actual `emsdk` version** used. This ensures consistent builds and +automatic recompilation when updating `emsdk`. + + + +### 🧡 Multithreading + +The `emcc` compiler can produce incompatible binaries depending on whether threading is enabled. + +Refer to the Emscripten documentation on [pthreads](https://emscripten.org/docs/porting/pthreads.html#compiling-with-pthreads-enabled) +and [wasm workers](https://emscripten.org/docs/api_reference/wasm_workers.html). + +Emscripten supports two threading models: + +- **POSIX Threads (Pthreads)** +- **Wasm Workers** + +These are **mutually incompatible**, and this distinction must be reflected in the Conan profile to avoid mixing binaries. + +Enable threading in your profile by setting: + +```ini +compiler.threads=posix # For Pthreads +compiler.threads=wasm_workers # For Wasm Workers +``` + +Conan will automatically inject the necessary linker flags. + +### πŸ“‚ Profile Overview + +This repository includes the following profiles: +- `wasm32`: WebAssembly 32-bit target (default). +- `wasm64`: Experimental 64-bit WebAssembly target (for projects needing >4β€―GB dynamic memory). +- `local`: Use your locally installed emsdk instead of the Conan-managed one. + +πŸ› οΈ For the local profile: +- Ensure `emcc`, `em++`, `emar`, etc. are available in your `PATH`. +- Check the `[buildenv]` section in the profile. +- Optionally, provide your own `Emscripten.cmake` via the `user_toolchains` setting. +- Define the arch setting: `wasm`, `wasm64`, or the mostly deprecated `asm.js`. + + +### ▢️ Usage + +After installing the profiles (TBD), you can build your project like this: + +``` +$ conan build -pr emsdk/wasm32 +``` + +### 🧠 Dynamic Memory Allocation + +By default, WebAssembly does not allow dynamic memory growth. To enable it, you must set the following linker flag: + +`-s ALLOW_MEMORY_GROWTH=1` + +Our base profiles enable this flag by default to simplify usage. + +If you want to disable memory growth, simply remove or comment out the relevant line in the profile. + +πŸ”Ž The Conan docs explain the dynamic memory limits for each architecture. +These are also preconfigured in the `wasm32` and `wasm64` profiles and can be +customized as needed, including the `INITIAL_MEMORY` setting. + + +### πŸ™Œ Contribute + +Feel free to open issues or pull requests in the `conan-toolchains` repository. +Contributions to extend or improve these profiles are welcome! diff --git a/conan_config/profiles/emsdk/native b/conan_config/profiles/emsdk/local similarity index 85% rename from conan_config/profiles/emsdk/native rename to conan_config/profiles/emsdk/local index 3a57246..eae26ea 100644 --- a/conan_config/profiles/emsdk/native +++ b/conan_config/profiles/emsdk/local @@ -1,9 +1,10 @@ +include(./.base) [platform_tool_requires] emsdk/4.0.10 [conf] tools.build:compiler_executables={'c':'emcc', 'cpp':'em++'} -# Add native Emscripten toolchain +# Add local Emscripten toolchain # tools.cmake.cmaketoolchain:user_toolchain=["/path/to/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"] [buildenv] diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index cedd2cc..a7e96bc 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -134,12 +134,5 @@ def package_info(self): self.buildenv_info.define_path("RANLIB", self._define_tool_var("emranlib")) self.buildenv_info.define_path("STRIP", self._define_tool_var("emstrip")) - self.cpp_info.builddirs = [ - os.path.join("bin", "releases", "src"), - os.path.join("bin", "upstream", "emscripten", "cmake", "Modules"), - os.path.join("bin", "upstream", "emscripten", "cmake", "Modules", "Platform"), - os.path.join("bin", "upstream", "emscripten", "system", "lib", "libunwind", "cmake", "Modules"), - os.path.join("bin", "upstream", "emscripten", "system", "lib", "libunwind", "cmake"), - os.path.join("bin", "upstream", "emscripten", "tests", "cmake", "target_library"), - os.path.join("bin", "upstream", "lib", "cmake", "llvm"), - ] + # Some useful config files: FindOpenGL.cmake, FindOpenAL.cmake, etc + self.cpp_info.builddirs = [os.path.join("bin", "upstream", "emscripten", "cmake", "Modules")] From 9ec67da0e473d58d803fdf2f97bb1b6aef87d271 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Thu, 3 Jul 2025 10:07:18 +0200 Subject: [PATCH 24/35] Removed unneded builddirs environment as already included by Emscripten.cmake --- recipes/emsdk/all/conanfile.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index a7e96bc..d5f5119 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -133,6 +133,3 @@ def package_info(self): self.buildenv_info.define_path("NM", self._define_tool_var("emnm")) self.buildenv_info.define_path("RANLIB", self._define_tool_var("emranlib")) self.buildenv_info.define_path("STRIP", self._define_tool_var("emstrip")) - - # Some useful config files: FindOpenGL.cmake, FindOpenAL.cmake, etc - self.cpp_info.builddirs = [os.path.join("bin", "upstream", "emscripten", "cmake", "Modules")] From 073931ef7d73903a68e207e904e6a2b7e4468c86 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Thu, 3 Jul 2025 10:38:06 +0200 Subject: [PATCH 25/35] Removed auto install conf in profile --- .github/scripts/.ci_base_profile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/scripts/.ci_base_profile b/.github/scripts/.ci_base_profile index e43e60a..a303234 100644 --- a/.github/scripts/.ci_base_profile +++ b/.github/scripts/.ci_base_profile @@ -6,7 +6,3 @@ tools.build.cross_building:can_run=True # Verbosity tools.build:verbosity=verbose tools.compilation:verbosity=verbose - -# Package Manager Configuration -*/system:tools.system.package_manager:mode=install -*/system:tools.system.package_manager:sudo=True From 64ef64ce66967d7f947cf7407993ed78ed891897 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Fri, 4 Jul 2025 13:01:10 +0200 Subject: [PATCH 26/35] Restored original test_package and created test_example --- .github/scripts/.ci_base_profile | 2 -- .github/scripts/build_recipes.py | 23 +++++++++++---- .github/scripts/profiles.json | 9 ++++++ conan_config/profiles/emsdk/.base | 1 + conan_config/profiles/emsdk/.emsdk_base | 4 --- conan_config/profiles/emsdk/README.md | 14 ++++++++-- conan_config/profiles/emsdk/local | 1 + conan_config/profiles/emsdk/wasm32 | 2 +- conan_config/profiles/emsdk/wasm64 | 4 ++- recipes/emsdk/all/.ci_profile | 4 --- recipes/emsdk/all/test_example/CMakeLists.txt | 4 +++ recipes/emsdk/all/test_example/conanfile.py | 28 +++++++++++++++++++ .../main.cpp} | 0 recipes/emsdk/all/test_package/CMakeLists.txt | 4 --- recipes/emsdk/all/test_package/conanfile.py | 28 +++++-------------- 15 files changed, 83 insertions(+), 45 deletions(-) create mode 100644 .github/scripts/profiles.json delete mode 100644 conan_config/profiles/emsdk/.emsdk_base delete mode 100644 recipes/emsdk/all/.ci_profile create mode 100644 recipes/emsdk/all/test_example/CMakeLists.txt create mode 100644 recipes/emsdk/all/test_example/conanfile.py rename recipes/emsdk/all/{test_package/test_package.cpp => test_example/main.cpp} (100%) delete mode 100644 recipes/emsdk/all/test_package/CMakeLists.txt diff --git a/.github/scripts/.ci_base_profile b/.github/scripts/.ci_base_profile index a303234..e9d1d47 100644 --- a/.github/scripts/.ci_base_profile +++ b/.github/scripts/.ci_base_profile @@ -1,8 +1,6 @@ include(default) [conf] -tools.build.cross_building:can_run=True - # Verbosity tools.build:verbosity=verbose tools.compilation:verbosity=verbose diff --git a/.github/scripts/build_recipes.py b/.github/scripts/build_recipes.py index 377b43d..7ad10f4 100644 --- a/.github/scripts/build_recipes.py +++ b/.github/scripts/build_recipes.py @@ -6,6 +6,8 @@ import yaml from collections import defaultdict +BASE_PATH = Path(__file__).parent + def get_updated_recipes(): updated_paths = os.getenv("BUILD_RECIPES", "").split(" ") @@ -47,19 +49,28 @@ def load_versions(recipe_dir: Path) -> dict: version, "--build", "missing", - "--build-test", - f"{recipe_name}/*", - "--build-require", - "-pr:h", - str(recipe_path / ".ci_profile"), "-pr:a", - str(Path(__file__).parent / ".ci_base_profile"), + str(BASE_PATH / ".ci_base_profile"), ] + with open(BASE_PATH / "profiles.json", "r") as f: + profile_list = json.load(f).get(recipe_name) + print(f"::group::{recipe_name}/{version}", flush=True) try: print("executing:", " ".join(cmd), flush=True) subprocess.run(cmd, check=True) + for profile in profile_list.get("profiles", []): + example_cmd = [ + "conan", + "test", + str(recipe_path / "test_example"), + f"{recipe_name}/{version}", + "--profile", + profile, + ] + print("executing:", " ".join(example_cmd), flush=True) + subprocess.run(example_cmd, check=True) finally: print("::endgroup::", flush=True) diff --git a/.github/scripts/profiles.json b/.github/scripts/profiles.json new file mode 100644 index 0000000..d7df156 --- /dev/null +++ b/.github/scripts/profiles.json @@ -0,0 +1,9 @@ +{ + "emsdk": { + "4.0.10": { + "profiles": [ + "emsdk/wasm32" + ] + } + } +} diff --git a/conan_config/profiles/emsdk/.base b/conan_config/profiles/emsdk/.base index 5ec9bcf..946eeee 100644 --- a/conan_config/profiles/emsdk/.base +++ b/conan_config/profiles/emsdk/.base @@ -10,6 +10,7 @@ os=Emscripten [tool_requires] ninja/[*] +emsdk/4.0.10 [conf] tools.build:exelinkflags+=['-sALLOW_MEMORY_GROWTH=1'] diff --git a/conan_config/profiles/emsdk/.emsdk_base b/conan_config/profiles/emsdk/.emsdk_base deleted file mode 100644 index 2c08254..0000000 --- a/conan_config/profiles/emsdk/.emsdk_base +++ /dev/null @@ -1,4 +0,0 @@ -include(./.base) - -[tool_requires] -emsdk/4.0.10 diff --git a/conan_config/profiles/emsdk/README.md b/conan_config/profiles/emsdk/README.md index 0a06f54..517da6d 100644 --- a/conan_config/profiles/emsdk/README.md +++ b/conan_config/profiles/emsdk/README.md @@ -73,13 +73,23 @@ compiler.threads=wasm_workers # For Wasm Workers Conan will automatically inject the necessary linker flags. -### πŸ“‚ Profile Overview +## πŸ“‚ Profile Overview This repository includes the following profiles: - `wasm32`: WebAssembly 32-bit target (default). - `wasm64`: Experimental 64-bit WebAssembly target (for projects needing >4β€―GB dynamic memory). - `local`: Use your locally installed emsdk instead of the Conan-managed one. + +⚠️ WASM64 caveats: + +The latest node version `emsdk/4.0.10` installs is the `node/22.16.0`, which can not run directly wasm64 binaries. +Also, it is not valid to compile wasm64 with `-sMIN_NODE_VERSION=221600`, see following error: +``` +em++: warning: MIN_NODE_VERSION=221600 is not compatible with MEMORY64 (230000 or above required) [-Wcompatibility] +``` +Thus, to be able to run an `wasm64` binary you will need to download at least `node/23` manually in your system. + πŸ› οΈ For the local profile: - Ensure `emcc`, `em++`, `emar`, etc. are available in your `PATH`. - Check the `[buildenv]` section in the profile. @@ -87,7 +97,7 @@ This repository includes the following profiles: - Define the arch setting: `wasm`, `wasm64`, or the mostly deprecated `asm.js`. -### ▢️ Usage +## ▢️ Usage After installing the profiles (TBD), you can build your project like this: diff --git a/conan_config/profiles/emsdk/local b/conan_config/profiles/emsdk/local index eae26ea..99b6580 100644 --- a/conan_config/profiles/emsdk/local +++ b/conan_config/profiles/emsdk/local @@ -1,4 +1,5 @@ include(./.base) + [platform_tool_requires] emsdk/4.0.10 diff --git a/conan_config/profiles/emsdk/wasm32 b/conan_config/profiles/emsdk/wasm32 index 5d6063f..be675ee 100644 --- a/conan_config/profiles/emsdk/wasm32 +++ b/conan_config/profiles/emsdk/wasm32 @@ -1,4 +1,4 @@ -include(./.emsdk_base) +include(./.base) [settings] arch=wasm diff --git a/conan_config/profiles/emsdk/wasm64 b/conan_config/profiles/emsdk/wasm64 index b4b1178..20f2909 100644 --- a/conan_config/profiles/emsdk/wasm64 +++ b/conan_config/profiles/emsdk/wasm64 @@ -1,4 +1,4 @@ -include(./.emsdk_base) +include(./.base) [settings] arch=wasm64 @@ -8,3 +8,5 @@ arch=wasm64 # wasm64 for now needs to declare INITIAL_MEMORY as the maximum memory tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=16GB', '-sINITIAL_MEMORY=16GB', '-sASSERTIONS'] tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=16GB', '-sINITIAL_MEMORY=16GB', '-sASSERTIONS'] + +# Node version from emsdk/4.0.10 can not run a wasm64 binary. See more details in README diff --git a/recipes/emsdk/all/.ci_profile b/recipes/emsdk/all/.ci_profile deleted file mode 100644 index 1687a38..0000000 --- a/recipes/emsdk/all/.ci_profile +++ /dev/null @@ -1,4 +0,0 @@ -include(emsdk/.base) - -[settings] -arch=wasm diff --git a/recipes/emsdk/all/test_example/CMakeLists.txt b/recipes/emsdk/all/test_example/CMakeLists.txt new file mode 100644 index 0000000..adff224 --- /dev/null +++ b/recipes/emsdk/all/test_example/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.15) +project(test_example CXX) + +add_executable(test_example main.cpp) diff --git a/recipes/emsdk/all/test_example/conanfile.py b/recipes/emsdk/all/test_example/conanfile.py new file mode 100644 index 0000000..c00605e --- /dev/null +++ b/recipes/emsdk/all/test_example/conanfile.py @@ -0,0 +1,28 @@ +import os +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps + + +class EmsdkExampleRecipe(ConanFile): + name = "emsdk-example" + version = "1.0" + package_type = "application" + settings = "os", "compiler", "build_type", "arch" + + def layout(self): + cmake_layout(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_example") + self.run(f"node {bin_path}", env="conanbuild") diff --git a/recipes/emsdk/all/test_package/test_package.cpp b/recipes/emsdk/all/test_example/main.cpp similarity index 100% rename from recipes/emsdk/all/test_package/test_package.cpp rename to recipes/emsdk/all/test_example/main.cpp diff --git a/recipes/emsdk/all/test_package/CMakeLists.txt b/recipes/emsdk/all/test_package/CMakeLists.txt deleted file mode 100644 index 26682be..0000000 --- a/recipes/emsdk/all/test_package/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package CXX) - -add_executable(test_package test_package.cpp) diff --git a/recipes/emsdk/all/test_package/conanfile.py b/recipes/emsdk/all/test_package/conanfile.py index b1a4813..a0948be 100644 --- a/recipes/emsdk/all/test_package/conanfile.py +++ b/recipes/emsdk/all/test_package/conanfile.py @@ -1,30 +1,16 @@ from conan import ConanFile -from conan.tools.cmake import CMake, cmake_layout -import os +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeToolchain", "VirtualBuildEnv" - def build_requirements(self): - self.tool_requires(self.tested_reference_str) - - def layout(self): - cmake_layout(self) - - def build(self): - if self.settings.os == "Emscripten": - cmake = CMake(self) - cmake.configure() - cmake.build() + def requirements(self): + self.requires(self.tested_reference_str) def test(self): # Check the package provides working binaries - self.run("emcc -v") - self.run("em++ -v") - self.run("node -v") - - if self.settings.os == "Emscripten": - test_file = os.path.join(self.cpp.build.bindirs[0], "test_package.js") - self.run(f"node {test_file}") + if can_run(self): + self.run("emcc -v", env="conanrun") + self.run("em++ -v", env="conanrun") + self.run("node -v", env="conanrun") From b1fe0cb1627bd4fe78b724eb74023888f8e137d7 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Fri, 4 Jul 2025 14:02:49 +0200 Subject: [PATCH 27/35] Fix ci --- .github/scripts/build_recipes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/build_recipes.py b/.github/scripts/build_recipes.py index 7ad10f4..efd89c5 100644 --- a/.github/scripts/build_recipes.py +++ b/.github/scripts/build_recipes.py @@ -61,7 +61,7 @@ def load_versions(recipe_dir: Path) -> dict: try: print("executing:", " ".join(cmd), flush=True) subprocess.run(cmd, check=True) - for profile in profile_list.get("profiles", []): + for profile in profile_list.get(version, {}).get("profiles", []): example_cmd = [ "conan", "test", From 6e335fb29a9be218bf2d8f8e9fd038f4488410f7 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Fri, 4 Jul 2025 14:20:01 +0200 Subject: [PATCH 28/35] Testing publish profiles workflow --- .github/workflows/profiles.yml | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/profiles.yml diff --git a/.github/workflows/profiles.yml b/.github/workflows/profiles.yml new file mode 100644 index 0000000..857d712 --- /dev/null +++ b/.github/workflows/profiles.yml @@ -0,0 +1,44 @@ +name: Package and publish profile releases + +on: + push: + pull_request: + branches: + - main + workflow_dispatch: + inputs: + recipe: + description: 'Recipe name to publish profiles for' + required: true + version: + description: 'Profiles version to publish' + required: true + +jobs: + create: + name: Create a profile release + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Set variables + id: vars + run: | + echo "RECIPE=${{ github.event.inputs.recipe }}" >> $GITHUB_ENV + echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV + echo "ZIP_NAME=toolchain-profiles-${{ github.event.inputs.recipe }}-${{ github.event.inputs.version }}.zip" >> $GITHUB_ENV + + - name: Zip profile folder + run: | + mkdir -p dist + zip -r "dist/$ZIP_NAME" "conan_config/profiles/$RECIPE" + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ env.ZIP_NAME }} + name: ${{ env.ZIP_NAME }} + files: dist/${{ env.ZIP_NAME }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From cbc1e53bcda3de003af619e47843c19bb01a6846 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Fri, 4 Jul 2025 14:21:18 +0200 Subject: [PATCH 29/35] WIP --- .github/workflows/profiles.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/profiles.yml b/.github/workflows/profiles.yml index 857d712..7f8219f 100644 --- a/.github/workflows/profiles.yml +++ b/.github/workflows/profiles.yml @@ -18,6 +18,7 @@ jobs: create: name: Create a profile release runs-on: ubuntu-latest + if: ${{ github.event_name == 'workflow_dispatch' }} # only run on manual trigger steps: - name: Checkout sources uses: actions/checkout@v4 From a5ed161f3569a9f017e27c9a0fb6dd47dccd4d27 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Fri, 4 Jul 2025 14:25:46 +0200 Subject: [PATCH 30/35] WIP --- .github/workflows/profiles.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/profiles.yml b/.github/workflows/profiles.yml index 7f8219f..0d82815 100644 --- a/.github/workflows/profiles.yml +++ b/.github/workflows/profiles.yml @@ -1,10 +1,6 @@ name: Package and publish profile releases on: - push: - pull_request: - branches: - - main workflow_dispatch: inputs: recipe: @@ -18,7 +14,6 @@ jobs: create: name: Create a profile release runs-on: ubuntu-latest - if: ${{ github.event_name == 'workflow_dispatch' }} # only run on manual trigger steps: - name: Checkout sources uses: actions/checkout@v4 From c6aae81c0baf5dc1cd04822254db6d43a3799628 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Fri, 4 Jul 2025 14:45:30 +0200 Subject: [PATCH 31/35] Publish profiles --- .github/workflows/profiles.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/profiles.yml b/.github/workflows/profiles.yml index 0d82815..e84b3b2 100644 --- a/.github/workflows/profiles.yml +++ b/.github/workflows/profiles.yml @@ -1,13 +1,13 @@ -name: Package and publish profile releases +name: Manually publish profile releases on: workflow_dispatch: inputs: recipe: - description: 'Recipe name to publish profiles for' + description: 'Recipe to publish profiles for' required: true version: - description: 'Profiles version to publish' + description: 'Version of the packaged profiles' required: true jobs: @@ -28,7 +28,8 @@ jobs: - name: Zip profile folder run: | mkdir -p dist - zip -r "dist/$ZIP_NAME" "conan_config/profiles/$RECIPE" + cd conan_config + zip -r "dist/$ZIP_NAME" "profiles/$RECIPE" - name: Create GitHub release uses: softprops/action-gh-release@v2 From dfe8b476a0c7d9998d60ec370185999326cdff10 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Fri, 4 Jul 2025 14:48:32 +0200 Subject: [PATCH 32/35] Publish profiles --- .github/workflows/profiles.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/profiles.yml b/.github/workflows/profiles.yml index e84b3b2..75ceef6 100644 --- a/.github/workflows/profiles.yml +++ b/.github/workflows/profiles.yml @@ -27,8 +27,8 @@ jobs: - name: Zip profile folder run: | - mkdir -p dist cd conan_config + mkdir -p dist zip -r "dist/$ZIP_NAME" "profiles/$RECIPE" - name: Create GitHub release From 8dc22f52b8f3b47656b0ca6796d2cacf45a028be Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Fri, 4 Jul 2025 14:53:07 +0200 Subject: [PATCH 33/35] Publish profiles --- .github/workflows/profiles.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/profiles.yml b/.github/workflows/profiles.yml index 75ceef6..ebd645f 100644 --- a/.github/workflows/profiles.yml +++ b/.github/workflows/profiles.yml @@ -27,9 +27,9 @@ jobs: - name: Zip profile folder run: | - cd conan_config mkdir -p dist - zip -r "dist/$ZIP_NAME" "profiles/$RECIPE" + cd conan_config + zip -r "../dist/$ZIP_NAME" "profiles/$RECIPE" - name: Create GitHub release uses: softprops/action-gh-release@v2 From 92be15d2f312209ff58b5c2074bdf87e7d5a75e9 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Fri, 4 Jul 2025 14:53:41 +0200 Subject: [PATCH 34/35] Publish profiles --- .github/workflows/profiles.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/profiles.yml b/.github/workflows/profiles.yml index ebd645f..4821eb5 100644 --- a/.github/workflows/profiles.yml +++ b/.github/workflows/profiles.yml @@ -23,7 +23,7 @@ jobs: run: | echo "RECIPE=${{ github.event.inputs.recipe }}" >> $GITHUB_ENV echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV - echo "ZIP_NAME=toolchain-profiles-${{ github.event.inputs.recipe }}-${{ github.event.inputs.version }}.zip" >> $GITHUB_ENV + echo "ZIP_NAME=${{ github.event.inputs.recipe }}-${{ github.event.inputs.version }}-profiles.zip" >> $GITHUB_ENV - name: Zip profile folder run: | From 516d06505996f59461796766e3ebe70c8eaa1167 Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Tue, 8 Jul 2025 12:00:53 +0200 Subject: [PATCH 35/35] Removed support for multi versions in CI --- .github/scripts/build_recipes.py | 2 +- .github/scripts/profiles.json | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/scripts/build_recipes.py b/.github/scripts/build_recipes.py index efd89c5..7ad10f4 100644 --- a/.github/scripts/build_recipes.py +++ b/.github/scripts/build_recipes.py @@ -61,7 +61,7 @@ def load_versions(recipe_dir: Path) -> dict: try: print("executing:", " ".join(cmd), flush=True) subprocess.run(cmd, check=True) - for profile in profile_list.get(version, {}).get("profiles", []): + for profile in profile_list.get("profiles", []): example_cmd = [ "conan", "test", diff --git a/.github/scripts/profiles.json b/.github/scripts/profiles.json index d7df156..09498fd 100644 --- a/.github/scripts/profiles.json +++ b/.github/scripts/profiles.json @@ -1,9 +1,5 @@ { "emsdk": { - "4.0.10": { - "profiles": [ - "emsdk/wasm32" - ] - } + "profiles": ["emsdk/wasm32"] } }