Commit c4d04887 authored by fmg005's avatar fmg005

modified cmake files

parent e919be06
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)
endif()
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
message( STATUS "64 bits compiler detected" )
set( EX_CONFIG "" )
set(FIND_LIBRARY_USE_LIB64_PATHS ON)
else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
message( STATUS "32 bits compiler detected" )
set( EX_CONFIG "32" )
set(FIND_LIBRARY_USE_LIB64_PATHS OFF)
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
SET(CONFIGURATION)
if(WIN32)
set(CONFIGURATION ${CMAKE_CFG_INTDIR})
else()
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
set(CONFIGURATION ${CMAKE_BUILD_TYPE})
endif()
string(TOLOWER ${CONFIGURATION} CONFIGURATION)
set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo CACHE TYPE INTERNAL FORCE )
if(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Zi /Ob2 /Oi /Od /RTC1" CACHE TYPE INTERNAL FORCE)
endif()
if(MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wl,--kill-at -std=gnu++0x")#turn on C++11
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--kill-at")
endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11 -stdlib=libc++")
endif()
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11 ")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:\$ORIGIN")
endif()
include(prosim.cmake)
cmake_minimum_required(VERSION 3.9.4)
project(prosim_driver)
project(prosim)
# 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>)
#prosim depends on pulse this will call will give you access to pulse directories
#needed by clasim
find_package(Pulse REQUIRED NO_MODULE)
# for serial communication with the prosim hardware simulator
find_package(serial REQUIRED)
if(serial_FOUND)
message("Serial Found")
endif()
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/)
set(PUlSE_STATE_DIR ${Pulse_INSTALL}/bin/states/)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/results)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/logs)
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
main.cpp
example.cpp
SimulationEngine.cpp
)
add_executable(prosim_test ${my_srcs})
target_include_directories(prosim_test PRIVATE
add_executable(prosim ${my_srcs})
#include directories
target_include_directories(prosim PRIVATE
${serial_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(prosim_test optimized ${serial_LIBRARIES})
${CMAKE_CURRENT_SOURCE_DIR}/include
${Pulse_INCLUDE_DIRS}
${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)
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