
cmake_minimum_required(VERSION 3.5)
project(rt_service)

set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Find python and Boost - both are required dependencies
#find_package(Boost COMPONENTS filesystem chrono REQUIRED)
find_package(PythonLibs 3.10 REQUIRED)
find_package(Boost COMPONENTS python filesystem chrono REQUIRED)

# Without this, any build libraries automatically have names "lib{x}.so"
set(CMAKE_SHARED_MODULE_PREFIX "")

add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)


#set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
#set (CMAKE_RUNTIME_OUTPUT_DIRECTORY /home/markus/git/vrpmdvweb/vrpmdvserver/extensions/rt_service)



file( GLOB LIB_SOURCES .src/*.cpp )
file( GLOB LIB_HEADERS lib/*.h )

set (RTSERVICEINCLUDE ./include)

# Add a shared module - modules are intended to be imported at runtime.
# - This is where you add the source files
#add_library(rt_service MODULE ./src/rt_service.cpp ./src/monitoringTask/RTSMonitoringTask.cpp ./src/utilities/RelGILLock.cpp ./src/utilities/GILLock.cpp ./src/utilities/RTSCoproHelper.cpp ./src/utilities/RTSPyLogging.cpp ./src/monitoringTask/RTSResult.cpp ./src/monitoringTask/RTSErrResult.cpp)
add_library(rt_service MODULE ./src/rt_service.cpp ./src/monitoringTask/RTSMonFrame.cpp ./src/monitoringTask/RTSMonitoringTask.cpp ./src/utilities/RelGILLock.cpp ./src/utilities/GILLock.cpp ./src/utilities/RTSCoproHelper.cpp ./src/monitoringTask/RTSErrResult.cpp  ./src/monitoringTask/VibChannelDesc.cpp ./src/monitoringTask/VibSensorDesc.cpp)

# Set up the libraries and header search pathsfor this target
target_link_libraries(rt_service ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
target_include_directories(rt_service PRIVATE ${PYTHON_INCLUDE_DIRS} ${RTSERVICEINCLUDE})

set(MY_RESOURCE_FILE rt_service.so)
# install(TARGETS rt_service LIBRARY DESTINATION lib)

# install(TARGETS t tlib
#         RUNTIME DESTINATION bin
#         LIBRARY DESTINATION lib
# )
