Skip to content

Commit

Permalink
PR #187 CMake enhancements to speed up dependency builds of OpenEXR.
Browse files Browse the repository at this point in the history
  • Loading branch information
meshula authored and nickrasmussen committed Aug 8, 2018
1 parent fb9d1be commit 17e10ab
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 179 deletions.
32 changes: 21 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# The following user options are cached. They are named with the OPENEXR
# prefix in order that they be grouped together in tools such as ccmake and cmake-gui.

option(OPENEXR_BUILD_ILMBASE "Build IlmBase" ON)
option(OPENEXR_BUILD_OPENEXR "Build OpenEXR" ON)
option(OPENEXR_BUILD_PYTHON_LIBS "Build the Python bindings" ON)
option(OPENEXR_BUILD_VIEWERS "Build the viewers" OFF)
option(OPENEXR_BUILD_TESTS "Enable the tests" ON)

option(OPENEXR_BUILD_SHARED "Build Shared Libraries" ON)
option(OPENEXR_BUILD_STATIC "Build Static Libraries" OFF)
option(OPENEXR_NAMESPACE_VERSIONING "Use Namespace Versioning" ON)
option(OPENEXR_FORCE_CXX03 "Force CXX03" OFF)
option(OPENEXR_BUILD_ILMBASE "Build IlmBase" ON)
option(OPENEXR_BUILD_OPENEXR "Build OpenEXR" ON)
option(OPENEXR_BUILD_PYTHON_LIBS "Build the Python bindings" ON)
option(OPENEXR_BUILD_VIEWERS "Build the viewers" OFF)
option(OPENEXR_BUILD_TESTS "Enable the tests" ON)
option(OPENEXR_BUILD_UTILS "Build the utility programs" ON)

option(OPENEXR_BUILD_SHARED "Build Shared Libraries" ON)
option(OPENEXR_BUILD_STATIC "Build Static Libraries" OFF)
option(OPENEXR_NAMESPACE_VERSIONING "Use Namespace Versioning" ON)
option(OPENEXR_FORCE_CXX03 "Force CXX03" OFF)
set(OPENEXR_PYTHON_MAJOR "2" CACHE STRING "Python major version")
set(OPENEXR_PYTHON_MINOR "7" CACHE STRING "Python minor version")

Expand Down Expand Up @@ -144,7 +145,7 @@ if(OPENEXR_BUILD_VIEWERS)
endif()
endif()

if ((OPENEXR_BUILD_OPENEXR OR OPENEXR_BUILD_PYTHON_LIBS OR OPENEXR_BUILD_VIEWERS) AND NOT(OPENEXR_BUILD_ILMBASE))
if ((OPENEXR_BUILD_OPENEXR OR OPENEXR_BUILD_UTILS OR OPENEXR_BUILD_TESTS OR OPENEXR_BUILD_PYTHON_LIBS OR OPENEXR_BUILD_VIEWERS) AND NOT(OPENEXR_BUILD_ILMBASE))
message(INFO "OPENEXR_BUILD_ILMBASE not requested, searching for installed IlmBase instead")
find_package(IlmBase)
if (NOT IlmBase_FOUND)
Expand All @@ -153,6 +154,15 @@ if ((OPENEXR_BUILD_OPENEXR OR OPENEXR_BUILD_PYTHON_LIBS OR OPENEXR_BUILD_VIEWERS
endif()
endif()

if ((OPENEXR_BUILD_UTILS OR OPENEXR_BUILD_TESTS OR OPENEXR_BUILD_VIEWERS) AND NOT(OPENEXR_BUILD_OPENEXR))
message(INFO "OPENEXR_BUILD_OPENEXR not requested, searching for installed OpenEXR instead")
find_package(OpenEXR)
if (NOT OpenEXR_FOUND)
message(ERROR "Could not find OpenEXR, cannot build dependent libraries.")
message(INFO, "Set OPENEXR_LOCATION to location of OpenEXR.")
endif()
endif()

# Perform the build
if(OPENEXR_BUILD_ILMBASE)
add_subdirectory(IlmBase)
Expand Down
4 changes: 4 additions & 0 deletions IlmBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ INCLUDE_DIRECTORIES ( Iex IexMath Imath Half
IlmThread IexTest ImathTest HalfTest
${CMAKE_CURRENT_BINARY_DIR}/config )

IF(WIN32)
SET(CMAKE_DEBUG_POSTFIX "_d")
ENDIF()

# also add the current directory to pick up the autogenerated headers
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

Expand Down
2 changes: 0 additions & 2 deletions IlmBase/Imath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
SET (ILMBASE_LIB_TARGETS "")

SET ( IMATH_SOURCES
ImathBox.cpp
ImathRandom.cpp
ImathColorAlgo.cpp
ImathShear.cpp
ImathFun.cpp
ImathVec.cpp
ImathMatrixAlgo.cpp
Expand Down
37 changes: 0 additions & 37 deletions IlmBase/Imath/ImathBox.cpp

This file was deleted.

8 changes: 4 additions & 4 deletions IlmBase/Imath/ImathMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -3244,13 +3244,13 @@ operator << (std::ostream &s, const Matrix33<T> &m)
if (s.flags() & std::ios_base::fixed)
{
s.setf (std::ios_base::showpoint);
width = s.precision() + 5;
width = static_cast<int>(s.precision()) + 5;
}
else
{
s.setf (std::ios_base::scientific);
s.setf (std::ios_base::showpoint);
width = s.precision() + 8;
width = static_cast<int>(s.precision()) + 8;
}

s << "(" << std::setw (width) << m[0][0] <<
Expand Down Expand Up @@ -3279,13 +3279,13 @@ operator << (std::ostream &s, const Matrix44<T> &m)
if (s.flags() & std::ios_base::fixed)
{
s.setf (std::ios_base::showpoint);
width = s.precision() + 5;
width = static_cast<int>(s.precision()) + 5;
}
else
{
s.setf (std::ios_base::scientific);
s.setf (std::ios_base::showpoint);
width = s.precision() + 8;
width = static_cast<int>(s.precision()) + 8;
}

s << "(" << std::setw (width) << m[0][0] <<
Expand Down
54 changes: 0 additions & 54 deletions IlmBase/Imath/ImathShear.cpp

This file was deleted.

4 changes: 2 additions & 2 deletions IlmBase/Imath/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

lib_LTLIBRARIES = libImath.la

libImath_la_SOURCES = ImathShear.cpp ImathMatrixAlgo.cpp ImathVec.cpp \
libImath_la_SOURCES = ImathMatrixAlgo.cpp ImathVec.cpp \
ImathColorAlgo.cpp ImathFun.cpp \
ImathColorAlgo.h ImathMatrixAlgo.h ImathVec.h \
ImathShear.h ImathFun.h ImathBox.h ImathBoxAlgo.h \
Expand All @@ -13,7 +13,7 @@ libImath_la_SOURCES = ImathShear.cpp ImathMatrixAlgo.cpp ImathVec.cpp \
ImathColor.h ImathRandom.h ImathRoots.h \
ImathHalfLimits.h ImathInterval.h ImathGLU.h \
ImathFrame.h ImathPlatform.h \
ImathBox.cpp ImathRandom.cpp ImathInt64.h \
ImathRandom.cpp ImathInt64.h \
ImathFrustumTest.h

libImath_la_LDFLAGS = -version-info @LIBTOOL_VERSION@ -no-undefined
Expand Down
22 changes: 14 additions & 8 deletions OpenEXR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ IF (NOT WIN32)
SET ( PTHREAD_LIB pthread )
ENDIF()

IF(WIN32)
SET(CMAKE_DEBUG_POSTFIX "_d")
ENDIF()


MACRO(SET_ILMBASE_INCLUDE_DIRS _target)
TARGET_INCLUDE_DIRECTORIES(${_target}
PRIVATE ${ZLIB_INCLUDE_DIR}
Expand Down Expand Up @@ -167,14 +172,15 @@ ENDIF ()
##########################
# Binaries / Utilities
##########################
ADD_SUBDIRECTORY ( exrheader )
ADD_SUBDIRECTORY ( exrmaketiled )
ADD_SUBDIRECTORY ( exrstdattr )
ADD_SUBDIRECTORY ( exrmakepreview )
ADD_SUBDIRECTORY ( exrenvmap )
ADD_SUBDIRECTORY ( exrmultiview )
ADD_SUBDIRECTORY ( exrmultipart )

IF (OPENEXR_BUILD_UTILS)
ADD_SUBDIRECTORY ( exrheader )
ADD_SUBDIRECTORY ( exrmaketiled )
ADD_SUBDIRECTORY ( exrstdattr )
ADD_SUBDIRECTORY ( exrmakepreview )
ADD_SUBDIRECTORY ( exrenvmap )
ADD_SUBDIRECTORY ( exrmultiview )
ADD_SUBDIRECTORY ( exrmultipart )
ENDIF ()

##########################
# Installation
Expand Down
Loading

0 comments on commit 17e10ab

Please sign in to comment.