Skip to content

Commit f2474a0

Browse files
Update build system (#115)
* fix some installation paths Use GNUInstallDirs variable throughout the build system. Bug: #100 Signed-off-by: Bernd Waibel <[email protected]> * streamline finding OpenEXR and Imath / IlmBase The search for OpenEXR and IlmBase resp. Imath dependencies can be simplified, as OpenEXR depends on either Imath or IlmBase, depending if we use <OpenEXR-3 or >=OpenEXR-3. Signed-off-by: Bernd Waibel <[email protected]> * enable testing only when CMAKE_BUILD_TESTS=ON The function enable_testing was globally enabled, no matter the value of the CMAKE_BUILD_TESTS option. This patch guards this call, so it only gets called, when CMAKE_BUILD_TESTS=ON. Signed-off-by: Bernd Waibel <[email protected]> * require C++ 11 using set(CMAKE_CXX_STANDARD 11) * add #include <limits> for std::numeric_limits * remove pkg-config *.pc.in and cmake *.cmake.in files Signed-off-by: Bernd Waibel <[email protected]> Co-authored-by: michaeldsmith <[email protected]>
1 parent 2483047 commit f2474a0

File tree

14 files changed

+18
-150
lines changed

14 files changed

+18
-150
lines changed

CMakeLists.txt

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
cmake_minimum_required(VERSION 3.1)
22
project(CTL VERSION 1.5.2)
3-
enable_testing()
43
include(GNUInstallDirs)
54

5+
set(CMAKE_CXX_STANDARD 11)
6+
67
set(CMAKE_MODULE_PATH
78
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
89
${CMAKE_MODULE_PATH}
@@ -27,74 +28,22 @@ else()
2728
MESSAGE( STATUS "To use AddressSanitizer, use \"cmake .. -DCMAKE_BUILD_TYPE=asan\"" )
2829
endif()
2930

30-
find_package(Imath CONFIG)
31-
32-
if (NOT TARGET Imath::Imath)
33-
message( STATUS " Couldn't find Imath::Imath, maybe it's older and has IlmBase?")
34-
find_package(IlmBase CONFIG)
35-
if(NOT IlmBase_FOUND)
36-
message( STATUS " Couldn't find IlmBase with find_package(IlmBase CONFIG), trying find_package(IlmBase QUIET)")
37-
find_package(IlmBase QUIET)
38-
endif()
39-
if( IlmBase_FOUND)
40-
message( STATUS "found IlmBase, version ${IlmBase_VERSION}" )
41-
else()
42-
message( SEND_ERROR "IlmBase not found, please set the include and library paths manually" )
43-
endif()
44-
else()
45-
message( STATUS "found Imath, version ${Imath_VERSION}" )
46-
message( STATUS " Imath_FOUND : ${Imath_FOUND}" )
47-
message( STATUS " Imath_LIBRARY : ${Imath_LIBRARY}" )
48-
message( STATUS " Imath_INCLUDE_DIR : ${Imath_INCLUDE_DIR}" )
49-
#find_package(IlmBase CONFIG)
50-
#if(NOT IlmBase_FOUND)
51-
# message( STATUS " Couldn't find IlmBase with find_package(IlmBase CONFIG), trying find_package(IlmBase QUIET)")
52-
# find_package(IlmBase QUIET)
53-
#endif()
54-
#if( IlmBase_FOUND)
55-
# message( STATUS "found IlmBase, version ${IlmBase_VERSION}" )
56-
#endif()
57-
endif ()
58-
59-
if(IlmBase_FOUND)
60-
message( STATUS "IlmBase_INCLUDE_DIR : ${IlmBase_INCLUDE_DIR}" )
61-
#find_package(OpenEXR QUIET CONFIG)
62-
find_package(OpenEXR CONFIG)
63-
if(NOT OpenEXR_FOUND)
64-
message( STATUS " Couldn't find OpenEXR with find_package(OpenEXR CONFIG), trying find_package(OpenEXR QUIET)")
65-
find_package(OpenEXR QUIET)
66-
endif()
67-
else()
68-
find_package(OpenEXR QUIET CONFIG REQUIRED)
69-
if(${OpenEXR_VERSION} VERSION_GREATER_EQUAL 3.0)
70-
message( STATUS " IlmBase not found and OpenEXR_VERSION: ${OpenEXR_VERSION} is greater than or equal to 3.0, we don't need IlmBase")
71-
else()
72-
message( STATUS " IlmBase not found and OpenEXR_VERSION: ${OpenEXR_VERSION} is not greater than or equal to 3.0, we need IlmBase")
73-
find_package(IlmBase CONFIG)
74-
if(NOT IlmBase_FOUND)
75-
message( STATUS " Couldn't find IlmBase with find_package(IlmBase CONFIG), trying find_package(IlmBase QUIET)")
76-
find_package(IlmBase QUIET)
77-
endif()
78-
if( IlmBase_FOUND)
79-
message( STATUS "found IlmBase, version ${IlmBase_VERSION}" )
80-
endif()
81-
endif()
82-
endif()
83-
84-
if( OpenEXR_FOUND )
85-
message( STATUS "found OpenEXR, version ${OpenEXR_VERSION}" )
31+
find_package(OpenEXR 3 CONFIG QUIET)
32+
if(OpenEXR_FOUND)
33+
message(STATUS "Found OpenEXR ${OpenEXR_VERSION}")
8634
else()
87-
message( SEND_ERROR "OpenEXR not found, this is a required dependency" )
35+
find_package(OpenEXR 2 CONFIG REQUIRED)
8836
endif()
8937

9038
add_subdirectory(lib)
9139
add_subdirectory(doc)
9240
if (CTL_BUILD_TOOLS)
93-
add_subdirectory(ctlrender)
41+
add_subdirectory(ctlrender)
9442
add_subdirectory(OpenEXR_CTL)
9543
endif()
9644

9745
if (CTL_BUILD_TESTS)
98-
add_subdirectory(unittest)
46+
enable_testing()
47+
add_subdirectory(unittest)
9948
endif()
10049

OpenEXR_CTL/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ add_subdirectory( exr_ctl_exr )
1111

1212
add_custom_target( OpenEXR_CTL DEPENDS CtlModules exrdpx exr_ctl_exr )
1313

14-
if ( PKG_CONFIG_FOUND )
15-
configure_file(../config/OpenEXR_CTL.pc.in "${PROJECT_BINARY_DIR}/OpenEXR_CTL.pc" @ONLY)
16-
install( FILES "${PROJECT_BINARY_DIR}/OpenEXR_CTL.pc" DESTINATION lib/pkgconfig COMPONENT dev )
17-
endif()
1814

1915
# TODO CMake config
2016

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
install(
1+
install(
22
FILES
33
utilities.ctl
4-
DESTINATION
5-
${INSTALL_LIB_DIR}/CTL
4+
DESTINATION
5+
${CMAKE_INSTALL_DATADIR}/CTL
66
)
77

OpenEXR_CTL/Makefile.am

Lines changed: 0 additions & 20 deletions
This file was deleted.

OpenEXR_CTL/exr_ctl_exr/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ target_link_libraries (exr_ctl_exr
3737
#target_link_libraries( exr_ctl_exr ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} )
3838
#target_link_libraries( exr_ctl_exr ${OpenEXR_LIBRARIES} ${OpenEXR_LDFLAGS_OTHER} )
3939

40-
install( TARGETS exr_ctl_exr DESTINATION ${INSTALL_BIN_DIR} )
40+
install( TARGETS exr_ctl_exr DESTINATION ${CMAKE_INSTALL_BINDIR} )
4141

42-
install( FILES change_saturation.ctl DESTINATION ${INSTALL_LIB_DIR}/CTL )
42+
install( FILES change_saturation.ctl DESTINATION ${CMAKE_INSTALL_DATADIR}/CTL )

OpenEXR_CTL/exrdpx/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ target_link_libraries (exrdpx
3737
#target_link_libraries( exrdpx ${IlmBase_LIBRARIES} ${IlmBase_LDFLAGS_OTHER} )
3838
#target_link_libraries( exrdpx ${OpenEXR_LIBRARIES} ${OpenEXR_LDFLAGS_OTHER} )
3939

40-
install( TARGETS exrdpx DESTINATION ${INSTALL_BIN_DIR} )
40+
install( TARGETS exrdpx DESTINATION ${CMAKE_INSTALL_BINDIR} )
4141

42-
install( FILES transform_DPX_EXR.ctl transform_EXR_DPX.ctl DESTINATION ${INSTALL_LIB_DIR}/CTL )
42+
install( FILES transform_DPX_EXR.ctl transform_EXR_DPX.ctl DESTINATION ${CMAKE_INSTALL_DATADIR}/CTL )
4343

4444

config/CTL.pc.in

Lines changed: 0 additions & 11 deletions
This file was deleted.

config/CTLBuildTreeSettings.cmake.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

config/CTLConfig.cmake.in

Lines changed: 0 additions & 21 deletions
This file was deleted.

config/CTLConfigVersion.cmake.in

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)