Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Revamp cmake install directory handling

Clean up some things to allow greater flexibility in specifying the install
directory structure.  The following new user-visible cmake path variables are
defined:

BIN_INSTALL_DIR     - replaces BINDIR, renamed for clarity
LIB_INSTALL_DIR     - replaces LIBDIR
PYLIB_INSTALL_DIR   - replaces PYLIBDIR
INCLUDE_INSTALL_DIR - new
DOC_INSTALL_DIR     - new
MAN_INSTALL_DIR     - new

In addition, there is an INSTALL_DOCS option for the benefit of linux packagers
relying on the packaging system to do the docs install.

Finally, there is a variable SELF_CONTAINED_INSTALL_TREE to specify whether the
user will be installing into standard unix system directories, or into a
special self-contained oiio directory.  It is false by default, but is
explicitly set in the Makefile, so anybody doing makefile builds should see
very few changes.  Windows builds are always set up as "self-contained".

Also clean up the docs install to avoid installing a few developer-centric
things which will normally be obtained directly from git.
  • Loading branch information...
commit 5de68071e5885be5cfac6377b416aea11ec1cc64 1 parent 2d830b5
Chris Foster c42f authored
2  Makefile
@@ -27,7 +27,7 @@ ifdef PROFILE
27 27 endif
28 28
29 29 MY_MAKE_FLAGS ?=
30   -MY_CMAKE_FLAGS ?=
  30 +MY_CMAKE_FLAGS ?= -DSELF_CONTAINED_INSTALL_TREE:BOOL=TRUE
31 31
32 32 # Site-specific build instructions
33 33 ifndef OPENIMAGEIO_SITE
58 src/CMakeLists.txt
@@ -87,19 +87,61 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
87 87 add_definitions ("-DDEBUG=1")
88 88 endif ()
89 89
90   -# Exec Install Locations
91   -set (BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
92   -set (LIBDIR "${CMAKE_INSTALL_PREFIX}/lib")
93   -set (PYLIBDIR "${CMAKE_INSTALL_PREFIX}/python")
  90 +###########################################################################
  91 +# Paths for install tree customization. Note that relative paths are relative
  92 +# to CMAKE_INSTALL_PREFIX.
  93 +set (DEFAULT_BIN_INSTALL_DIR "bin")
  94 +set (DEFAULT_LIB_INSTALL_DIR "lib")
  95 +set (DEFAULT_INCLUDE_INSTALL_DIR "include/OpenImageIO")
  96 +if (UNIX AND NOT SELF_CONTAINED_INSTALL_TREE)
  97 + # Try to be well-behaved and install into reasonable places according to
  98 + # the "standard" unix directory heirarchy
  99 + # TODO: Figure out how to get the correct python directory
  100 + set (DEFAULT_PYLIB_INSTALL_DIR "lib/python/site-packages")
  101 + set (DEFAULT_DOC_INSTALL_DIR "share/doc/openimageio")
  102 + set (DEFAULT_MAN_INSTALL_DIR "share/man/man1")
  103 +else ()
  104 + # Here is the "self-contained install tree" case: the expectation here is
  105 + # that everything OIIO related will go into its own directory, not into
  106 + # some standard system heirarchy.
  107 + set (DEFAULT_PYLIB_INSTALL_DIR "python")
  108 + set (DEFAULT_DOC_INSTALL_DIR "doc")
  109 + set (DEFAULT_MAN_INSTALL_DIR "doc/man")
  110 +endif ()
94 111 if (EXEC_INSTALL_PREFIX)
95   - set (BINDIR "${EXEC_INSTALL_PREFIX}/bin")
96   - set (LIBDIR "${EXEC_INSTALL_PREFIX}/lib")
97   - set (PYLIBDIR "${EXEC_INSTALL_PREFIX}/python")
  112 + # Tack on an extra prefix to support multi-arch builds.
  113 + set (DEFAULT_BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${DEFAULT_BIN_INSTALL_DIR}")
  114 + set (DEFAULT_LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${DEFAULT_LIB_INSTALL_DIR}")
  115 + set (DEFAULT_PYLIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${DEFAULT_PYLIB_INSTALL_DIR}")
98 116 endif ()
  117 +# Set up cmake cache variables corresponding to the defaults deduced above, so
  118 +# that the user can override them as desired:
  119 +set (BIN_INSTALL_DIR ${DEFAULT_BIN_INSTALL_DIR} CACHE STRING
  120 + "Install location for binaries (relative to CMAKE_INSTALL_PREFIX or absolute)")
  121 +set (LIB_INSTALL_DIR ${DEFAULT_LIB_INSTALL_DIR} CACHE STRING
  122 + "Install location for libraries (relative to CMAKE_INSTALL_PREFIX or absolute)")
  123 +set (PYLIB_INSTALL_DIR ${DEFAULT_PYLIB_INSTALL_DIR} CACHE STRING
  124 + "Install location for python libraries (relative to CMAKE_INSTALL_PREFIX or absolute)")
  125 +set (INCLUDE_INSTALL_DIR ${DEFAULT_INCLUDE_INSTALL_DIR} CACHE STRING
  126 + "Install location of header files (relative to CMAKE_INSTALL_PREFIX or absolute)")
  127 +set (DOC_INSTALL_DIR ${DEFAULT_DOC_INSTALL_DIR} CACHE STRING
  128 + "Install location for documentation (relative to CMAKE_INSTALL_PREFIX or absolute)")
  129 +if (UNIX)
  130 + set (MAN_INSTALL_DIR ${DEFAULT_MAN_INSTALL_DIR} CACHE STRING
  131 + "Install location for manual pages (relative to CMAKE_INSTALL_PREFIX or absolute)")
  132 +endif()
99 133
100   -set (CMAKE_INSTALL_RPATH "${LIBDIR}")
  134 +set (INSTALL_DOCS ON CACHE BOOL "Install documentation")
  135 +
  136 +
  137 +#####
  138 +set (CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}")
  139 +if (NOT IS_ABSOLUTE ${CMAKE_INSTALL_RPATH})
  140 + set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
  141 +endif ()
101 142 set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
102 143
  144 +
103 145 ###########################################################################
104 146 if (MSVC)
105 147 add_definitions (-D_CRT_SECURE_NO_DEPRECATE)
6 src/cmake/oiio_macros.cmake
@@ -7,9 +7,9 @@
7 7 #
8 8 macro (oiio_install_targets)
9 9 install (TARGETS ${ARGN}
10   - RUNTIME DESTINATION "${BINDIR}" COMPONENT user
11   - LIBRARY DESTINATION "${LIBDIR}" COMPONENT user
12   - ARCHIVE DESTINATION "${LIBDIR}" COMPONENT developer)
  10 + RUNTIME DESTINATION "${BIN_INSTALL_DIR}" COMPONENT user
  11 + LIBRARY DESTINATION "${LIB_INSTALL_DIR}" COMPONENT user
  12 + ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT developer)
13 13 endmacro ()
14 14
15 15 # Macro to add a build target for an IO plugin.
28 src/doc/CMakeLists.txt
... ... @@ -1,22 +1,22 @@
1 1 project(documentation)
2   -set (public_docs openimageio.pdf CLA-INDIVIDUAL CLA-CORPORATE)
3 2
4   -install (FILES ${public_docs} DESTINATION doc COMPONENT documentation)
  3 +set (public_docs
  4 + openimageio.pdf
  5 + ${OpenImageIO_SOURCE_DIR}/../LICENSE
  6 + ${OpenImageIO_SOURCE_DIR}/../CHANGES
  7 +)
5 8
6   -install (FILES ${OpenImageIO_SOURCE_DIR}/../LICENSE
7   - ${OpenImageIO_SOURCE_DIR}/../INSTALL
8   - ${OpenImageIO_SOURCE_DIR}/../CHANGES
9   - DESTINATION .)
10   -
11   -#install (DIRECTORY doxygen/html DESTINATION doc
12   -# PATTERN .svn EXCLUDE)
  9 +if (INSTALL_DOCS)
  10 + install (FILES ${public_docs} DESTINATION ${DOC_INSTALL_DIR}
  11 + COMPONENT documentation)
  12 +endif ()
13 13
14 14 # generate man pages using txt2man and a tiny python script to munge the
15   -# result of "tool --help"
  15 +# result of "$tool --help"
16 16 find_program(TXT2MAN txt2man)
17 17 find_package(PythonInterp)
18 18 if (UNIX AND TXT2MAN AND PYTHONINTERP_FOUND)
19   - message (STATUS "Generating manual page docs")
  19 + message (STATUS "Unix man page documentation will be generated")
20 20 set (cli_tools iinfo maketx idiff iv igrep iprocess iconvert)
21 21
22 22 foreach (tool ${cli_tools})
@@ -32,6 +32,8 @@ if (UNIX AND TXT2MAN AND PYTHONINTERP_FOUND)
32 32 # force man page build before install
33 33 add_custom_target (man_pages ALL DEPENDS ${manpage_files})
34 34
35   - install (FILES ${manpage_files}
36   - DESTINATION doc/man COMPONENT documentation)
  35 + if (INSTALL_DOCS)
  36 + install (FILES ${manpage_files}
  37 + DESTINATION ${MAN_INSTALL_DIR} COMPONENT documentation)
  38 + endif ()
37 39 endif()
8 src/include/CMakeLists.txt
@@ -15,15 +15,11 @@ set (OIIO_VERSION_NS "v${MANGLED_SOVERSION}")
15 15 configure_file(version.h.in ${CMAKE_BINARY_DIR}/include/version.h @ONLY)
16 16 list(APPEND public_headers ${CMAKE_BINARY_DIR}/include/version.h)
17 17
18   -install (FILES ${public_headers} DESTINATION include/OpenImageIO
  18 +install (FILES ${public_headers} DESTINATION ${INCLUDE_INSTALL_DIR}
19 19 COMPONENT developer)
20 20
21 21 if (USE_TBB)
22   - file (GLOB tbb_headers tbb/*.h)
23   - file (GLOB tbb_headers2 tbb/machine/*.h)
24   - install (FILES ${tbb_headers} DESTINATION include/OpenImageIO/tbb
25   - COMPONENT developer)
26   - install (FILES ${tbb_headers2} DESTINATION include/OpenImageIO/tbb/machine
  22 + install (DIRECTORY tbb DESTINATION ${INCLUDE_INSTALL_DIR}
27 23 COMPONENT developer)
28 24 endif ()
29 25
4 src/python/CMakeLists.txt
@@ -42,7 +42,7 @@ if ( BOOST_CUSTOM OR Boost_FOUND AND PYTHONLIBS_FOUND)
42 42 endif()
43 43
44 44 install (TARGETS PyOpenImageIO
45   - RUNTIME DESTINATION ${PYLIBDIR} COMPONENT user
46   - LIBRARY DESTINATION ${PYLIBDIR} COMPONENT user)
  45 + RUNTIME DESTINATION ${PYLIB_INSTALL_DIR} COMPONENT user
  46 + LIBRARY DESTINATION ${PYLIB_INSTALL_DIR} COMPONENT user)
47 47
48 48 endif ()

0 comments on commit 5de6807

Please sign in to comment.
Something went wrong with that request. Please try again.