From 9772de139a46fbca042184dfa2e21c8d3c0d7cdc Mon Sep 17 00:00:00 2001 From: AndreasV Date: Tue, 14 Feb 2023 21:41:10 +0100 Subject: [PATCH 01/15] wip --- CMakeLists.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..47d04d9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.15) +project(libvideo-defs VERSION 1.0) + +set(LIB_SOURCES + src/vdefs.c + src/vdefs_formats.c + src/vdefs_json.c + src/vdefs_params.c +) + +add_library(video-defs ${LIB_SOURCES}) +add_library(video-defs_compiler_flags INTERFACE) +target_compile_features(video-defs_compiler_flags INTERFACE cxx_std_11) + +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + +target_include_directories(video-defs PUBLIC + $ + $ +) + +target_compile_definitions(video-defs PRIVATE "VDEF_API_EXPORTS") +target_compile_definitions(video-defs PRIVATE "_GNU_SOURCE") + + +find_package(json-c CONFIG REQUIRED) +target_link_libraries(video-defs PRIVATE json-c::json-c json-c::json-c-static) +target_link_libraries(video-defs PRIVATE ulog h264 h265 video-defs_compiler_flags) \ No newline at end of file From e2e6d81440581a960861894956f80cc0891418e6 Mon Sep 17 00:00:00 2001 From: AndreasV Date: Wed, 15 Feb 2023 21:57:02 +0100 Subject: [PATCH 02/15] wip --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47d04d9..1b1c09b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,5 +24,5 @@ target_compile_definitions(video-defs PRIVATE "_GNU_SOURCE") find_package(json-c CONFIG REQUIRED) -target_link_libraries(video-defs PRIVATE json-c::json-c json-c::json-c-static) -target_link_libraries(video-defs PRIVATE ulog h264 h265 video-defs_compiler_flags) \ No newline at end of file +target_link_libraries(video-defs PUBLIC json-c::json-c json-c::json-c-static) +target_link_libraries(video-defs PUBLIC ulog h264 h265 video-defs_compiler_flags) \ No newline at end of file From aaaf1b052ca32996f2647a3d66a026c1358bf313 Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Sun, 26 Feb 2023 12:47:52 +0100 Subject: [PATCH 03/15] wip --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b1c09b..d2db87b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,9 @@ add_library(video-defs_compiler_flags INTERFACE) target_compile_features(video-defs_compiler_flags INTERFACE cxx_std_11) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) +set_target_properties(video-defs PROPERTIES + POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} +) target_include_directories(video-defs PUBLIC $ @@ -24,5 +27,5 @@ target_compile_definitions(video-defs PRIVATE "_GNU_SOURCE") find_package(json-c CONFIG REQUIRED) -target_link_libraries(video-defs PUBLIC json-c::json-c json-c::json-c-static) +target_link_libraries(video-defs PUBLIC json-c::json-c) target_link_libraries(video-defs PUBLIC ulog h264 h265 video-defs_compiler_flags) \ No newline at end of file From d79363fcd52040da6f09d1fb8a98608d8bfb18c7 Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Tue, 28 Feb 2023 10:05:36 +0100 Subject: [PATCH 04/15] updating the local CMakeLists.txt file --- CMakeLists.txt | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b1c09b..c44258b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.15) -project(libvideo-defs VERSION 1.0) +project(video-defs VERSION 1.0) set(LIB_SOURCES src/vdefs.c @@ -8,21 +8,31 @@ set(LIB_SOURCES src/vdefs_params.c ) -add_library(video-defs ${LIB_SOURCES}) -add_library(video-defs_compiler_flags INTERFACE) -target_compile_features(video-defs_compiler_flags INTERFACE cxx_std_11) +add_library(${PROJECT_NAME} ${LIB_SOURCES}) +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_11) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) -target_include_directories(video-defs PUBLIC +target_include_directories(${PROJECT_NAME} PUBLIC $ $ ) -target_compile_definitions(video-defs PRIVATE "VDEF_API_EXPORTS") -target_compile_definitions(video-defs PRIVATE "_GNU_SOURCE") +target_compile_definitions(${PROJECT_NAME} PRIVATE "VDEF_API_EXPORTS") +target_compile_definitions(${PROJECT_NAME} PRIVATE "_GNU_SOURCE") find_package(json-c CONFIG REQUIRED) -target_link_libraries(video-defs PUBLIC json-c::json-c json-c::json-c-static) -target_link_libraries(video-defs PUBLIC ulog h264 h265 video-defs_compiler_flags) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} PUBLIC + json-c::json-c + json-c::json-c-static + ulog + h264 + h265 + ) + +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 7504fca13192e719b718b988912b3514aaab28aa Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Wed, 1 Mar 2023 17:33:40 +0100 Subject: [PATCH 05/15] able to do correct install --- CMakeLists.txt | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c44258b..7373b7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,14 @@ cmake_minimum_required(VERSION 3.15) project(video-defs 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(LIB_SOURCES src/vdefs.c src/vdefs_formats.c @@ -23,16 +31,22 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "_GNU_SOURCE") find_package(json-c CONFIG REQUIRED) -target_link_libraries(${PROJECT_NAME} PUBLIC + +target_link_libraries(${PROJECT_NAME} + PRIVATE json-c::json-c json-c::json-c-static ulog + + PUBLIC h264 h265 + ) 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 + ) From 67b5f4735d70575139fe92b1e52be201e64ca9aa Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Wed, 1 Mar 2023 17:34:51 +0100 Subject: [PATCH 06/15] wip From b9ca4a5d33d0b4fd730c5d316921e3130c29d0ab Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Thu, 2 Mar 2023 15:58:01 +0100 Subject: [PATCH 07/15] moving rpath --- CMakeLists.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5530a9e..3b6d982 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,6 @@ cmake_minimum_required(VERSION 3.15) project(video-defs 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(LIB_SOURCES src/vdefs.c @@ -17,6 +10,14 @@ 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() + target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_11) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) From 62935873f7b7003450d8e001210118cad1550abf Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Thu, 2 Mar 2023 16:05:31 +0100 Subject: [PATCH 08/15] correcting cmake From febc029a70960f71c2423b7d0066f9a9c33bec53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Sj=C3=B6berg?= Date: Fri, 3 Mar 2023 11:22:41 +0100 Subject: [PATCH 09/15] pulling correct dll when installing windows From b121503ff9da578fed53783e86db57bfb719d781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Sj=C3=B6berg?= Date: Fri, 3 Mar 2023 11:59:53 +0100 Subject: [PATCH 10/15] pulling correct dll when installing windows From c8fdb7c8ff82c63b2f1a4e9c266df14e1a4b540d Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Mon, 6 Mar 2023 21:03:36 +0100 Subject: [PATCH 11/15] linux fix --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b6d982..6d1dce0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,6 @@ find_package(json-c CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE json-c::json-c - json-c::json-c-static ulog PUBLIC From 0630b76833231c4b63ea3a2dc50187bf01df859d Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Tue, 14 Mar 2023 09:26:19 +0100 Subject: [PATCH 12/15] use shared libs --- CMakeLists.txt | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d1dce0..5e3c3c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ set(LIB_SOURCES src/vdefs_params.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) @@ -21,7 +21,7 @@ endif() target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_11) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) -set_target_properties(video-defs PROPERTIES +set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} ) @@ -37,15 +37,45 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "_GNU_SOURCE") find_package(json-c CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} - PRIVATE - json-c::json-c - ulog + PRIVATE + json-c::json-c + ulog + PUBLIC + h264 + h265 + ) - PUBLIC - h264 - h265 +# to get all header files correctly +set(${PROJECT_NAME}-headers + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/ +) +install( + DIRECTORY ${${PROJECT_NAME}-headers} DESTINATION include/${PROJECT_NAME} +) - ) +if(WIN32) + install(CODE "file(GLOB dll_files \"${CMAKE_CURRENT_BINARY_DIR}/*.dll\")") + install(CODE "file(INSTALL DESTINATION \"\$\{CMAKE_INSTALL_PREFIX\}/bin\" TYPE SHARED_LIBRARY FILES \$\{dll_files\})") +else() + install(CODE "set(DEPENDENCY_PATHS \"\$\\")") + install(CODE [[ + file(GET_RUNTIME_DEPENDENCIES + LIBRARIES $ + RESOLVED_DEPENDENCIES_VAR _r_deps + UNRESOLVED_DEPENDENCIES_VAR _u_deps + DIRECTORIES ${DEPENDENCY_PATHS} + ) + foreach(_file ${_r_deps}) + file(INSTALL + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" + TYPE SHARED_LIBRARY + FOLLOW_SYMLINK_CHAIN + FILES "${_file}" + ) + endforeach() + list(LENGTH _u_deps _u_length) + ]]) +endif() install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets From e8bf3df8f9afcc136d10ab876494667395af9bc2 Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Tue, 14 Mar 2023 14:09:14 +0100 Subject: [PATCH 13/15] fix system lib exclusion --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e3c3c5..5f6a5f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ else() RESOLVED_DEPENDENCIES_VAR _r_deps UNRESOLVED_DEPENDENCIES_VAR _u_deps DIRECTORIES ${DEPENDENCY_PATHS} + POST_EXCLUDE_REGEXES "^/lib" "^/usr/lib" ) foreach(_file ${_r_deps}) file(INSTALL From 954b20fc5c114c7072ae12252959951e479216e3 Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Thu, 16 Mar 2023 15:41:43 +0100 Subject: [PATCH 14/15] fix debug dependency --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f6a5f7..d16cee4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,13 +57,11 @@ if(WIN32) install(CODE "file(GLOB dll_files \"${CMAKE_CURRENT_BINARY_DIR}/*.dll\")") install(CODE "file(INSTALL DESTINATION \"\$\{CMAKE_INSTALL_PREFIX\}/bin\" TYPE SHARED_LIBRARY FILES \$\{dll_files\})") else() - install(CODE "set(DEPENDENCY_PATHS \"\$\\")") install(CODE [[ file(GET_RUNTIME_DEPENDENCIES LIBRARIES $ RESOLVED_DEPENDENCIES_VAR _r_deps UNRESOLVED_DEPENDENCIES_VAR _u_deps - DIRECTORIES ${DEPENDENCY_PATHS} POST_EXCLUDE_REGEXES "^/lib" "^/usr/lib" ) foreach(_file ${_r_deps}) From 51b27c16a22a20e2639cdf1de37a899231a58ddb Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Tue, 21 Mar 2023 13:11:01 +0100 Subject: [PATCH 15/15] dll fixes --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d16cee4..0abbe30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,6 @@ else() FILES "${_file}" ) endforeach() - list(LENGTH _u_deps _u_length) ]]) endif()