Skip to content

emsdk: recipe maintenance and latest version #27213

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions recipes/emsdk/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sources:
"4.0.9":
url: "https://github.com/emscripten-core/emsdk/archive/4.0.9.tar.gz"
sha256: "a5507307854f2b0997d278589f1cd82f949358f5dbde42fadc348f128a4f4c02"
"4.0.10":
url: "https://github.com/emscripten-core/emsdk/archive/4.0.10.tar.gz"
sha256: "2497b55ddbba9bf9be2d18cfca3e973d40a0cfaa8d18f6caacb882a65b2faf1c"
"4.0.6":
url: "https://github.com/emscripten-core/emsdk/archive/4.0.6.tar.gz"
sha256: "2d3292d508b4f5477f490b080b38a34aaefed43e85258a1de72cb8dde3f8f3af"
Expand All @@ -11,9 +11,3 @@ sources:
"3.1.50":
url: "https://github.com/emscripten-core/emsdk/archive/3.1.50.tar.gz"
sha256: "7491a881eb5ee15fe81bbabcfff1fd571e45ccdb24a81890af429f9970cbd1f3"
"3.0.1":
url: "https://github.com/emscripten-core/emsdk/archive/3.0.1.tar.gz"
sha256: "3a51e17d45878a5c6d1b6c20f35d308b95d58d56dbfbee4ec058e2ee216b2c90"
"2.0.34":
url: "https://github.com/emscripten-core/emsdk/archive/2.0.34.tar.gz"
sha256: "a96ddf34de8de779c78be2785df04ae63c9a557da9e83e85332cda3d01bca250"
17 changes: 10 additions & 7 deletions recipes/emsdk/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from conan import ConanFile
from conan.tools.build import cross_building
from conan.tools.env import Environment
from conan.tools.env import Environment, VirtualBuildEnv
from conan.tools.files import chdir, copy, get, replace_in_file
from conan.tools.layout import basic_layout
from pathlib import Path
Expand All @@ -17,14 +17,10 @@ class EmSDKConan(ConanFile):
homepage = "https://github.com/kripken/emscripten"
topics = ("emsdk", "emscripten", "sdk")
license = "MIT"
package_type = "application"
settings = "os", "arch", "compiler", "build_type"

short_paths = True

@property
def _settings_build(self):
return getattr(self, "settings_build", self.settings)

def layout(self):
basic_layout(self, src_folder="src")

Expand Down Expand Up @@ -76,6 +72,13 @@ def generate(self):
env.define_path("EM_CACHE", self._em_cache)
env.vars(self, scope="emsdk").save_script("emsdk_env_file")

if cross_building(self):
env = VirtualBuildEnv(self)
# If cross-compiling, we need to set EMSDK_ARCH
# This is important for the emsdk install command
env.environment().define("EMSDK_ARCH", str(self.settings.arch))
env.generate()

def _tools_for_version(self):
ret = {}
# Select release-upstream from version (wasm-binaries)
Expand All @@ -95,7 +98,7 @@ def _tools_for_version(self):

def build(self):
with chdir(self, self.source_folder):
emsdk = "emsdk.bat" if self._settings_build.os == "Windows" else "./emsdk"
emsdk = "emsdk.bat" if self.settings_build.os == "Windows" else "./emsdk"
# Install required tools
required_tools = self._tools_for_version()
for value in required_tools.values():
Expand Down
20 changes: 11 additions & 9 deletions recipes/emsdk/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.env import Environment
from conan.tools.cmake import CMake, cmake_layout
import os
Expand All @@ -9,8 +10,8 @@ class TestPackageConan(ConanFile):
generators = "CMakeToolchain", "VirtualBuildEnv"
test_type = "explicit"

def build_requirements(self):
self.tool_requires(self.tested_reference_str)
def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)
Expand All @@ -31,10 +32,11 @@ def build(self):

def test(self):
# Check the package provides working binaries
self.run("emcc -v")
self.run("em++ -v")

# Run the project that was built using emsdk
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")
self.run("em++ -v")

# Run the project that was built using emsdk
if self.settings.os == "Emscripten":
test_file = os.path.join(self.cpp.build.bindirs[0], "test_package.js")
self.run(f"node {test_file}")
6 changes: 1 addition & 5 deletions recipes/emsdk/config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
versions:
"4.0.9":
"4.0.10":
folder: all
"4.0.6":
folder: all
"3.1.73":
folder: all
"3.1.50":
folder: all
"3.0.1":
folder: all
"2.0.34":
folder: all