Skip to content

Commit

Permalink
Adsk contrib - Configure the OpenColorIO.pc file on Windows (AcademyS…
Browse files Browse the repository at this point in the history
…oftwareFoundation#1720)

* 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.

Signed-off-by: Cédrik Fuoco <[email protected]>

* Removing pkconfig folder since that PC file is not used.

Signed-off-by: Cédrik Fuoco <[email protected]>

* 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 AcademySoftwareFoundation#1120).

Signed-off-by: Cédrik Fuoco <[email protected]>

* Using ${prefix} for includedir

Signed-off-by: Cédrik Fuoco <[email protected]>

Signed-off-by: Cédrik Fuoco <[email protected]>
Co-authored-by: Doug Walker <[email protected]>
Signed-off-by: Cédrik Fuoco <[email protected]>
  • Loading branch information
cedrik-fuoco-adsk and doug-walker committed Mar 24, 2023
1 parent 3fa84e3 commit 322b826
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
3 changes: 2 additions & 1 deletion share/dev/windows/ocio.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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!"^
Expand Down Expand Up @@ -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 (
Expand Down
26 changes: 19 additions & 7 deletions src/OpenColorIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,30 @@ set(SOURCES
SystemMonitor.cpp
)

if(NOT WIN32)
# Install the pkg-config file.

# Install the pkg-config file.
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")

set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
# 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}")
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()

# 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 "\${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)

add_library(OpenColorIO ${SOURCES})

# Require at least a C++11 compatible compiler for consumer projects.
Expand Down
11 changes: 0 additions & 11 deletions src/OpenColorIO/pkgconfig/OpenColorIO.pc.in

This file was deleted.

0 comments on commit 322b826

Please sign in to comment.