From 3285c9b2fb95108ec13461e1354ac60a54f4bf8a Mon Sep 17 00:00:00 2001 From: AndreasV Date: Tue, 14 Feb 2023 21:40:43 +0100 Subject: [PATCH 01/15] wip --- CMakeLists.txt | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..552f22c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.15) +project(libpomp VERSION 1.0) + +set(LIBS pthread) + +set(LIB_SOURCES + src/pomp_addr.c + src/pomp_buffer.c + src/pomp_conn.c + src/pomp_ctx.c + src/pomp_decoder.c + src/pomp_encoder.c + src/pomp_evt.c + src/pomp_log.c + src/pomp_loop.c + src/pomp_msg.c + src/pomp_prot.c + src/pomp_watchdog.c + src/pomp_timer.c +) + +add_library(pomp ${LIB_SOURCES}) + +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + +target_include_directories(pomp PUBLIC + $ + $ +) +# define the symbol stating we are using the declspec(dllexport) when +# building on windows +target_compile_definitions(pomp PRIVATE "POMP_API_EXPORTS") +target_compile_options(pomp PRIVATE "-fvisibility=hidden") + +if(WIN32) + target_link_libraries(pomp ws2_32) +endif() +target_link_libraries(pomp ${LIBS}) + +# state that libpomp need PIC when the default is shared libraries +set_target_properties(pomp PROPERTIES + POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} +) \ No newline at end of file From add34a8f8b23022fb4abf1df8b906993fb8340ca Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Sun, 26 Feb 2023 12:46:18 +0100 Subject: [PATCH 02/15] wip --- CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 552f22c..2a917cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,9 @@ set(LIB_SOURCES add_library(pomp ${LIB_SOURCES}) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) +set_target_properties(pomp PROPERTIES + POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} +) target_include_directories(pomp PUBLIC $ @@ -35,9 +38,4 @@ target_compile_options(pomp PRIVATE "-fvisibility=hidden") if(WIN32) target_link_libraries(pomp ws2_32) endif() -target_link_libraries(pomp ${LIBS}) - -# state that libpomp need PIC when the default is shared libraries -set_target_properties(pomp PROPERTIES - POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} -) \ No newline at end of file +target_link_libraries(pomp ${LIBS}) \ No newline at end of file From 723760585124a311126261a133df8b50515d9ec6 Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Tue, 28 Feb 2023 10:05:36 +0100 Subject: [PATCH 03/15] updating the local CMakeLists.txt file --- CMakeLists.txt | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 552f22c..a7f6814 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.15) -project(libpomp VERSION 1.0) +project(pomp VERSION 1.0) -set(LIBS pthread) +set(LIBS pthread rt) set(LIB_SOURCES src/pomp_addr.c @@ -19,25 +19,32 @@ set(LIB_SOURCES src/pomp_timer.c ) -add_library(pomp ${LIB_SOURCES}) +add_library(${PROJECT_NAME} ${LIB_SOURCES}) + option(BUILD_SHARED_LIBS "Build using shared libraries" ON) -target_include_directories(pomp PUBLIC +target_include_directories(${PROJECT_NAME} PUBLIC $ $ ) # define the symbol stating we are using the declspec(dllexport) when # building on windows -target_compile_definitions(pomp PRIVATE "POMP_API_EXPORTS") -target_compile_options(pomp PRIVATE "-fvisibility=hidden") +target_compile_definitions(${PROJECT_NAME} PRIVATE "POMP_API_EXPORTS") +target_compile_options(${PROJECT_NAME} PRIVATE "-fvisibility=hidden") if(WIN32) - target_link_libraries(pomp ws2_32) + target_link_libraries(${PROJECT_NAME} ws2_32) endif() -target_link_libraries(pomp ${LIBS}) +target_link_libraries(${PROJECT_NAME} ${LIBS}) + +# state that lib${PROJECT_NAME} need PIC when the default is shared libraries +set_target_properties(${PROJECT_NAME} PROPERTIES + POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} +) -# state that libpomp need PIC when the default is shared libraries -set_target_properties(pomp PROPERTIES - POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} -) \ No newline at end of file +install(TARGETS ${PROJECT_NAME} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME} + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME} + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME} +) From 39466adbfe60800ff201c184cdf1d24799ccd362 Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Tue, 28 Feb 2023 12:11:05 +0100 Subject: [PATCH 04/15] wip --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a917cb..632ccd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.15) project(libpomp VERSION 1.0) -set(LIBS pthread) +set(LIBS ) set(LIB_SOURCES src/pomp_addr.c @@ -36,6 +36,9 @@ target_compile_definitions(pomp PRIVATE "POMP_API_EXPORTS") target_compile_options(pomp PRIVATE "-fvisibility=hidden") if(WIN32) - target_link_libraries(pomp ws2_32) + target_link_libraries(pomp PRIVATE ws2_32) endif() -target_link_libraries(pomp ${LIBS}) \ No newline at end of file +target_link_libraries(pomp PRIVATE + pthread + rt +) \ No newline at end of file From 0e028d1cf456745458aacf99c6f94c855793d29d Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Wed, 1 Mar 2023 17:33:38 +0100 Subject: [PATCH 05/15] able to do correct install --- CMakeLists.txt | 29 +++++++++++++++++++++++++---- atom.mk | 1 + 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7f6814..4b4ef2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,13 @@ cmake_minimum_required(VERSION 3.15) project(pomp VERSION 1.0) +# checks if set up rpath exists for install +if(COMMAND set_up_rpath) + set_up_rpath() +else() + message("Set up rpath not defined!") +endif() + set(LIBS pthread rt) set(LIB_SOURCES @@ -36,7 +43,12 @@ target_compile_options(${PROJECT_NAME} PRIVATE "-fvisibility=hidden") if(WIN32) target_link_libraries(${PROJECT_NAME} ws2_32) endif() -target_link_libraries(${PROJECT_NAME} ${LIBS}) + +# target_link_libraries(${PROJECT_NAME} ${LIBS}) + +set(${PROJECT_NAME}-headers + ${PROJECT_SOURCE_DIR}/include/ +) # state that lib${PROJECT_NAME} need PIC when the default is shared libraries set_target_properties(${PROJECT_NAME} PROPERTIES @@ -44,7 +56,16 @@ set_target_properties(${PROJECT_NAME} PROPERTIES ) install(TARGETS ${PROJECT_NAME} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME} - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME} - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin ) + +# to get all header files correctly +# directly in include due to reasons + +install( + DIRECTORY ${${PROJECT_NAME}-headers} DESTINATION include/ +) + diff --git a/atom.mk b/atom.mk index f43996e..9035791 100644 --- a/atom.mk +++ b/atom.mk @@ -49,6 +49,7 @@ ifeq ("$(TARGET_OS_FLAVOUR)","android") LOCAL_LDLIBS += -llog endif + LOCAL_DOXYFILE := Doxyfile include $(BUILD_LIBRARY) From edc79090093d11e68fb51da629aa2de6690a6886 Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Wed, 1 Mar 2023 17:34:50 +0100 Subject: [PATCH 06/15] wip From 7dbabb9e8cf12fd4054be0cbf8dbe04639f95923 Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Thu, 2 Mar 2023 08:13:52 +0100 Subject: [PATCH 07/15] wip --- CMakeLists.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 632ccd7..2c1f158 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.15) project(libpomp VERSION 1.0) -set(LIBS ) - set(LIB_SOURCES src/pomp_addr.c src/pomp_buffer.c @@ -37,8 +35,7 @@ target_compile_options(pomp PRIVATE "-fvisibility=hidden") if(WIN32) target_link_libraries(pomp PRIVATE ws2_32) +else() + target_link_libraries(pomp PRIVATE rt) endif() -target_link_libraries(pomp PRIVATE - pthread - rt -) \ No newline at end of file +target_link_libraries(pomp PRIVATE pthread ) \ No newline at end of file From ddcb1e8bd5e85b173d016c6c678788655a29a943 Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Thu, 2 Mar 2023 15:57:59 +0100 Subject: [PATCH 08/15] moving rpath --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c05268..76760dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,6 @@ cmake_minimum_required(VERSION 3.15) project(pomp VERSION 1.0) -# checks if set up rpath exists for install -if(COMMAND set_up_rpath) - set_up_rpath() -else() - message("Set up rpath not defined!") -endif() list(APPEND LIBS pthread rt) @@ -28,6 +22,12 @@ set(LIB_SOURCES add_library(${PROJECT_NAME} ${LIB_SOURCES}) +# checks if set up rpath exists for install +if(COMMAND set_up_rpath) + set_up_rpath() +else() + message("Set up rpath not defined!") +endif() option(BUILD_SHARED_LIBS "Build using shared libraries" ON) set_target_properties(${PROJECT_NAME} PROPERTIES From 380c07c7b41ba76ed7e33746784c212c7c22cdc8 Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Thu, 2 Mar 2023 16:05:31 +0100 Subject: [PATCH 09/15] correcting cmake From 378e00aed3ac93cff19dc24be8811d072a05794a Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Thu, 2 Mar 2023 17:20:15 +0100 Subject: [PATCH 10/15] wip --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c1f158..83551be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,4 +38,4 @@ if(WIN32) else() target_link_libraries(pomp PRIVATE rt) endif() -target_link_libraries(pomp PRIVATE pthread ) \ No newline at end of file +#target_link_libraries(pomp PRIVATE pthread) \ No newline at end of file From 157e89c107a89ecf316b8bfdfc7c13efc5bd0f93 Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Thu, 2 Mar 2023 18:07:53 +0100 Subject: [PATCH 11/15] wip --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b4ef2a..21a6ee3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ else() message("Set up rpath not defined!") endif() -set(LIBS pthread rt) +set(LIBS pthread) set(LIB_SOURCES src/pomp_addr.c @@ -42,6 +42,8 @@ target_compile_options(${PROJECT_NAME} PRIVATE "-fvisibility=hidden") if(WIN32) target_link_libraries(${PROJECT_NAME} ws2_32) +else() +target_link_libraries(${PROJECT_NAME} rt) endif() # target_link_libraries(${PROJECT_NAME} ${LIBS}) From 7cda891d2374395334c302da3b2ef962dc327875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Sj=C3=B6berg?= Date: Fri, 3 Mar 2023 11:22:38 +0100 Subject: [PATCH 12/15] pulling correct dll when installing windows From c42ae49da674a1336ead37e3a7ddf06768c9f80e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Sj=C3=B6berg?= Date: Fri, 3 Mar 2023 11:59:49 +0100 Subject: [PATCH 13/15] pulling correct dll when installing windows From a1326c103d95b0084de02d2c5490bfce6eca20f1 Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Tue, 7 Mar 2023 10:00:23 +0100 Subject: [PATCH 14/15] export all symbols --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94aff9d..dabb015 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ target_compile_options(${PROJECT_NAME} PRIVATE "-fvisibility=hidden") if(WIN32) list(APPEND LIBS ws2_32) + target_link_options(${PROJECT_NAME} PUBLIC "-Wl,--export-all-symbols") else() list(APPEND LIBS rt) endif() From 0b04e4deb2f4c632812559945495b31d9f982910 Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Tue, 14 Mar 2023 09:27:11 +0100 Subject: [PATCH 15/15] use shared libs --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dabb015..11d1967 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ set(LIB_SOURCES src/pomp_timer.c ) -add_library(${PROJECT_NAME} ${LIB_SOURCES}) +add_library(${PROJECT_NAME} SHARED ${LIB_SOURCES}) # checks if set up rpath exists for install if(COMMAND set_up_rpath) @@ -72,6 +72,6 @@ install(TARGETS ${PROJECT_NAME} # to get all header files correctly # directly in include due to reasons install( - DIRECTORY ${${PROJECT_NAME}-headers} DESTINATION include/ + DIRECTORY ${${PROJECT_NAME}-headers} DESTINATION include )