From 9e2e1b653e9ba14ff1ff21498a7a218113d4ebe7 Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Thu, 16 Feb 2023 19:17:16 +0100 Subject: [PATCH 01/10] wip --- CMakeLists.txt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9dc901f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.15) +project(libmp4 VERSION 1.0) + +set(LIB_SOURCES + src/mp4.c + src/mp4_box_reader.c + src/mp4_box_writer.c + src/mp4_demux.c + src/mp4_mux.c + src/mp4_track.c +) + +add_library(mp4 ${LIB_SOURCES}) + +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + +target_include_directories(mp4 PUBLIC + $ + $ +) + +target_compile_definitions(mp4 PRIVATE "MP4_API_EXPORTS") +target_compile_options(mp4 PRIVATE "-fvisibility=hidden") +target_compile_options(mp4 PRIVATE "-std=gnu99") + +if(WIN32) + target_link_libraries(mp4 ws2_32) +endif() + +target_link_libraries(mp4 futils ulog) \ No newline at end of file From 5ebdbfc9c3da32d57311135cfc480ebcd917067a Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Sun, 26 Feb 2023 12:46:07 +0100 Subject: [PATCH 02/10] wip --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dc901f..867ce61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,9 @@ set(LIB_SOURCES add_library(mp4 ${LIB_SOURCES}) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) +set_target_properties(mp4 PROPERTIES + POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} +) target_include_directories(mp4 PUBLIC $ From 83919f3c2757d7a5fbde5b4f15ee46caffb2e2c7 Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Tue, 28 Feb 2023 10:05:36 +0100 Subject: [PATCH 03/10] updating the local CMakeLists.txt file From e0329c56caec915e2c64922a686975aaa478354f Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Wed, 1 Mar 2023 17:33:38 +0100 Subject: [PATCH 04/10] able to do correct install --- CMakeLists.txt | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dc901f..9206fca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,13 @@ cmake_minimum_required(VERSION 3.15) -project(libmp4 VERSION 1.0) +project(mp4 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/mp4.c @@ -10,21 +18,28 @@ set(LIB_SOURCES src/mp4_track.c ) -add_library(mp4 ${LIB_SOURCES}) +add_library(${PROJECT_NAME} ${LIB_SOURCES}) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) -target_include_directories(mp4 PUBLIC +target_include_directories(${PROJECT_NAME} PUBLIC $ $ ) -target_compile_definitions(mp4 PRIVATE "MP4_API_EXPORTS") -target_compile_options(mp4 PRIVATE "-fvisibility=hidden") -target_compile_options(mp4 PRIVATE "-std=gnu99") +target_compile_definitions(${PROJECT_NAME} PRIVATE "MP4_API_EXPORTS") +target_compile_options(${PROJECT_NAME} PRIVATE "-fvisibility=hidden") +target_compile_options(${PROJECT_NAME} PRIVATE "-std=gnu99") if(WIN32) - target_link_libraries(mp4 ws2_32) + target_link_libraries(${PROJECT_NAME} ws2_32) endif() -target_link_libraries(mp4 futils ulog) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} futils ulog) + +install(TARGETS ${PROJECT_NAME} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME} + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/ + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/ +) + From f2ac4c6c21abdeebd731df3777106a81c3a03a21 Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Wed, 1 Mar 2023 17:34:50 +0100 Subject: [PATCH 05/10] wip From d0b510ab4acba4e738cfe4558d9b49369ed335f1 Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Thu, 2 Mar 2023 15:57:58 +0100 Subject: [PATCH 06/10] moving rpath --- CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f668b3c..3110c4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,6 @@ cmake_minimum_required(VERSION 3.15) project(mp4 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/mp4.c @@ -20,6 +13,13 @@ 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(mp4 PROPERTIES POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} From 418f89b7582a0e28e356db401b0b4d29720ba7d6 Mon Sep 17 00:00:00 2001 From: Oscar Sjoberg Date: Thu, 2 Mar 2023 16:05:30 +0100 Subject: [PATCH 07/10] correcting cmake From a5112be8cbf2dd9698596f84da948f62e68a27b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Sj=C3=B6berg?= Date: Fri, 3 Mar 2023 11:22:37 +0100 Subject: [PATCH 08/10] pulling correct dll when installing windows --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3110c4d..c488c7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,8 +41,10 @@ endif() target_link_libraries(${PROJECT_NAME} futils ulog) install(TARGETS ${PROJECT_NAME} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME} - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/ - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/ + EXPORT ${PROJECT_NAME}-targets + PUBLIC_HEADER DESTINATION include + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin ) From 1e552f4c73b5fda238bc4ddfdb300c89bad8e02a 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 09/10] pulling correct dll when installing windows From 498bd44bfc380bdad5c1e1ee43189b00f561917a Mon Sep 17 00:00:00 2001 From: Andreas Viborg Date: Tue, 14 Mar 2023 09:27:18 +0100 Subject: [PATCH 10/10] use shared libs --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c488c7e..c12699d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ set(LIB_SOURCES src/mp4_track.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 @@ else() endif() option(BUILD_SHARED_LIBS "Build using shared libraries" ON) -set_target_properties(mp4 PROPERTIES +set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} )