From a03be2280f92fa3830b8086cfc03c54185e36041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drik=20Fuoco?= Date: Mon, 7 Nov 2022 14:33:48 -0500 Subject: [PATCH 1/4] Configure the OpenColorIO.pc file on Windows and fix an issue where CMAKE_INSTALL_PREFIX wasn't included in the cmake build command in ocio.bat. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédrik Fuoco --- share/dev/windows/ocio.bat | 3 ++- src/OpenColorIO/CMakeLists.txt | 19 ++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/share/dev/windows/ocio.bat b/share/dev/windows/ocio.bat index 04e61b7096..7f24bc279b 100644 --- a/share/dev/windows/ocio.bat +++ b/share/dev/windows/ocio.bat @@ -193,6 +193,7 @@ IF NOT EXIST "!PYTHON_PATH!" ( if !DO_CONFIGURE!==1 ( echo Running CMake... cmake -B "!BUILD_PATH!"^ + -DCMAKE_INSTALL_PREFIX=!INSTALL_PATH!^ -DOCIO_INSTALL_EXT_PACKAGES=ALL^ -DCMAKE_BUILD_TYPE=!CMAKE_BUILD_TYPE!^ -DGLEW_ROOT="!GLEW_ROOT!"^ @@ -231,7 +232,7 @@ if Not "%CMAKE_CONFIGURE_STATUS%"=="Failed" ( rem Run cmake --install only if cmake --build was successful. if Not "%CMAKE_BUILD_STATUS%"=="Failed" ( rem Install OCIO - cmake --install !BUILD_PATH! --config !CMAKE_BUILD_TYPE! --prefix !INSTALL_PATH! + cmake --install !BUILD_PATH! --config !CMAKE_BUILD_TYPE! if not ErrorLevel 1 ( set CMAKE_INSTALL_STATUS=Ok ) else ( diff --git a/src/OpenColorIO/CMakeLists.txt b/src/OpenColorIO/CMakeLists.txt index ab9c048126..c46a8bf67c 100755 --- a/src/OpenColorIO/CMakeLists.txt +++ b/src/OpenColorIO/CMakeLists.txt @@ -174,17 +174,14 @@ set(SOURCES SystemMonitor.cpp ) -if(NOT WIN32) - - # Install the pkg-config file. - - set(prefix ${CMAKE_INSTALL_PREFIX}) - set(exec_prefix "\${prefix}") - set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") - set(includedir "\${exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}") - configure_file(res/OpenColorIO.pc.in ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -endif() +# Install the pkg-config file. + +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix "\${prefix}") +set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +set(includedir "\${exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}") +configure_file(res/OpenColorIO.pc.in ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) add_library(OpenColorIO ${SOURCES}) From 6cf65ed96ec664618a034654daf2aedaeaa7d7f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drik=20Fuoco?= Date: Fri, 25 Nov 2022 09:30:40 -0500 Subject: [PATCH 2/4] Removing pkconfig folder since that PC file is not used. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédrik Fuoco --- src/OpenColorIO/pkgconfig/OpenColorIO.pc.in | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 src/OpenColorIO/pkgconfig/OpenColorIO.pc.in diff --git a/src/OpenColorIO/pkgconfig/OpenColorIO.pc.in b/src/OpenColorIO/pkgconfig/OpenColorIO.pc.in deleted file mode 100644 index ed1d5c4549..0000000000 --- a/src/OpenColorIO/pkgconfig/OpenColorIO.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright Contributors to the OpenColorIO Project. - -libdir=@CMAKE_INSTALL_FULL_LIBDIR@ -includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ - -Name: OpenColorIO -Description: A color management framework for visual effects and animation -Version: @OCIO_VERSION_FULL_STR@ -Cflags: -I${includedir} -Libs: -L${libdir} -lOpenColorIO From 54f247e01ca608cea3128f512d363fc2950f3a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drik=20Fuoco?= Date: Tue, 29 Nov 2022 09:43:59 -0500 Subject: [PATCH 3/4] Small tweak in the configuration of OpenColorIO.cmake.in to handle absolute path with CMAKE_INSTALL_LIBDIR or CMAKE_INSTALL_INCLUDEDIR. Keeping exec_prefix for CMAKE_INSTALL_INCLUDE_DIR since it was changed for a specific issue on Mac (see PR #1120). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédrik Fuoco --- src/OpenColorIO/CMakeLists.txt | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/OpenColorIO/CMakeLists.txt b/src/OpenColorIO/CMakeLists.txt index c46a8bf67c..4d85c66f98 100755 --- a/src/OpenColorIO/CMakeLists.txt +++ b/src/OpenColorIO/CMakeLists.txt @@ -178,8 +178,23 @@ set(SOURCES set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix "\${prefix}") -set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") -set(includedir "\${exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + +# CMAKE_INSTALL_LIBDIR is not guaranteed to be relative. +# Not using cmake_path function since it is only available from CMake ≥ 3.20. +if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") + set(libdir "${CMAKE_INSTALL_LIBDIR}") +else() + set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +endif() + +# CMAKE_INSTALL_INCLUDEDIR is not guaranteed to be relative. +# Not using cmake_path function since it is only available from CMake ≥ 3.20. +if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(includedir "${CMAKE_INSTALL_INCLUDEDIR}") +else() + set(includedir "\${exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}") +endif() + configure_file(res/OpenColorIO.pc.in ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) From 4a2db7c2c7b3dc6b26862a5de0375534a5803462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drik=20Fuoco?= Date: Wed, 30 Nov 2022 09:05:04 -0500 Subject: [PATCH 4/4] Using ${prefix} for includedir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédrik Fuoco --- src/OpenColorIO/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenColorIO/CMakeLists.txt b/src/OpenColorIO/CMakeLists.txt index 4d85c66f98..80a53a87ef 100755 --- a/src/OpenColorIO/CMakeLists.txt +++ b/src/OpenColorIO/CMakeLists.txt @@ -192,7 +192,7 @@ endif() if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") set(includedir "${CMAKE_INSTALL_INCLUDEDIR}") else() - set(includedir "\${exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") endif() configure_file(res/OpenColorIO.pc.in ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc @ONLY)