summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2024-03-15 13:07:26 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-16 11:25:08 +0000
commit921eea923db613ae6e2c76be9972f6c3ed1b38b3 (patch)
tree53d9a32b85fab43a12526a9300b9913dc17b364b
parente6cc3c0fa07938ce1742ef728d461ec2e4656db4 (diff)
CMake: Avoid dsmyutil warnings on shared libraries using libjpeg
We link object files with the same names into the BundledLibjpeg static archive. This caused warnings when running dsymutil on shared libraries using that archive: skipping debug map object with duplicate name and timestamp could not find object file symbol for symbol _jpeg_start_compress Avoid that by creating copies of the source files with different names, so that all object files are unique. Pick-to: 6.5 6.2 Fixes: QTBUG-123324 Change-Id: I1d4ebdd111b4172cde793671fbe059957f102871 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit b72158daf502e1f7f0d8c585df6923b4d958cb94) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 9eb01b53642384a2e072c20ffaae13cd850a2a0d)
-rw-r--r--src/3rdparty/libjpeg/CMakeLists.txt36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/3rdparty/libjpeg/CMakeLists.txt b/src/3rdparty/libjpeg/CMakeLists.txt
index 6b211e2542..6ceb5e5a1a 100644
--- a/src/3rdparty/libjpeg/CMakeLists.txt
+++ b/src/3rdparty/libjpeg/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(JPEG16_SOURCES
+set(jpeg16_original_sources
src/jcapistd.c
src/jccolor.c
src/jcdiffct.c
@@ -15,8 +15,8 @@ set(JPEG16_SOURCES
src/jdsample.c
src/jutils.c)
-set(JPEG12_SOURCES
- ${JPEG16_SOURCES}
+set(jpeg12_original_sources
+ ${jpeg16_original_sources}
src/jccoefct.c
src/jcdctmgr.c
src/jdcoefct.c
@@ -31,8 +31,8 @@ set(JPEG12_SOURCES
src/jquant1.c
src/jquant2.c)
-set(JPEG_SOURCES
- ${JPEG12_SOURCES}
+set(jpeg_original_sources
+ ${jpeg12_original_sources}
src/jaricom.c
src/jcapimin.c
src/jcarith.c
@@ -64,11 +64,31 @@ set(JPEG_SOURCES
src/jmemnobs.c
src/jpeg_nbits.c)
+# Make copies of the source files for the different bit counts, so that all the object file names
+# are unique in the static archive. This avoids duplicate warnings for certain linkers and debug
+# info extractors (like Apple's ld and dsymutil).
+function(qt_internal_copy_jpeg_sources in_sources infix out_var)
+ set(jpeg_sources "")
+ foreach(src_file ${in_sources})
+ get_filename_component(src_file_name "${src_file}" NAME_WLE)
+ get_filename_component(src_file_extension "${src_file}" LAST_EXT)
+ set(dest_path "${CMAKE_CURRENT_BINARY_DIR}/${src_file_name}${infix}${src_file_extension}")
+ configure_file(${src_file} "${dest_path}" COPYONLY)
+ message(DEBUG "Copying jpeg source file ${src_file} to ${dest_path}.")
+ list(APPEND jpeg_sources "${dest_path}")
+ endforeach()
+ set(${out_var} "${jpeg_sources}" PARENT_SCOPE)
+endfunction()
+
+qt_internal_copy_jpeg_sources("${jpeg16_original_sources}" "_16" jpeg16_sources)
+qt_internal_copy_jpeg_sources("${jpeg12_original_sources}" "_12" jpeg12_sources)
+qt_internal_copy_jpeg_sources("${jpeg_original_sources}" "" jpeg_sources)
+
qt_internal_add_3rdparty_library(BundledLibjpeg16bits
STATIC
SKIP_AUTOMOC
SOURCES
- ${JPEG16_SOURCES}
+ ${jpeg16_sources}
DEFINES
BITS_IN_JSAMPLE=16
INCLUDE_DIRECTORIES
@@ -81,7 +101,7 @@ qt_internal_add_3rdparty_library(BundledLibjpeg12bits
STATIC
SKIP_AUTOMOC
SOURCES
- ${JPEG12_SOURCES}
+ ${jpeg12_sources}
DEFINES
BITS_IN_JSAMPLE=12
INCLUDE_DIRECTORIES
@@ -96,7 +116,7 @@ qt_internal_add_3rdparty_library(BundledLibjpeg
SKIP_AUTOMOC
INSTALL
SOURCES
- ${JPEG_SOURCES}
+ ${jpeg_sources}
$<TARGET_OBJECTS:BundledLibjpeg12bits>
$<TARGET_OBJECTS:BundledLibjpeg16bits>
INCLUDE_DIRECTORIES