Skip to content
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

Initial support for wasmtime package #6083

Merged
merged 25 commits into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
455e9a4
Initial support for wasmtime package
redradist Jun 29, 2021
15736c9
Fixed build package on Linux
redradist Jul 3, 2021
30ad84c
Updates according the comments in review #0
redradist Jul 4, 2021
638e944
Merge branch 'add-wasmtime' of github.com:redradist/conan-center-inde…
redradist Jul 4, 2021
326e85d
Update recipes/wasmtime/all/conanfile.py
redradist Jul 4, 2021
43445ea
Updates according the comments in review #1
redradist Jul 4, 2021
2746861
Merge branch 'add-wasmtime' of github.com:redradist/conan-center-inde…
redradist Jul 4, 2021
45b7d00
Updates according the comments in review #2
redradist Jul 4, 2021
7aa47ca
Updates according the comments in review #3
redradist Jul 5, 2021
dddb52d
Updates according the comments in review #4
redradist Jul 10, 2021
fe85d9e
Updates according the comments in review #5
redradist Jul 10, 2021
c3a4642
Next iteration of fixes
redradist Jul 25, 2021
6304223
Fixed cmake variable C_STANDARD -> CMAKE_C_STANDARD
redradist Jul 28, 2021
c75ea1a
Added check on minimal version of conan
redradist Jul 28, 2021
2e49fa7
Used copytree instead of copy individual files
redradist Aug 2, 2021
8af9461
Fixed the build
redradist Aug 14, 2021
7b0b19c
Added checking for architechure in validate(...)
redradist Aug 14, 2021
728690c
Updated receipt for new comments from @madebr
redradist Aug 14, 2021
59f9c9f
Fixed calling method tools.cross_building(...)
redradist Aug 14, 2021
dca562b
Update def package(self) according the comments in review
redradist Aug 22, 2021
7eeed40
Updated versions of wasmtime
redradist Aug 30, 2021
c1fa065
Updated forgot version ugrade
redradist Aug 30, 2021
20d43a9
Fixed sha256sum for macos
redradist Aug 30, 2021
ed7f493
Fixed SHA256 for Linux
redradist Aug 30, 2021
3012cca
Updated all SHA256 to proer values
redradist Aug 30, 2021
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
4 changes: 4 additions & 0 deletions recipes/wasmtime/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ sources:
"x86_64":
url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.28.0/wasmtime-v0.28.0-x86_64-windows-c-api.zip"
sha256: "9bc1c2dad2a281efb3b4c577c12b02f15b80e1c95e9f7cf1512895b469ca3ce4"
MinGW:
"x86_64":
url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.28.0/wasmtime-v0.28.0-x86_64-mingw-c-api.zip"
sha256: "477719cf2de83121c3f3b05b9fbe6eca322ba56b9508e86322ecf73ed8085479"
Linux:
"x86_64":
url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.28.0/wasmtime-v0.28.0-x86_64-linux-c-api.tar.xz"
Expand Down
62 changes: 32 additions & 30 deletions recipes/wasmtime/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration, ConanException
import os
import shutil

required_conan_version = ">=1.33.0"

class WasmtimeConan(ConanFile):
name = 'wasmtime'
Expand All @@ -11,20 +13,10 @@ class WasmtimeConan(ConanFile):
description = "Standalone JIT-style runtime for WebAssembly, using Cranelift"
topics = ("webassembly", "wasm", "wasi")
settings = "os", "compiler", "arch"
options = {
"shared": [True, False],
'fPIC': [True],
}
default_options = {
'shared': False,
'fPIC': True,
}
options = { "shared": [True, False] }
default_options = { 'shared': False }
no_copy_source = True

@property
def _source_subfolder(self):
return "source_subfolder"

@property
def _minimum_cpp_standard(self):
return 11
Expand All @@ -35,18 +27,21 @@ def _minimum_compilers_version(self):
"Visual Studio": "15",
"apple-clang": "9.4",
"clang": "3.3",
"gcc": "4.9.4"
"gcc": "5.1"
}

def config_options(self):
if self.settings.os == 'Windows':
del self.options.fPIC
@property
def _sources_key(self):
if self.settings.compiler == "Visual Studio":
return "Windows"
elif self.settings.os == "Windows" and self.settings.compiler == "gcc":
return "MinGW"
return str(self.settings.os)

def configure(self):
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
if self.options.shared:
del self.options.fPIC
del self.settings.compiler.runtime

def validate(self):
compiler = self.settings.compiler
Expand All @@ -65,26 +60,33 @@ def validate(self):
self.output.warn(msg)

try:
self.conan_data["sources"][self.version][str(self.settings.os)]
self.conan_data["sources"][self.version][self._sources_key][str(self.settings.arch)]
except KeyError:
raise ConanInvalidConfiguration("Binaries for this combination of architecture/version/os not available")

if (self.settings.compiler, self.settings.os) == ("gcc", "Windows") and self.options.shared:
# FIXME: https://github.com/bytecodealliance/wasmtime/issues/3168
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was merged in

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, but we will need to wait for the next release to have shared mingw avaialble.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I did not look, but thats for checking!

raise ConanInvalidConfiguration("Shared mingw is currently not possible")

def source(self):
tools.get(**self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)], destination=self._source_subfolder, strip_root=True)
tools.get(**self.conan_data["sources"][self.version][self._sources_key][str(self.settings.arch)], destination=self.source_folder, strip_root=True)

def package(self):
include_path = os.path.join(self._source_subfolder, 'include')
self.copy('*.h', dst='include', src=include_path)
self.copy('*.hh', dst='include', src=include_path)
self.copy('*.hpp', dst='include', src=include_path)
shutil.copytree(os.path.join(self.source_folder, "include"),
os.path.join(self.package_folder, "include"))

self.copy('*.lib', dst='lib', keep_path=False)
self.copy('*.dll', dst='bin', keep_path=False)
self.copy('*.so', dst='lib', keep_path=False)
self.copy('*.dylib', dst='lib', keep_path=False)
self.copy('*.a', dst='lib', keep_path=False)
srclibdir = os.path.join(self.source_folder, "lib")
if self.options.shared:
self.copy("wasmtime.dll.lib", src=srclibdir, dst="lib", keep_path=False)
self.copy("wasmtime.dll", src=srclibdir, dst="bin", keep_path=False)
self.copy("libwasmtime.dll.a", src=srclibdir, dst="lib", keep_path=False)
self.copy("libwasmtime.so*", src=srclibdir, dst="lib", keep_path=False)
self.copy("libwasmtime.dylib", src=srclibdir, dst="lib", keep_path=False)
else:
self.copy("wasmtime.lib", src=srclibdir, dst="lib", keep_path=False)
self.copy("libwasmtime.a", src=srclibdir, dst="lib", keep_path=False)

self.copy('LICENSE', dst='licenses', src=self._source_subfolder)
self.copy('LICENSE', dst='licenses', src=self.source_folder)

def package_info(self):
if self.options.shared:
Expand Down
4 changes: 2 additions & 2 deletions recipes/wasmtime/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(PackageTest)
project(PackageTest C)

set(C_STANDARD 11)
set(CMAKE_C_STANDARD 11)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
Expand Down
2 changes: 1 addition & 1 deletion recipes/wasmtime/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ def build(self):
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
if not tools.cross_building(self):
bin_path = os.path.join('bin', 'example')
self.run(bin_path, run_environment=True)