-
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.
- Loading branch information
Showing
7 changed files
with
213 additions
and
174 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,31 +1,49 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.tools.apple import is_apple_os | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain | ||
|
||
class TestVerilatorConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package" | ||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build_requirements(self): | ||
self.tool_requires(self.tested_reference_str) | ||
if self._with_systemc_example: | ||
self.tool_requires("systemc/2.3.4") | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
@property | ||
def _with_systemc_example(self): | ||
# systemc is not available on Macos | ||
return self.settings.os != "Macos" | ||
return not is_apple_os(self) | ||
|
||
def requirements(self): | ||
if self._with_systemc_example: | ||
self.requires("systemc/2.3.3") | ||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["BUILD_SYSTEMC"] = self._with_systemc_example | ||
tc.generate() | ||
|
||
def build(self): | ||
if not tools.cross_building(self.settings, skip_x64_x86=True): | ||
if can_run(self): | ||
cmake = CMake(self) | ||
cmake.definitions["BUILD_SYSTEMC"] = self._with_systemc_example | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings, skip_x64_x86=True): | ||
with tools.run_environment(self): | ||
self.run("perl {} --version".format(os.path.join(self.deps_cpp_info["verilator"].rootpath, "bin", "verilator")), run_environment=True) | ||
self.run(os.path.join("bin", "blinky"), run_environment=True) | ||
if can_run(self): | ||
verilator_path = os.path.join(self.dependencies["verilator"].package_folder, "bin", "verilator") | ||
self.run(f"perl {verilator_path} --version") | ||
bin_path = os.path.join(self.cpp.build.bindir, "blinky") | ||
self.run(bin_path, env="conanrun") | ||
if self._with_systemc_example: | ||
self.run(os.path.join("bin", "blinky_sc"), run_environment=True) | ||
bin_path = os.path.join(self.cpp.build.bindir, "blinky_sc") | ||
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,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ | ||
${CMAKE_CURRENT_BINARY_DIR}/test_package/) |
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,31 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestVerilatorConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
@property | ||
def _with_systemc_example(self): | ||
# systemc is not available on Macos | ||
return not is_apple_os(self) | ||
|
||
def requirements(self): | ||
if self._with_systemc_example: | ||
self.requires("systemc/2.3.3") | ||
|
||
def build(self): | ||
if not tools.cross_building(self.settings, skip_x64_x86=True): | ||
cmake = CMake(self) | ||
cmake.definitions["BUILD_SYSTEMC"] = self._with_systemc_example | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings, skip_x64_x86=True): | ||
with tools.run_environment(self): | ||
self.run("perl {} --version".format(os.path.join(self.deps_cpp_info["verilator"].rootpath, "bin", "verilator")), run_environment=True) | ||
self.run(os.path.join("bin", "blinky"), run_environment=True) | ||
if self._with_systemc_example: | ||
self.run(os.path.join("bin", "blinky_sc"), run_environment=True) |