6
0
mirror of https://github.com/Minres/conan-recipes.git synced 2024-12-26 01:47:23 +01:00

SystemC packaging working

This commit is contained in:
Eyck Jentzsch 2017-10-27 22:55:33 +02:00
parent 98ccbf7829
commit 48610bb377
4 changed files with 82 additions and 0 deletions

34
SystemC/conanfile.py Normal file
View File

@ -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"]

View File

@ -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)

View File

@ -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/<build_id>" 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)

View File

@ -0,0 +1,7 @@
#include <iostream>
#include "systemc"
int sc_main(int argc, char* argv[]) {
printf("Success!\n");
return 0;
}