Skip to content

Commit 77818e5

Browse files
Remove unwanted files in the install directory (#350)
### Remove unwanted files in the install directory ### Linked issues n/a ### Summarize your change. I disabled some tools and apps that were built by a few dependencies and a few fixes in the variables that we use in our deps Cmake modules. (**_all platform_**) I've also added more file filters when we copy files over the install directory for Qt. I filtered out the following extensions: `pdb`, `lib` and `exe` (except QtWebEngineProcess.exe because is it needed). (**_Windows only_**) I used `windeployqt.exe` to determine which executables was needed, and only QtWebEngineProcess.exe showed up in the list. ### Describe the reason for the change. The goal was to lighten the Windows package. These changes removed about 200MB from the zip file and about 800MB for the unzip folder (numbers are very rough). ### Describe what you have tested and on which operating system. Tested the Qt part on Windows because the Qt changes only affect Windows. Tested the build on Rocky 8. ### Add a list of changes, and note any that might need special attention during the review. n/a ### If possible, provide screenshots. n/a --------- Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
1 parent aef2b06 commit 77818e5

File tree

13 files changed

+140
-46
lines changed

13 files changed

+140
-46
lines changed

cmake/dependencies/jpegturbo.cmake

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,25 @@ EXTERNALPROJECT_ADD(
105105
)
106106

107107
# The macro is using existing _target, _libname, _lib_dir and _bin_dir variabless
108-
RV_COPY_LIB_BIN_FOLDERS()
108+
IF(NOT RV_TARGET_WINDOWS)
109+
RV_COPY_LIB_BIN_FOLDERS()
110+
ELSE()
111+
# Don't use RV_COPY_LIB_BIN_FOLDERS() because RV don't need the whole bin directory.
112+
# Copying the two DLLs from jpegturbo.
113+
ADD_CUSTOM_COMMAND(
114+
TARGET ${_target}
115+
POST_BUILD
116+
COMMENT "Installing ${_target}'s libs and bin into ${RV_STAGE_LIB_DIR} and ${RV_STAGE_BIN_DIR}"
117+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_lib_dir} ${RV_STAGE_LIB_DIR}
118+
COMMAND ${CMAKE_COMMAND} -E copy ${_bin_dir}/${_winlibjpegname} ${RV_STAGE_BIN_DIR}
119+
COMMAND ${CMAKE_COMMAND} -E copy ${_bin_dir}/${_libturbojpegname} ${RV_STAGE_BIN_DIR}
120+
)
121+
122+
ADD_CUSTOM_TARGET(
123+
${_target}-stage-target ALL
124+
DEPENDS ${RV_STAGE_BIN_DIR}/${_libname}
125+
)
126+
ENDIF()
109127

110128
IF(NOT RV_TARGET_WINDOWS)
111129
# RV_COPY_LIB_BIN_FOLDERS doesn't copy symlinks so this command is used for _libjpeg62path

cmake/dependencies/ocio.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,19 +241,21 @@ ELSE()
241241
"-DOCIO_BUILD_TESTS=OFF"
242242
"-DOCIO_BUILD_GPU_TESTS=OFF"
243243
"-DOCIO_BUILD_DOCS=OFF"
244+
# Note for OCIO v2.3.0 (future): OCIO_USE_SSE has been renamed to OCIO_USE_SIMD.
244245
"-DOCIO_USE_SSE=ON"
246+
# OCIO apps are not needed.
247+
"-DOCIO_BUILD_APPS=OFF"
245248
"-DOCIO_WARNING_AS_ERROR=OFF"
246249
"-DOCIO_BUILD_JAVA=OFF"
247250
"-S ${_source_dir}"
248251
"-B ${_build_dir}"
249252
)
250253

251254
IF(CMAKE_BUILD_TYPE MATCHES "^Debug$")
252-
# We don't build GLUT in Debug hence the debug lib for Glut doesn't exist which is needed for APPs We also switch the Python EXE because in Debug, Python
253-
# builds python_d.exe and not the normal EXE filename.
254-
LIST(APPEND _configure_options "-DPython_EXECUTABLE=${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install/bin/python_d.exe" "-DOCIO_BUILD_APPS=OFF")
255+
# Use debug Python executable.
256+
LIST(APPEND _configure_options "-DPython_EXECUTABLE=${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install/bin/python_d.exe")
255257
ELSE()
256-
LIST(APPEND _configure_options "-DPython_EXECUTABLE=${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install/bin/python.exe" "-DOCIO_BUILD_APPS=ON")
258+
LIST(APPEND _configure_options "-DPython_EXECUTABLE=${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install/bin/python.exe")
257259
ENDIF()
258260

259261
LIST(APPEND _ocio_build_options "--build" "${_build_dir}" "--config" "${CMAKE_BUILD_TYPE}"

cmake/dependencies/oiio.cmake

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ RV_MAKE_STANDARD_LIB_NAME("OpenImageIO" "2.4.6" "SHARED" "${RV_DEBUG_POSTFIX}")
4242
LIST(APPEND _byproducts ${_byprojects_copy})
4343

4444
# The '_configure_options' list gets reset and initialized in 'RV_CREATE_STANDARD_DEPS_VARIABLES'
45-
LIST(APPEND _configure_options "-DBUILD_THIRDPARTY=1")
4645
LIST(APPEND _configure_options "-DBUILD_TESTING=OFF")
4746
LIST(APPEND _configure_options "-DUSE_PYTHON=0") # this on would requireextra pybind11 package
4847
LIST(APPEND _configure_options "-DUSE_OCIO=0")
@@ -67,7 +66,7 @@ ENDIF()
6766
GET_TARGET_PROPERTY(_png_library PNG::PNG IMPORTED_LOCATION)
6867
GET_TARGET_PROPERTY(_png_include_dir PNG::PNG INTERFACE_INCLUDE_DIRECTORIES)
6968
LIST(APPEND _configure_options "-DPNG_LIBRARY=${_png_library}")
70-
LIST(APPEND _configure_options "-DPNG_INCLUDE_DIR=${_png_include_dir}")
69+
LIST(APPEND _configure_options "-DPNG_PNG_INCLUDE_DIR=${_png_include_dir}")
7170

7271
IF(RV_TARGET_WINDOWS)
7372
GET_TARGET_PROPERTY(_jpeg_library jpeg-turbo::jpeg IMPORTED_IMPLIB)
@@ -89,14 +88,7 @@ GET_TARGET_PROPERTY(_openjpeg_include_dir OpenJpeg::OpenJpeg INTERFACE_INCLUDE_D
8988
LIST(APPEND _configure_options "-DOPENJPEG_OPENJP2_LIBRARY=${_openjpeg_library}")
9089
LIST(APPEND _configure_options "-DOPENJPEG_INCLUDE_DIR=${_openjpeg_include_dir}")
9190

92-
GET_TARGET_PROPERTY(_tiff_library Tiff::Tiff IMPORTED_LOCATION)
93-
GET_TARGET_PROPERTY(_tiff_include_dir Tiff::Tiff INTERFACE_INCLUDE_DIRECTORIES)
94-
IF(NOT RV_TARGET_WINDOWS)
95-
LIST(APPEND _configure_options "-DTIFF_LIBRARY=${_tiff_library}")
96-
ELSE()
97-
LIST(APPEND _configure_options "-DTIFF_ROOT=${RV_DEPS_TIFF_ROOT_DIR}")
98-
ENDIF()
99-
LIST(APPEND _configure_options "-DTIFF_INCLUDE_DIR=${_tiff_include_dir}")
91+
LIST(APPEND _configure_options "-DTIFF_ROOT=${RV_DEPS_TIFF_ROOT_DIR}")
10092

10193
GET_TARGET_PROPERTY(_ffmpeg_include_dir ffmpeg::avcodec INTERFACE_INCLUDE_DIRECTORIES)
10294
IF(RV_TARGET_WINDOWS)
@@ -146,10 +138,8 @@ IF(NOT RV_TARGET_LINUX)
146138
ENDIF()
147139
LIST(APPEND _configure_options "-DZLIB_ROOT=${RV_DEPS_ZLIB_ROOT_DIR}")
148140

149-
IF(RV_TARGET_LINUX)
150-
# OIIO's libUtils Tools & Tests USES a different Link Flags which is 'hidden' and isn't set by us.
151-
LIST(APPEND _configure_options "-DOIIO_BUILD_TOOLS=OFF" "-DOIIO_BUILD_TESTS=OFF")
152-
ENDIF()
141+
# OIIO tools are not needed.
142+
LIST(APPEND _configure_options "-DOIIO_BUILD_TOOLS=OFF" "-DOIIO_BUILD_TESTS=OFF")
153143

154144
IF(RV_TARGET_WINDOWS)
155145
LIST(PREPEND _configure_options "-G ${CMAKE_GENERATOR}")

cmake/dependencies/openexr.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ IF(RV_TARGET_WINDOWS)
165165
LIST(APPEND _cmake_configure_command "-DZLIB_LIBRARY=${_zlib_implibpath}")
166166
ENDIF()
167167

168+
# OpenEXR tools are not needed.
169+
LIST(APPEND _cmake_configure_command "-DOPENEXR_BUILD_TOOLS=OFF")
170+
168171
EXTERNALPROJECT_ADD(
169172
${_target}
170173
URL ${_download_url}

cmake/dependencies/openjpeg.cmake

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,11 @@ SET(_download_hash
3333
RV_MAKE_STANDARD_LIB_NAME("openjp2" "2.5.0" "SHARED" "")
3434

3535
# The '_configure_options' list gets reset and initialized in 'RV_CREATE_STANDARD_DEPS_VARIABLES'
36-
LIST(APPEND _configure_options "-DBUILD_THIRDPARTY=1") # to build LCMS2
3736

38-
GET_TARGET_PROPERTY(_zlib_library ZLIB::ZLIB IMPORTED_LOCATION)
39-
GET_TARGET_PROPERTY(_zlib_include_dir ZLIB::ZLIB INTERFACE_INCLUDE_DIRECTORIES)
40-
LIST(APPEND _configure_options "-DZLIB_LIBRARY=${_zlib_library}")
41-
LIST(APPEND _configure_options "-DZLIB_INCLUDE_DIR=${_zlib_include_dir}")
42-
43-
GET_TARGET_PROPERTY(_png_library PNG::PNG IMPORTED_LOCATION)
44-
GET_TARGET_PROPERTY(_png_include_dir PNG::PNG INTERFACE_INCLUDE_DIRECTORIES)
45-
LIST(APPEND _configure_options "-DPNG_LIBRARY=${_png_library}")
46-
LIST(APPEND _configure_options "-DPNG_INCLUDE_DIR=${_png_include_dir}")
47-
48-
GET_TARGET_PROPERTY(_tiff_library Tiff::Tiff IMPORTED_LOCATION)
49-
GET_TARGET_PROPERTY(_tiff_include_dir Tiff::Tiff INTERFACE_INCLUDE_DIRECTORIES)
50-
LIST(APPEND _configure_options "-DTIFF_LIBRARY=${_tiff_library}")
51-
LIST(APPEND _configure_options "-DTIFF_INCLUDE_DIR=${_tiff_include_dir}")
37+
# Do not build the executables (OpenJPEG calls them "codec executables").
38+
# BUILD_THIRDPARTY options is valid only if BUILD_CODEC=ON.
39+
# PNG, TIFF and ZLIB are not needed anymore because they are used for the executables only.
40+
LIST(APPEND _configure_options "-DBUILD_CODEC=OFF")
5241

5342
EXTERNALPROJECT_ADD(
5443
${_target}

cmake/dependencies/openssl.cmake

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ ELSE()
9494
LIST(APPEND _make_command --arch=${RV_OSX_EMULATION_ARCH})
9595
ENDIF()
9696

97+
98+
# On most POSIX platforms, shared libraries are named `libcrypto.so.1.1`
99+
# and `libssl.so.1.1`.
100+
101+
# On Windows build with MSVC or using MingW, shared libraries are named
102+
# `libcrypto-1_1.dll` and `libssl-1_1.dll` for 32-bit Windows,
103+
# `libcrypto-1_1-x64.dll` and `libssl-1_1-x64.dll` for 64-bit x86_64 Windows,
104+
# and `libcrypto-1_1-ia64.dll` and `libssl-1_1-ia64.dll` for IA64 Windows.
105+
# With MSVC, the import libraries are named `libcrypto.lib` and `libssl.lib`,
106+
# while with MingW, they are named `libcrypto.dll.a` and `libssl.dll.a`.
107+
108+
# Ref: https://github.com/openssl/openssl/blob/398011848468c7e8e481b295f7904afc30934217/INSTALL.md?plain=1#L1847-L1858
109+
97110
IF(RV_TARGET_LINUX)
98111
SET(_crypto_lib_name
99112
${CMAKE_SHARED_LIBRARY_PREFIX}crypto${CMAKE_SHARED_LIBRARY_SUFFIX}.1.1
@@ -102,6 +115,15 @@ ELSE()
102115
SET(_ssl_lib_name
103116
${CMAKE_SHARED_LIBRARY_PREFIX}ssl${CMAKE_SHARED_LIBRARY_SUFFIX}.1.1
104117
)
118+
ELSEIF(RV_TARGET_WINDOWS)
119+
# As stated in the openssl documentation, the names are libcrypto-1_1-x64 and libssl-1_1-x64
120+
# when OpenSSL is build with MSVC.
121+
SET(_crypto_lib_name
122+
libcrypto-1_1-x64${CMAKE_SHARED_LIBRARY_SUFFIX}
123+
)
124+
SET(_ssl_lib_name
125+
libssl-1_1-x64${CMAKE_SHARED_LIBRARY_SUFFIX}
126+
)
105127
ELSE()
106128
SET(_crypto_lib_name
107129
${CMAKE_SHARED_LIBRARY_PREFIX}crypto.1.1${CMAKE_SHARED_LIBRARY_SUFFIX}
@@ -187,7 +209,8 @@ ELSE()
187209
COMMENT "Installing ${_target}'s libs and bin into ${RV_STAGE_LIB_DIR} and ${RV_STAGE_BIN_DIR}"
188210
OUTPUT ${RV_STAGE_LIB_DIR}/${_crypto_lib_name} ${RV_STAGE_LIB_DIR}/${_ssl_lib_name}
189211
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_lib_dir} ${RV_STAGE_LIB_DIR}
190-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_bin_dir} ${RV_STAGE_BIN_DIR}
212+
COMMAND ${CMAKE_COMMAND} -E copy ${_bin_dir}/${_crypto_lib_name} ${RV_STAGE_BIN_DIR}
213+
COMMAND ${CMAKE_COMMAND} -E copy ${_bin_dir}/${_ssl_lib_name} ${RV_STAGE_BIN_DIR}
191214
DEPENDS ${_target}
192215
)
193216
ADD_CUSTOM_TARGET(

cmake/dependencies/png.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ ELSE()
3333
RV_MAKE_STANDARD_LIB_NAME("libpng16" "${_libpng_lib_version}" "SHARED" "d")
3434
ENDIF()
3535
# The '_configure_options' list gets reset and initialized in 'RV_CREATE_STANDARD_DEPS_VARIABLES'
36+
# Future: The main branch of libpng has deprecated 'PNG_EXECUTABLES' in favor of 'PNG_TOOLS'.
3637
LIST(APPEND _configure_options "-DZLIB_ROOT=${RV_DEPS_ZLIB_ROOT_DIR}")
38+
LIST(APPEND _configure_options "-DPNG_EXECUTABLES=OFF")
39+
LIST(APPEND _configure_options "-DPNG_TESTS=OFF")
3740

3841
EXTERNALPROJECT_ADD(
3942
${_target}

cmake/dependencies/qt5.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,24 @@ IF(RV_TARGET_WINDOWS)
179179
LIST(REMOVE_ITEM _qt_debug_libs ${_d_lib})
180180
ENDFOREACH()
181181

182+
# Remove Qt5 executables that are not needed.
183+
FILE(
184+
GLOB _qt_executables
185+
RELATIVE ${SRC_DIR}
186+
${SRC_DIR}/*.exe
187+
)
188+
189+
# Filtering. Some executables are needed for RV to work:
190+
# QtWebEngineProcess.exe
191+
FOREACH(
192+
_qt_executable
193+
${_qt_executables}
194+
)
195+
IF("${_qt_executable}" STREQUAL "QtWebEngineProcess.exe")
196+
LIST(REMOVE_ITEM _qt_executables "${_qt_executable}")
197+
ENDIF()
198+
ENDFOREACH()
199+
182200
IF(CMAKE_BUILD_TYPE MATCHES "^Debug$")
183201
SET(_qt_libs_to_copy
184202
${_qt_debug_libs}
@@ -190,6 +208,7 @@ IF(RV_TARGET_WINDOWS)
190208
${SRC_DIR}/*
191209
)
192210
LIST(REMOVE_ITEM _qt_libs_to_copy ${_qt_debug_libs})
211+
LIST(REMOVE_ITEM _qt_libs_to_copy ${_qt_executables})
193212
ENDIF()
194213

195214
FOREACH(

cmake/dependencies/raw.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ IF(RV_TARGET_WINDOWS)
6767
COMMENT "Installing ${_target}'s libs & files into ${_install_dir}"
6868
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_base_dir}/src/lib ${_lib_dir}
6969
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_base_dir}/src/libraw ${_include_dir}/libraw
70-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_base_dir}/src/bin ${_bin_dir}
71-
COMMAND ${CMAKE_COMMAND} -E rm ${_bin_dir}/.keep_me
70+
# Copy only the DLL on Windows because there is no option to disable the "examples/samples"
71+
# with Makefile.msvc.
72+
COMMAND ${CMAKE_COMMAND} -E make_directory ${_bin_dir}
73+
COMMAND ${CMAKE_COMMAND} -E copy ${_base_dir}/src/bin/${_libname} ${_bin_dir}
7274
COMMAND ${CMAKE_COMMAND} -E rm ${_lib_dir}/Makefile
7375
)
7476

cmake/dependencies/tiff.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ LIST(APPEND _configure_options "-Dlzma=OFF")
6666
LIST(APPEND _configure_options "-Dzlib=ON")
6767
LIST(APPEND _configure_options "-Dwebp=OFF")
6868

69+
# Do not need TIFF tools.
70+
LIST(APPEND _configure_options "-Dtiff-tools=OFF")
71+
6972
EXTERNALPROJECT_ADD(
7073
${_target}
7174
URL ${_download_url}

0 commit comments

Comments
 (0)