-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* waf: migrate to Conan v2 * waf: make it work on macOS * Restore v2.0.19 Should not remove the most recent current version from an existing recipe to not break deps for consumers. * waf: fix tests * waf: fix DYLD_LIBRARY_PATH in tests * waf: waf fails with cmake_layout() * waf: bump version --------- Co-authored-by: Piotr Gaczkowski <DoomHammerNG@gmail.com>
- Loading branch information
1 parent
93fb1ef
commit e1d2375
Showing
5 changed files
with
120 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
sources: | ||
"2.0.26": | ||
url: "https://waf.io/waf-2.0.26.tar.bz2" | ||
sha256: "c33d19c1bdfae1b078edaef2fab19b1bc734294edd4cc005d4881e9d53ed219c" | ||
"2.0.25": | ||
url: "https://waf.io/waf-2.0.25.tar.bz2" | ||
sha256: "66cff7beed0e77db874e9232cc08874abb3e866c7f0f1f34ba2f959fde44fdd4" | ||
"2.0.19": | ||
url: "https://waf.io/waf-2.0.19.tar.bz2" | ||
sha256: "d8402689b72fe75f759a83b5f6bdf9b4f34ca7fd6007d80680ecfcbef5c2bba5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,45 @@ | ||
from conans import ConanFile, tools | ||
from contextlib import contextmanager | ||
import os | ||
import shutil | ||
|
||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.env import Environment, VirtualBuildEnv | ||
from conan.tools.files import chdir | ||
from conan.tools.layout import basic_layout | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
settings = "os", "arch", "compiler", "build_type" | ||
test_type = "explicit" | ||
exports_sources = "a.cpp", "b.cpp", "main.c", "main.cpp", "wscript" | ||
|
||
def build_requirements(self): | ||
self.tool_requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
basic_layout(self) | ||
|
||
def generate(self): | ||
buildenv = VirtualBuildEnv(self) | ||
buildenv.generate() | ||
|
||
env = Environment() | ||
for var in ["DYLD_LIBRARY_PATH", "LD_LIBRARY_PATH"]: | ||
env.append_path(var, self.build_folder) | ||
env.vars(self, scope="run").save_script("conanrun_macos_dyld_path") | ||
|
||
def build(self): | ||
if tools.cross_building(self.settings): | ||
return | ||
|
||
for src in self.exports_sources: | ||
shutil.copy(os.path.join(self.source_folder, src), self.build_folder) | ||
|
||
waf_path = tools.which("waf") | ||
if waf_path: | ||
waf_path = waf_path.replace("\\", "/") | ||
assert waf_path.startswith(str(self.deps_cpp_info["waf"].rootpath)) | ||
|
||
with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): | ||
self.run("waf -h") | ||
self.run("waf configure") | ||
self.run("waf") | ||
|
||
@contextmanager | ||
def _add_ld_search_path(self): | ||
env = {} | ||
if self.settings.os == "Linux": | ||
env["LD_LIBRARY_PATH"] = [os.path.join(os.getcwd(), "build")] | ||
elif self.settings.os == "Macos": | ||
env["DYLD_LIBRARY_PATH"] = [os.path.join(os.getcwd(), "build")] | ||
with tools.environment_append(env): | ||
yield | ||
if can_run(self): | ||
for src in self.exports_sources: | ||
shutil.copy(os.path.join(self.source_folder, src), self.build_folder) | ||
|
||
with chdir(self, self.build_folder): | ||
self.run(f"waf configure -o {self.cpp.build.bindir}") | ||
self.run("waf") | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
with self._add_ld_search_path(): | ||
self.run(os.path.join("build", "app"), run_environment=True) | ||
self.run(os.path.join("build", "app2"), run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "app") | ||
self.run(bin_path, env="conanrun") | ||
bin_path = os.path.join(self.cpp.build.bindir, "app2") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from conan.tools.apple import is_apple_os | ||
from conans import ConanFile, tools | ||
from contextlib import contextmanager | ||
import os | ||
import shutil | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
exports_sources = "a.cpp", "b.cpp", "main.c", "main.cpp", "wscript" | ||
|
||
def build(self): | ||
if tools.cross_building(self.settings): | ||
return | ||
|
||
for src in self.exports_sources: | ||
shutil.copy(os.path.join(self.source_folder, os.pardir, "test_package", src), self.build_folder) | ||
|
||
waf_path = tools.which("waf") | ||
if waf_path: | ||
waf_path = waf_path.replace("\\", "/") | ||
assert waf_path.startswith(str(self.deps_cpp_info["waf"].rootpath)) | ||
|
||
with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): | ||
self.run("waf -h") | ||
self.run("waf configure") | ||
self.run("waf") | ||
|
||
@contextmanager | ||
def _add_ld_search_path(self): | ||
env = {} | ||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
env["LD_LIBRARY_PATH"] = [os.path.join(os.getcwd(), "build")] | ||
elif is_apple_os(self): | ||
env["DYLD_LIBRARY_PATH"] = [os.path.join(os.getcwd(), "build")] | ||
with tools.environment_append(env): | ||
yield | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
with self._add_ld_search_path(): | ||
self.run(os.path.join("build", "app"), run_environment=True) | ||
self.run(os.path.join("build", "app2"), run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
versions: | ||
"2.0.26": | ||
folder: all | ||
"2.0.25": | ||
folder: all | ||
"2.0.19": | ||
folder: all |