summaryrefslogtreecommitdiff
blob: c561e26a66568f3a049caa9b2fc050942e71ef13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 60bbcde225f3c28a36d8643c451509d9deb09222 Mon Sep 17 00:00:00 2001
From: Bernd Waibel <waebbl@gmail.com>
Date: Sat, 15 Jun 2019 13:34:09 +0200
Subject: [PATCH 2/5] Find IlmBase by setting a proper ILMBASE_ROOT value and
 by using pkg-config to determine the installed ilmbase version, instead of
 using the cmake STRINGS command.

Signed-off-by: Bernd Waibel <waebbl@gmail.com>
---
 cmake/Modules/FindIlmBase.cmake   | 18 +++++++++++++++++-
 cmake/Modules/FindPyIlmBase.cmake |  2 +-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/cmake/Modules/FindIlmBase.cmake b/cmake/Modules/FindIlmBase.cmake
index 679a02f..0fe2b1a 100644
--- a/cmake/Modules/FindIlmBase.cmake
+++ b/cmake/Modules/FindIlmBase.cmake
@@ -52,7 +52,7 @@ IF(NOT DEFINED ILMBASE_ROOT)
           SET( ALEMBIC_ILMBASE_ROOT NOTFOUND )
         ELSE()
           # TODO: set to default install path when shipping out
-          SET( ALEMBIC_ILMBASE_ROOT "/usr/local/ilmbase-1.0.1/" )
+          SET( ALEMBIC_ILMBASE_ROOT "/usr" )
         ENDIF()
     ELSE()
         IF ( ${WINDOWS} )
@@ -87,6 +87,21 @@ SET(_ilmbase_SEARCH_DIRS
     /usr/freeware
 )
 
+# use pkg-config to determine the correct version
+include(FindPkgConfig)
+IF(PKG_CONFIG_FOUND)
+    PKG_CHECK_MODULES(PC_ILMBASE QUIET IlmBase)
+    IF(PC_ILMBASE_FOUND)
+        SET(ILMBASE_VERSION ${PC_ILMBASE_VERSION})
+        SET(ALEMBIC_ILMBASE_INCLUDE_DIRECTORY ${PC_ILMBASE_INCLUDE_DIRS})
+        STRING(REGEX MATCH "-lHalf" ALEMBIC_ILMBASE_HALF_LIB ${PC_ILMBASE_LDFLAGS})
+        STRING(REGEX MATCH "-lIex" ALEMBIC_ILMBASE_IEX_LIB ${PC_ILMBASE_LDFLAGS})
+        STRING(REGEX MATCH "-lIexMath" ALEMBIC_ILMBASE_IEXMATH_LIB ${PC_ILMBASE_LDFLAGS})
+        STRING(REGEX MATCH "-lIlmThread" ALEMBIC_ILMBASE_ILMTHREAD_LIB ${PC_ILMBASE_LDFLAGS})
+        String(REGEX MATCH "-lImath" ALEMBIC_ILMBASE_IMATH_LIB ${PC_ILMBASE_LDFLAGS})
+    ENDIF()
+ELSE(PKG_CONFIG_FOUND)
+
 FIND_PATH(ILMBASE_INCLUDE_DIR
   NAMES
     IlmBaseConfig.h
@@ -179,6 +194,7 @@ IF ( ${ALEMBIC_ILMBASE_INCLUDE_DIRECTORY} STREQUAL "ALEMBIC_ILMBASE_INCLUDE_DIRE
   MESSAGE( FATAL_ERROR "ilmbase header files not found, required: ALEMBIC_ILMBASE_ROOT: ${ALEMBIC_ILMBASE_ROOT}" )
 ENDIF()
 
+ENDIF(PKG_CONFIG_FOUND)
 
 MESSAGE( STATUS "ILMBASE INCLUDE PATH: ${ALEMBIC_ILMBASE_INCLUDE_DIRECTORY}" )
 MESSAGE( STATUS "HALF LIB: ${ALEMBIC_ILMBASE_HALF_LIB}" )
diff --git a/cmake/Modules/FindPyIlmBase.cmake b/cmake/Modules/FindPyIlmBase.cmake
index d55f8d3..b5f3cb5 100644
--- a/cmake/Modules/FindPyIlmBase.cmake
+++ b/cmake/Modules/FindPyIlmBase.cmake
@@ -44,7 +44,7 @@ ELSE()
               SET(ALEMBIC_PYILMBASE_ROOT NOTFOUND)
             ELSE()
               # TODO: set to default install path when shipping out
-              SET(ALEMBIC_PYILMBASE_ROOT "/usr/local/pyilmbase/")
+              SET(ALEMBIC_PYILMBASE_ROOT "/usr")
             ENDIF()
         ELSE()
             IF (${WINDOWS})
-- 
2.22.0