From 12a691583ecf0d00d5e84c91e89348399be76605 Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Fri, 19 Jan 2024 09:49:15 +0100 Subject: [PATCH 01/13] Link libkvazaar to libm --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9bb4546..5b432d8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,6 +231,7 @@ else() set(EXTRA_LIBS ${EXTRA_LIBS} ${CMAKE_BINARY_DIR}/lib/libcryptopp.a) endif () + target_link_libraries(kvazaar PUBLIC ${EXTRA_LIBS}) target_link_libraries(kvazaar-bin PUBLIC ${EXTRA_LIBS} ) endif() From 0802a0dd9c1c9352a337db35f13648588ae49268 Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Fri, 19 Jan 2024 09:52:24 +0100 Subject: [PATCH 02/13] Fix lib installation paths --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b432d8a..86e862a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,7 @@ if (USE_CRYPTO) endif () if(KVZ_BUILD_SHARED_LIBS) - list( APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" "./" "../lib" ) + list( APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "./" "../lib" ) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) add_library(kvazaar SHARED ${LIB_SOURCES}) else() @@ -282,9 +282,9 @@ source_group( "" FILES ${SOURCE_GROUP_TOPLEVEL}) # ToDo: make configurable -install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pkgconfig) +install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig) install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) +install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) if(KVZ_BUILD_SHARED_LIBS) # Just add the lib to the bin directory for now if(MSVC) install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) From ecbc1a408afd77b40bf041690027a55a4ffee096 Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Fri, 19 Jan 2024 09:53:19 +0100 Subject: [PATCH 03/13] Fix man installation path --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86e862a1..f8775fbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -291,7 +291,7 @@ if(KVZ_BUILD_SHARED_LIBS) # Just add the lib to the bin directory for now endif() endif() install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include) -install(FILES ${PROJECT_SOURCE_DIR}/doc/kvazaar.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man) +install(FILES ${PROJECT_SOURCE_DIR}/doc/kvazaar.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1) IF(UNIX) # DIST From ebbdaac8375a4ccc5d14cc95a9ce7faf0d0fcf11 Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Fri, 19 Jan 2024 14:18:11 +0100 Subject: [PATCH 04/13] Use newer cmake macro for libdir --- CMakeLists.txt | 6 +++--- src/kvazaarCMake.pc.in | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8775fbd..f7eebc4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,7 @@ if (USE_CRYPTO) endif () if(KVZ_BUILD_SHARED_LIBS) - list( APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "./" "../lib" ) + list( APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" "./" "../lib" ) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) add_library(kvazaar SHARED ${LIB_SOURCES}) else() @@ -282,9 +282,9 @@ source_group( "" FILES ${SOURCE_GROUP_TOPLEVEL}) # ToDo: make configurable -install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig) +install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) +install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) if(KVZ_BUILD_SHARED_LIBS) # Just add the lib to the bin directory for now if(MSVC) install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) diff --git a/src/kvazaarCMake.pc.in b/src/kvazaarCMake.pc.in index 73c49416..60aeca5e 100644 --- a/src/kvazaarCMake.pc.in +++ b/src/kvazaarCMake.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${prefix}/lib +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ incdir=${prefix}/include Name: libkvazaar From 1492496fbffd91c28f9be7719441028a90269fd8 Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Fri, 19 Jan 2024 15:43:14 +0100 Subject: [PATCH 05/13] Use CMAKE_INSTALL_FULL_LIBDIR --- CMakeLists.txt | 6 +++--- src/kvazaarCMake.pc.in | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7eebc4f..55b096d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,7 @@ if (USE_CRYPTO) endif () if(KVZ_BUILD_SHARED_LIBS) - list( APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" "./" "../lib" ) + list( APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}" "./" "../lib" ) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) add_library(kvazaar SHARED ${LIB_SOURCES}) else() @@ -282,9 +282,9 @@ source_group( "" FILES ${SOURCE_GROUP_TOPLEVEL}) # ToDo: make configurable -install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig) +install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig) install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) +install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) if(KVZ_BUILD_SHARED_LIBS) # Just add the lib to the bin directory for now if(MSVC) install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) diff --git a/src/kvazaarCMake.pc.in b/src/kvazaarCMake.pc.in index 60aeca5e..4bb5f4d4 100644 --- a/src/kvazaarCMake.pc.in +++ b/src/kvazaarCMake.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ incdir=${prefix}/include Name: libkvazaar From 3697d3853aa775a816d582bd649edc3e1b1be003 Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Sun, 21 Jan 2024 10:20:27 +0100 Subject: [PATCH 06/13] Revert CMAKE_INSTALL_FULL_LIBDIR --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55b096d1..d9859f48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,7 @@ if (USE_CRYPTO) endif () if(KVZ_BUILD_SHARED_LIBS) - list( APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}" "./" "../lib" ) + list( APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}" "./" "../lib" ) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) add_library(kvazaar SHARED ${LIB_SOURCES}) else() @@ -282,9 +282,9 @@ source_group( "" FILES ${SOURCE_GROUP_TOPLEVEL}) # ToDo: make configurable -install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig) +install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) +install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_LIBDIR}) if(KVZ_BUILD_SHARED_LIBS) # Just add the lib to the bin directory for now if(MSVC) install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) From 0c3b5d03e1bf5d3c8d98c6061204a01322d1e798 Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Sun, 21 Jan 2024 10:22:46 +0100 Subject: [PATCH 07/13] Account for non-absolute libdir in pkgconfig file --- CMakeLists.txt | 7 +++++++ src/kvazaarCMake.pc.in | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9859f48..bf882c65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,13 @@ set(KVZ_COMPILER_STRING "${KVZ_COMPILER_VERSION}") add_definitions(-DCMAKE_BUILD) +# Set correct pkgconfig libdir variable +if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") + set(KVAZAAR_PC_LIBDIR "${CMAKE_INSTALL_LIBDIR}") +else() + set(KVAZAAR_PC_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}") +endif() + # Apply dynamic info to the config files configure_file("${PROJECT_SOURCE_DIR}/src/kvazaarCMake.pc.in" "${PROJECT_SOURCE_DIR}/src/kvazaar.pc" @ONLY) configure_file("${PROJECT_SOURCE_DIR}/src/version.h.in" "${PROJECT_SOURCE_DIR}/src/version.h" @ONLY) diff --git a/src/kvazaarCMake.pc.in b/src/kvazaarCMake.pc.in index 4bb5f4d4..753e9742 100644 --- a/src/kvazaarCMake.pc.in +++ b/src/kvazaarCMake.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +libdir=@KVAZAAR_PC_LIBDIR@ incdir=${prefix}/include Name: libkvazaar From fe021f46bb00e95e058ed2bc082f51373f2ef8e5 Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Mon, 22 Jan 2024 12:47:09 +0100 Subject: [PATCH 08/13] Further pkgconfig refinement --- CMakeLists.txt | 4 +++- src/kvazaarCMake.pc.in | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf882c65..ca6fce30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,8 +101,10 @@ add_definitions(-DCMAKE_BUILD) # Set correct pkgconfig libdir variable if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") set(KVAZAAR_PC_LIBDIR "${CMAKE_INSTALL_LIBDIR}") + set(KVAZAAR_PC_INCDIR "${CMAKE_INSTALL_INCLUDEDIR}") else() - set(KVAZAAR_PC_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}") + set(KVAZAAR_PC_LIBDIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") + set(KVAZAAR_PC_INCDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") endif() # Apply dynamic info to the config files diff --git a/src/kvazaarCMake.pc.in b/src/kvazaarCMake.pc.in index 753e9742..800f4f9e 100644 --- a/src/kvazaarCMake.pc.in +++ b/src/kvazaarCMake.pc.in @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=@KVAZAAR_PC_LIBDIR@ -incdir=${prefix}/include +incdir=@KVAZAAR_PC_INCDIR@ Name: libkvazaar Description: @CMAKE_PROJECT_DESCRIPTION@ From d1bde0264db6a2b3663094833a6fb798f6eb9f0a Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Mon, 22 Jan 2024 12:52:18 +0100 Subject: [PATCH 09/13] Use a couple macros more --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca6fce30..055cc002 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -292,15 +292,15 @@ source_group( "" FILES ${SOURCE_GROUP_TOPLEVEL}) # ToDo: make configurable install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_LIBDIR}) if(KVZ_BUILD_SHARED_LIBS) # Just add the lib to the bin directory for now if(MSVC) install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) endif() endif() -install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include) -install(FILES ${PROJECT_SOURCE_DIR}/doc/kvazaar.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1) +install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(FILES ${PROJECT_SOURCE_DIR}/doc/kvazaar.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) IF(UNIX) # DIST From 426a7d1a38486a67f93aa56d95b836a3788e4e59 Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Mon, 22 Jan 2024 12:54:12 +0100 Subject: [PATCH 10/13] Use more elegant general installer --- CMakeLists.txt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 055cc002..727fb33b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -292,13 +292,10 @@ source_group( "" FILES ${SOURCE_GROUP_TOPLEVEL}) # ToDo: make configurable install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_LIBDIR}) -if(KVZ_BUILD_SHARED_LIBS) # Just add the lib to the bin directory for now - if(MSVC) - install(TARGETS kvazaar DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) - endif() -endif() +install(TARGETS kvazaar + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES ${PROJECT_SOURCE_DIR}/doc/kvazaar.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) From 6c7722e699acef80ded958e68c4f15126c9aaf86 Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Mon, 22 Jan 2024 13:09:35 +0100 Subject: [PATCH 11/13] Revert executable install command --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 727fb33b..2d36ee14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -292,8 +292,8 @@ source_group( "" FILES ${SOURCE_GROUP_TOPLEVEL}) # ToDo: make configurable install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS kvazaar - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) From f282d164b684e8fd4bfb9baa47fbd1917cecc91d Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Mon, 22 Jan 2024 13:14:37 +0100 Subject: [PATCH 12/13] Specific absolute path detection for incdir --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d36ee14..46d0f1dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,9 +101,14 @@ add_definitions(-DCMAKE_BUILD) # Set correct pkgconfig libdir variable if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") set(KVAZAAR_PC_LIBDIR "${CMAKE_INSTALL_LIBDIR}") - set(KVAZAAR_PC_INCDIR "${CMAKE_INSTALL_INCLUDEDIR}") else() set(KVAZAAR_PC_LIBDIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +endif() + +# Set correct pkgconfig include variable +if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(KVAZAAR_PC_INCDIR "${CMAKE_INSTALL_INCLUDEDIR}") +else() set(KVAZAAR_PC_INCDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") endif() From ce2799d7249315d7e90d5548a77896ac9265c0bc Mon Sep 17 00:00:00 2001 From: Luigi Baldoni Date: Mon, 22 Jan 2024 13:16:43 +0100 Subject: [PATCH 13/13] Re-add .dll install command --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46d0f1dd..5b6cc87c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -299,6 +299,7 @@ source_group( "" FILES ${SOURCE_GROUP_TOPLEVEL}) install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS kvazaar + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})