-
Notifications
You must be signed in to change notification settings - Fork 4
emsdk: new recipe #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 22 commits
695ba52
ac1c0d2
8f27571
12820bd
1768ae6
8bfa242
240b479
e01773a
4c44611
e62adda
334f376
48823f6
06b9bd6
43ab52f
ecb363a
fa69614
d08d241
44f11d9
c080b28
81f7789
6ff3792
c5746ce
3c475c9
9736f29
9ec67da
073931e
64ef64c
b1fe0cb
6e335fb
cbc1e53
a5ed161
c6aae81
dfe8b47
8dc22f5
92be15d
516d065
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| include(default) | ||
|
|
||
| [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 | ||
perseoGI marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/usr/bin/env python3 | ||
| import os | ||
| import json | ||
| from pathlib import Path | ||
| import subprocess | ||
| import yaml | ||
| from collections import defaultdict | ||
|
|
||
|
|
||
| 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: 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_name in get_updated_recipes(): | ||
| recipe_dir = Path("recipes") / recipe_name | ||
| versions = load_versions(recipe_dir) | ||
|
|
||
| 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", | ||
| str(recipe_path), | ||
| "--version", | ||
| version, | ||
| "--build", | ||
| "missing", | ||
| "--build-test", | ||
| f"{recipe_name}/*", | ||
| "--build-require", | ||
perseoGI marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "-pr:h", | ||
| str(recipe_path / ".ci_profile"), | ||
| "-pr:a", | ||
| str(Path(__file__).parent / ".ci_base_profile"), | ||
| ] | ||
|
|
||
| print(f"::group::{recipe_name}/{version}", flush=True) | ||
|
|
||
| try: | ||
| print("executing:", " ".join(cmd), flush=True) | ||
| subprocess.run(cmd, check=True) | ||
| finally: | ||
| print("::endgroup::", flush=True) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Test all recipes | ||
|
|
||
| on: | ||
| push: | ||
| 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 requirements | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
|
|
||
| - 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: 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 | ||
| python .github/scripts/build_recipes.py |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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,10 +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. | ||
|
|
||
| --- | ||
| ## 🧰 Built-in Profiles | ||
perseoGI marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This repository includes several **pre-configured Conan profiles** designed to make toolchain setup effortless: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each "toolchain" should have a readme with tailored instructions - as I would expect this grow in the future. we may consider having the profile .zip files as releases - so that a user can do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this line, another approach would be to have the profiles in a specific folder, under the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is another good approach, right now, what I've done in the CI is the ability to publish recipe specific profiles manually with a github action, check out my fork releases: https://github.com/perseoGI/conan-toolchains/releases This can be installed with: $ conan config install https://github.com/perseoGI/conan-toolchains/releases/download/emsdk-4.0.10-profiles.zip/emsdk-4.0.10-profiles.zipAllowing profile isolation with different recipes, and also, keeping a profile versioning. Do you like this approach? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seem a bit overkill to me, in terms of extra effort to publish and release the profiles, version them, etc. |
||
|
|
||
| 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 `<toolchain_name>/<profile>`. | ||
| Profiles starting with dot (`.`) are considered *base* which are used for other profiles and should not be used directly. | ||
|
|
||
| ## 🚀 Getting started | ||
|
|
||
| ## 🚀 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 | ||
|
|
||
|
|
@@ -38,21 +52,14 @@ 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 required development dependencies. | ||
| 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: | ||
|
|
||
| ``` | ||
| git clone [email protected]:conan-io/conan-toolchains.git | ||
| cd conan-toolchains | ||
| # Recommended: Setup your virtual environment before installing dependencies | ||
| # Setup your virtual environment before installing dependencies | ||
| pip install pre-commit | ||
| ``` | ||
|
|
||
| We use [pre-commit](https://pre-commit.com/) to enforce code style and formatting. To | ||
| activate the pre-commit hooks: | ||
|
|
||
| ``` | ||
| pre-commit install | ||
| ``` | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Note: To use a local emsdk installation use -pr:h <wasm32/wasm64/asmjs> -pr:h native | ||
perseoGI marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| [settings] | ||
| build_type=Release | ||
| compiler=emcc | ||
| compiler.cppstd=17 | ||
| compiler.libcxx=libc++ | ||
| # Choose between both types of multithreading support (or none) | ||
| # compiler.threads=<posix|wasm_workers> | ||
| 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 avoid Windows issues | ||
| tools.cmake.cmaketoolchain:generator=Ninja | ||
|
||
|
|
||
| # Distinguish between architectures | ||
| tools.cmake.cmake_layout:build_folder_vars=['settings.build_type', 'settings.arch'] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| include(./.base) | ||
|
||
|
|
||
| [tool_requires] | ||
| emsdk/[*] | ||
perseoGI marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| include(./.emsdk_base) | ||
perseoGI marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| [settings] | ||
| arch=asm.js | ||
|
|
||
| [conf] | ||
| tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=2GB', '-sINITIAL_MEMORY=64MB'] | ||
| tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=2GB', '-sINITIAL_MEMORY=64MB'] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [platform_tool_requires] | ||
| emsdk/4.0.10 | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name "native" can be confusing because "native" usually means the "local cpu architecture". This profile seems to assume that all these tools are discoverable in Is there a case for adding a PATH in the once again ,a README for this profiles may clarify these questions |
||
| [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 | ||
| CXX=em++ | ||
| AR=emar | ||
| NM=emnm | ||
| RANLIB=emranlib | ||
| STRIP=emstrip | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| include(./.emsdk_base) | ||
|
|
||
| [settings] | ||
| arch=wasm | ||
|
|
||
| [conf] | ||
| tools.build:exelinkflags+=['-sMAXIMUM_MEMORY=4GB', '-sINITIAL_MEMORY=64MB'] | ||
| tools.build:sharedlinkflags+=['-sMAXIMUM_MEMORY=4GB', '-sINITIAL_MEMORY=64MB'] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| include(./.emsdk_base) | ||
|
|
||
| [settings] | ||
| arch=wasm64 | ||
|
|
||
| [conf] | ||
| # In this early stage of wasm64, ALLOW_MEMORY_GROWTH is not having effect. Also it may not be the most efficient solution. | ||
perseoGI marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # 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'] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| include(emsdk/.base) | ||
|
|
||
| [settings] | ||
| arch=wasm |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| sources: | ||
| "4.0.10": | ||
| url: "https://github.com/emscripten-core/emsdk/archive/4.0.10.tar.gz" | ||
| sha256: "2497b55ddbba9bf9be2d18cfca3e973d40a0cfaa8d18f6caacb882a65b2faf1c" |
Uh oh!
There was an error while loading. Please reload this page.