{"action":"created","issue":{"url":"https://api.github.com/repos/AcademySoftwareFoundation/openvdb/issues/382","repository_url":"https://api.github.com/repos/AcademySoftwareFoundation/openvdb","labels_url":"https://api.github.com/repos/AcademySoftwareFoundation/openvdb/issues/382/labels{/name}","comments_url":"https://api.github.com/repos/AcademySoftwareFoundation/openvdb/issues/382/comments","events_url":"https://api.github.com/repos/AcademySoftwareFoundation/openvdb/issues/382/events","html_url":"https://github.com/AcademySoftwareFoundation/openvdb/pull/382","id":421145586,"node_id":"MDExOlB1bGxSZXF1ZXN0MjYxMjYzMDcx","number":382,"title":"CMake Refactor","user":{"login":"Idclip","id":4256455,"node_id":"MDQ6VXNlcjQyNTY0NTU=","avatar_url":"https://avatars0.githubusercontent.com/u/4256455?v=4","gravatar_id":"","url":"https://api.github.com/users/Idclip","html_url":"https://github.com/Idclip","followers_url":"https://api.github.com/users/Idclip/followers","following_url":"https://api.github.com/users/Idclip/following{/other_user}","gists_url":"https://api.github.com/users/Idclip/gists{/gist_id}","starred_url":"https://api.github.com/users/Idclip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Idclip/subscriptions","organizations_url":"https://api.github.com/users/Idclip/orgs","repos_url":"https://api.github.com/users/Idclip/repos","events_url":"https://api.github.com/users/Idclip/events{/privacy}","received_events_url":"https://api.github.com/users/Idclip/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":22,"created_at":"2019-03-14T17:14:44Z","updated_at":"2019-03-25T18:48:56Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/AcademySoftwareFoundation/openvdb/pulls/382","html_url":"https://github.com/AcademySoftwareFoundation/openvdb/pull/382","diff_url":"https://github.com/AcademySoftwareFoundation/openvdb/pull/382.diff","patch_url":"https://github.com/AcademySoftwareFoundation/openvdb/pull/382.patch"},"body":"<b>Aims of this PR:</b>\r\n\r\n - Validate CMake build system for Linux/MacOs\r\n - Homogenize FindXxx.cmake modules and all CMakeLists\r\n - Improve and document dependency requirements for all OpenVDB components\r\n - Add missing build options for the core, python, binaries and houdini components\r\n\r\n<b>Incorporates the following PRs:</b>\r\n\r\n - https://github.com/AcademySoftwareFoundation/openvdb/pull/150 - OpenEXR fixes\r\n - https://github.com/AcademySoftwareFoundation/openvdb/pull/268 - ILMBase fixes\r\n\r\n<b>Does not address:</b>\r\n\r\n - https://github.com/AcademySoftwareFoundation/openvdb/pull/160 - I've added NumPy support, but it requires CMake 3.14. This PR adds NumPy support for any version using another custom Find module. We should discuss minimum CMake version.\r\n - https://github.com/AcademySoftwareFoundation/openvdb/pull/171 - GNU vars. Not incorporated, but should be done\r\n - https://github.com/AcademySoftwareFoundation/openvdb/pull/240 - Lots of Windows and Maya updates which need investigating\r\n\r\n<b>Some important things that have *not* been done in this PR:</b>\r\n\r\n - Update BuildingWithCMake.md\r\n - Full Windows tests (notably GLEW module, vdb_view). See #240\r\n - Test Maya plugin. Seems to be working but could do with some more eyes on this. Also see tbb comment in the maya cmake. See #240 for more.\r\n - Shared/static lib options. See #240\r\n - glfw, blosc, log4cplus. numpy auto options (use if available)\r\n\r\n<b>Known issues:</b>\r\n\r\n- I am getting cmake warnings on some paltforms when building against houdini and providing my own boost version or my own ilmbase/openexr version (for Houdini 17.5). To be honest I think these warnings are valid as libHalf, for example, is called the same thing in dsolib/ as it is in any old install of ilmbase. But I'd like to try and resolve these as loads are output.\r\n- NumPy support does not work with Boost 1.65 as it needs Boost::numpy. Better NumPy support will be added in a separate PR.\r\n\r\nI realise there are a lot of changes here. I can refactor the branch history if it's desired.\r\n\r\n----------------------------------------------------------------------------------------------------------------\r\n\r\nTest environments include CentOS, travis and MacOS. Note this PR does not include the travis update. This can be found here:\r\n\r\nhttps://github.com/Idclip/openvdb/tree/cmake_travis\r\n\r\n- CentOS 7 - g++, runtime tested with and without a Houdini 17 installation. In both cases, uses the same library versions as Houdini.\r\n- MacOS 10.14.3 - clang++, runtime tested with and without a Houdini 17 installation. Of note, tested with Blosc 1.16 where there are issues, Boost 1.68, TBB 2019, ZLIB 1.2.11.\r\n - Travis - Latest build - https://travis-ci.com/Idclip/openvdb/builds/104392461\r\n\r\n----------------------------------------------------------------------------------------------------------------\r\n\r\n<details><summary>General Changes</summary>\r\n<p>\r\n\r\n - Copyright dates\r\n - Consistent formatting and white space changes\r\n - Fixed a number of CMake warnings with newer versions\r\n - Bumped the minimum CMake requirement to 3.3 to be able to use `IN_LIST` functionality for CMake `LIST`s\r\n - Explicitly set CMake policy CMP0048 everywhere which represents to monitoring of <Package>_ROOT variables (which our FindXx.cmake modules use)\r\n - Added support for Log4cplus\r\n - Remove GLFW <= 2 support\r\n - Set minimum versions for GLFW, Blosc and Boost\r\n - Fixed all incorrect dependencies and compile flags for each target\r\n - Full rpath updates for houdini, bianries, core and python installations\r\n</p>\r\n</details>\r\n\r\n<details><summary>FindXxx/OpenVDBXxxSetup.cmake Modules</summary>\r\n<p>\r\n\r\n - Fully updated to be consistent in terms of variable names, controls, functionality and results\r\n - Fixed a number of bugs and improved library searches\r\n - Find modules now attempt to use pkg-config as part of the search, setting dependent cflags where possible\r\n - Added component support to ILMBase OpenEXR, TBB, OpenVDB\r\n - Added imported target support for all dependencies (and updated all vdb cmakes to use this)\r\n - Converted FindGLFW and FindHDK to setup scripts which wrap FIND_PACKAGE calls (as these packages use the dependent packages cmake)\r\n\r\nOpenVDBXxxSetup.cmake\r\n\r\n - I've added these to wrap FindPackage calls to packages which are installed with their own CMake scripts. These wrappers allow for additional handling of _ROOT and pkg-config calls to try as many things as possible to attempt to locate the installation, reporting the locations consisently using PackageHandleStandardArgs.\r\n\r\nOpenVDBHoudiniSetup.cmake\r\n\r\n - Wraps the call to FindPackage ( Houdini ) by reading from HFS, HOUDINI_ROOT etc\r\n - Adds missing libHoudiniRAY target for VRAY procedural\r\n - Explicitly sets dependency variables to point to the Houdini installation, ensuring all configured packages use the correct libraries and removing the need for the user to provide these\r\n  - Updates to support ilmbase and openexr for Houdini 17.5\r\n - Sets OPENVDB_HOUDINI_ABI, read by the root CMake to configure the OpenVDB ABI\r\n</p>\r\n</details>\r\n\r\n<details><summary>Root CMake</summary>\r\n<p>\r\n\r\n - Full documentation of dependencies for core library components\r\n - Specifically disable in source builds\r\n - Revamped options to ensure advanced/deprecated options are hidden\r\n - Added specific handling for CMAKE_BUILD_TYPE\r\n - Migrated the Houdini detection stage to the root CMake to enabled subsequent dependency configuration for all packages (see OpenVDBHoudiniSetup.cmake)\r\n - Removed the limitation of building the python plugin with Houdini if >= H16.5\r\n - More controls for default behaviour for OPENVDB_ABI_VERSION_NUMBER, including automatic detection from Houdini installations\r\n - Consolidated OpenVDB Version detection into FindOpenVDB.cmake\r\n - Moved doxygen generation to root as it doesn't rely on anything else\r\n</p>\r\n</details>\r\n\r\n<details><summary>Core CMake</summary>\r\n<p>\r\n\r\n - Now only represents the core library\r\n - Added OPENVDB_TOOLS_RAYTRACER_USE_EXR option\r\n - Added a Blosc version warning\r\n - Removed directory install command in favour of specific header file installations (resolving recursive directory issues)\r\n - Added an option to specify the target library name\r\n</p>\r\n</details>\r\n\r\n<details><summary>Binaries/Unit Tests CMake</summary>\r\n<p>\r\n\r\n - New CMake to represent binaries\r\n - Added granular binary controls\r\n - Fixed RPathing issues\r\n - New CMake to represent unit tests\r\n</p>\r\n</details>\r\n\r\n<details><summary>Python CMake</summary>\r\n<p>\r\n\r\n - Fixed a compile issue on MacOS\r\n - Added OPENVDB_PYTHON_WRAP_ALL_GRID_TYPES option\r\n - Improved python component requirement handling with FindPython\r\n - Added BOOST_PYTHON_NAMESPACE_VERSIONING\r\n - Added a PYTHON_VERSION cached variable\r\n - Added missing pyPointGrid.cc\r\n - Fixed header installation\r\n - Added NumPy support (but requires CMake 3.14)\r\n</p>\r\n</details>\r\n\r\n<details><summary>Houdini CMake</summary>\r\n<p>\r\n\r\n - Updated to use Houdini CMake for library handling\r\n - Added optional and cache variables to control SESI dso tagging\r\n - Added variables to explicitly control install locations\r\n - Improve blosc defines applied to SOPs\r\n - Added missing houdini/GEO_VDBTranslator.cc to openvdb_houdini lib\r\n - Improved SOP list formatting\r\n - Added a dummy target representing all DSOs (not the shared library)\r\n - Added VRAY_OpenVDB_Points target\r\n - Added install rules for icons\r\n - Changed the behaviour of OPENVDB_HOUDINI_INSTALL_LIBRARY to install to CMAKE_INSTALL_PREFIX\r\n</p>\r\n</details>\r\n\r\n--------------------------------------------------------------------------------------------------------------------------------\r\n\r\nTo Test:\r\n\r\nNote that you can provide the ROOT variables as CMake defines instead of exporting the environment. These minimal option sets may not work first time, but will provide a good starting point.\r\n\r\n<details><summary>If building standalone:</summary>\r\n<p>\r\n\r\n```\r\n#!/bin/bash\r\n\r\nrm -rf .build\r\nmkdir .build\r\ncd .build\r\n\r\n# No pkg-config for tbb\r\nexport TBB_ROOT=\r\n\r\ncmake \\\r\n -D CMAKE_INSTALL_PREFIX=<install location> \\\r\n ../\r\n```\r\n</p>\r\n</details>\r\n\r\n<details><summary>If building against Houdini:</summary>\r\n<p>\r\n\r\n```\r\n#!/bin/bash\r\n\r\nrm -rf .build\r\nmkdir .build\r\ncd .build\r\n\r\nexport HOUDINI_ROOT= # Or source houdini env\r\n\r\ncmake \\\r\n -D CMAKE_INSTALL_PREFIX=<install location> \\\r\n -D OPENVDB_BUILD_HOUDINI_SOPS=ON \\\r\n ../\r\n```\r\n</p>\r\n</details>"},"comment":{"url":"https://api.github.com/repos/AcademySoftwareFoundation/openvdb/issues/comments/476330337","html_url":"https://github.com/AcademySoftwareFoundation/openvdb/pull/382#issuecomment-476330337","issue_url":"https://api.github.com/repos/AcademySoftwareFoundation/openvdb/issues/382","id":476330337,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3NjMzMDMzNw==","user":{"login":"Idclip","id":4256455,"node_id":"MDQ6VXNlcjQyNTY0NTU=","avatar_url":"https://avatars0.githubusercontent.com/u/4256455?v=4","gravatar_id":"","url":"https://api.github.com/users/Idclip","html_url":"https://github.com/Idclip","followers_url":"https://api.github.com/users/Idclip/followers","following_url":"https://api.github.com/users/Idclip/following{/other_user}","gists_url":"https://api.github.com/users/Idclip/gists{/gist_id}","starred_url":"https://api.github.com/users/Idclip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Idclip/subscriptions","organizations_url":"https://api.github.com/users/Idclip/orgs","repos_url":"https://api.github.com/users/Idclip/repos","events_url":"https://api.github.com/users/Idclip/events{/privacy}","received_events_url":"https://api.github.com/users/Idclip/received_events","type":"User","site_admin":false},"created_at":"2019-03-25T18:48:56Z","updated_at":"2019-03-25T18:48:56Z","author_association":"CONTRIBUTOR","body":"Okay, here's the code required for creating the gl/glu imported targets with the cmake version wrap, taken from here:\r\nhttps://github.com/Kitware/CMake/commit/027ce359ff7454ac0aca4d9a9208759ef4b9c8b7#diff-00044a4f1f8f9047efdc7e7bcdbc82db\r\nand hasn't changed since the latest release. Should just be placed after ` FIND_PACKAGE ( OpenGL REQUIRED )` though I might make another file like cmake/OpenVDBOpenGLSetup.cmake to contain it:\r\n\r\n<details><summary>CMake Snippet</summary>\r\n<p>\r\n\r\n```\r\n    IF ( ${CMAKE_VERSION} VERSION_LESS 3.8 )\r\n      # Create GL imported targets (not introduced until 3.8)\r\n      if(NOT TARGET OpenGL::GL)\r\n        if(IS_ABSOLUTE \"${OPENGL_gl_LIBRARY}\")\r\n          add_library(OpenGL::GL UNKNOWN IMPORTED)\r\n          if(OPENGL_gl_LIBRARY MATCHES \"/([^/]+)\\\\.framework$\")\r\n            set(_gl_fw \"${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}\")\r\n            if(EXISTS \"${_gl_fw}.tbd\")\r\n              set(_gl_fw \"${_gl_fw}.tbd\")\r\n            endif()\r\n            set_target_properties(OpenGL::GL PROPERTIES\r\n              IMPORTED_LOCATION \"${_gl_fw}\")\r\n          else()\r\n            set_target_properties(OpenGL::GL PROPERTIES\r\n              IMPORTED_LOCATION \"${OPENGL_gl_LIBRARY}\")\r\n          endif()\r\n        else()\r\n          add_library(OpenGL::GL INTERFACE IMPORTED)\r\n          set_target_properties(OpenGL::GL PROPERTIES\r\n            IMPORTED_LIBNAME \"${OPENGL_gl_LIBRARY}\")\r\n        endif()\r\n        set_target_properties(OpenGL::GL PROPERTIES\r\n          INTERFACE_INCLUDE_DIRECTORIES \"${OPENGL_INCLUDE_DIR}\")\r\n      endif()\r\n\r\n      if(OPENGL_GLU_FOUND AND NOT TARGET OpenGL::GLU)\r\n        if(IS_ABSOLUTE \"${OPENGL_glu_LIBRARY}\")\r\n          add_library(OpenGL::GLU UNKNOWN IMPORTED)\r\n          if(OPENGL_glu_LIBRARY MATCHES \"/([^/]+)\\\\.framework$\")\r\n            set(_glu_fw \"${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}\")\r\n            if(EXISTS \"${_glu_fw}.tbd\")\r\n              set(_glu_fw \"${_glu_fw}.tbd\")\r\n            endif()\r\n            set_target_properties(OpenGL::GLU PROPERTIES\r\n              IMPORTED_LOCATION \"${_glu_fw}\")\r\n          else()\r\n            set_target_properties(OpenGL::GLU PROPERTIES\r\n              IMPORTED_LOCATION \"${OPENGL_glu_LIBRARY}\")\r\n          endif()\r\n        else()\r\n          add_library(OpenGL::GLU INTERFACE IMPORTED)\r\n          set_target_properties(OpenGL::GLU PROPERTIES\r\n            IMPORTED_LIBNAME \"${OPENGL_glu_LIBRARY}\")\r\n        endif()\r\n        set_target_properties(OpenGL::GLU PROPERTIES\r\n          INTERFACE_LINK_LIBRARIES OpenGL::GL)\r\n      endif()\r\n    ENDIF ()\r\n```\r\n</p>\r\n</details>"}}
{"actor":{"display_login":"Idclip"}}