Skip to content
Snippets Groups Projects
Commit 19ff4e78 authored by Patrick MADELA's avatar Patrick MADELA
Browse files

Add conan recipe

parent cba48cca
Branches
Tags
No related merge requests found
* text=auto eol=lf
\ No newline at end of file
.project
bin
target
# Ignore all files in folder test_package
test_package/*
# except conanfile.py
!test_package/conanfile.py
cmake_minimum_required(VERSION 3.15)
project(${PROJECT_NAME} CXX)
find_package(nexuscpp CONFIG REQUIRED)
find_package(hdf5 CONFIG REQUIRED)
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
)
set(includedirs
src
)
add_executable(${EXECUTABLE_NAME} ${sources})
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${includedirs})
target_link_libraries(${EXECUTABLE_NAME} PRIVATE nexuscpp::nexuscpp)
target_link_libraries(${EXECUTABLE_NAME} PRIVATE hdf5::hdf5)
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)
conan.create(['win7-msvc12-x86-static'])
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
class XiaDxpRecipe(ConanFile):
name = "xiadxp"
executable = "ds_XiaDxp"
version = "3.2.3"
package_type = "application"
user = "soleil"
license = "GPL-3.0-or-later"
author = "Arafat Nourredine"
url = "https://gitlab.synchrotron-soleil.fr/software-control-system/tango-devices/acquisition/1d/xiadxp.git"
description = "XiaDxp device"
topics = ("control-system", "tango", "device")
settings = "os", "compiler", "build_type", "arch"
exports_sources = "CMakeLists.txt", "src/*"
def requirements(self):
self.requires("nexuscpp/[>=1.0]@soleil")
self.requires("hdf5/[>=1.0]@soleil")
self.requires("yat4tango/[>=1.0]@soleil")
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()
import os
from conan import ConanFile
from conan.tools.build import can_run
class XiaDxpTestConan(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_XiaDxp 2>&1 | findstr \"usage\"", env="conanrun")
else:
self.run("ds_XiaDxp 2>&1 | grep \"usage\"", env="conanrun")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment