diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..94f480de94e1d767531580401cbf13844868e82b --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..7946446b9a36cf362000dd70075f40ec54c7d735 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.project +bin +target +# Ignore all files in folder test_package +test_package/* +# except conanfile.py +!test_package/conanfile.py diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d4215be015b08046f4ce3ec719d89dcebf4841e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.15) +project(${PROJECT_NAME} CXX) + +find_package(yat4tango CONFIG REQUIRED) + +if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") + find_package(crashreporting2 CONFIG) +endif() + +add_compile_definitions(PROJECT_NAME=${PROJECT_NAME}) +add_compile_definitions(PROJECT_VERSION=${PROJECT_VERSION}) + +file(GLOB_RECURSE sources + src/*.cpp +) + +list(FILTER sources EXCLUDE REGEX ".*Win32.*") + +set(includedirs + src + include +) + +add_executable(${EXECUTABLE_NAME} ${sources}) +target_include_directories(${EXECUTABLE_NAME} PRIVATE ${includedirs}) +target_link_libraries(${EXECUTABLE_NAME} PRIVATE yat4tango::yat4tango) + +if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") + target_link_libraries(${EXECUTABLE_NAME} PRIVATE crashreporting2::crashreporting2) +endif() + +install(TARGETS ${EXECUTABLE_NAME} DESTINATION "." RUNTIME DESTINATION bin) diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000000000000000000000000000000000..4d99c5acb5180eda25ab63523a0373733b4faebb --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1 @@ +conan.create(['el6-gcc44-x86-shared']) diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000000000000000000000000000000000000..006bc5f7c22a18f8df8d8ab44bc0f1b8663d5838 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,46 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps + + +class AcquireWaveformLecroyRecipe(ConanFile): + name = "acquirewaveformlecroy" + executable = "ds_AcquireWaveformLecroy" + version = "1.2.0" + package_type = "application" + user = "soleil" + + license = "GPL-3.0-or-later" + author = "Xavier Elattaoui" + url = "https://gitlab.synchrotron-soleil.fr/software-control-system/tango-devices/measureinstruments/lecroy/acquirewaveformlecroy.git" + description = "AcquireWaveformLecroy device" + topics = ("control-system", "tango", "device") + + settings = "os", "compiler", "build_type", "arch" + + exports_sources = "CMakeLists.txt", "src/*", "include/*" + + def requirements(self): + self.requires("yat4tango/[>=1.0]@soleil/stable") + if self.settings.os == "Linux": + self.requires("crashreporting2/[>=1.0]@soleil/stable") + + def layout(self): + cmake_layout(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.variables["PROJECT_NAME"] = self.name + tc.variables["PROJECT_VERSION"] = self.version + tc.variables["EXECUTABLE_NAME"] = self.executable + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() diff --git a/test_package/conanfile.py b/test_package/conanfile.py new file mode 100644 index 0000000000000000000000000000000000000000..d17a489febe965f8c10ceae3a5bf2b1f60edc445 --- /dev/null +++ b/test_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conan import ConanFile +from conan.tools.build import can_run + + +class AcquireWaveformLecroyTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + + def requirements(self): + self.requires(self.tested_reference_str) + + def test(self): + if can_run(self): + if self.settings.os == "Windows": + self.run("ds_AcquireWaveformLecroy 2>&1 | findstr \"usage\"", env="conanrun") + else: + self.run("ds_AcquireWaveformLecroy 2>&1 | grep \"usage\"", env="conanrun")