diff --git a/SystemC/conanfile.py b/SystemC/conanfile.py new file mode 100644 index 0000000..37434da --- /dev/null +++ b/SystemC/conanfile.py @@ -0,0 +1,34 @@ +from conans import ConanFile, CMake + + +class SeasocksConan(ConanFile): + name = "SystemC" + version = "2.3.2" + license = "Apache 2.0 License" + url = "" + description = "SystemC is a set of C++ classes and macros which provide an event-driven simulation interface (see also discrete event simulation)." + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "stdcxx":[98,11,14]} + default_options = "shared=True","stdcxx=98" + generators = "cmake" + exports_sources = "systemc-2.3.2/*" + + +# def build_id(self): +# self.info_build.settings.build_type = "Any" + +# def source(self): +# self.run("git clone https://github.com/Minres/SystemCLanguage.git") +# self.run("cd SystemCLanguage && git checkout master") + + def build(self): + cmake = CMake(self) + cmake.configure(source_dir="%s/systemc-2.3.2" % self.source_folder) + shared = "-DBUILD_SHARED_LIBS=ON" if self.options.shared else "-DBUILD_SHARED_LIBS=OFF" + self.run('cmake systemc-2.3.2 %s %s -DCMAKE_CXX_STANDARD=%s' % (cmake.command_line, shared, self.options.stdcxx)) + # self.run("cmake --build . %s" % cmake.build_config) + self.run("cmake --build . --target install %s" % cmake.build_config) + + def package_info(self): + self.cpp_info.libs = ["systemc"] + diff --git a/SystemC/test_package/CMakeLists.txt b/SystemC/test_package/CMakeLists.txt new file mode 100644 index 0000000..d691abc --- /dev/null +++ b/SystemC/test_package/CMakeLists.txt @@ -0,0 +1,17 @@ +project(PackageTest CXX) +cmake_minimum_required(VERSION 2.8.12) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +add_executable(example example.cpp) +target_link_libraries(example ${CONAN_LIBS}) + +# CTest is a testing tool that can be used to test your project. +# enable_testing() +# add_test(NAME example +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin +# COMMAND example) diff --git a/SystemC/test_package/conanfile.py b/SystemC/test_package/conanfile.py new file mode 100644 index 0000000..1cee8c8 --- /dev/null +++ b/SystemC/test_package/conanfile.py @@ -0,0 +1,24 @@ +from conans import ConanFile, CMake +import os + +class SystemcTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cxxstd = self.options["SystemC"].stdcxx + cmake = CMake(self) + # Current dir is "test_package/build/" and CMakeLists.txt is in "test_package" + cmake.configure(source_dir=self.conanfile_directory, build_dir="./") + #cmake.build() + self.run('cmake %s %s -DCMAKE_CXX_STANDARD=%s' % (self.conanfile_directory, cmake.command_line, cxxstd)) + self.run("cmake --build . %s" % cmake.build_config) + + def imports(self): + self.copy("*.dll", dst="bin", src="bin") + self.copy("*.dylib*", dst="bin", src="lib") + self.copy('*.so*', dst='bin', src='lib') + + def test(self): + os.chdir("bin") + self.run(".%sexample" % os.sep) diff --git a/SystemC/test_package/example.cpp b/SystemC/test_package/example.cpp new file mode 100644 index 0000000..f04bad6 --- /dev/null +++ b/SystemC/test_package/example.cpp @@ -0,0 +1,7 @@ +#include +#include "systemc" + +int sc_main(int argc, char* argv[]) { + printf("Success!\n"); + return 0; +}