Skip to content

Commit

Permalink
Add Conan integration (eclipse-ecal#18)
Browse files Browse the repository at this point in the history
* Add Conan dependencies for simpleini, tclap and asio

* Add Conan protobuf package from bintray

* Prepare CI build scripts for using Conan

* Add spdlog from bincrafters

* Add HDF5 package to conanfile.txt

* Add own Qt5 Conan package (needed for WinExtras)

* Add proto compiler as another dependency
  • Loading branch information
NewProggie authored and rex-schilasky committed Nov 7, 2019
1 parent b580171 commit d26eacc
Show file tree
Hide file tree
Showing 35 changed files with 75 additions and 106 deletions.
6 changes: 5 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@ image: Visual Studio 2015
environment:
QT5_ROOT_DIRECTORY: C:\Qt\5.11.3
HDF5_DIR: C:\Program Files\HDF_Group\HDF5\1.8.21\cmake
PYTHON_HOME: C:\Python37

install:
# Initialize thirdparty dependencies (remove with Conan integration)
- git submodule update --init --recursive

# Install build requirements
- curl -fsS -O https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.21/bin/hdf5-1.8.21-Std-win7_64-vs14.zip
- 7z x -bb0 hdf5-1.8.21-Std-win7_64-vs14.zip
- msiexec /package hdf\HDF5-1.8.21-win64.msi /quiet
- choco install doxygen.install
- choco install cmake
- choco install wixtoolset
- refreshenv

build_script:
- set PATH="C:\Program Files\CMake\bin";%PATH%
- build_win\win_make_all.bat
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CMake build folders
/_build*
/_setup
/build*

# autogenerated files
/ecal/include/ecal/ecal_defs.h
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dist: xenial

language: cpp
compiler: gcc

addons:
apt:
sources:
Expand Down
49 changes: 25 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -18,10 +18,11 @@

cmake_minimum_required(VERSION 3.13)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/find_scripts)
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)

project(eCAL)
project(eCAL)

# Set CMake policy behavior (alias targets)
cmake_policy(SET CMP0028 NEW)
Expand Down Expand Up @@ -76,7 +77,7 @@ message(STATUS "Prefix Path: ${CMAKE_PREFIX_PATH}")
# third party dependencies as requested
# --------------------------------------------------------
if (ECAL_THIRDPARTY_BUILD_PROTOBUF)
list(APPEND as_subproject Protobuf)
list(APPEND as_subproject Protobuf)
if(MSVC)
# supress google protobuf warnings for windows platform
set(CMAKE_CXX_FLAGS_OLD "${CMAKE_CXX_FLAGS}")
Expand Down Expand Up @@ -106,15 +107,15 @@ if (ECAL_THIRDPARTY_BUILD_PROTOBUF)
endif()

if (ECAL_THIRDPARTY_BUILD_SPDLOG)
list(APPEND as_subproject spdlog)
list(APPEND as_subproject spdlog)
add_subdirectory(thirdparty/spdlog)
add_library(spdlog::spdlog ALIAS spdlog)
endif ()



if (ECAL_THIRDPARTY_BUILD_CMAKE_FUNCTIONS)
list(APPEND as_subproject CMakeFunctions)
list(APPEND as_subproject CMakeFunctions)
endif()

macro(find_package)
Expand All @@ -136,7 +137,7 @@ set(eCAL_VERSION_MAJOR ${GIT_REVISION_MAYOR})
set(eCAL_VERSION_MINOR ${GIT_REVISION_MINOR})
set(eCAL_VERSION_PATCH ${GIT_REVISION_PATCH})
set(eCAL_VERSION_STRING ${eCAL_VERSION_MAJOR}.${eCAL_VERSION_MINOR}.${eCAL_VERSION_PATCH})
set(eCAL_VERSION ${eCAL_VERSION_STRING})
set(eCAL_VERSION ${eCAL_VERSION_STRING})

include(helper_functions/ecal_add_functions)
include(helper_functions/ecal_helper_functions)
Expand All @@ -152,7 +153,7 @@ endif()
# --------------------------------------------------------
if(WIN32 AND HAS_QT5)
if (NOT DEFINED ENV{QT5_ROOT_DIRECTORY} AND NOT DEFINED ENV{QT5_ROOT})
# If the QT5_ROOT_DIRECTORY Variable is not set, there is still a chance that
# If the QT5_ROOT_DIRECTORY Variable is not set, there is still a chance that
# the user set the CMAKE_PREFIX_PATH himself. Thus we try to find
# Qt5 Core just to see if that works. If we can find Qt, we assume
# that the user knows what he is doing.
Expand All @@ -173,8 +174,8 @@ if(WIN32 AND HAS_QT5)
endif ()
if (DEFINED ENV{QT5_ROOT_DIRECTORY})
set(qt_directory $ENV{QT5_ROOT_DIRECTORY})
endif ()
endif ()

qt_msvc_path(qt_subfolder)
list(APPEND CMAKE_PREFIX_PATH ${qt_directory}/${qt_subfolder}/)
message(STATUS "Searching for QT in ${qt_directory}/${qt_subfolder}/")
Expand Down Expand Up @@ -266,13 +267,13 @@ if(WIN32)
set(CMAKE_DEBUG_POSTFIX d)
set(CMAKE_MINSIZEREL_POSTFIX minsize)
set(CMAKE_RELWITHDEBINFO_POSTFIX reldbg)
endif()
endif()

# --------------------------------------------------------
# protobuf utilities
# --------------------------------------------------------
add_subdirectory(contrib/ecalproto/src)
# --------------------------------------------------------
add_subdirectory(contrib/ecalproto/src)

# --------------------------------------------------------
# ecal core internal protobuf
# --------------------------------------------------------
Expand Down Expand Up @@ -391,26 +392,26 @@ write_basic_package_version_file(
configure_package_config_file(
cmake/${PROJECT_NAME}Config.cmake.in
${eCAL_config}
INSTALL_DESTINATION ${${PROJECT_NAME}_install_cmake_dir}
INSTALL_DESTINATION ${${PROJECT_NAME}_install_cmake_dir}
PATH_VARS ${PROJECT_NAME}_install_include_dir ${PROJECT_NAME}_install_cmake_dir
)
)

install(FILES ${eCAL_config} ${eCAL_config_version}
DESTINATION ${eCAL_install_cmake_dir}
COMPONENT sdk
)
install(FILES

install(FILES
cmake/helper_functions/ecal_add_functions.cmake
cmake/helper_functions/ecal_helper_functions.cmake
cmake/helper_functions/ecal_install_functions.cmake
DESTINATION ${${PROJECT_NAME}_install_cmake_dir}/helper_functions
COMPONENT sdk
)
install(EXPORT eCALCoreTargets
)

install(EXPORT eCALCoreTargets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${eCAL_install_cmake_dir}
DESTINATION ${eCAL_install_cmake_dir}
NAMESPACE eCAL::
COMPONENT sdk
)
Expand Down
1 change: 0 additions & 1 deletion app/mon/eCALMon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ ecal_add_app_qt(${PROJECT_NAME}
${autogen_ui}
)

create_targets_protobuf()
target_link_libraries (${PROJECT_NAME}
protobuf::libprotobuf
simpleini::simpleini
Expand Down
1 change: 0 additions & 1 deletion app/mon/eCALMonPlugins/ProtobufReflection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ qt5_wrap_ui(autogen_ui ${${PROJECT_NAME}_ui})

ecal_add_mon_plugin(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_src} ${${PROJECT_NAME}_header} ${${PROJECT_NAME}_ui} ${autogen_ui})

create_targets_protobuf()
target_link_libraries (${PROJECT_NAME} Qt5::Widgets eCAL::core eCAL::pb protobuf::libprotobuf MonitorTreeView eCAL::mon_plugin_lib)

if(MSVC)
Expand Down
1 change: 0 additions & 1 deletion app/mon/eCALMonPlugins/RawDataReflection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ qt5_wrap_ui(autogen_ui ${${PROJECT_NAME}_ui})

ecal_add_mon_plugin(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_src} ${${PROJECT_NAME}_header} ${${PROJECT_NAME}_ui} ${autogen_ui})

create_targets_protobuf()
target_link_libraries (${PROJECT_NAME} Qt5::Widgets eCAL::core eCAL::mon_plugin_lib)

if(MSVC)
Expand Down
1 change: 0 additions & 1 deletion app/mon/eCALMonPlugins/StringReflection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ qt5_wrap_ui(autogen_ui ${${PROJECT_NAME}_ui})

ecal_add_mon_plugin(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_src} ${${PROJECT_NAME}_header} ${${PROJECT_NAME}_ui} ${autogen_ui})

create_targets_protobuf()
target_link_libraries (${PROJECT_NAME} Qt5::Widgets eCAL::core eCAL::mon_plugin_lib)

if(MSVC)
Expand Down
2 changes: 0 additions & 2 deletions app/mon/eCALTopic/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ target_include_directories(${PROJECT_NAME}
target_compile_definitions(${PROJECT_NAME}
PRIVATE $<$<BOOL:${MSVC}>:PCRE_STATIC;_UNICODE>)

create_targets_protobuf()

target_link_libraries(${PROJECT_NAME}
protobuf::libprotobuf
tclap::tclap
Expand Down
18 changes: 8 additions & 10 deletions cmake/find_scripts/Findasio.cmake → cmake/Modules/Findasio.cmake
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
find_path(Asio_INCLUDE_DIR
NAMES asio.hpp
PATHS
${CMAKE_SOURCE_DIR}/thirdparty/asio/asio/include
include
)
HINTS
include ${CONAN_ASIO_ROOT}/include
${CMAKE_SOURCE_DIR}/thirdparty/asio/asio/include
include
)

if(Asio_INCLUDE_DIR-NOTFOUND)
message(FATAL_ERROR "Could not find Asio library")
set(Asio_FOUND False)
set(Asio_FOUND FALSE)
else()
set(Asio_FOUND True)
# Add workaround for stupid eprosima_find_package()
set(Asio_FOUND TRUE)
set(ASIO_INCLUDE_DIR ${Asio_INCLUDE_DIR})
endif()

if(Asio_FOUND)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Asio
REQUIRED_VARS Asio_INCLUDE_DIR
)
REQUIRED_VARS Asio_INCLUDE_DIR)

if(NOT TARGET asio::asio)
set(Asio_INCLUDE_DIRS ${Asio_INCLUDE_DIR})

add_library(asio::asio INTERFACE IMPORTED)
set_target_properties(asio::asio PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Asio_INCLUDE_DIR}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
find_path(simpleini_INCLUDE_DIR
NAMES SimpleIni.h
PATHS
include
${CMAKE_SOURCE_DIR}/thirdparty/simpleini
)
HINTS
include
${CONAN_SIMPLEINI_ROOT}/include
${CMAKE_SOURCE_DIR}/thirdparty/simpleini
)

if(simpleini_INCLUDE_DIR-NOTFOUND)
message(FATAL_ERROR "Could not find simpleini library")
set(simpleini_FOUND False)
set(simpleini_FOUND FALSE)
else()
set(simpleini_FOUND True)
set(simpleini_FOUND TRUE)
endif()

if(simpleini_FOUND)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(simpleini
REQUIRED_VARS simpleini_INCLUDE_DIR
)
REQUIRED_VARS simpleini_INCLUDE_DIR)

if(NOT TARGET simpleini::simpleini)
set(simpleini_INCLUDE_DIRS ${simpleini_INCLUDE_DIR})

add_library(simpleini::simpleini INTERFACE IMPORTED)
set_target_properties(simpleini::simpleini PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${simpleini_INCLUDE_DIR})
mark_as_advanced(simpleini_INCLUDE_DIR)
endif()
endif()
endif()
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
find_path(tclap_INCLUDE_DIR
NAMES tclap/Arg.h
PATHS
include
${CMAKE_SOURCE_DIR}/thirdparty/tclap/include
)
HINTS
include
${CONAN_TCLAP_ROOT}/include
${CMAKE_SOURCE_DIR}/thirdparty/tclap/include
)

if(tclap_INCLUDE_DIR-NOTFOUND)
message(FATAL_ERROR "Could not find tclap library")
set(tclap_FOUND False)
set(tclap_FOUND FALSE)
else()
set(tclap_FOUND True)
set(tclap_FOUND TRUE)
endif()

if(tclap_FOUND)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(tclap
REQUIRED_VARS tclap_INCLUDE_DIR
)
REQUIRED_VARS tclap_INCLUDE_DIR)

if(NOT TARGET tclap::tclap)
set(tclap_INCLUDE_DIRS ${tclap_INCLUDE_DIR})

add_library(tclap::tclap INTERFACE IMPORTED)
set_target_properties(tclap::tclap PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${tclap_INCLUDE_DIR})
mark_as_advanced(tclap_INCLUDE_DIRS)
endif()
endif()
endif()
3 changes: 1 addition & 2 deletions cmake/eCALConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@ endif()

find_package(CMakeFunctions REQUIRED)

find_package(Protobuf REQUIRED)
create_targets_protobuf()
find_package(protobuf REQUIRED)
find_package(Threads REQUIRED)
13 changes: 13 additions & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[requires]
Qt/5.12.4@kwc_bintray/stable
protobuf/3.5.1@bincrafters/stable
protoc_installer/3.5.1@bincrafters/stable
spdlog/0.16.3@kwc_bintray/stable

tclap/1.2.2@kwc_bintray/stable
simpleini/4.17@kwc_bintray/stable
asio/1.14.0@kwc_bintray/stable
hdf5/1.8.21@kwc_bintray/stable

[generators]
cmake_paths
6 changes: 1 addition & 5 deletions contrib/ecalhdf5/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@

project(hdf5)

if (WIN32)
find_package(HDF5 COMPONENTS C NO_MODULE REQUIRED static)
else()
find_package(HDF5 COMPONENTS C REQUIRED)
endif()
find_package(HDF5 COMPONENTS C REQUIRED)

set(ecalhdf5_src
eh5_meas.cpp
Expand Down
2 changes: 0 additions & 2 deletions contrib/ecalproto/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# ========================= eCAL LICENSE =================================

find_package(Protobuf REQUIRED)
create_targets_protobuf()

project(proto)

Expand Down Expand Up @@ -45,7 +44,6 @@ target_include_directories(${PROJECT_NAME} PUBLIC
$<INSTALL_INTERFACE:include>
)

create_targets_protobuf()
target_link_libraries(${PROJECT_NAME} PUBLIC protobuf::libprotobuf)

ecal_install_library(${PROJECT_NAME})
Expand Down
1 change: 0 additions & 1 deletion ecal/pb/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
project(pb)

find_package(Protobuf REQUIRED)
create_targets_protobuf()

set(ProtoFiles
${CMAKE_CURRENT_SOURCE_DIR}/ecal/pb/ecal.proto
Expand Down
Loading

0 comments on commit d26eacc

Please sign in to comment.