Commit 5f490493 authored by fmg005's avatar fmg005

Automatically download and build dependecies

parent 52acf6a6
......@@ -49,4 +49,4 @@ if(UNIX)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:\$ORIGIN")
endif()
include(prosim.cmake)
include(prosim4.cmake)
......@@ -2,17 +2,17 @@ cmake_minimum_required(VERSION 3.9.4)
project(cla_prosim)
# Download, build and install Dependency: serial library for
# Download, build and install Dependency: serial library for
# talking to the hardware simulator
include(ExternalProject)
ExternalProject_Add( serial
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/serial
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/serial
GIT_REPOSITORY https://github.com/wjwwood/serial.git
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/serial/build
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty//serial/build
UPDATE_COMMAND ""
BUILD_COMMAND make
INSTALL_COMMAND make install
INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/serial"
INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/serial"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=<INSTALL_DIR>
)
......@@ -21,11 +21,25 @@ ExternalProject_Get_Property(serial install_dir)
add_library(libserial SHARED IMPORTED)
set_target_properties(libserial PROPERTIES IMPORTED_LOCATION ${install_dir}/lib/libserial.so)
add_dependencies(libserial serial)
set(serial_INCLUDE_DIR ${install_dir}/include)
# use dpkg -L libconfig++-dev to find the location of libconfig.h++ and libconfig++.a
find_path(CONFIG++_INCLUDE_DIR libconfig.h++ <libconfig.h++ location>)
find_library(CONFIG++_LIBRARY NAMES libconfig++.a PATH <libconfig++.a location>)
#--------------------------------------------------------------------------------
ExternalProject_Add( libconfig
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libconfig
GIT_REPOSITORY "https://github.com/hyperrealm/libconfig.git"
UPDATE_COMMAND ""
INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libconfig"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=<INSTALL_DIR>
)
ExternalProject_Get_Property(libconfig install_dir)
add_library(libconfig++ SHARED IMPORTED)
set_target_properties(libconfig++ PROPERTIES IMPORTED_LOCATION ${install_dir}/lib/liblibconfig++.so)
add_dependencies(libconfig++ libconfig)
set(libconfig++_INCLUDE_DIR ${install_dir}/include)
#--------------------------------------------------------------------------------
#prosim depends on pulse this will call will give you access to pulse directories
#needed by prosim
find_package(Pulse REQUIRED NO_MODULE)
......@@ -54,14 +68,14 @@ add_executable(prosim ${my_srcs})
#include directories
target_include_directories(prosim PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
${install_dir}/include
${serial_INCLUDE_DIR}
${Pulse_INCLUDE_DIRS}
${CONFIG++_INCLUDE_DIR})
${libconfig++_INCLUDE_DIR})
#libraries
target_link_libraries(prosim debug "${Pulse_DEBUG_LIBS}")
target_link_libraries(prosim optimized
${Pulse_LIBS}
${CONFIG++_LIBRARY}
libconfig++
libserial)
install(TARGETS prosim DESTINATION ${Pulse_INSTALL}/bin)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment