-
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.
makefile-project-workspace-creator: migrate to Conan v2
- Loading branch information
Showing
3 changed files
with
58 additions
and
24 deletions.
There are no files selected for viewing
51 changes: 34 additions & 17 deletions
51
recipes/makefile-project-workspace-creator/all/conanfile.py
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,37 +1,54 @@ | ||
import os | ||
from conans import ConanFile, tools | ||
|
||
from conan import ConanFile | ||
from conan.tools.files import copy, get | ||
from conan.tools.layout import basic_layout | ||
|
||
required_conan_version = ">=1.47.0" | ||
|
||
|
||
class MPCGeneratorConan(ConanFile): | ||
name = "makefile-project-workspace-creator" | ||
description = "The Makefile, Project and Workspace Creator" | ||
license = "BSD-3-Clause" | ||
homepage = "https://objectcomputing.com/" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
topics = ("conan", "makefile-project-workspace-creator", "objectcomputing", "installer") | ||
settings = "os" | ||
homepage = "https://github.com/objectcomputing/MPC" | ||
topics = ("objectcomputing", "installer") | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
package_type = "build-scripts" | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
def requirements(self): | ||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def build_requirements(self): | ||
if self.settings.os == "Windows": | ||
self.requires("strawberryperl/5.30.0.1") | ||
self.tool_requires("strawberryperl/5.32.1.1", visible=True) | ||
|
||
def build(self): | ||
pass | ||
def package_id(self): | ||
del self.info.settings.compiler | ||
del self.info.settings.build_type | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
os.rename("MPC-MPC_" + self.version.replace(".", "_"), self._source_subfolder) | ||
def build(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def package(self): | ||
self.copy(pattern="*", src=self._source_subfolder, dst="bin") | ||
self.copy(pattern="LICENSE", src=os.path.join(self._source_subfolder, "docs"), dst="licenses") | ||
copy(self, "*", | ||
src=self.build_folder, | ||
dst=os.path.join(self.package_folder, "bin")) | ||
copy(self, "LICENSE", | ||
src=os.path.join(self.build_folder, "docs"), | ||
dst=os.path.join(self.package_folder, "licenses")) | ||
|
||
def package_info(self): | ||
self.cpp_info.frameworkdirs = [] | ||
self.cpp_info.libdirs = [] | ||
self.cpp_info.resdirs = [] | ||
self.cpp_info.includedirs = [] | ||
|
||
bin_path = os.path.join(self.package_folder, "bin") | ||
self.output.info('Appending PATH environment variable: %s' % bin_path) | ||
self.buildenv_info.define("MPC_ROOT", bin_path) | ||
self.runenv_info.define("MPC_ROOT", bin_path) | ||
|
||
self.env_info.PATH.append(bin_path) | ||
self.env_info.MPC_ROOT = bin_path |
19 changes: 12 additions & 7 deletions
19
recipes/makefile-project-workspace-creator/all/test_package/conanfile.py
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,12 +1,17 @@ | ||
from conans import ConanFile, tools | ||
from conan import ConanFile | ||
from conan.tools.layout import basic_layout | ||
|
||
|
||
class DefaultNameConan(ConanFile): | ||
settings = "os" | ||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "VirtualBuildEnv" | ||
test_type = "explicit" | ||
|
||
def build(self): | ||
pass | ||
def layout(self): | ||
basic_layout(self) | ||
|
||
def build_requirements(self): | ||
self.tool_requires(self.tested_reference_str) | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
self.run("perl -S mpc.pl --version", run_environment=True) | ||
self.run("perl -S mpc.pl --version") |
12 changes: 12 additions & 0 deletions
12
recipes/makefile-project-workspace-creator/all/test_v1_package/conanfile.py
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,12 @@ | ||
from conans import ConanFile, tools | ||
|
||
|
||
class DefaultNameConan(ConanFile): | ||
settings = "os" | ||
|
||
def build(self): | ||
pass | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
self.run("perl -S mpc.pl --version", run_environment=True) |