openvdb-mods.patch 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908
  1. From d359098d9989ac7dbd149611d6ac941529fb4157 Mon Sep 17 00:00:00 2001
  2. From: tamasmeszaros <meszaros.q@gmail.com>
  3. Date: Thu, 23 Jan 2020 17:17:36 +0100
  4. Subject: [PATCH] openvdb-mods
  5. ---
  6. CMakeLists.txt | 3 -
  7. cmake/CheckAtomic.cmake | 106 ++++++
  8. cmake/FindBlosc.cmake | 218 ------------
  9. cmake/FindCppUnit.cmake | 4 +-
  10. cmake/FindIlmBase.cmake | 337 ------------------
  11. cmake/FindOpenEXR.cmake | 329 ------------------
  12. cmake/FindOpenVDB.cmake | 19 +-
  13. cmake/FindTBB.cmake | 599 ++++++++++++++++----------------
  14. openvdb/CMakeLists.txt | 16 +-
  15. openvdb/Grid.cc | 3 +
  16. openvdb/PlatformConfig.h | 9 +-
  17. openvdb/cmd/CMakeLists.txt | 4 +-
  18. openvdb/unittest/CMakeLists.txt | 3 +-
  19. openvdb/unittest/TestFile.cc | 2 +-
  20. 14 files changed, 442 insertions(+), 1210 deletions(-)
  21. create mode 100644 cmake/CheckAtomic.cmake
  22. delete mode 100644 cmake/FindBlosc.cmake
  23. delete mode 100644 cmake/FindIlmBase.cmake
  24. delete mode 100644 cmake/FindOpenEXR.cmake
  25. diff --git a/CMakeLists.txt b/CMakeLists.txt
  26. index 580b353..6d364c1 100644
  27. --- a/CMakeLists.txt
  28. +++ b/CMakeLists.txt
  29. @@ -267,12 +267,9 @@ endif()
  30. if(OPENVDB_INSTALL_CMAKE_MODULES)
  31. set(OPENVDB_CMAKE_MODULES
  32. - cmake/FindBlosc.cmake
  33. cmake/FindCppUnit.cmake
  34. cmake/FindJemalloc.cmake
  35. - cmake/FindIlmBase.cmake
  36. cmake/FindLog4cplus.cmake
  37. - cmake/FindOpenEXR.cmake
  38. cmake/FindOpenVDB.cmake
  39. cmake/FindTBB.cmake
  40. cmake/OpenVDBGLFW3Setup.cmake
  41. diff --git a/cmake/CheckAtomic.cmake b/cmake/CheckAtomic.cmake
  42. new file mode 100644
  43. index 0000000..c045e30
  44. --- /dev/null
  45. +++ b/cmake/CheckAtomic.cmake
  46. @@ -0,0 +1,106 @@
  47. +# atomic builtins are required for threading support.
  48. +
  49. +INCLUDE(CheckCXXSourceCompiles)
  50. +INCLUDE(CheckLibraryExists)
  51. +
  52. +# Sometimes linking against libatomic is required for atomic ops, if
  53. +# the platform doesn't support lock-free atomics.
  54. +
  55. +function(check_working_cxx_atomics varname)
  56. + set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
  57. + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
  58. + CHECK_CXX_SOURCE_COMPILES("
  59. +#include <atomic>
  60. +std::atomic<int> x;
  61. +int main() {
  62. + return x;
  63. +}
  64. +" ${varname})
  65. + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
  66. +endfunction(check_working_cxx_atomics)
  67. +
  68. +function(check_working_cxx_atomics64 varname)
  69. + set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
  70. + set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}")
  71. + CHECK_CXX_SOURCE_COMPILES("
  72. +#include <atomic>
  73. +#include <cstdint>
  74. +std::atomic<uint64_t> x (0);
  75. +int main() {
  76. + uint64_t i = x.load(std::memory_order_relaxed);
  77. + return 0;
  78. +}
  79. +" ${varname})
  80. + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
  81. +endfunction(check_working_cxx_atomics64)
  82. +
  83. +
  84. +# This isn't necessary on MSVC, so avoid command-line switch annoyance
  85. +# by only running on GCC-like hosts.
  86. +if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
  87. + # First check if atomics work without the library.
  88. + check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
  89. + # If not, check if the library exists, and atomics work with it.
  90. + if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
  91. + check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
  92. + if( HAVE_LIBATOMIC )
  93. + list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
  94. + check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
  95. + if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
  96. + message(FATAL_ERROR "Host compiler must support std::atomic!")
  97. + endif()
  98. + else()
  99. + message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
  100. + endif()
  101. + endif()
  102. +endif()
  103. +
  104. +# Check for 64 bit atomic operations.
  105. +if(MSVC)
  106. + set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True)
  107. +else()
  108. + check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
  109. +endif()
  110. +
  111. +# If not, check if the library exists, and atomics work with it.
  112. +if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
  113. + check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64)
  114. + if(HAVE_CXX_LIBATOMICS64)
  115. + list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
  116. + check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB)
  117. + if (NOT HAVE_CXX_ATOMICS64_WITH_LIB)
  118. + message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!")
  119. + endif()
  120. + else()
  121. + message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.")
  122. + endif()
  123. +endif()
  124. +
  125. +## TODO: This define is only used for the legacy atomic operations in
  126. +## llvm's Atomic.h, which should be replaced. Other code simply
  127. +## assumes C++11 <atomic> works.
  128. +CHECK_CXX_SOURCE_COMPILES("
  129. +#ifdef _MSC_VER
  130. +#include <windows.h>
  131. +#endif
  132. +int main() {
  133. +#ifdef _MSC_VER
  134. + volatile LONG val = 1;
  135. + MemoryBarrier();
  136. + InterlockedCompareExchange(&val, 0, 1);
  137. + InterlockedIncrement(&val);
  138. + InterlockedDecrement(&val);
  139. +#else
  140. + volatile unsigned long val = 1;
  141. + __sync_synchronize();
  142. + __sync_val_compare_and_swap(&val, 1, 0);
  143. + __sync_add_and_fetch(&val, 1);
  144. + __sync_sub_and_fetch(&val, 1);
  145. +#endif
  146. + return 0;
  147. + }
  148. +" LLVM_HAS_ATOMICS)
  149. +
  150. +if( NOT LLVM_HAS_ATOMICS )
  151. + message(STATUS "Warning: LLVM will be built thread-unsafe because atomic builtins are missing")
  152. +endif()
  153. \ No newline at end of file
  154. diff --git a/cmake/FindBlosc.cmake b/cmake/FindBlosc.cmake
  155. deleted file mode 100644
  156. index 5aacfdd..0000000
  157. --- a/cmake/FindBlosc.cmake
  158. +++ /dev/null
  159. @@ -1,218 +0,0 @@
  160. -# Copyright (c) DreamWorks Animation LLC
  161. -#
  162. -# All rights reserved. This software is distributed under the
  163. -# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
  164. -#
  165. -# Redistributions of source code must retain the above copyright
  166. -# and license notice and the following restrictions and disclaimer.
  167. -#
  168. -# * Neither the name of DreamWorks Animation nor the names of
  169. -# its contributors may be used to endorse or promote products derived
  170. -# from this software without specific prior written permission.
  171. -#
  172. -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  173. -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  174. -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  175. -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  176. -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
  177. -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  178. -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  179. -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  180. -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  181. -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  182. -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  183. -# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
  184. -# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
  185. -#
  186. -#[=======================================================================[.rst:
  187. -
  188. -FindBlosc
  189. ----------
  190. -
  191. -Find Blosc include dirs and libraries
  192. -
  193. -Use this module by invoking find_package with the form::
  194. -
  195. - find_package(Blosc
  196. - [version] [EXACT] # Minimum or EXACT version e.g. 1.5.0
  197. - [REQUIRED] # Fail with error if Blosc is not found
  198. - )
  199. -
  200. -IMPORTED Targets
  201. -^^^^^^^^^^^^^^^^
  202. -
  203. -``Blosc::blosc``
  204. - This module defines IMPORTED target Blosc::Blosc, if Blosc has been found.
  205. -
  206. -Result Variables
  207. -^^^^^^^^^^^^^^^^
  208. -
  209. -This will define the following variables:
  210. -
  211. -``Blosc_FOUND``
  212. - True if the system has the Blosc library.
  213. -``Blosc_VERSION``
  214. - The version of the Blosc library which was found.
  215. -``Blosc_INCLUDE_DIRS``
  216. - Include directories needed to use Blosc.
  217. -``Blosc_LIBRARIES``
  218. - Libraries needed to link to Blosc.
  219. -``Blosc_LIBRARY_DIRS``
  220. - Blosc library directories.
  221. -
  222. -Cache Variables
  223. -^^^^^^^^^^^^^^^
  224. -
  225. -The following cache variables may also be set:
  226. -
  227. -``Blosc_INCLUDE_DIR``
  228. - The directory containing ``blosc.h``.
  229. -``Blosc_LIBRARY``
  230. - The path to the Blosc library.
  231. -
  232. -Hints
  233. -^^^^^
  234. -
  235. -Instead of explicitly setting the cache variables, the following variables
  236. -may be provided to tell this module where to look.
  237. -
  238. -``BLOSC_ROOT``
  239. - Preferred installation prefix.
  240. -``BLOSC_INCLUDEDIR``
  241. - Preferred include directory e.g. <prefix>/include
  242. -``BLOSC_LIBRARYDIR``
  243. - Preferred library directory e.g. <prefix>/lib
  244. -``SYSTEM_LIBRARY_PATHS``
  245. - Paths appended to all include and lib searches.
  246. -
  247. -#]=======================================================================]
  248. -
  249. -mark_as_advanced(
  250. - Blosc_INCLUDE_DIR
  251. - Blosc_LIBRARY
  252. -)
  253. -
  254. -# Append BLOSC_ROOT or $ENV{BLOSC_ROOT} if set (prioritize the direct cmake var)
  255. -set(_BLOSC_ROOT_SEARCH_DIR "")
  256. -
  257. -if(BLOSC_ROOT)
  258. - list(APPEND _BLOSC_ROOT_SEARCH_DIR ${BLOSC_ROOT})
  259. -else()
  260. - set(_ENV_BLOSC_ROOT $ENV{BLOSC_ROOT})
  261. - if(_ENV_BLOSC_ROOT)
  262. - list(APPEND _BLOSC_ROOT_SEARCH_DIR ${_ENV_BLOSC_ROOT})
  263. - endif()
  264. -endif()
  265. -
  266. -# Additionally try and use pkconfig to find blosc
  267. -
  268. -find_package(PkgConfig)
  269. -pkg_check_modules(PC_Blosc QUIET blosc)
  270. -
  271. -# ------------------------------------------------------------------------
  272. -# Search for blosc include DIR
  273. -# ------------------------------------------------------------------------
  274. -
  275. -set(_BLOSC_INCLUDE_SEARCH_DIRS "")
  276. -list(APPEND _BLOSC_INCLUDE_SEARCH_DIRS
  277. - ${BLOSC_INCLUDEDIR}
  278. - ${_BLOSC_ROOT_SEARCH_DIR}
  279. - ${PC_Blosc_INCLUDE_DIRS}
  280. - ${SYSTEM_LIBRARY_PATHS}
  281. -)
  282. -
  283. -# Look for a standard blosc header file.
  284. -find_path(Blosc_INCLUDE_DIR blosc.h
  285. - NO_DEFAULT_PATH
  286. - PATHS ${_BLOSC_INCLUDE_SEARCH_DIRS}
  287. - PATH_SUFFIXES include
  288. -)
  289. -
  290. -if(EXISTS "${Blosc_INCLUDE_DIR}/blosc.h")
  291. - file(STRINGS "${Blosc_INCLUDE_DIR}/blosc.h"
  292. - _blosc_version_major_string REGEX "#define BLOSC_VERSION_MAJOR +[0-9]+ "
  293. - )
  294. - string(REGEX REPLACE "#define BLOSC_VERSION_MAJOR +([0-9]+).*$" "\\1"
  295. - _blosc_version_major_string "${_blosc_version_major_string}"
  296. - )
  297. - string(STRIP "${_blosc_version_major_string}" Blosc_VERSION_MAJOR)
  298. -
  299. - file(STRINGS "${Blosc_INCLUDE_DIR}/blosc.h"
  300. - _blosc_version_minor_string REGEX "#define BLOSC_VERSION_MINOR +[0-9]+ "
  301. - )
  302. - string(REGEX REPLACE "#define BLOSC_VERSION_MINOR +([0-9]+).*$" "\\1"
  303. - _blosc_version_minor_string "${_blosc_version_minor_string}"
  304. - )
  305. - string(STRIP "${_blosc_version_minor_string}" Blosc_VERSION_MINOR)
  306. -
  307. - unset(_blosc_version_major_string)
  308. - unset(_blosc_version_minor_string)
  309. -
  310. - set(Blosc_VERSION ${Blosc_VERSION_MAJOR}.${Blosc_VERSION_MINOR})
  311. -endif()
  312. -
  313. -# ------------------------------------------------------------------------
  314. -# Search for blosc lib DIR
  315. -# ------------------------------------------------------------------------
  316. -
  317. -set(_BLOSC_LIBRARYDIR_SEARCH_DIRS "")
  318. -list(APPEND _BLOSC_LIBRARYDIR_SEARCH_DIRS
  319. - ${BLOSC_LIBRARYDIR}
  320. - ${_BLOSC_ROOT_SEARCH_DIR}
  321. - ${PC_Blosc_LIBRARY_DIRS}
  322. - ${SYSTEM_LIBRARY_PATHS}
  323. -)
  324. -
  325. -# Static library setup
  326. -if(UNIX AND BLOSC_USE_STATIC_LIBS)
  327. - set(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  328. - set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
  329. -endif()
  330. -
  331. -set(BLOSC_PATH_SUFFIXES
  332. - lib64
  333. - lib
  334. -)
  335. -
  336. -find_library(Blosc_LIBRARY blosc
  337. - NO_DEFAULT_PATH
  338. - PATHS ${_BLOSC_LIBRARYDIR_SEARCH_DIRS}
  339. - PATH_SUFFIXES ${BLOSC_PATH_SUFFIXES}
  340. -)
  341. -
  342. -if(UNIX AND BLOSC_USE_STATIC_LIBS)
  343. - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  344. - unset(_BLOSC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
  345. -endif()
  346. -
  347. -# ------------------------------------------------------------------------
  348. -# Cache and set Blosc_FOUND
  349. -# ------------------------------------------------------------------------
  350. -
  351. -include(FindPackageHandleStandardArgs)
  352. -find_package_handle_standard_args(Blosc
  353. - FOUND_VAR Blosc_FOUND
  354. - REQUIRED_VARS
  355. - Blosc_LIBRARY
  356. - Blosc_INCLUDE_DIR
  357. - VERSION_VAR Blosc_VERSION
  358. -)
  359. -
  360. -if(Blosc_FOUND)
  361. - set(Blosc_LIBRARIES ${Blosc_LIBRARY})
  362. - set(Blosc_INCLUDE_DIRS ${Blosc_INCLUDE_DIR})
  363. - set(Blosc_DEFINITIONS ${PC_Blosc_CFLAGS_OTHER})
  364. -
  365. - get_filename_component(Blosc_LIBRARY_DIRS ${Blosc_LIBRARY} DIRECTORY)
  366. -
  367. - if(NOT TARGET Blosc::blosc)
  368. - add_library(Blosc::blosc UNKNOWN IMPORTED)
  369. - set_target_properties(Blosc::blosc PROPERTIES
  370. - IMPORTED_LOCATION "${Blosc_LIBRARIES}"
  371. - INTERFACE_COMPILE_DEFINITIONS "${Blosc_DEFINITIONS}"
  372. - INTERFACE_INCLUDE_DIRECTORIES "${Blosc_INCLUDE_DIRS}"
  373. - )
  374. - endif()
  375. -elseif(Blosc_FIND_REQUIRED)
  376. - message(FATAL_ERROR "Unable to find Blosc")
  377. -endif()
  378. diff --git a/cmake/FindCppUnit.cmake b/cmake/FindCppUnit.cmake
  379. index e2beb93..a891624 100644
  380. --- a/cmake/FindCppUnit.cmake
  381. +++ b/cmake/FindCppUnit.cmake
  382. @@ -125,7 +125,7 @@ list(APPEND _CPPUNIT_INCLUDE_SEARCH_DIRS
  383. # Look for a standard cppunit header file.
  384. find_path(CppUnit_INCLUDE_DIR cppunit/Portability.h
  385. - NO_DEFAULT_PATH
  386. + # NO_DEFAULT_PATH
  387. PATHS ${_CPPUNIT_INCLUDE_SEARCH_DIRS}
  388. PATH_SUFFIXES include
  389. )
  390. @@ -177,7 +177,7 @@ set(CPPUNIT_PATH_SUFFIXES
  391. )
  392. find_library(CppUnit_LIBRARY cppunit
  393. - NO_DEFAULT_PATH
  394. + # NO_DEFAULT_PATH
  395. PATHS ${_CPPUNIT_LIBRARYDIR_SEARCH_DIRS}
  396. PATH_SUFFIXES ${CPPUNIT_PATH_SUFFIXES}
  397. )
  398. diff --git a/cmake/FindIlmBase.cmake b/cmake/FindIlmBase.cmake
  399. deleted file mode 100644
  400. index 9dbc252..0000000
  401. --- a/cmake/FindIlmBase.cmake
  402. +++ /dev/null
  403. @@ -1,337 +0,0 @@
  404. -# Copyright (c) DreamWorks Animation LLC
  405. -#
  406. -# All rights reserved. This software is distributed under the
  407. -# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
  408. -#
  409. -# Redistributions of source code must retain the above copyright
  410. -# and license notice and the following restrictions and disclaimer.
  411. -#
  412. -# * Neither the name of DreamWorks Animation nor the names of
  413. -# its contributors may be used to endorse or promote products derived
  414. -# from this software without specific prior written permission.
  415. -#
  416. -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  417. -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  418. -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  419. -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  420. -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
  421. -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  422. -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  423. -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  424. -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  425. -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  426. -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  427. -# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
  428. -# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
  429. -#
  430. -#[=======================================================================[.rst:
  431. -
  432. -FindIlmBase
  433. ------------
  434. -
  435. -Find IlmBase include dirs and libraries
  436. -
  437. -Use this module by invoking find_package with the form::
  438. -
  439. - find_package(IlmBase
  440. - [version] [EXACT] # Minimum or EXACT version
  441. - [REQUIRED] # Fail with error if IlmBase is not found
  442. - [COMPONENTS <libs>...] # IlmBase libraries by their canonical name
  443. - # e.g. "Half" for "libHalf"
  444. - )
  445. -
  446. -IMPORTED Targets
  447. -^^^^^^^^^^^^^^^^
  448. -
  449. -``IlmBase::Half``
  450. - The Half library target.
  451. -``IlmBase::Iex``
  452. - The Iex library target.
  453. -``IlmBase::IexMath``
  454. - The IexMath library target.
  455. -``IlmBase::IlmThread``
  456. - The IlmThread library target.
  457. -``IlmBase::Imath``
  458. - The Imath library target.
  459. -
  460. -Result Variables
  461. -^^^^^^^^^^^^^^^^
  462. -
  463. -This will define the following variables:
  464. -
  465. -``IlmBase_FOUND``
  466. - True if the system has the IlmBase library.
  467. -``IlmBase_VERSION``
  468. - The version of the IlmBase library which was found.
  469. -``IlmBase_INCLUDE_DIRS``
  470. - Include directories needed to use IlmBase.
  471. -``IlmBase_LIBRARIES``
  472. - Libraries needed to link to IlmBase.
  473. -``IlmBase_LIBRARY_DIRS``
  474. - IlmBase library directories.
  475. -``IlmBase_{COMPONENT}_FOUND``
  476. - True if the system has the named IlmBase component.
  477. -
  478. -Cache Variables
  479. -^^^^^^^^^^^^^^^
  480. -
  481. -The following cache variables may also be set:
  482. -
  483. -``IlmBase_INCLUDE_DIR``
  484. - The directory containing ``IlmBase/config-auto.h``.
  485. -``IlmBase_{COMPONENT}_LIBRARY``
  486. - Individual component libraries for IlmBase
  487. -``IlmBase_{COMPONENT}_DLL``
  488. - Individual component dlls for IlmBase on Windows.
  489. -
  490. -Hints
  491. -^^^^^
  492. -
  493. -Instead of explicitly setting the cache variables, the following variables
  494. -may be provided to tell this module where to look.
  495. -
  496. -``ILMBASE_ROOT``
  497. - Preferred installation prefix.
  498. -``ILMBASE_INCLUDEDIR``
  499. - Preferred include directory e.g. <prefix>/include
  500. -``ILMBASE_LIBRARYDIR``
  501. - Preferred library directory e.g. <prefix>/lib
  502. -``SYSTEM_LIBRARY_PATHS``
  503. - Paths appended to all include and lib searches.
  504. -
  505. -#]=======================================================================]
  506. -
  507. -# Support new if() IN_LIST operator
  508. -if(POLICY CMP0057)
  509. - cmake_policy(SET CMP0057 NEW)
  510. -endif()
  511. -
  512. -mark_as_advanced(
  513. - IlmBase_INCLUDE_DIR
  514. - IlmBase_LIBRARY
  515. -)
  516. -
  517. -set(_ILMBASE_COMPONENT_LIST
  518. - Half
  519. - Iex
  520. - IexMath
  521. - IlmThread
  522. - Imath
  523. -)
  524. -
  525. -if(IlmBase_FIND_COMPONENTS)
  526. - set(ILMBASE_COMPONENTS_PROVIDED TRUE)
  527. - set(_IGNORED_COMPONENTS "")
  528. - foreach(COMPONENT ${IlmBase_FIND_COMPONENTS})
  529. - if(NOT ${COMPONENT} IN_LIST _ILMBASE_COMPONENT_LIST)
  530. - list(APPEND _IGNORED_COMPONENTS ${COMPONENT})
  531. - endif()
  532. - endforeach()
  533. -
  534. - if(_IGNORED_COMPONENTS)
  535. - message(STATUS "Ignoring unknown components of IlmBase:")
  536. - foreach(COMPONENT ${_IGNORED_COMPONENTS})
  537. - message(STATUS " ${COMPONENT}")
  538. - endforeach()
  539. - list(REMOVE_ITEM IlmBase_FIND_COMPONENTS ${_IGNORED_COMPONENTS})
  540. - endif()
  541. -else()
  542. - set(ILMBASE_COMPONENTS_PROVIDED FALSE)
  543. - set(IlmBase_FIND_COMPONENTS ${_ILMBASE_COMPONENT_LIST})
  544. -endif()
  545. -
  546. -# Append ILMBASE_ROOT or $ENV{ILMBASE_ROOT} if set (prioritize the direct cmake var)
  547. -set(_ILMBASE_ROOT_SEARCH_DIR "")
  548. -
  549. -if(ILMBASE_ROOT)
  550. - list(APPEND _ILMBASE_ROOT_SEARCH_DIR ${ILMBASE_ROOT})
  551. -else()
  552. - set(_ENV_ILMBASE_ROOT $ENV{ILMBASE_ROOT})
  553. - if(_ENV_ILMBASE_ROOT)
  554. - list(APPEND _ILMBASE_ROOT_SEARCH_DIR ${_ENV_ILMBASE_ROOT})
  555. - endif()
  556. -endif()
  557. -
  558. -# Additionally try and use pkconfig to find IlmBase
  559. -
  560. -find_package(PkgConfig)
  561. -pkg_check_modules(PC_IlmBase QUIET IlmBase)
  562. -
  563. -# ------------------------------------------------------------------------
  564. -# Search for IlmBase include DIR
  565. -# ------------------------------------------------------------------------
  566. -
  567. -set(_ILMBASE_INCLUDE_SEARCH_DIRS "")
  568. -list(APPEND _ILMBASE_INCLUDE_SEARCH_DIRS
  569. - ${ILMBASE_INCLUDEDIR}
  570. - ${_ILMBASE_ROOT_SEARCH_DIR}
  571. - ${PC_IlmBase_INCLUDEDIR}
  572. - ${SYSTEM_LIBRARY_PATHS}
  573. -)
  574. -
  575. -# Look for a standard IlmBase header file.
  576. -find_path(IlmBase_INCLUDE_DIR IlmBaseConfig.h
  577. - NO_DEFAULT_PATH
  578. - PATHS ${_ILMBASE_INCLUDE_SEARCH_DIRS}
  579. - PATH_SUFFIXES include/OpenEXR OpenEXR
  580. -)
  581. -
  582. -if(EXISTS "${IlmBase_INCLUDE_DIR}/IlmBaseConfig.h")
  583. - # Get the ILMBASE version information from the config header
  584. - file(STRINGS "${IlmBase_INCLUDE_DIR}/IlmBaseConfig.h"
  585. - _ilmbase_version_major_string REGEX "#define ILMBASE_VERSION_MAJOR "
  586. - )
  587. - string(REGEX REPLACE "#define ILMBASE_VERSION_MAJOR" ""
  588. - _ilmbase_version_major_string "${_ilmbase_version_major_string}"
  589. - )
  590. - string(STRIP "${_ilmbase_version_major_string}" IlmBase_VERSION_MAJOR)
  591. -
  592. - file(STRINGS "${IlmBase_INCLUDE_DIR}/IlmBaseConfig.h"
  593. - _ilmbase_version_minor_string REGEX "#define ILMBASE_VERSION_MINOR "
  594. - )
  595. - string(REGEX REPLACE "#define ILMBASE_VERSION_MINOR" ""
  596. - _ilmbase_version_minor_string "${_ilmbase_version_minor_string}"
  597. - )
  598. - string(STRIP "${_ilmbase_version_minor_string}" IlmBase_VERSION_MINOR)
  599. -
  600. - unset(_ilmbase_version_major_string)
  601. - unset(_ilmbase_version_minor_string)
  602. -
  603. - set(IlmBase_VERSION ${IlmBase_VERSION_MAJOR}.${IlmBase_VERSION_MINOR})
  604. -endif()
  605. -
  606. -# ------------------------------------------------------------------------
  607. -# Search for ILMBASE lib DIR
  608. -# ------------------------------------------------------------------------
  609. -
  610. -set(_ILMBASE_LIBRARYDIR_SEARCH_DIRS "")
  611. -
  612. -# Append to _ILMBASE_LIBRARYDIR_SEARCH_DIRS in priority order
  613. -
  614. -list(APPEND _ILMBASE_LIBRARYDIR_SEARCH_DIRS
  615. - ${ILMBASE_LIBRARYDIR}
  616. - ${_ILMBASE_ROOT_SEARCH_DIR}
  617. - ${PC_IlmBase_LIBDIR}
  618. - ${SYSTEM_LIBRARY_PATHS}
  619. -)
  620. -
  621. -# Build suffix directories
  622. -
  623. -set(ILMBASE_PATH_SUFFIXES
  624. - lib64
  625. - lib
  626. -)
  627. -
  628. -if(UNIX)
  629. - list(INSERT ILMBASE_PATH_SUFFIXES 0 lib/x86_64-linux-gnu)
  630. -endif()
  631. -
  632. -set(_ILMBASE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  633. -
  634. -# library suffix handling
  635. -if(WIN32)
  636. - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
  637. - "-${IlmBase_VERSION_MAJOR}_${IlmBase_VERSION_MINOR}.lib"
  638. - )
  639. -else()
  640. - if(ILMBASE_USE_STATIC_LIBS)
  641. - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
  642. - "-${IlmBase_VERSION_MAJOR}_${IlmBase_VERSION_MINOR}.a"
  643. - )
  644. - else()
  645. - if(APPLE)
  646. - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
  647. - "-${IlmBase_VERSION_MAJOR}_${IlmBase_VERSION_MINOR}.dylib"
  648. - )
  649. - else()
  650. - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
  651. - "-${IlmBase_VERSION_MAJOR}_${IlmBase_VERSION_MINOR}.so"
  652. - )
  653. - endif()
  654. - endif()
  655. -endif()
  656. -
  657. -set(IlmBase_LIB_COMPONENTS "")
  658. -
  659. -foreach(COMPONENT ${IlmBase_FIND_COMPONENTS})
  660. - find_library(IlmBase_${COMPONENT}_LIBRARY ${COMPONENT}
  661. - NO_DEFAULT_PATH
  662. - PATHS ${_ILMBASE_LIBRARYDIR_SEARCH_DIRS}
  663. - PATH_SUFFIXES ${ILMBASE_PATH_SUFFIXES}
  664. - )
  665. - list(APPEND IlmBase_LIB_COMPONENTS ${IlmBase_${COMPONENT}_LIBRARY})
  666. -
  667. - if(WIN32 AND NOT ILMBASE_USE_STATIC_LIBS)
  668. - set(_ILMBASE_TMP ${CMAKE_FIND_LIBRARY_SUFFIXES})
  669. - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
  670. - find_library(IlmBase_${COMPONENT}_DLL ${COMPONENT}
  671. - NO_DEFAULT_PATH
  672. - PATHS ${_ILMBASE_LIBRARYDIR_SEARCH_DIRS}
  673. - PATH_SUFFIXES bin
  674. - )
  675. - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ILMBASE_TMP})
  676. - unset(_ILMBASE_TMP)
  677. - endif()
  678. -
  679. - if(IlmBase_${COMPONENT}_LIBRARY)
  680. - set(IlmBase_${COMPONENT}_FOUND TRUE)
  681. - else()
  682. - set(IlmBase_${COMPONENT}_FOUND FALSE)
  683. - endif()
  684. -endforeach()
  685. -
  686. -# reset lib suffix
  687. -
  688. -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ILMBASE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  689. -unset(_ILMBASE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
  690. -
  691. -# ------------------------------------------------------------------------
  692. -# Cache and set ILMBASE_FOUND
  693. -# ------------------------------------------------------------------------
  694. -
  695. -include(FindPackageHandleStandardArgs)
  696. -find_package_handle_standard_args(IlmBase
  697. - FOUND_VAR IlmBase_FOUND
  698. - REQUIRED_VARS
  699. - IlmBase_INCLUDE_DIR
  700. - IlmBase_LIB_COMPONENTS
  701. - VERSION_VAR IlmBase_VERSION
  702. - HANDLE_COMPONENTS
  703. -)
  704. -
  705. -if(IlmBase_FOUND)
  706. - set(IlmBase_LIBRARIES ${IlmBase_LIB_COMPONENTS})
  707. -
  708. - # We have to add both include and include/OpenEXR to the include
  709. - # path in case OpenEXR and IlmBase are installed separately
  710. -
  711. - set(IlmBase_INCLUDE_DIRS)
  712. - list(APPEND IlmBase_INCLUDE_DIRS
  713. - ${IlmBase_INCLUDE_DIR}/../
  714. - ${IlmBase_INCLUDE_DIR}
  715. - )
  716. - set(IlmBase_DEFINITIONS ${PC_IlmBase_CFLAGS_OTHER})
  717. -
  718. - set(IlmBase_LIBRARY_DIRS "")
  719. - foreach(LIB ${IlmBase_LIB_COMPONENTS})
  720. - get_filename_component(_ILMBASE_LIBDIR ${LIB} DIRECTORY)
  721. - list(APPEND IlmBase_LIBRARY_DIRS ${_ILMBASE_LIBDIR})
  722. - endforeach()
  723. - list(REMOVE_DUPLICATES IlmBase_LIBRARY_DIRS)
  724. -
  725. - # Configure imported targets
  726. -
  727. - foreach(COMPONENT ${IlmBase_FIND_COMPONENTS})
  728. - if(NOT TARGET IlmBase::${COMPONENT})
  729. - add_library(IlmBase::${COMPONENT} UNKNOWN IMPORTED)
  730. - set_target_properties(IlmBase::${COMPONENT} PROPERTIES
  731. - IMPORTED_LOCATION "${IlmBase_${COMPONENT}_LIBRARY}"
  732. - INTERFACE_COMPILE_OPTIONS "${IlmBase_DEFINITIONS}"
  733. - INTERFACE_INCLUDE_DIRECTORIES "${IlmBase_INCLUDE_DIRS}"
  734. - )
  735. - endif()
  736. - endforeach()
  737. -
  738. -elseif(IlmBase_FIND_REQUIRED)
  739. - message(FATAL_ERROR "Unable to find IlmBase")
  740. -endif()
  741. diff --git a/cmake/FindOpenEXR.cmake b/cmake/FindOpenEXR.cmake
  742. deleted file mode 100644
  743. index 339c1a2..0000000
  744. --- a/cmake/FindOpenEXR.cmake
  745. +++ /dev/null
  746. @@ -1,329 +0,0 @@
  747. -# Copyright (c) DreamWorks Animation LLC
  748. -#
  749. -# All rights reserved. This software is distributed under the
  750. -# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
  751. -#
  752. -# Redistributions of source code must retain the above copyright
  753. -# and license notice and the following restrictions and disclaimer.
  754. -#
  755. -# * Neither the name of DreamWorks Animation nor the names of
  756. -# its contributors may be used to endorse or promote products derived
  757. -# from this software without specific prior written permission.
  758. -#
  759. -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  760. -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  761. -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  762. -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  763. -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
  764. -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  765. -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  766. -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  767. -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  768. -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  769. -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  770. -# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
  771. -# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
  772. -#
  773. -#[=======================================================================[.rst:
  774. -
  775. -FindOpenEXR
  776. ------------
  777. -
  778. -Find OpenEXR include dirs and libraries
  779. -
  780. -Use this module by invoking find_package with the form::
  781. -
  782. - find_package(OpenEXR
  783. - [version] [EXACT] # Minimum or EXACT version
  784. - [REQUIRED] # Fail with error if OpenEXR is not found
  785. - [COMPONENTS <libs>...] # OpenEXR libraries by their canonical name
  786. - # e.g. "IlmImf" for "libIlmImf"
  787. - )
  788. -
  789. -IMPORTED Targets
  790. -^^^^^^^^^^^^^^^^
  791. -
  792. -``OpenEXR::IlmImf``
  793. - The IlmImf library target.
  794. -``OpenEXR::IlmImfUtil``
  795. - The IlmImfUtil library target.
  796. -
  797. -Result Variables
  798. -^^^^^^^^^^^^^^^^
  799. -
  800. -This will define the following variables:
  801. -
  802. -``OpenEXR_FOUND``
  803. - True if the system has the OpenEXR library.
  804. -``OpenEXR_VERSION``
  805. - The version of the OpenEXR library which was found.
  806. -``OpenEXR_INCLUDE_DIRS``
  807. - Include directories needed to use OpenEXR.
  808. -``OpenEXR_LIBRARIES``
  809. - Libraries needed to link to OpenEXR.
  810. -``OpenEXR_LIBRARY_DIRS``
  811. - OpenEXR library directories.
  812. -``OpenEXR_DEFINITIONS``
  813. - Definitions to use when compiling code that uses OpenEXR.
  814. -``OpenEXR_{COMPONENT}_FOUND``
  815. - True if the system has the named OpenEXR component.
  816. -
  817. -Cache Variables
  818. -^^^^^^^^^^^^^^^
  819. -
  820. -The following cache variables may also be set:
  821. -
  822. -``OpenEXR_INCLUDE_DIR``
  823. - The directory containing ``OpenEXR/config-auto.h``.
  824. -``OpenEXR_{COMPONENT}_LIBRARY``
  825. - Individual component libraries for OpenEXR
  826. -``OpenEXR_{COMPONENT}_DLL``
  827. - Individual component dlls for OpenEXR on Windows.
  828. -
  829. -Hints
  830. -^^^^^
  831. -
  832. -Instead of explicitly setting the cache variables, the following variables
  833. -may be provided to tell this module where to look.
  834. -
  835. -``OPENEXR_ROOT``
  836. - Preferred installation prefix.
  837. -``OPENEXR_INCLUDEDIR``
  838. - Preferred include directory e.g. <prefix>/include
  839. -``OPENEXR_LIBRARYDIR``
  840. - Preferred library directory e.g. <prefix>/lib
  841. -``SYSTEM_LIBRARY_PATHS``
  842. - Paths appended to all include and lib searches.
  843. -
  844. -#]=======================================================================]
  845. -
  846. -# Support new if() IN_LIST operator
  847. -if(POLICY CMP0057)
  848. - cmake_policy(SET CMP0057 NEW)
  849. -endif()
  850. -
  851. -mark_as_advanced(
  852. - OpenEXR_INCLUDE_DIR
  853. - OpenEXR_LIBRARY
  854. -)
  855. -
  856. -set(_OPENEXR_COMPONENT_LIST
  857. - IlmImf
  858. - IlmImfUtil
  859. -)
  860. -
  861. -if(OpenEXR_FIND_COMPONENTS)
  862. - set(OPENEXR_COMPONENTS_PROVIDED TRUE)
  863. - set(_IGNORED_COMPONENTS "")
  864. - foreach(COMPONENT ${OpenEXR_FIND_COMPONENTS})
  865. - if(NOT ${COMPONENT} IN_LIST _OPENEXR_COMPONENT_LIST)
  866. - list(APPEND _IGNORED_COMPONENTS ${COMPONENT})
  867. - endif()
  868. - endforeach()
  869. -
  870. - if(_IGNORED_COMPONENTS)
  871. - message(STATUS "Ignoring unknown components of OpenEXR:")
  872. - foreach(COMPONENT ${_IGNORED_COMPONENTS})
  873. - message(STATUS " ${COMPONENT}")
  874. - endforeach()
  875. - list(REMOVE_ITEM OpenEXR_FIND_COMPONENTS ${_IGNORED_COMPONENTS})
  876. - endif()
  877. -else()
  878. - set(OPENEXR_COMPONENTS_PROVIDED FALSE)
  879. - set(OpenEXR_FIND_COMPONENTS ${_OPENEXR_COMPONENT_LIST})
  880. -endif()
  881. -
  882. -# Append OPENEXR_ROOT or $ENV{OPENEXR_ROOT} if set (prioritize the direct cmake var)
  883. -set(_OPENEXR_ROOT_SEARCH_DIR "")
  884. -
  885. -if(OPENEXR_ROOT)
  886. - list(APPEND _OPENEXR_ROOT_SEARCH_DIR ${OPENEXR_ROOT})
  887. -else()
  888. - set(_ENV_OPENEXR_ROOT $ENV{OPENEXR_ROOT})
  889. - if(_ENV_OPENEXR_ROOT)
  890. - list(APPEND _OPENEXR_ROOT_SEARCH_DIR ${_ENV_OPENEXR_ROOT})
  891. - endif()
  892. -endif()
  893. -
  894. -# Additionally try and use pkconfig to find OpenEXR
  895. -
  896. -find_package(PkgConfig)
  897. -pkg_check_modules(PC_OpenEXR QUIET OpenEXR)
  898. -
  899. -# ------------------------------------------------------------------------
  900. -# Search for OpenEXR include DIR
  901. -# ------------------------------------------------------------------------
  902. -
  903. -set(_OPENEXR_INCLUDE_SEARCH_DIRS "")
  904. -list(APPEND _OPENEXR_INCLUDE_SEARCH_DIRS
  905. - ${OPENEXR_INCLUDEDIR}
  906. - ${_OPENEXR_ROOT_SEARCH_DIR}
  907. - ${PC_OpenEXR_INCLUDEDIR}
  908. - ${SYSTEM_LIBRARY_PATHS}
  909. -)
  910. -
  911. -# Look for a standard OpenEXR header file.
  912. -find_path(OpenEXR_INCLUDE_DIR OpenEXRConfig.h
  913. - NO_DEFAULT_PATH
  914. - PATHS ${_OPENEXR_INCLUDE_SEARCH_DIRS}
  915. - PATH_SUFFIXES include/OpenEXR OpenEXR
  916. -)
  917. -
  918. -if(EXISTS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h")
  919. - # Get the EXR version information from the config header
  920. - file(STRINGS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h"
  921. - _openexr_version_major_string REGEX "#define OPENEXR_VERSION_MAJOR "
  922. - )
  923. - string(REGEX REPLACE "#define OPENEXR_VERSION_MAJOR" ""
  924. - _openexr_version_major_string "${_openexr_version_major_string}"
  925. - )
  926. - string(STRIP "${_openexr_version_major_string}" OpenEXR_VERSION_MAJOR)
  927. -
  928. - file(STRINGS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h"
  929. - _openexr_version_minor_string REGEX "#define OPENEXR_VERSION_MINOR "
  930. - )
  931. - string(REGEX REPLACE "#define OPENEXR_VERSION_MINOR" ""
  932. - _openexr_version_minor_string "${_openexr_version_minor_string}"
  933. - )
  934. - string(STRIP "${_openexr_version_minor_string}" OpenEXR_VERSION_MINOR)
  935. -
  936. - unset(_openexr_version_major_string)
  937. - unset(_openexr_version_minor_string)
  938. -
  939. - set(OpenEXR_VERSION ${OpenEXR_VERSION_MAJOR}.${OpenEXR_VERSION_MINOR})
  940. -endif()
  941. -
  942. -# ------------------------------------------------------------------------
  943. -# Search for OPENEXR lib DIR
  944. -# ------------------------------------------------------------------------
  945. -
  946. -set(_OPENEXR_LIBRARYDIR_SEARCH_DIRS "")
  947. -
  948. -# Append to _OPENEXR_LIBRARYDIR_SEARCH_DIRS in priority order
  949. -
  950. -list(APPEND _OPENEXR_LIBRARYDIR_SEARCH_DIRS
  951. - ${OPENEXR_LIBRARYDIR}
  952. - ${_OPENEXR_ROOT_SEARCH_DIR}
  953. - ${PC_OpenEXR_LIBDIR}
  954. - ${SYSTEM_LIBRARY_PATHS}
  955. -)
  956. -
  957. -# Build suffix directories
  958. -
  959. -set(OPENEXR_PATH_SUFFIXES
  960. - lib64
  961. - lib
  962. -)
  963. -
  964. -if(UNIX )
  965. - list(INSERT OPENEXR_PATH_SUFFIXES 0 lib/x86_64-linux-gnu)
  966. -endif()
  967. -
  968. -set(_OPENEXR_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  969. -
  970. -# library suffix handling
  971. -if(WIN32)
  972. - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
  973. - "-${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}.lib"
  974. - )
  975. -else()
  976. - if(OPENEXR_USE_STATIC_LIBS)
  977. - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
  978. - "-${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}.a"
  979. - )
  980. - else()
  981. - if(APPLE)
  982. - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
  983. - "-${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}.dylib"
  984. - )
  985. - else()
  986. - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
  987. - "-${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}.so"
  988. - )
  989. - endif()
  990. - endif()
  991. -endif()
  992. -
  993. -set(OpenEXR_LIB_COMPONENTS "")
  994. -
  995. -foreach(COMPONENT ${OpenEXR_FIND_COMPONENTS})
  996. - find_library(OpenEXR_${COMPONENT}_LIBRARY ${COMPONENT}
  997. - NO_DEFAULT_PATH
  998. - PATHS ${_OPENEXR_LIBRARYDIR_SEARCH_DIRS}
  999. - PATH_SUFFIXES ${OPENEXR_PATH_SUFFIXES}
  1000. - )
  1001. - list(APPEND OpenEXR_LIB_COMPONENTS ${OpenEXR_${COMPONENT}_LIBRARY})
  1002. -
  1003. - if(WIN32 AND NOT OPENEXR_USE_STATIC_LIBS)
  1004. - set(_OPENEXR_TMP ${CMAKE_FIND_LIBRARY_SUFFIXES})
  1005. - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
  1006. - find_library(OpenEXR_${COMPONENT}_DLL ${COMPONENT}
  1007. - NO_DEFAULT_PATH
  1008. - PATHS ${_OPENEXR_LIBRARYDIR_SEARCH_DIRS}
  1009. - PATH_SUFFIXES bin
  1010. - )
  1011. - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_OPENEXR_TMP})
  1012. - unset(_OPENEXR_TMP)
  1013. - endif()
  1014. -
  1015. - if(OpenEXR_${COMPONENT}_LIBRARY)
  1016. - set(OpenEXR_${COMPONENT}_FOUND TRUE)
  1017. - else()
  1018. - set(OpenEXR_${COMPONENT}_FOUND FALSE)
  1019. - endif()
  1020. -endforeach()
  1021. -
  1022. -# reset lib suffix
  1023. -
  1024. -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_OPENEXR_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  1025. -unset(_OPENEXR_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
  1026. -
  1027. -# ------------------------------------------------------------------------
  1028. -# Cache and set OPENEXR_FOUND
  1029. -# ------------------------------------------------------------------------
  1030. -
  1031. -include(FindPackageHandleStandardArgs)
  1032. -find_package_handle_standard_args(OpenEXR
  1033. - FOUND_VAR OpenEXR_FOUND
  1034. - REQUIRED_VARS
  1035. - OpenEXR_INCLUDE_DIR
  1036. - OpenEXR_LIB_COMPONENTS
  1037. - VERSION_VAR OpenEXR_VERSION
  1038. - HANDLE_COMPONENTS
  1039. -)
  1040. -
  1041. -if(OpenEXR_FOUND)
  1042. - set(OpenEXR_LIBRARIES ${OpenEXR_LIB_COMPONENTS})
  1043. -
  1044. - # We have to add both include and include/OpenEXR to the include
  1045. - # path in case OpenEXR and IlmBase are installed separately
  1046. -
  1047. - set(OpenEXR_INCLUDE_DIRS)
  1048. - list(APPEND OpenEXR_INCLUDE_DIRS
  1049. - ${OpenEXR_INCLUDE_DIR}/../
  1050. - ${OpenEXR_INCLUDE_DIR}
  1051. - )
  1052. - set(OpenEXR_DEFINITIONS ${PC_OpenEXR_CFLAGS_OTHER})
  1053. -
  1054. - set(OpenEXR_LIBRARY_DIRS "")
  1055. - foreach(LIB ${OpenEXR_LIB_COMPONENTS})
  1056. - get_filename_component(_OPENEXR_LIBDIR ${LIB} DIRECTORY)
  1057. - list(APPEND OpenEXR_LIBRARY_DIRS ${_OPENEXR_LIBDIR})
  1058. - endforeach()
  1059. - list(REMOVE_DUPLICATES OpenEXR_LIBRARY_DIRS)
  1060. -
  1061. - # Configure imported target
  1062. -
  1063. - foreach(COMPONENT ${OpenEXR_FIND_COMPONENTS})
  1064. - if(NOT TARGET OpenEXR::${COMPONENT})
  1065. - add_library(OpenEXR::${COMPONENT} UNKNOWN IMPORTED)
  1066. - set_target_properties(OpenEXR::${COMPONENT} PROPERTIES
  1067. - IMPORTED_LOCATION "${OpenEXR_${COMPONENT}_LIBRARY}"
  1068. - INTERFACE_COMPILE_OPTIONS "${OpenEXR_DEFINITIONS}"
  1069. - INTERFACE_INCLUDE_DIRECTORIES "${OpenEXR_INCLUDE_DIRS}"
  1070. - )
  1071. - endif()
  1072. - endforeach()
  1073. -elseif(OpenEXR_FIND_REQUIRED)
  1074. - message(FATAL_ERROR "Unable to find OpenEXR")
  1075. -endif()
  1076. diff --git a/cmake/FindOpenVDB.cmake b/cmake/FindOpenVDB.cmake
  1077. index 63a2eda..d9f6d07 100644
  1078. --- a/cmake/FindOpenVDB.cmake
  1079. +++ b/cmake/FindOpenVDB.cmake
  1080. @@ -244,7 +244,7 @@ set(OpenVDB_LIB_COMPONENTS "")
  1081. foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS})
  1082. set(LIB_NAME ${COMPONENT})
  1083. - find_library(OpenVDB_${COMPONENT}_LIBRARY ${LIB_NAME}
  1084. + find_library(OpenVDB_${COMPONENT}_LIBRARY ${LIB_NAME} lib${LIB_NAME}
  1085. NO_DEFAULT_PATH
  1086. PATHS ${_OPENVDB_LIBRARYDIR_SEARCH_DIRS}
  1087. PATH_SUFFIXES ${OPENVDB_PATH_SUFFIXES}
  1088. @@ -282,16 +282,13 @@ find_package_handle_standard_args(OpenVDB
  1089. # ------------------------------------------------------------------------
  1090. # Set the ABI number the library was built against. Uses vdb_print
  1091. +find_program(OPENVDB_PRINT vdb_print
  1092. + PATHS ${_OPENVDB_INSTALL}/bin ${OpenVDB_INCLUDE_DIR}
  1093. + NO_DEFAULT_PATH)
  1094. if(_OPENVDB_INSTALL)
  1095. OPENVDB_ABI_VERSION_FROM_PRINT(
  1096. - "${_OPENVDB_INSTALL}/bin/vdb_print"
  1097. - ABI OpenVDB_ABI
  1098. - )
  1099. -else()
  1100. - # Try and find vdb_print from the include path
  1101. - OPENVDB_ABI_VERSION_FROM_PRINT(
  1102. - "${OpenVDB_INCLUDE_DIR}/../bin/vdb_print"
  1103. + "${OPENVDB_PRINT}"
  1104. ABI OpenVDB_ABI
  1105. )
  1106. endif()
  1107. @@ -472,6 +469,12 @@ foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS})
  1108. INTERFACE_LINK_LIBRARIES "${_OPENVDB_VISIBLE_DEPENDENCIES}" # visible deps (headers)
  1109. INTERFACE_COMPILE_FEATURES cxx_std_11
  1110. )
  1111. +
  1112. + if (OPENVDB_USE_STATIC_LIBS)
  1113. + set_target_properties(OpenVDB::${COMPONENT} PROPERTIES
  1114. + INTERFACE_COMPILE_DEFINITIONS "OPENVDB_STATICLIB;OPENVDB_OPENEXR_STATICLIB"
  1115. + )
  1116. + endif()
  1117. endif()
  1118. endforeach()
  1119. diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake
  1120. index bdf9c81..06093a4 100644
  1121. --- a/cmake/FindTBB.cmake
  1122. +++ b/cmake/FindTBB.cmake
  1123. @@ -1,333 +1,332 @@
  1124. -# Copyright (c) DreamWorks Animation LLC
  1125. +# The MIT License (MIT)
  1126. #
  1127. -# All rights reserved. This software is distributed under the
  1128. -# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
  1129. +# Copyright (c) 2015 Justus Calvin
  1130. #
  1131. -# Redistributions of source code must retain the above copyright
  1132. -# and license notice and the following restrictions and disclaimer.
  1133. +# Permission is hereby granted, free of charge, to any person obtaining a copy
  1134. +# of this software and associated documentation files (the "Software"), to deal
  1135. +# in the Software without restriction, including without limitation the rights
  1136. +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1137. +# copies of the Software, and to permit persons to whom the Software is
  1138. +# furnished to do so, subject to the following conditions:
  1139. #
  1140. -# * Neither the name of DreamWorks Animation nor the names of
  1141. -# its contributors may be used to endorse or promote products derived
  1142. -# from this software without specific prior written permission.
  1143. +# The above copyright notice and this permission notice shall be included in all
  1144. +# copies or substantial portions of the Software.
  1145. #
  1146. -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  1147. -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  1148. -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  1149. -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  1150. -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
  1151. -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  1152. -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  1153. -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  1154. -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  1155. -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  1156. -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1157. -# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
  1158. -# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
  1159. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1160. +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1161. +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1162. +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1163. +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1164. +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  1165. +# SOFTWARE.
  1166. +
  1167. #
  1168. -#[=======================================================================[.rst:
  1169. -
  1170. -FindTBB
  1171. --------
  1172. -
  1173. -Find Tbb include dirs and libraries
  1174. -
  1175. -Use this module by invoking find_package with the form::
  1176. -
  1177. - find_package(TBB
  1178. - [version] [EXACT] # Minimum or EXACT version
  1179. - [REQUIRED] # Fail with error if Tbb is not found
  1180. - [COMPONENTS <libs>...] # Tbb libraries by their canonical name
  1181. - # e.g. "tbb" for "libtbb"
  1182. - )
  1183. -
  1184. -IMPORTED Targets
  1185. -^^^^^^^^^^^^^^^^
  1186. -
  1187. -``TBB::tbb``
  1188. - The tbb library target.
  1189. -``TBB::tbbmalloc``
  1190. - The tbbmalloc library target.
  1191. -``TBB::tbbmalloc_proxy``
  1192. - The tbbmalloc_proxy library target.
  1193. -
  1194. -Result Variables
  1195. -^^^^^^^^^^^^^^^^
  1196. -
  1197. -This will define the following variables:
  1198. -
  1199. -``Tbb_FOUND``
  1200. - True if the system has the Tbb library.
  1201. -``Tbb_VERSION``
  1202. - The version of the Tbb library which was found.
  1203. -``Tbb_INCLUDE_DIRS``
  1204. - Include directories needed to use Tbb.
  1205. -``Tbb_LIBRARIES``
  1206. - Libraries needed to link to Tbb.
  1207. -``Tbb_LIBRARY_DIRS``
  1208. - Tbb library directories.
  1209. -``TBB_{COMPONENT}_FOUND``
  1210. - True if the system has the named TBB component.
  1211. -
  1212. -Cache Variables
  1213. -^^^^^^^^^^^^^^^
  1214. -
  1215. -The following cache variables may also be set:
  1216. -
  1217. -``Tbb_INCLUDE_DIR``
  1218. - The directory containing ``tbb/tbb_stddef.h``.
  1219. -``Tbb_{COMPONENT}_LIBRARY``
  1220. - Individual component libraries for Tbb
  1221. -
  1222. -Hints
  1223. -^^^^^
  1224. -
  1225. -Instead of explicitly setting the cache variables, the following variables
  1226. -may be provided to tell this module where to look.
  1227. -
  1228. -``TBB_ROOT``
  1229. - Preferred installation prefix.
  1230. -``TBB_INCLUDEDIR``
  1231. - Preferred include directory e.g. <prefix>/include
  1232. -``TBB_LIBRARYDIR``
  1233. - Preferred library directory e.g. <prefix>/lib
  1234. -``SYSTEM_LIBRARY_PATHS``
  1235. - Paths appended to all include and lib searches.
  1236. -
  1237. -#]=======================================================================]
  1238. -
  1239. -# Support new if() IN_LIST operator
  1240. -if(POLICY CMP0057)
  1241. - cmake_policy(SET CMP0057 NEW)
  1242. -endif()
  1243. +# FindTBB
  1244. +# -------
  1245. +#
  1246. +# Find TBB include directories and libraries.
  1247. +#
  1248. +# Usage:
  1249. +#
  1250. +# find_package(TBB [major[.minor]] [EXACT]
  1251. +# [QUIET] [REQUIRED]
  1252. +# [[COMPONENTS] [components...]]
  1253. +# [OPTIONAL_COMPONENTS components...])
  1254. +#
  1255. +# where the allowed components are tbbmalloc and tbb_preview. Users may modify
  1256. +# the behavior of this module with the following variables:
  1257. +#
  1258. +# * TBB_ROOT_DIR - The base directory the of TBB installation.
  1259. +# * TBB_INCLUDE_DIR - The directory that contains the TBB headers files.
  1260. +# * TBB_LIBRARY - The directory that contains the TBB library files.
  1261. +# * TBB_<library>_LIBRARY - The path of the TBB the corresponding TBB library.
  1262. +# These libraries, if specified, override the
  1263. +# corresponding library search results, where <library>
  1264. +# may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug,
  1265. +# tbb_preview, or tbb_preview_debug.
  1266. +# * TBB_USE_DEBUG_BUILD - The debug version of tbb libraries, if present, will
  1267. +# be used instead of the release version.
  1268. +# * TBB_STATIC - Static linking of libraries with a _static suffix.
  1269. +# For example, on Windows a tbb_static.lib will be searched for
  1270. +# instead of tbb.lib.
  1271. +#
  1272. +# Users may modify the behavior of this module with the following environment
  1273. +# variables:
  1274. +#
  1275. +# * TBB_INSTALL_DIR
  1276. +# * TBBROOT
  1277. +# * LIBRARY_PATH
  1278. +#
  1279. +# This module will set the following variables:
  1280. +#
  1281. +# * TBB_FOUND - Set to false, or undefined, if we haven’t found, or
  1282. +# don’t want to use TBB.
  1283. +# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
  1284. +# not available.
  1285. +# * TBB_VERSION - The full version string
  1286. +# * TBB_VERSION_MAJOR - The major version
  1287. +# * TBB_VERSION_MINOR - The minor version
  1288. +# * TBB_INTERFACE_VERSION - The interface version number defined in
  1289. +# tbb/tbb_stddef.h.
  1290. +# * TBB_<library>_LIBRARY_RELEASE - The path of the TBB release version of
  1291. +# <library>, where <library> may be tbb, tbb_debug,
  1292. +# tbbmalloc, tbbmalloc_debug, tbb_preview, or
  1293. +# tbb_preview_debug.
  1294. +# * TBB_<library>_LIBRARY_DEGUG - The path of the TBB release version of
  1295. +# <library>, where <library> may be tbb, tbb_debug,
  1296. +# tbbmalloc, tbbmalloc_debug, tbb_preview, or
  1297. +# tbb_preview_debug.
  1298. +#
  1299. +# The following varibles should be used to build and link with TBB:
  1300. +#
  1301. +# * TBB_INCLUDE_DIRS - The include directory for TBB.
  1302. +# * TBB_LIBRARIES - The libraries to link against to use TBB.
  1303. +# * TBB_LIBRARIES_RELEASE - The release libraries to link against to use TBB.
  1304. +# * TBB_LIBRARIES_DEBUG - The debug libraries to link against to use TBB.
  1305. +# * TBB_DEFINITIONS - Definitions to use when compiling code that uses
  1306. +# TBB.
  1307. +# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that
  1308. +# uses TBB.
  1309. +# * TBB_DEFINITIONS_DEBUG - Definitions to use when compiling debug code that
  1310. +# uses TBB.
  1311. +#
  1312. +# This module will also create the "tbb" target that may be used when building
  1313. +# executables and libraries.
  1314. -mark_as_advanced(
  1315. - Tbb_INCLUDE_DIR
  1316. - Tbb_LIBRARY
  1317. -)
  1318. -
  1319. -set(_TBB_COMPONENT_LIST
  1320. - tbb
  1321. - tbbmalloc
  1322. - tbbmalloc_proxy
  1323. -)
  1324. -
  1325. -if(TBB_FIND_COMPONENTS)
  1326. - set(_TBB_COMPONENTS_PROVIDED TRUE)
  1327. - set(_IGNORED_COMPONENTS "")
  1328. - foreach(COMPONENT ${TBB_FIND_COMPONENTS})
  1329. - if(NOT ${COMPONENT} IN_LIST _TBB_COMPONENT_LIST)
  1330. - list(APPEND _IGNORED_COMPONENTS ${COMPONENT})
  1331. - endif()
  1332. - endforeach()
  1333. +unset(TBB_FOUND CACHE)
  1334. +unset(TBB_INCLUDE_DIRS CACHE)
  1335. +unset(TBB_LIBRARIES)
  1336. +unset(TBB_LIBRARIES_DEBUG)
  1337. +unset(TBB_LIBRARIES_RELEASE)
  1338. - if(_IGNORED_COMPONENTS)
  1339. - message(STATUS "Ignoring unknown components of TBB:")
  1340. - foreach(COMPONENT ${_IGNORED_COMPONENTS})
  1341. - message(STATUS " ${COMPONENT}")
  1342. - endforeach()
  1343. - list(REMOVE_ITEM TBB_FIND_COMPONENTS ${_IGNORED_COMPONENTS})
  1344. - endif()
  1345. -else()
  1346. - set(_TBB_COMPONENTS_PROVIDED FALSE)
  1347. - set(TBB_FIND_COMPONENTS ${_TBB_COMPONENT_LIST})
  1348. -endif()
  1349. +include(FindPackageHandleStandardArgs)
  1350. -# Append TBB_ROOT or $ENV{TBB_ROOT} if set (prioritize the direct cmake var)
  1351. -set(_TBB_ROOT_SEARCH_DIR "")
  1352. +find_package(Threads QUIET REQUIRED)
  1353. -if(TBB_ROOT)
  1354. - list(APPEND _TBB_ROOT_SEARCH_DIR ${TBB_ROOT})
  1355. -else()
  1356. - set(_ENV_TBB_ROOT $ENV{TBB_ROOT})
  1357. - if(_ENV_TBB_ROOT)
  1358. - list(APPEND _TBB_ROOT_SEARCH_DIR ${_ENV_TBB_ROOT})
  1359. - endif()
  1360. -endif()
  1361. +if(NOT TBB_FOUND)
  1362. -# Additionally try and use pkconfig to find Tbb
  1363. -
  1364. -find_package(PkgConfig)
  1365. -pkg_check_modules(PC_Tbb QUIET tbb)
  1366. -
  1367. -# ------------------------------------------------------------------------
  1368. -# Search for tbb include DIR
  1369. -# ------------------------------------------------------------------------
  1370. -
  1371. -set(_TBB_INCLUDE_SEARCH_DIRS "")
  1372. -list(APPEND _TBB_INCLUDE_SEARCH_DIRS
  1373. - ${TBB_INCLUDEDIR}
  1374. - ${_TBB_ROOT_SEARCH_DIR}
  1375. - ${PC_Tbb_INCLUDE_DIRS}
  1376. - ${SYSTEM_LIBRARY_PATHS}
  1377. -)
  1378. -
  1379. -# Look for a standard tbb header file.
  1380. -find_path(Tbb_INCLUDE_DIR tbb/tbb_stddef.h
  1381. - NO_DEFAULT_PATH
  1382. - PATHS ${_TBB_INCLUDE_SEARCH_DIRS}
  1383. - PATH_SUFFIXES include
  1384. -)
  1385. -
  1386. -if(EXISTS "${Tbb_INCLUDE_DIR}/tbb/tbb_stddef.h")
  1387. - file(STRINGS "${Tbb_INCLUDE_DIR}/tbb/tbb_stddef.h"
  1388. - _tbb_version_major_string REGEX "#define TBB_VERSION_MAJOR "
  1389. - )
  1390. - string(REGEX REPLACE "#define TBB_VERSION_MAJOR" ""
  1391. - _tbb_version_major_string "${_tbb_version_major_string}"
  1392. - )
  1393. - string(STRIP "${_tbb_version_major_string}" Tbb_VERSION_MAJOR)
  1394. -
  1395. - file(STRINGS "${Tbb_INCLUDE_DIR}/tbb/tbb_stddef.h"
  1396. - _tbb_version_minor_string REGEX "#define TBB_VERSION_MINOR "
  1397. - )
  1398. - string(REGEX REPLACE "#define TBB_VERSION_MINOR" ""
  1399. - _tbb_version_minor_string "${_tbb_version_minor_string}"
  1400. - )
  1401. - string(STRIP "${_tbb_version_minor_string}" Tbb_VERSION_MINOR)
  1402. -
  1403. - unset(_tbb_version_major_string)
  1404. - unset(_tbb_version_minor_string)
  1405. -
  1406. - set(Tbb_VERSION ${Tbb_VERSION_MAJOR}.${Tbb_VERSION_MINOR})
  1407. -endif()
  1408. + ##################################
  1409. + # Check the build type
  1410. + ##################################
  1411. +
  1412. + if(NOT DEFINED TBB_USE_DEBUG_BUILD)
  1413. + if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug)")
  1414. + set(TBB_BUILD_TYPE DEBUG)
  1415. + else()
  1416. + set(TBB_BUILD_TYPE RELEASE)
  1417. + endif()
  1418. + elseif(TBB_USE_DEBUG_BUILD)
  1419. + set(TBB_BUILD_TYPE DEBUG)
  1420. + else()
  1421. + set(TBB_BUILD_TYPE RELEASE)
  1422. + endif()
  1423. -# ------------------------------------------------------------------------
  1424. -# Search for TBB lib DIR
  1425. -# ------------------------------------------------------------------------
  1426. + ##################################
  1427. + # Set the TBB search directories
  1428. + ##################################
  1429. -set(_TBB_LIBRARYDIR_SEARCH_DIRS "")
  1430. + # Define search paths based on user input and environment variables
  1431. + set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT})
  1432. -# Append to _TBB_LIBRARYDIR_SEARCH_DIRS in priority order
  1433. + # Define the search directories based on the current platform
  1434. + if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
  1435. + set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB"
  1436. + "C:/Program Files (x86)/Intel/TBB")
  1437. -set(_TBB_LIBRARYDIR_SEARCH_DIRS "")
  1438. -list(APPEND _TBB_LIBRARYDIR_SEARCH_DIRS
  1439. - ${TBB_LIBRARYDIR}
  1440. - ${_TBB_ROOT_SEARCH_DIR}
  1441. - ${PC_Tbb_LIBRARY_DIRS}
  1442. - ${SYSTEM_LIBRARY_PATHS}
  1443. -)
  1444. + # Set the target architecture
  1445. + if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  1446. + set(TBB_ARCHITECTURE "intel64")
  1447. + else()
  1448. + set(TBB_ARCHITECTURE "ia32")
  1449. + endif()
  1450. -set(TBB_PATH_SUFFIXES
  1451. - lib64
  1452. - lib
  1453. -)
  1454. + # Set the TBB search library path search suffix based on the version of VC
  1455. + if(WINDOWS_STORE)
  1456. + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui")
  1457. + elseif(MSVC14)
  1458. + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14")
  1459. + elseif(MSVC12)
  1460. + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12")
  1461. + elseif(MSVC11)
  1462. + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11")
  1463. + elseif(MSVC10)
  1464. + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10")
  1465. + endif()
  1466. -# platform branching
  1467. + # Add the library path search suffix for the VC independent version of TBB
  1468. + list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt")
  1469. -if(UNIX)
  1470. - list(INSERT TBB_PATH_SUFFIXES 0 lib/x86_64-linux-gnu)
  1471. -endif()
  1472. + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
  1473. + # OS X
  1474. + set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
  1475. -if(APPLE)
  1476. - if(TBB_FOR_CLANG)
  1477. - list(INSERT TBB_PATH_SUFFIXES 0 lib/libc++)
  1478. - endif()
  1479. -elseif(WIN32)
  1480. - if(MSVC10)
  1481. - set(TBB_VC_DIR vc10)
  1482. - elseif(MSVC11)
  1483. - set(TBB_VC_DIR vc11)
  1484. - elseif(MSVC12)
  1485. - set(TBB_VC_DIR vc12)
  1486. - endif()
  1487. - list(INSERT TBB_PATH_SUFFIXES 0 lib/intel64/${TBB_VC_DIR})
  1488. -else()
  1489. - if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
  1490. - if(TBB_MATCH_COMPILER_VERSION)
  1491. - string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${CMAKE_CXX_COMPILER_VERSION})
  1492. - list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR)
  1493. - list(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR)
  1494. - list(INSERT TBB_PATH_SUFFIXES 0 lib/intel64/gcc${GCC_MAJOR}.${GCC_MINOR})
  1495. + # TODO: Check to see which C++ library is being used by the compiler.
  1496. + if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0)
  1497. + # The default C++ library on OS X 10.9 and later is libc++
  1498. + set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib")
  1499. else()
  1500. - list(INSERT TBB_PATH_SUFFIXES 0 lib/intel64/gcc4.4)
  1501. + set(TBB_LIB_PATH_SUFFIX "lib")
  1502. + endif()
  1503. + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
  1504. + # Linux
  1505. + set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
  1506. +
  1507. + # TODO: Check compiler version to see the suffix should be <arch>/gcc4.1 or
  1508. + # <arch>/gcc4.1. For now, assume that the compiler is more recent than
  1509. + # gcc 4.4.x or later.
  1510. + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
  1511. + set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4")
  1512. + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
  1513. + set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4")
  1514. endif()
  1515. endif()
  1516. -endif()
  1517. -
  1518. -if(UNIX AND TBB_USE_STATIC_LIBS)
  1519. - set(_TBB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  1520. - set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
  1521. -endif()
  1522. -set(Tbb_LIB_COMPONENTS "")
  1523. -
  1524. -foreach(COMPONENT ${TBB_FIND_COMPONENTS})
  1525. - find_library(Tbb_${COMPONENT}_LIBRARY ${COMPONENT}
  1526. - NO_DEFAULT_PATH
  1527. - PATHS ${_TBB_LIBRARYDIR_SEARCH_DIRS}
  1528. - PATH_SUFFIXES ${TBB_PATH_SUFFIXES}
  1529. - )
  1530. -
  1531. - # On Unix, TBB sometimes uses linker scripts instead of symlinks, so parse the linker script
  1532. - # and correct the library name if so
  1533. - if(UNIX AND EXISTS ${Tbb_${COMPONENT}_LIBRARY})
  1534. - # Ignore files where the first four bytes equals the ELF magic number
  1535. - file(READ ${Tbb_${COMPONENT}_LIBRARY} Tbb_${COMPONENT}_HEX OFFSET 0 LIMIT 4 HEX)
  1536. - if(NOT ${Tbb_${COMPONENT}_HEX} STREQUAL "7f454c46")
  1537. - # Read the first 1024 bytes of the library and match against an "INPUT (file)" regex
  1538. - file(READ ${Tbb_${COMPONENT}_LIBRARY} Tbb_${COMPONENT}_ASCII OFFSET 0 LIMIT 1024)
  1539. - if("${Tbb_${COMPONENT}_ASCII}" MATCHES "INPUT \\(([^(]+)\\)")
  1540. - # Extract the directory and apply the matched text (in brackets)
  1541. - get_filename_component(Tbb_${COMPONENT}_DIR "${Tbb_${COMPONENT}_LIBRARY}" DIRECTORY)
  1542. - set(Tbb_${COMPONENT}_LIBRARY "${Tbb_${COMPONENT}_DIR}/${CMAKE_MATCH_1}")
  1543. - endif()
  1544. - endif()
  1545. + ##################################
  1546. + # Find the TBB include dir
  1547. + ##################################
  1548. +
  1549. + find_path(TBB_INCLUDE_DIRS tbb/tbb.h
  1550. + HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
  1551. + PATHS ${TBB_DEFAULT_SEARCH_DIR}
  1552. + PATH_SUFFIXES include)
  1553. +
  1554. + ##################################
  1555. + # Set version strings
  1556. + ##################################
  1557. +
  1558. + if(TBB_INCLUDE_DIRS)
  1559. + file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file)
  1560. + string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
  1561. + TBB_VERSION_MAJOR "${_tbb_version_file}")
  1562. + string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
  1563. + TBB_VERSION_MINOR "${_tbb_version_file}")
  1564. + string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
  1565. + TBB_INTERFACE_VERSION "${_tbb_version_file}")
  1566. + set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
  1567. endif()
  1568. - list(APPEND Tbb_LIB_COMPONENTS ${Tbb_${COMPONENT}_LIBRARY})
  1569. + ##################################
  1570. + # Find TBB components
  1571. + ##################################
  1572. - if(Tbb_${COMPONENT}_LIBRARY)
  1573. - set(TBB_${COMPONENT}_FOUND TRUE)
  1574. + if(TBB_VERSION VERSION_LESS 4.3)
  1575. + set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb)
  1576. else()
  1577. - set(TBB_${COMPONENT}_FOUND FALSE)
  1578. + set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
  1579. endif()
  1580. -endforeach()
  1581. -if(UNIX AND TBB_USE_STATIC_LIBS)
  1582. - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_TBB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  1583. - unset(_TBB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
  1584. -endif()
  1585. + if(TBB_STATIC)
  1586. + set(TBB_STATIC_SUFFIX "_static")
  1587. + endif()
  1588. -# ------------------------------------------------------------------------
  1589. -# Cache and set TBB_FOUND
  1590. -# ------------------------------------------------------------------------
  1591. + # Find each component
  1592. + foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
  1593. + if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};")
  1594. +
  1595. + unset(TBB_${_comp}_LIBRARY_DEBUG CACHE)
  1596. + unset(TBB_${_comp}_LIBRARY_RELEASE CACHE)
  1597. +
  1598. + # Search for the libraries
  1599. + find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}${TBB_STATIC_SUFFIX}
  1600. + HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
  1601. + PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
  1602. + PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
  1603. +
  1604. + find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}${TBB_STATIC_SUFFIX}_debug
  1605. + HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
  1606. + PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
  1607. + PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
  1608. +
  1609. + if(TBB_${_comp}_LIBRARY_DEBUG)
  1610. + list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}")
  1611. + endif()
  1612. + if(TBB_${_comp}_LIBRARY_RELEASE)
  1613. + list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}")
  1614. + endif()
  1615. + if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY)
  1616. + set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}")
  1617. + endif()
  1618. +
  1619. + if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}")
  1620. + set(TBB_${_comp}_FOUND TRUE)
  1621. + else()
  1622. + set(TBB_${_comp}_FOUND FALSE)
  1623. + endif()
  1624. +
  1625. + # Mark internal variables as advanced
  1626. + mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
  1627. + mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
  1628. + mark_as_advanced(TBB_${_comp}_LIBRARY)
  1629. -include(FindPackageHandleStandardArgs)
  1630. -find_package_handle_standard_args(TBB
  1631. - FOUND_VAR TBB_FOUND
  1632. - REQUIRED_VARS
  1633. - Tbb_INCLUDE_DIR
  1634. - Tbb_LIB_COMPONENTS
  1635. - VERSION_VAR Tbb_VERSION
  1636. - HANDLE_COMPONENTS
  1637. -)
  1638. -
  1639. -if(TBB_FOUND)
  1640. - set(Tbb_LIBRARIES
  1641. - ${Tbb_LIB_COMPONENTS}
  1642. - )
  1643. - set(Tbb_INCLUDE_DIRS ${Tbb_INCLUDE_DIR})
  1644. - set(Tbb_DEFINITIONS ${PC_Tbb_CFLAGS_OTHER})
  1645. -
  1646. - set(Tbb_LIBRARY_DIRS "")
  1647. - foreach(LIB ${Tbb_LIB_COMPONENTS})
  1648. - get_filename_component(_TBB_LIBDIR ${LIB} DIRECTORY)
  1649. - list(APPEND Tbb_LIBRARY_DIRS ${_TBB_LIBDIR})
  1650. - endforeach()
  1651. - list(REMOVE_DUPLICATES Tbb_LIBRARY_DIRS)
  1652. -
  1653. - # Configure imported targets
  1654. -
  1655. - foreach(COMPONENT ${TBB_FIND_COMPONENTS})
  1656. - if(NOT TARGET TBB::${COMPONENT})
  1657. - add_library(TBB::${COMPONENT} UNKNOWN IMPORTED)
  1658. - set_target_properties(TBB::${COMPONENT} PROPERTIES
  1659. - IMPORTED_LOCATION "${Tbb_${COMPONENT}_LIBRARY}"
  1660. - INTERFACE_COMPILE_OPTIONS "${Tbb_DEFINITIONS}"
  1661. - INTERFACE_INCLUDE_DIRECTORIES "${Tbb_INCLUDE_DIR}"
  1662. - )
  1663. endif()
  1664. endforeach()
  1665. -elseif(TBB_FIND_REQUIRED)
  1666. - message(FATAL_ERROR "Unable to find TBB")
  1667. +
  1668. + ##################################
  1669. + # Set compile flags and libraries
  1670. + ##################################
  1671. +
  1672. + set(TBB_DEFINITIONS_RELEASE "")
  1673. + set(TBB_DEFINITIONS_DEBUG "TBB_USE_DEBUG=1")
  1674. +
  1675. + if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
  1676. + set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
  1677. + endif()
  1678. +
  1679. + if(NOT MSVC AND NOT TBB_LIBRARIES)
  1680. + set(TBB_LIBRARIES ${TBB_LIBRARIES_RELEASE})
  1681. + endif()
  1682. +
  1683. + set(TBB_DEFINITIONS "")
  1684. + if (MSVC AND TBB_STATIC)
  1685. + set(TBB_DEFINITIONS __TBB_NO_IMPLICIT_LINKAGE)
  1686. + endif ()
  1687. +
  1688. + unset (TBB_STATIC_SUFFIX)
  1689. +
  1690. + find_package_handle_standard_args(TBB
  1691. + REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
  1692. + FAIL_MESSAGE "TBB library cannot be found. Consider set TBBROOT environment variable."
  1693. + HANDLE_COMPONENTS
  1694. + VERSION_VAR TBB_VERSION)
  1695. +
  1696. + ##################################
  1697. + # Create targets
  1698. + ##################################
  1699. +
  1700. + if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND)
  1701. + add_library(TBB::tbb UNKNOWN IMPORTED)
  1702. + set_target_properties(TBB::tbb PROPERTIES
  1703. + INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS}"
  1704. + INTERFACE_LINK_LIBRARIES "Threads::Threads;${CMAKE_DL_LIBS}"
  1705. + INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS}
  1706. + IMPORTED_LOCATION ${TBB_LIBRARIES})
  1707. + if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
  1708. + set_target_properties(TBB::tbb PROPERTIES
  1709. + INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS};$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:${TBB_DEFINITIONS_DEBUG}>;$<$<CONFIG:Release>:${TBB_DEFINITIONS_RELEASE}>"
  1710. + IMPORTED_LOCATION_DEBUG ${TBB_LIBRARIES_DEBUG}
  1711. + IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_RELEASE}
  1712. + IMPORTED_LOCATION_RELEASE ${TBB_LIBRARIES_RELEASE}
  1713. + IMPORTED_LOCATION_MINSIZEREL ${TBB_LIBRARIES_RELEASE}
  1714. + )
  1715. + endif()
  1716. + endif()
  1717. +
  1718. + mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
  1719. +
  1720. + unset(TBB_ARCHITECTURE)
  1721. + unset(TBB_BUILD_TYPE)
  1722. + unset(TBB_LIB_PATH_SUFFIX)
  1723. + unset(TBB_DEFAULT_SEARCH_DIR)
  1724. +
  1725. + if(TBB_DEBUG)
  1726. + message(STATUS " TBB_FOUND = ${TBB_FOUND}")
  1727. + message(STATUS " TBB_INCLUDE_DIRS = ${TBB_INCLUDE_DIRS}")
  1728. + message(STATUS " TBB_DEFINITIONS = ${TBB_DEFINITIONS}")
  1729. + message(STATUS " TBB_LIBRARIES = ${TBB_LIBRARIES}")
  1730. + message(STATUS " TBB_DEFINITIONS_DEBUG = ${TBB_DEFINITIONS_DEBUG}")
  1731. + message(STATUS " TBB_LIBRARIES_DEBUG = ${TBB_LIBRARIES_DEBUG}")
  1732. + message(STATUS " TBB_DEFINITIONS_RELEASE = ${TBB_DEFINITIONS_RELEASE}")
  1733. + message(STATUS " TBB_LIBRARIES_RELEASE = ${TBB_LIBRARIES_RELEASE}")
  1734. + endif()
  1735. +
  1736. endif()
  1737. diff --git a/openvdb/CMakeLists.txt b/openvdb/CMakeLists.txt
  1738. index 89301bd..6a3c90c 100644
  1739. --- a/openvdb/CMakeLists.txt
  1740. +++ b/openvdb/CMakeLists.txt
  1741. @@ -78,7 +78,7 @@ else()
  1742. endif()
  1743. find_package(TBB ${MINIMUM_TBB_VERSION} REQUIRED COMPONENTS tbb)
  1744. -if(${Tbb_VERSION} VERSION_LESS FUTURE_MINIMUM_TBB_VERSION)
  1745. +if(${TBB_VERSION} VERSION_LESS FUTURE_MINIMUM_TBB_VERSION)
  1746. message(DEPRECATION "Support for TBB versions < ${FUTURE_MINIMUM_TBB_VERSION} "
  1747. "is deprecated and will be removed.")
  1748. endif()
  1749. @@ -129,10 +129,13 @@ endif()
  1750. # include paths from shared installs (including houdini) may pull in the wrong
  1751. # headers
  1752. +include (CheckAtomic)
  1753. +
  1754. set(OPENVDB_CORE_DEPENDENT_LIBS
  1755. Boost::iostreams
  1756. Boost::system
  1757. IlmBase::Half
  1758. + ${CMAKE_REQUIRED_LIBRARIES}
  1759. )
  1760. if(USE_EXR)
  1761. @@ -185,11 +188,6 @@ if(WIN32)
  1762. endif()
  1763. endif()
  1764. -# @todo Should be target definitions
  1765. -if(WIN32)
  1766. - add_definitions(-D_WIN32 -DNOMINMAX -DOPENVDB_DLL)
  1767. -endif()
  1768. -
  1769. ##### Core library configuration
  1770. set(OPENVDB_LIBRARY_SOURCE_FILES
  1771. @@ -374,10 +372,16 @@ set(OPENVDB_LIBRARY_UTIL_INCLUDE_FILES
  1772. if(OPENVDB_CORE_SHARED)
  1773. add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES})
  1774. + if(WIN32)
  1775. + target_compile_definitions(openvdb_shared PUBLIC OPENVDB_DLL)
  1776. + endif()
  1777. endif()
  1778. if(OPENVDB_CORE_STATIC)
  1779. add_library(openvdb_static STATIC ${OPENVDB_LIBRARY_SOURCE_FILES})
  1780. + if(WIN32)
  1781. + target_compile_definitions(openvdb_static PUBLIC OPENVDB_STATICLIB)
  1782. + endif()
  1783. endif()
  1784. # Alias either the shared or static library to the generic OpenVDB
  1785. diff --git a/openvdb/Grid.cc b/openvdb/Grid.cc
  1786. index 0015f81..cb6084a 100644
  1787. --- a/openvdb/Grid.cc
  1788. +++ b/openvdb/Grid.cc
  1789. @@ -35,6 +35,9 @@
  1790. #include <boost/algorithm/string/trim.hpp>
  1791. #include <tbb/mutex.h>
  1792. +// WTF??? Somehow from stdlib.h
  1793. +#undef min
  1794. +#undef max
  1795. namespace openvdb {
  1796. OPENVDB_USE_VERSION_NAMESPACE
  1797. diff --git a/openvdb/PlatformConfig.h b/openvdb/PlatformConfig.h
  1798. index 20ad9a3..c2dd1ef 100644
  1799. --- a/openvdb/PlatformConfig.h
  1800. +++ b/openvdb/PlatformConfig.h
  1801. @@ -44,9 +44,12 @@
  1802. // By default, assume that we're dynamically linking OpenEXR, unless
  1803. // OPENVDB_OPENEXR_STATICLIB is defined.
  1804. - #if !defined(OPENVDB_OPENEXR_STATICLIB) && !defined(OPENEXR_DLL)
  1805. - #define OPENEXR_DLL
  1806. - #endif
  1807. + // Meszaros Tamas: Why? OpenEXR and its imported targets have OPENEXR_DLL
  1808. + // in INTERFACE_COMPILE_DEFINITIONS if build with it.
  1809. + // #if !defined(OPENVDB_OPENEXR_STATICLIB) && !defined(OPENEXR_DLL)
  1810. + // #define OPENEXR_DLL
  1811. + // static_assert(false, "This is bad: OPENEXR_DLL");
  1812. + // #endif
  1813. #endif // _WIN32
  1814. diff --git a/openvdb/cmd/CMakeLists.txt b/openvdb/cmd/CMakeLists.txt
  1815. index 57fbec0..55b3850 100644
  1816. --- a/openvdb/cmd/CMakeLists.txt
  1817. +++ b/openvdb/cmd/CMakeLists.txt
  1818. @@ -74,8 +74,9 @@ if(WIN32)
  1819. endif()
  1820. endif()
  1821. +# @todo Should be target definitions
  1822. if(WIN32)
  1823. - add_definitions(-D_WIN32 -DNOMINMAX -DOPENVDB_DLL)
  1824. + add_definitions(-D_WIN32 -DNOMINMAX)
  1825. endif()
  1826. # rpath handling
  1827. @@ -88,7 +89,6 @@ if(OPENVDB_ENABLE_RPATH)
  1828. ${IlmBase_LIBRARY_DIRS}
  1829. ${Log4cplus_LIBRARY_DIRS}
  1830. ${Blosc_LIBRARY_DIRS}
  1831. - ${Tbb_LIBRARY_DIRS}
  1832. )
  1833. if(OPENVDB_BUILD_CORE)
  1834. list(APPEND RPATHS ${CMAKE_INSTALL_PREFIX}/lib)
  1835. diff --git a/openvdb/unittest/CMakeLists.txt b/openvdb/unittest/CMakeLists.txt
  1836. index c9e0c34..7e261c0 100644
  1837. --- a/openvdb/unittest/CMakeLists.txt
  1838. +++ b/openvdb/unittest/CMakeLists.txt
  1839. @@ -71,8 +71,9 @@ if(WIN32)
  1840. link_directories(${Boost_LIBRARY_DIR})
  1841. endif()
  1842. +# @todo Should be target definitions
  1843. if(WIN32)
  1844. - add_definitions(-D_WIN32 -DNOMINMAX -DOPENVDB_DLL)
  1845. + add_definitions(-D_WIN32 -DNOMINMAX)
  1846. endif()
  1847. ##### VDB unit tests
  1848. diff --git a/openvdb/unittest/TestFile.cc b/openvdb/unittest/TestFile.cc
  1849. index df51830..0ab0c12 100644
  1850. --- a/openvdb/unittest/TestFile.cc
  1851. +++ b/openvdb/unittest/TestFile.cc
  1852. @@ -2573,7 +2573,7 @@ TestFile::testBlosc()
  1853. outdata(new char[decompbufbytes]);
  1854. for (int compcode = 0; compcode <= BLOSC_ZLIB; ++compcode) {
  1855. - char* compname = nullptr;
  1856. + const char* compname = nullptr;
  1857. if (0 > blosc_compcode_to_compname(compcode, &compname)) continue;
  1858. /// @todo This changes the compressor setting globally.
  1859. if (blosc_set_compressor(compname) < 0) continue;
  1860. --
  1861. 2.17.1