diff --git a/recipes/wasmtime/all/conanfile.py b/recipes/wasmtime/all/conanfile.py index 5965ffaee4fb3..450e90653e753 100644 --- a/recipes/wasmtime/all/conanfile.py +++ b/recipes/wasmtime/all/conanfile.py @@ -5,25 +5,14 @@ class WasmtimeConan(ConanFile): name = 'wasmtime' - homepage = 'https://github.com/bytecodealliance/wasmtime' + homepage = 'https://wasmtime.dev' license = 'Apache-2.0' url = 'https://github.com/conan-io/conan-center-index' 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, - } - no_copy_source = True - - @property - def _source_subfolder(self): - return "source_subfolder" + options = {"shared": [True, False]} + default_options = {"shared": False} @property def _minimum_cpp_standard(self): @@ -35,18 +24,12 @@ def _minimum_compilers_version(self): "Visual Studio": "15", "apple-clang": "9.4", "clang": "3.3", - "gcc": "4.9.4" + "gcc": "4.9" } - def config_options(self): - if self.settings.os == 'Windows': - del self.options.fPIC - - def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.options.shared: - del self.options.fPIC + @property + def _source_subfolder(self): + return "source_subfolder" def validate(self): compiler = self.settings.compiler @@ -60,7 +43,7 @@ def validate(self): except KeyError: msg = ( "{} recipe lacks information about the {} compiler, " - "support for the required C++{} features is assumed" + "support for the required C{} features is assumed" ).format(self.name, compiler, self._minimum_cpp_standard) self.output.warn(msg) @@ -69,8 +52,9 @@ def validate(self): not (str(self.settings.arch) in self.conan_data["sources"][self.version][str(self.settings.os)] ) ): raise ConanInvalidConfiguration("Binaries for this combination of architecture/version/os not available") - 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) + def build(self): + tools.get(**self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)], + destination=self._source_subfolder, strip_root=True) def package(self): include_path = os.path.join(self._source_subfolder, 'include') @@ -78,26 +62,30 @@ def package(self): self.copy('*.hh', dst='include', src=include_path) self.copy('*.hpp', dst='include', src=include_path) - 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) - - self.copy('LICENSE', dst='licenses', src=self._source_subfolder) - - def package_info(self): if self.options.shared: + self.copy('*.dll', dst='bin', keep_path=False) + self.copy('*.dll.lib', dst='lib', keep_path=False) + self.copy('*.so', dst='lib', keep_path=False) + self.copy('*.dylib', dst='lib', keep_path=False) if self.settings.os == "Windows": - self.cpp_info.libs = ["wasmtime.dll"] - else: - self.cpp_info.libs = ["wasmtime"] + tools.rename(os.path.join(self.package_folder, "lib", "wasmtime.dll.lib"), + os.path.join(self.package_folder, "lib", "wasmtime.lib")) else: - if self.settings.os == "Windows": - self.cpp_info.defines= ["/DWASM_API_EXTERN=", "/DWASI_API_EXTERN="] - self.cpp_info.libs = ["wasmtime"] + self.copy('*.lib', dst='lib', excludes="*.dll.lib", keep_path=False) + self.copy('*.a', dst='lib', keep_path=False) - if self.settings.os == 'Windows': + self.copy('LICENSE', dst='licenses', src=self._source_subfolder) + + def package_id(self): + del self.info.settings.compiler + + def package_info(self): + self.cpp_info.libs = ["wasmtime"] + if self.settings.os == "Windows": + if not self.options.shared: + # FIXME: Tricky way to pass definions. cpp_info.define does not work. + self.cpp_info.cflags = ["-DWASM_API_EXTERN=", "-DWASI_API_EXTERN="] + self.cpp_info.cxxflags = ["-DWASM_API_EXTERN=", "-DWASI_API_EXTERN="] self.cpp_info.system_libs = ['ws2_32', 'bcrypt', 'advapi32', 'userenv', 'ntdll', 'shell32', 'ole32'] - if self.settings.os == 'Linux': + elif self.settings.os == 'Linux': self.cpp_info.system_libs = ['pthread', 'dl', 'm'] diff --git a/recipes/wasmtime/all/test_package/CMakeLists.txt b/recipes/wasmtime/all/test_package/CMakeLists.txt index 374e151bc1046..dcf05ac0e17f7 100644 --- a/recipes/wasmtime/all/test_package/CMakeLists.txt +++ b/recipes/wasmtime/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest) - -set(C_STANDARD 11) +project(PackageTest C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -find_package(wasmtime REQUIRED) +find_package(wasmtime REQUIRED CONFIG) add_executable(example example.c) -target_link_libraries(example PRIVATE wasmtime::wasmtime) -target_compile_options(example PRIVATE ${CONAN_COMPILE_DEFINITIONS_WASMTIME}) +target_link_libraries(example wasmtime::wasmtime) diff --git a/recipes/wasmtime/all/test_package/conanfile.py b/recipes/wasmtime/all/test_package/conanfile.py index b92626c3778c4..3225bb0b3ce4e 100644 --- a/recipes/wasmtime/all/test_package/conanfile.py +++ b/recipes/wasmtime/all/test_package/conanfile.py @@ -4,7 +4,7 @@ class WasmtimeTestConan(ConanFile): settings = 'os', 'compiler', 'build_type', 'arch' - generators = 'cmake', 'cmake_find_package' + generators = 'cmake', 'cmake_find_package_multi' def build(self): cmake = CMake(self)