Commit bc80a1a6 authored by Andreas Schmidt's avatar Andreas Schmidt

+= CMake install as static and shared library

parent a4801866
Pipeline #3254 failed with stages
in 1 minute and 13 seconds
......@@ -36,4 +36,4 @@ if(PRRT_TESTS)
endif()
add_custom_target(perftest COMMAND python3 tests/eval.py)
add_custom_target(memtest COMMAND bash ./memtest.sh DEPENDS sender receiver)
add_custom_target(memtest COMMAND bash ./memtest.sh DEPENDS sender receiver)
\ No newline at end of file
......@@ -25,11 +25,14 @@ add_executable(receiver receiver.c)
add_executable(time-sender time-sender.c)
add_executable(time-receiver time-receiver.c)
target_link_libraries(sender LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(receiver LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(sender LINK_PUBLIC prrt_shared prrtUtil_shared ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(receiver LINK_PUBLIC prrt_shared prrtUtil_shared ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(time-sender LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(time-receiver LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(time-sender LINK_PUBLIC prrt_shared prrtUtil_shared ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(time-receiver LINK_PUBLIC prrt_shared prrtUtil_shared ${CMAKE_THREAD_LIBS_INIT})
add_executable(refcount refcount.c)
target_link_libraries(refcount LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(refcount LINK_PUBLIC prrt_shared prrtUtil_shared ${CMAKE_THREAD_LIBS_INIT})
install(DIRECTORY ./ DESTINATION include/prrt
FILES_MATCHING PATTERN "*.h")
\ No newline at end of file
......@@ -26,6 +26,19 @@ if (XLAP)
set(PRRT_SOURCES ${PRRT_SOURCES} ../xlap/xlap.c ../xlap/xlap.h)
endif()
add_library(PRRT ${PRRT_SOURCES})
add_library(prrt_obj OBJECT ${PRRT_SOURCES})
set_property(TARGET prrt_obj PROPERTY POSITION_INDEPENDENT_CODE 1)
target_link_libraries(PRRT rt)
add_library(prrt_static STATIC $<TARGET_OBJECTS:prrt_obj>)
target_link_libraries(prrt_static rt)
set_target_properties(prrt_static PROPERTIES OUTPUT_NAME "prrt")
add_library(prrt_shared SHARED $<TARGET_OBJECTS:prrt_obj>)
target_link_libraries(prrt_shared rt)
set_target_properties(prrt_shared PROPERTIES OUTPUT_NAME "prrt")
install(TARGETS prrt_static prrt_shared
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
add_library(UTIL ../defines.h
set (UTIL_SOURCES ../defines.h
common.c common.h
list.c list.h
pipe.c pipe.h
dbg.h
bptree.c bptree.h
bitmap.c bitmap.h
mpsc_queue.c mpsc_queue.h
time.c time.h
mpsc_queue.c mpsc_queue.h
windowedFilter.c windowedFilter.h)
set_property(TARGET UTIL PROPERTY C_STANDARD 99)
target_link_libraries(UTIL ${M_LIB})
add_library(prrtUtil_obj OBJECT ${UTIL_SOURCES})
set_property(TARGET prrtUtil_obj PROPERTY C_STANDARD 99)
add_library(prrtUtil_shared SHARED $<TARGET_OBJECTS:prrtUtil_obj>)
set_target_properties(prrtUtil_shared PROPERTIES OUTPUT_NAME "prrtUtil")
add_library(prrtUtil_static SHARED $<TARGET_OBJECTS:prrtUtil_obj>)
set_target_properties(prrtUtil_static PROPERTIES OUTPUT_NAME "prrtUtil")
target_link_libraries(prrtUtil_shared ${M_LIB})
target_link_libraries(prrtUtil_static ${M_LIB})
install(TARGETS prrtUtil_shared prrtUtil_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
......@@ -2,4 +2,4 @@ add_subdirectory(lib/gtest-1.8.0)
include_directories(SYSTEM ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
add_executable(prrtTests common.h util_tests.cpp bitmap_tests.cpp receptionTable_tests.cpp delivered_packet_table_tests.cpp bptree_tests.cpp PrrtBlock_tests.cpp)
target_link_libraries(prrtTests LINK_PUBLIC gtest PRRT UTIL gtest_main)
\ No newline at end of file
target_link_libraries(prrtTests LINK_PUBLIC gtest prrt_shared prrtUtil_shared gtest_main)
\ No newline at end of file
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