From 5656d8dc657f4702c67fbabfab8922c80e0cf778 Mon Sep 17 00:00:00 2001 From: Jonathan Scruggs Date: Sat, 23 Sep 2017 16:08:48 +0100 Subject: [PATCH] Use PkgConfig for IlmBase --- CMakeLists.txt | 15 +++++++------- cmake/FindILMBase.cmake | 54 ------------------------------------------------- 2 files changed, 8 insertions(+), 61 deletions(-) delete mode 100644 cmake/FindILMBase.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e9ad44f..864f0d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,8 +35,9 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) PROJECT ( field3d ) -set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake ) +set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ) +FIND_PACKAGE ( PkgConfig ) FIND_PACKAGE (Doxygen) FIND_PACKAGE (HDF5) IF ( CMAKE_HOST_WIN32 ) @@ -49,7 +50,7 @@ FIND_PACKAGE (Boost COMPONENTS regex thread program_options system) FIND_PACKAGE (MPI) ENDIF () -FIND_PACKAGE (ILMBase) +PKG_CHECK_MODULES ( ILMBASE_LIBS REQUIRED IlmBase ) # Allow the developer to select if Dynamic or Static libraries are built OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) @@ -65,14 +66,14 @@ INCLUDE_DIRECTORIES ( . ) INCLUDE_DIRECTORIES ( src ) INCLUDE_DIRECTORIES ( export ) INCLUDE_DIRECTORIES ( include ) -INCLUDE_DIRECTORIES ( ${ILMBASE_INCLUDE_DIRS} ) +INCLUDE_DIRECTORIES ( SYSTEM ${ILMBASE_LIBS_INCLUDE_DIRS} ) INCLUDE_DIRECTORIES ( ${HDF5_INCLUDE_DIRS} ) INCLUDE_DIRECTORIES ( ${Boost_INCLUDE_DIR} ) # link directories LINK_DIRECTORIES ( ${Boost_LIBRARY_DIRS} ) LINK_DIRECTORIES ( ${HDF5_LIBRARY_DIRS} ) -LINK_DIRECTORIES ( ${ILMBASE_LIBRARY_DIRS} ) +LINK_DIRECTORIES ( ${ILMBASE_LIBS_LIBRARY_DIRS} ) IF ( CMAKE_HOST_UNIX ) ADD_DEFINITIONS ( -fPIC -DREQUIRE_IOSTREAM -Wno-invalid-offsetof ) @@ -147,7 +148,7 @@ IF ( CMAKE_HOST_UNIX ) ${MPI_LIBRARIES} ) ENDIF ( MPI_FOUND ) LIST ( APPEND Field3D_Libraries_Shared - Iex Half IlmThread Imath + ${ILMBASE_LIBS_LIBRARIES} pthread dl z ) SET ( Field3D_DSO_Libraries ${Field3D_Libraries_Shared} ) SET ( Field3D_BIN_Libraries Field3D ${Field3D_Libraries_Shared} @@ -155,7 +156,7 @@ IF ( CMAKE_HOST_UNIX ) ENDIF ( ) IF ( CMAKE_HOST_WIN32 ) # Add OpenEXR and zlib release/debug - FOREACH ( lib Iex Half IlmThread Imath zdll ) + FOREACH ( lib ${ILMBASE_LIBS_LIBRARIES} zdll ) LIST ( APPEND Field3D_Libraries_Shared optimized ${lib} debug ${lib}_d ) @@ -164,7 +165,7 @@ IF ( CMAKE_HOST_WIN32 ) SET ( Field3D_BIN_Libraries Field3D ${Boost_LIBRARIES} ) ENDIF () -TARGET_LINK_LIBRARIES ( Field3D ${Field3D_DSO_Libraries} ${Boost_LIBRARIES}) +TARGET_LINK_LIBRARIES ( Field3D ${Field3D_DSO_Libraries} ${Boost_LIBRARIES} ) # Parase version and soversion from export/ns.h diff --git a/cmake/FindILMBase.cmake b/cmake/FindILMBase.cmake deleted file mode 100644 index c555100..0000000 --- a/cmake/FindILMBase.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2009 Sony Pictures Imageworks Inc. et al. -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the -# distribution. Neither the name of Sony Pictures Imageworks nor the -# names of its contributors may be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -# OF THE POSSIBILITY OF SUCH DAMAGE. - -# Author : Nicholas Yue yue.nicholas@gmail.com - -# This module will define the following variables: -# ILMBASE_INCLUDE_DIRS - Location of the ilmbase includes -# ILMBASE_LIBRARIES - [TODO] Required libraries for all requested bindings -# ILMBASE_FOUND - true if ILMBASE was found on the system -# ILMBASE_LIBRARY_DIRS - the full set of library directories - -FIND_PATH ( Ilmbase_Base_Dir include/OpenEXR/IlmBaseConfig.h - ENV ILMBASE_ROOT - ) - -IF ( Ilmbase_Base_Dir ) - - SET ( ILMBASE_INCLUDE_DIRS - ${Ilmbase_Base_Dir}/include - ${Ilmbase_Base_Dir}/include/OpenEXR - CACHE STRING "ILMBase include directories") - SET ( ILMBASE_LIBRARY_DIRS ${Ilmbase_Base_Dir}/lib - CACHE STRING "ILMBase library directories") - SET ( ILMBASE_FOUND TRUE ) - -ENDIF ( Ilmbase_Base_Dir ) -- 2.14.1