Commit c00a3922 authored by fmg005's avatar fmg005

Automatically download serial library(dependency)

parent d55e10e6
cmake_minimum_required(VERSION 3.9.4)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "Install location")
# set(CMAKE_PREFIX_PATH /home/farooq/Programming/pulse/builds/install CACHE PATH FORCE)
# Policy to address @foo@ variable expansion
if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
......
cmake_minimum_required(VERSION 3.9.4)
project(prosim)
project(serial2_tut)
# Download Dependency: serial library for talking to the hardware simulator
include(ExternalProject)
ExternalProject_Add( serial
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/serial
GIT_REPOSITORY https://github.com/wjwwood/serial.git
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/serial/build
UPDATE_COMMAND ""
BUILD_COMMAND make
INSTALL_COMMAND make install
INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/serial"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=<INSTALL_DIR>
)
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)
# 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>)
......@@ -10,9 +29,6 @@ find_library(CONFIG++_LIBRARY NAMES libconfig++.a PATH <libconfig++.a location>)
#needed by prosim
find_package(Pulse REQUIRED NO_MODULE)
# for serial communication with the prosim hardware simulator
find_package(serial REQUIRED)
set(PROSIM_CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources/)
set(PROSIM_RESULTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/results/)
set(PROSIM_LOGS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/logs/)
......@@ -25,29 +41,26 @@ configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/configure_prosim_paths.h.in
${CMAKE_CURRENT_SOURCE_DIR}/include/configure_prosim_paths.h
)
set( my_srcs
HardwareSimulator.cpp
CLA_Logger.cpp
example.cpp
# SimulationEngine.cpp
#example.cpp
SimulationEngine.cpp
)
add_executable(prosim ${my_srcs})
#include directories
target_include_directories(prosim PRIVATE
${serial_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/include
${install_dir}/include
${Pulse_INCLUDE_DIRS}
${CONFIG++_INCLUDE_DIR}
)
${CONFIG++_INCLUDE_DIR})
#libraries
target_link_libraries(prosim debug "${Pulse_DEBUG_LIBS}")
target_link_libraries(prosim optimized
${serial_LIBRARIES}
${Pulse_LIBS}
${CONFIG++_LIBRARY})
install(TARGETS prosim RUNTIME DESTINATION ${Pulse_INSTALL}/bin)
${CONFIG++_LIBRARY}
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