A patch update will be applied today - June 21st between 1pm - 1:45pm EDT (UTC-0400). GitLab will go down a few minutes within that time.

Commits (27)
# TODO: error on unrecognized arguments
#[==[.md
## Mach-O (macOS)
The superbuild installs Mach-O binaries using a core function to construct an
`.app` bundle using the `fixup_bundle.apple.py` script with the correct
arguments. It tries to emulate an Mach-O runtime loader to determine where to
find dependent files and it copies them to the installation directory. It also
fixes up internal library references so that the resulting package is
self-contained and relocatable.
### Create an application bundle.
```
superbuild_apple_create_app(<DESTINATION> <NAME> <BINARY>
[INCLUDE_REGEXES <regex>...]
[EXCLUDE_REGEXES <regex>...]
[SEARCH_DIRECTORIES <library-path>...]
[PLUGINS <plugin>...]
[ADDITIONAL_LIBRARIES <library-path>...]
[FAKE_PLUGIN_PATHS] [CLEAN])
```
Creates a `<NAME>.app` bundle. The bundle is placed in `<DESTINATION>` with
`<BINARY>` (an absolute path) as a main executable for the bundle (under the
`MacOS/` directory). Libraries are searched for and placed into the bundle from
the `SEARCH_DIRECTORIES` specified. Library IDs and link paths are rewritten to
use `@executable_path` or `@loader_path` as necessary.
To exclude libraries from the bundle, use Python regular expressions as
arguments to the `EXCLUDE_REGEXES` keyword. To include any otherwise-excluded
libraries, use `INCLUDE_REGEXES`. System libraries and frameworks are excluded
by default.
The `CLEAN` argument starts a new bundle, otherwise the bundle is left as-is
(and is expected to have been created by this call).
Plugins may be listed under the `PLUGINS` keyword and will be installed to the
`Plugins/` directory in the bundle. These are full paths to the plugin
binaries. If `FAKE_PLUGIN_PATHS` is given, the plugin is treated as its own
`@executable_path` which is useful when packaging plugins which may be used for
multiple applications and may require additional libraries depending on the
application.
Additional libraries may be listed under the ``ADDITIONAL_LIBRARIES`` keyword
and will be installed to the ``Libraries/`` directory in the bundle. These are
full paths to the libraries.
#]==]
function (superbuild_apple_create_app destination name binary)
set(options
CLEAN
FAKE_PLUGIN_PATHS)
set(multivalues
INCLUDE_REGEXES
EXCLUDE_REGEXES
SEARCH_DIRECTORIES
PLUGINS
ADDITIONAL_LIBRARIES)
cmake_parse_arguments(_create_app "${options}" "" "${multivalues}" ${ARGN})
set(fixup_bundle_arguments)
if (_create_app_CLEAN)
if (superbuild_is_install_target)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --new")
else ()
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --clean --new")
endif ()
endif ()
if (_create_app_FAKE_PLUGIN_PATHS)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --fake-plugin-paths")
endif ()
foreach (include_regex IN LISTS _create_app_INCLUDE_REGEXES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --include \"${include_regex}\"")
endforeach ()
foreach (exclude_regex IN LISTS _create_app_EXCLUDE_REGEXES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --exclude \"${exclude_regex}\"")
endforeach ()
foreach (search_directory IN LISTS _create_app_SEARCH_DIRECTORIES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --search \"${search_directory}\"")
endforeach ()
foreach (plugin IN LISTS _create_app_PLUGINS)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --plugin \"${plugin}\"")
endforeach ()
foreach (library IN LISTS _create_app_ADDITIONAL_LIBRARIES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --library \"${library}\"")
endforeach ()
install(CODE
"execute_process(
COMMAND \"${_superbuild_install_cmake_dir}/scripts/fixup_bundle.apple.py\"
--bundle \"${name}\"
--destination \"${destination}\"
${fixup_bundle_arguments}
--manifest \"${CMAKE_BINARY_DIR}/${name}.manifest\"
--type executable
\"${binary}\"
RESULT_VARIABLE res
ERROR_VARIABLE err)
if (res)
message(FATAL_ERROR \"Failed to install ${name}:\n\${err}\")
endif ()"
COMPONENT superbuild)
endfunction ()
#[==[.md
### Utility executables
```
superbuild_apple_install_utility(<DESTINATION> <NAME> <BINARY>
[INCLUDE_REGEXES <regex>...]
[EXCLUDE_REGEXES <regex>...]
[SEARCH_DIRECTORIES <library-path>...]
[FRAMEWORK_DEST <framework-dest>]
[LIBRARY_DEST <library-dest>])
```
Adds a binary to the `bin/` path of the bundle. Required libraries are
installed and fixed up using `@executable_path`.
A previous call must have been made with matching `DESTINATION` and `NAME`
arguments; this call will not create a new application bundle.
The `INCLUDE_REGEXES`, `EXCLUDE_REGEXES`, and `SEARCH_DIRECTORIES` arguments
are the same as those for `superbuild_apple_create_app`.
#]==]
function (superbuild_apple_install_utility destination name binary)
set(values
FRAMEWORK_DEST
LIBRARY_DEST)
set(multivalues
INCLUDE_REGEXES
EXCLUDE_REGEXES
SEARCH_DIRECTORIES)
cmake_parse_arguments(_install_utility "" "${values}" "${multivalues}" ${ARGN})
set(fixup_bundle_arguments)
foreach (include_regex IN LISTS _install_utility_INCLUDE_REGEXES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --include \"${include_regex}\"")
endforeach ()
foreach (exclude_regex IN LISTS _install_utility_EXCLUDE_REGEXES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --exclude \"${exclude_regex}\"")
endforeach ()
foreach (search_directory IN LISTS _install_utility_SEARCH_DIRECTORIES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --search \"${search_directory}\"")
endforeach ()
if (DEFINED _install_utility_FRAMEWORK_DEST)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --framework-dest \"${_install_utility_FRAMEWORK_DEST}\"")
endif ()
if (DEFINED _install_utility_LIBRARY_DEST)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --library-dest \"${_install_utility_LIBRARY_DEST}\"")
endif ()
install(CODE
"execute_process(
COMMAND \"${_superbuild_install_cmake_dir}/scripts/fixup_bundle.apple.py\"
--bundle \"${name}\"
--destination \"${destination}\"
${fixup_bundle_arguments}
--manifest \"${CMAKE_BINARY_DIR}/${name}.manifest\"
--type utility
\"${binary}\"
RESULT_VARIABLE res
ERROR_VARIABLE err)
if (res)
message(FATAL_ERROR \"Failed to install ${name}:\n\${err}\")
endif ()"
COMPONENT superbuild)
endfunction ()
#[==[.md
### Module libraries
```
superbuild_apple_install_module(<DESTINATION> <NAME> <BINARY> <LOCATION>
[INCLUDE_REGEXES <regex>...]
[EXCLUDE_REGEXES <regex>...]
[SEARCH_DIRECTORIES <library-path>...])
```
Adds a library to the `<LOCATION>` path of the bundle. Required libraries which
have not been installed by previous executable installs are installed and fixed
up using `@loader_path`. Use this to install things such as compiled language
modules and the like.
A previous call must have been made with matching `DESTINATION` and `NAME`
arguments; this call will not create a new application bundle.
The `INCLUDE_REGEXES`, `EXCLUDE_REGEXES`, and `SEARCH_DIRECTORIES` arguments
are the same as those for `superbuild_apple_create_app`.
#]==]
function (superbuild_apple_install_module destination name binary location)
set(multivalues
INCLUDE_REGEXES
EXCLUDE_REGEXES
SEARCH_DIRECTORIES)
cmake_parse_arguments(_install_module "" "" "${multivalues}" ${ARGN})
set(fixup_bundle_arguments)
foreach (include_regex IN LISTS _install_module_INCLUDE_REGEXES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --include \"${include_regex}\"")
endforeach ()
foreach (exclude_regex IN LISTS _install_module_EXCLUDE_REGEXES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --exclude \"${exclude_regex}\"")
endforeach ()
foreach (search_directory IN LISTS _install_module_SEARCH_DIRECTORIES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --search \"${search_directory}\"")
endforeach ()
install(CODE
"execute_process(
COMMAND \"${_superbuild_install_cmake_dir}/scripts/fixup_bundle.apple.py\"
--bundle \"${name}\"
--destination \"${destination}\"
${fixup_bundle_arguments}
--manifest \"${CMAKE_BINARY_DIR}/${name}.manifest\"
--location \"${location}\"
--type module
\"${binary}\"
RESULT_VARIABLE res
ERROR_VARIABLE err)
if (res)
message(FATAL_ERROR \"Failed to install ${name}:\n\${err}\")
endif ()"
COMPONENT superbuild)
endfunction ()
#[==[.md
### Python packages
The superbuild also provides functions to install Python modules and packages.
```
superbuild_apple_install_python(<DESTINATION> <NAME>
MODULES <module>...
MODULE_DIRECTORIES <module-path>...
[SEARCH_DIRECTORIES <library-path>...])
```
The list of modules to installed is given to the `MODULES` argument. These
modules (or packages) are searched for at install time in the paths given to
the `MODULE_DIRECTORIES` argument.
Modules are placed in the `Python/` directory in the given application bundle.
A previous call must have been made with matching `DESTINATION` and `NAME`
arguments; this call will not create a new application bundle.
Note that modules in the list which cannot be found are ignored.
#]==]
function (superbuild_apple_install_python destination name)
set(multivalues
SEARCH_DIRECTORIES
MODULE_DIRECTORIES
MODULES)
cmake_parse_arguments(_install_python "" "" "${multivalues}" ${ARGN})
if (NOT _install_python_MODULES)
message(FATAL_ERROR "No modules specified.")
endif ()
if (NOT _install_python_MODULE_DIRECTORIES)
message(FATAL_ERROR "No modules search paths specified.")
endif ()
set(fixup_bundle_arguments)
foreach (search_directory IN LISTS _install_python_SEARCH_DIRECTORIES)
list(APPEND fixup_bundle_arguments
--search "${search_directory}")
endforeach ()
install(CODE
"include(\"${_superbuild_install_cmake_dir}/scripts/fixup_python.apple.cmake\")
set(python_modules \"${_install_python_MODULES}\")
set(module_directories \"${_install_python_MODULE_DIRECTORIES}\")
set(fixup_bundle_arguments \"${fixup_bundle_arguments}\")
set(bundle_destination \"${destination}\")
set(bundle_name \"${name}\")
set(bundle_manifest \"${CMAKE_BINARY_DIR}/${name}.manifest\")
foreach (python_module IN LISTS python_modules)
superbuild_apple_install_python_module(\"\${bundle_destination}/\${bundle_name}\"
\"\${python_module}\" \"\${module_directories}\" \"Contents/Python\")
endforeach ()"
COMPONENT superbuild)
endfunction ()
set_property(GLOBAL PROPERTY
superbuild_has_cleaned FALSE)
# TODO: error on unrecognized arguments
#[==[.md
## ELF (Linux)
The superbuild installs ELF binaries using a core function to construct a
command to run the `fixup_bundle.unix.py` script with the correct arguments. It
tries to emulate an ELF runtime loader to determine where to find dependent
files and it copies them to the installation directory.
Calling this function directory should not be necessary. Instead, using the
more specific functions documented later is recommended. The core function is
used as a single place to document the various common arguments available to
the other functions. If an argument is specified by a function, it should not
be passed as the remaining arguments to the function.
```
_superbuild_unix_install_binary(
LIBDIR <libdir>
BINARY <path>
TYPE <module|executable>
[CLEAN]
[DESTINATION <destination>]
[LOCATION <location>]
[INCLUDE_REGEXES <include-regex>...]
[EXCLUDE_REGEXES <exclude-regex>...]
[LOADER_PATHS <loader-paths>...]
[SEARCH_DIRECTORIES <search-directory>...])
```
A manifest file is kept in the binary directory of the packaging step. This
allows for a library to be installed just once for an entire package. It is
reset when the `CLEAN` argument is present. In addition, the install directory
is removed for non-install targets (based on `superbuild_is_install_target`)
when `CLEAN` is specified. Whether this is necessary or not is maintained
internally and it should almost never need to be provided.
The `DESTINATION` is the absolute path to the installation prefix, including
`DESTDIR`. It defaults to `\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}`. It is
escaped because we want CMake to expand its value at install time, not
configure time.
The `BINARY` argument is the path to the actual executable to install. It must
be an absolute path.
The `TYPE` argument specifies whether an executable or module (e.g., plugin or
standalone library) is being installed. For a module, the `LOCATION` argument
must be given. This is the path under the installation prefix to place the
module. Executables are always installed into `bin`. The libraries that are
found to be required by the installed binary are placed in the subdirectory of
the install destination given by the `LIBDIR` argument.
The `LOADER_PATHS` argument is a list of paths to use when installing a module
to search for libraries that are assumed to be available because of the loading
executable. This is intended to be where libraries assumed to be with an
executable live when installing a plugin for that executable.
The `SEARCH_DIRECTORIES` argument is a list of paths to search for libraries if
the library cannot be found due to rpaths in the binary, `LOADER_PATHS`, or
other runtime-loader logic. If these paths are required to find a library, a
warning is printed at install time.
By default, libraries from the "system" (basically standard `/lib` directories)
are ignored when installing. The `INCLUDE_REGEXES` and `EXCLUDE_REGEXES`
arguments are lists of Python regular expressions to either force-include or
force-exclude from installation. Inclusion overrides exclusion. The provided
regular expressions are also expected to match the full path of the library.
#]==]
function (_superbuild_unix_install_binary)
set(options
CLEAN)
set(values
DESTINATION
LIBDIR
LOCATION
BINARY
TYPE)
set(multivalues
INCLUDE_REGEXES
EXCLUDE_REGEXES
LOADER_PATHS
SEARCH_DIRECTORIES)
cmake_parse_arguments(_install_binary "${options}" "${values}" "${multivalues}" ${ARGN})
if (NOT _install_binary_BINARY)
message(FATAL_ERROR "Cannot install a binary without a path.")
endif ()
if (NOT IS_ABSOLUTE "${_install_binary_BINARY}")
message(FATAL_ERROR "Cannot install a binary without an absolute path (${_install_binary_BINARY}).")
endif ()
if (NOT _install_binary_DESTINATION)
set(_install_binary_DESTINATION
"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}")
endif ()
if (NOT _install_binary_LIBDIR)
message(FATAL_ERROR "Cannot install ${_install_binary_BINARY} without knowing where to put dependent libraries.")
endif ()
if (NOT _install_binary_TYPE)
message(FATAL_ERROR "Cannot install ${_install_binary_BINARY} without knowing its type.")
endif ()
if (_install_binary_TYPE STREQUAL "module" AND NOT _install_binary_LOCATION)
message(FATAL_ERROR "Cannot install ${_install_binary_BINARY} as a module without knowing where to place it.")
endif ()
set(fixup_bundle_arguments)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --destination ${_install_binary_DESTINATION}")
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --type ${_install_binary_TYPE}")
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --libdir ${_install_binary_LIBDIR}")
get_property(superbuild_install_no_external_dependencies GLOBAL PROPERTY
superbuild_install_no_external_dependencies)
if (superbuild_install_no_external_dependencies)
set(fixup_bundle_arguments "${fixup_bundle_arguments} --source-only")
endif ()
get_property(superbuild_has_cleaned GLOBAL PROPERTY
superbuild_has_cleaned)
if (_install_binary_CLEAN OR NOT superbuild_has_cleaned)
set_property(GLOBAL PROPERTY
superbuild_has_cleaned TRUE)
if (superbuild_is_install_target)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --new")
else ()
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --clean --new")
endif ()
endif ()
if (_install_binary_LOCATION)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --location \"${_install_binary_LOCATION}\"")
endif ()
foreach (include_regex IN LISTS _install_binary_INCLUDE_REGEXES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --include \"${include_regex}\"")
endforeach ()
foreach (exclude_regex IN LISTS _install_binary_EXCLUDE_REGEXES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --exclude \"${exclude_regex}\"")
endforeach ()
foreach (loader_path IN LISTS _install_binary_LOADER_PATHS)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --loader-path \"${loader_path}\"")
endforeach ()
foreach (search_directory IN LISTS _install_binary_SEARCH_DIRECTORIES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --search \"${search_directory}\"")
endforeach ()
install(CODE
"execute_process(
COMMAND \"${superbuild_python_executable}\"
\"${_superbuild_install_cmake_dir}/scripts/fixup_bundle.unix.py\"
${fixup_bundle_arguments}
--manifest \"${CMAKE_BINARY_DIR}/install.manifest\"
--source \"${superbuild_install_location}\"
\"${_install_binary_BINARY}\"
RESULT_VARIABLE res
ERROR_VARIABLE err)
if (res)
message(FATAL_ERROR \"Failed to install ${name}:\n\${err}\")
endif ()"
COMPONENT superbuild)
endfunction ()
# A convenience function for installing an executable.
function (_superbuild_unix_install_executable path libdir)
_superbuild_unix_install_binary(
BINARY "${path}"
LIBDIR "${libdir}"
TYPE executable
${ARGN})
endfunction ()
# A convenience function for installing a module.
function (_superbuild_unix_install_module path subdir libdir)
_superbuild_unix_install_binary(
BINARY "${path}"
LOCATION "${subdir}"
LIBDIR "${libdir}"
TYPE module
${ARGN})
endfunction ()
#[==[.md
### Forwarding executables
In the ParaView world, "forwarding" executables are used to make packages
standalone. This functionality is provided by KWSys. This creates a small
binary in `bin/` which finds its companion "real" executable under the
corresponding `lib/` directory. It then sets the `LD_LIBRARY_PATH` environment
variable accordingly and executes the real binary.
In order to install these kinds of executables, this function is provided:
```
superbuild_unix_install_program_fwd(<NAME> <LIBRARY PATHS> [<ARG>...])
```
Installs a binary named `NAME` to the package. The `LIBRARY PATHS` argument is
a list of directories to search for the real binary and its libraries. These
paths are assumed to be relative to `superbuild_install_location`. The
libraries are installed to the subdirectory the actual executable is found in.
Note that `LIBRARY PATHS` is a CMake list passed as a single argument.
The following arguments are set by calling this function:
- `BINARY`
- `LIBDIR`
- `LOCATION`
- `TYPE`
#]==]
function (superbuild_unix_install_program_fwd name paths)
set(found FALSE)
foreach (path IN LISTS paths)
if (EXISTS "${superbuild_install_location}/${path}/${name}")
_superbuild_unix_install_module("${superbuild_install_location}/${path}/${name}" "${path}" "${path}" ${ARGN})
set(found TRUE)
break ()
endif ()
endforeach ()
if (NOT found)
message(FATAL_ERROR "Unable to find the actual executable for ${name}")
endif ()
_superbuild_unix_install_executable("${superbuild_install_location}/bin/${name}" "lib")
endfunction ()
#[==[.md
### Executables
Non-forwarding executables are binaries that may not work in the package
without the proper rpaths or `LD_LIBRARY_PATH` set when running the executable.
```
superbuild_unix_install_program(<PATH> <LIBRARY DIR> [<ARG>...])
```
Installs a program at `PATH` into `bin/` and its dependent libraries into
`LIBRARY DIR` under the install destination. The program must be an absolute
path.
The following arguments are set by calling this function:
- `BINARY`
- `LIBDIR`
- `TYPE` (`executable`)
#]==]
function (superbuild_unix_install_program name libdir)
_superbuild_unix_install_executable("${name}" "${libdir}" ${ARGN})
endfunction ()
#[==[.md
### Plugins
Plugins include libraries that are meant to be loaded at runtime. It also
includes libraries that are linked to, but need to be installed separately.
```
superbuild_unix_install_plugin(<PATH> <LIBRARY DIR> <SEARCH PATHS> [<ARG>...])
```
Installs a library at `PATH` into `bin/` and its dependent libraries into
`LIBRARY DIR` under the install destination. If the path is not absolute, it is
searched for underneath `superbuild_install_location` with the given `PATH`
under each path in the `SEARCH PATHS` argument.
Note that `SEARCH PATHS` is a CMake list passed as a single argument.
The following arguments are set by calling this function:
- `BINARY`
- `LIBDIR`
- `TYPE` (`module`)
#]==]
function (superbuild_unix_install_plugin name libdir paths)
if (IS_ABSOLUTE "${name}")
_superbuild_unix_install_module("${name}" "${paths}" "${libdir}" ${ARGN})
return ()
endif ()
set(found FALSE)
foreach (path IN LISTS paths)
if (EXISTS "${superbuild_install_location}/${path}/${name}")
_superbuild_unix_install_module("${superbuild_install_location}/${path}/${name}" "${path}" "${libdir}" ${ARGN})
set(found TRUE)
break ()
endif ()
endforeach ()
if (NOT found)
string(REPLACE ";" ", " paths_list "${paths}")
message(FATAL_ERROR "Unable to find the ${name} plugin in ${paths_list}")
endif ()
endfunction ()
#[==[.md
### Python packages
The superbuild also provides functions to install Python modules and packages.
```
superbuild_unix_install_python(
MODULES <module>...
LIBDIR <libdir>
MODULE_DIRECTORIES <module-path>...
[MODULE_DESTINATION <destination>]
[INCLUDE_REGEXES <include-regex>...]
[EXCLUDE_REGEXES <exclude-regex>...]
[LOADER_PATHS <loader-paths>...]
[SEARCH_DIRECTORIES <library-path>...])
```
The list of modules to installed is given to the `MODULES` argument. These
modules (or packages) are searched for at install time in the paths given to
the `MODULE_DIRECTORIES` argument.
Modules are placed in the `MODULE_DESTINATION` under the expected Python module
paths in the package (`lib/python2.7`). By default, `/site-packages` is used.
The `INCLUDE_REGEXES`, `EXCLUDE_REGEXES`, `LOADER_PATHS`, and
`SEARCH_DIRECTORIES` arguments used when installing compiled Python modules
through an internal `superbuild_unix_install_plugin` call.
Note that modules in the list which cannot be found are ignored. This function
also assumes Python 2.7 for now.
#]==]
function (superbuild_unix_install_python)
set(values
MODULE_DESTINATION
LIBDIR)
set(multivalues
INCLUDE_REGEXES
EXCLUDE_REGEXES
LOADER_PATHS
SEARCH_DIRECTORIES
MODULE_DIRECTORIES
MODULES)
cmake_parse_arguments(_install_python "${options}" "${values}" "${multivalues}" ${ARGN})
if (NOT _install_python_LIBDIR)
message(FATAL_ERROR "Cannot install Python modules without knowing where to put dependent libraries.")
endif ()
if (NOT _install_python_MODULES)
message(FATAL_ERROR "No modules specified.")
endif ()
if (NOT _install_python_MODULE_DIRECTORIES)
message(FATAL_ERROR "No modules search paths specified.")
endif ()
set(fixup_bundle_arguments)
if (NOT _install_python_MODULE_DESTINATION)
set(_install_python_MODULE_DESTINATION "/site-packages")
endif ()
foreach (include_regex IN LISTS _install_python_INCLUDE_REGEXES)
list(APPEND fixup_bundle_arguments
--include "${include_regex}")
endforeach ()
foreach (exclude_regex IN LISTS _install_python_EXCLUDE_REGEXES)
list(APPEND fixup_bundle_arguments
--exclude "${exclude_regex}")
endforeach ()
foreach (search_directory IN LISTS _install_python_SEARCH_DIRECTORIES)
list(APPEND fixup_bundle_arguments
--search "${search_directory}")
endforeach ()
foreach (loader_path IN LISTS _install_python_LOADER_PATHS)
list(APPEND fixup_bundle_arguments
--loader-path "${loader_path}")
endforeach ()
get_property(superbuild_install_no_external_dependencies GLOBAL PROPERTY
superbuild_install_no_external_dependencies)
if (superbuild_install_no_external_dependencies)
list(APPEND fixup_bundle_arguments --source-only)
endif ()
install(CODE
"set(superbuild_python_executable \"${superbuild_python_executable}\")
set(superbuild_install_location \"${superbuild_install_location}\")
include(\"${_superbuild_install_cmake_dir}/scripts/fixup_python.unix.cmake\")
set(python_modules \"${_install_python_MODULES}\")
set(module_directories \"${_install_python_MODULE_DIRECTORIES}\")
set(fixup_bundle_arguments \"${fixup_bundle_arguments}\")
set(bundle_destination \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")
set(bundle_manifest \"${CMAKE_BINARY_DIR}/install.manifest\")
set(libdir \"${_install_python_LIBDIR}\")
foreach (python_module IN LISTS python_modules)
superbuild_unix_install_python_module(\"\${CMAKE_INSTALL_PREFIX}\"
\"\${python_module}\" \"\${module_directories}\" \"lib/python2.7${_install_python_MODULE_DESTINATION}\")
endforeach ()"
COMPONENT superbuild)
endfunction ()
set_property(GLOBAL PROPERTY
superbuild_has_cleaned FALSE)
# TODO: error on unrecognized arguments
#[==[.md
## PE-COFF (Windows)
The superbuild installs PE-COFF binaries using a core function to construct a
command to run the `fixup_bundle.windows.py` script with the correct arguments.
It tries to emulate the runtime loader to determine where to find dependent
files and it copies them to the installation directory.
Calling this function directory should not be necessary. Instead, using the
more specific functions documented later is recommended. The core function is
used as a single place to document the various common arguments available to
the other functions. If an argument is specified by a function, it should not
be passed as the remaining arguments to the function.
```
_superbuild_windows_install_binary(
LIBDIR <libdir>
BINARY <path>
TYPE <module|executable>
[CLEAN]
[DESTINATION <destination>]
[LOCATION <location>]
[INCLUDE_REGEXES <include-regex>...]
[EXCLUDE_REGEXES <exclude-regex>...]
[BINARY_LIBDIR <binary_libdirs>...]
[SEARCH_DIRECTORIES <search-directory>...])
```
A manifest file is kept in the binary directory of the packaging step. This
allows for a library to be installed just once for an entire package. It is
reset when the `CLEAN` argument is present. In addition, the install directory
is removed for non-install targets (based on `superbuild_is_install_target`)
when `CLEAN` is specified. Whether this is necessary or not is maintained
internally and it should almost never need to be provided.
The `DESTINATION` is the absolute path to the installation prefix, including
`DESTDIR`. It defaults to `\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}`. It is
escaped because we want CMake to expand its value at install time, not
configure time.
The `BINARY` argument is the path to the actual executable to install. It must
be an absolute path.
The `TYPE` argument specifies whether an executable or module (e.g., plugin or
standalone library) is being installed. For a module, the `LOCATION` argument
must be given. This is the path under the installation prefix to place the
module. Executables are always installed into `bin`. The libraries that are
found to be required by the installed binary are placed in the subdirectory of
the install destination given by the `LIBDIR` argument.
The `BINARY_LIBDIR` argument is a list of paths which the binary is assumed to
already be searching when loading a module.
The `SEARCH_DIRECTORIES` argument is a list of paths to search for libraries if
the library cannot be found due to rpaths in the binary, `LOADER_PATHS`, or
other runtime-loader logic. If these paths are required to find a library, a
warning is printed at install time.
By default, Microsoft's C runtime libraries are ignored when installing. The
`INCLUDE_REGEXES` and `EXCLUDE_REGEXES` arguments are lists of Python regular
expressions to either force-include or force-exclude from installation.
Inclusion overrides exclusion. The provided regular expressions are also
expected to match the full path of the library.
#]==]
function (_superbuild_windows_install_binary)
set(options
CLEAN)
set(values
DESTINATION
LIBDIR
LOCATION
BINARY
TYPE)
set(multivalues
INCLUDE_REGEXES
EXCLUDE_REGEXES
BINARY_LIBDIR
SEARCH_DIRECTORIES)
cmake_parse_arguments(_install_binary "${options}" "${values}" "${multivalues}" ${ARGN})
if (NOT _install_binary_BINARY)
message(FATAL_ERROR "Cannot install a binary without a path.")
endif ()
if (NOT IS_ABSOLUTE "${_install_binary_BINARY}")
message(FATAL_ERROR "Cannot install a binary without an absolute path (${_install_binary_BINARY}).")
endif ()
if (NOT _install_binary_DESTINATION)
set(_install_binary_DESTINATION
"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}")
endif ()
if (NOT _install_binary_LIBDIR)
message(FATAL_ERROR "Cannot install ${_install_binary_BINARY} without knowing where to put dependent libraries.")
endif ()
if (NOT _install_binary_TYPE)
message(FATAL_ERROR "Cannot install ${_install_binary_BINARY} without knowing its type.")
endif ()
if (_install_binary_TYPE STREQUAL "module" AND NOT _install_binary_LOCATION)
message(FATAL_ERROR "Cannot install ${_install_binary_BINARY} as a module without knowing where to place it.")
endif ()
if (NOT _install_binary_BINARY_LIBDIR)
list(APPEND _install_binary_BINARY_LIBDIR "bin")
endif()
set(fixup_bundle_arguments)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --destination ${_install_binary_DESTINATION}")
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --type ${_install_binary_TYPE}")
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --libdir ${_install_binary_LIBDIR}")
get_property(superbuild_has_cleaned GLOBAL PROPERTY
superbuild_has_cleaned)
if (_install_binary_CLEAN OR NOT superbuild_has_cleaned)
set_property(GLOBAL PROPERTY
superbuild_has_cleaned TRUE)
if (superbuild_is_install_target)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --new")
else ()
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --clean --new")
endif ()
endif ()
if (_install_binary_LOCATION)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --location \"${_install_binary_LOCATION}\"")
endif ()
foreach (include_regex IN LISTS _install_binary_INCLUDE_REGEXES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --include \"${include_regex}\"")
endforeach ()
foreach (exclude_regex IN LISTS _install_binary_EXCLUDE_REGEXES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --exclude \"${exclude_regex}\"")
endforeach ()
foreach(binary_libdir IN LISTS _install_binary_BINARY_LIBDIR)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --binary-libdir \"${binary_libdir}\"")
endforeach()
foreach (search_directory IN LISTS _install_binary_SEARCH_DIRECTORIES)
set(fixup_bundle_arguments
"${fixup_bundle_arguments} --search \"${search_directory}\"")
endforeach ()
install(CODE
"execute_process(
COMMAND \"${superbuild_python_executable}\"
\"${_superbuild_install_cmake_dir}/scripts/fixup_bundle.windows.py\"
${fixup_bundle_arguments}
--manifest \"${CMAKE_BINARY_DIR}/install.manifest\"
\"${_install_binary_BINARY}\"
RESULT_VARIABLE res
ERROR_VARIABLE err)
if (res)
message(FATAL_ERROR \"Failed to install ${name}:\n\${err}\")
endif ()"
COMPONENT superbuild)
endfunction ()
# A convenience function for installing an executable.
function (_superbuild_windows_install_executable path libdir)
_superbuild_windows_install_binary(
BINARY "${path}"
LIBDIR "${libdir}"
TYPE executable
${ARGN})
endfunction ()
# A convenience function for installing a module.
function (_superbuild_windows_install_module path subdir libdir)
_superbuild_windows_install_binary(
BINARY "${path}"
LOCATION "${subdir}"
LIBDIR "${libdir}"
TYPE module
${ARGN})
endfunction ()
#[==[.md
### Executables
Non-forwarding executables are binaries that may not work in the package
without the proper rpaths or `LD_LIBRARY_PATH` set when running the executable.
```
superbuild_windows_install_program(<NAME> <LIBDIR>)
```
Installs a program at `NAME` into `bin/` and its dependent libraries into
`LIBDIR` under the install destination. The program is assumed to be in the
installation prefix as `bin/<NAME>.exe`.
The following arguments are set by calling this function:
- `BINARY`
- `LIBDIR`
- `TYPE` (`executable`)
#]==]
function (superbuild_windows_install_program name libdir)
_superbuild_windows_install_executable("${superbuild_install_location}/bin/${name}.exe" "${libdir}" ${ARGN})
endfunction ()
#[==[.md
### Plugins
Plugins include libraries that are meant to be loaded at runtime. It also
includes libraries that are linked to, but need to be installed separately.
```
superbuild_windows_install_plugin(<FILENAME> <LIBDIR> <SEARCH PATHS> [<ARG>...])
```
Installs a library named `FILENAME` into `bin/` and its dependent libraries
into `LIBDIR` under the install destination. The given filename is searched for
under each path in the `SEARCH PATHS` argument.
Note that `SEARCH PATHS` is a CMake list passed as a single argument.
The following arguments are set by calling this function:
- `BINARY`
- `LIBDIR`
- `LOCATION`
- `TYPE` (`module`)
#]==]
function (superbuild_windows_install_plugin name libdir paths)
if (IS_ABSOLUTE "${name}")
_superbuild_windows_install_module("${name}" "${paths}" "${libdir}" ${ARGN})
return ()
endif ()
set(found FALSE)
foreach (path IN LISTS paths)
if (EXISTS "${superbuild_install_location}/${path}/${name}")
_superbuild_windows_install_module("${superbuild_install_location}/${path}/${name}" "${path}" "${libdir}" ${ARGN})
set(found TRUE)
break ()
endif ()
endforeach ()
if (NOT found)
string(REPLACE ";" ", " paths_list "${paths}")
message(FATAL_ERROR "Unable to find the ${name} plugin in ${paths_list}")
endif ()
endfunction ()
#[==[.md
### Python packages
The superbuild also provides functions to install Python modules and packages.
```
superbuild_windows_install_python(
MODULES <module>...
MODULE_DIRECTORIES <module-path>...
[MODULE_DESTINATION <destination>]
[INCLUDE_REGEXES <include-regex>...]
[EXCLUDE_REGEXES <exclude-regex>...]
[SEARCH_DIRECTORIES <library-path>...])
```
The list of modules to installed is given to the `MODULES` argument. These
modules (or packages) are searched for at install time in the paths given to
the `MODULE_DIRECTORIES` argument.
Modules are placed in the `MODULE_DESTINATION` under the expected Python module
paths in the package (`bin/Lib`). By default, `/site-packages` is used.
The `INCLUDE_REGEXES`, `EXCLUDE_REGEXES`, and `SEARCH_DIRECTORIES` used when
installing compiled Python modules through `superbuild_windows_install_plugin`.
Note that modules in the list which cannot be found are ignored.
#]==]
function (superbuild_windows_install_python)
set(values
MODULE_DESTINATION)
set(multivalues
INCLUDE_REGEXES
EXCLUDE_REGEXES
SEARCH_DIRECTORIES
MODULE_DIRECTORIES
MODULES)
cmake_parse_arguments(_install_python "${options}" "${values}" "${multivalues}" ${ARGN})
if (NOT _install_python_MODULES)
message(FATAL_ERROR "No modules specified.")
endif ()
if (NOT _install_python_MODULE_DIRECTORIES)
message(FATAL_ERROR "No modules search paths specified.")
endif ()
set(fixup_bundle_arguments)
if (NOT _install_python_MODULE_DESTINATION)
set(_install_python_MODULE_DESTINATION "/site-packages")
endif ()
foreach (include_regex IN LISTS _install_python_INCLUDE_REGEXES)
list(APPEND fixup_bundle_arguments
--include "${include_regex}")
endforeach ()
foreach (exclude_regex IN LISTS _install_python_EXCLUDE_REGEXES)
list(APPEND fixup_bundle_arguments
--exclude "${exclude_regex}")
endforeach ()
foreach (search_directory IN LISTS _install_python_SEARCH_DIRECTORIES)
list(APPEND fixup_bundle_arguments
--search "${search_directory}")
endforeach ()
install(CODE
"set(superbuild_python_executable \"${superbuild_python_executable}\")
include(\"${_superbuild_install_cmake_dir}/scripts/fixup_python.windows.cmake\")
set(python_modules \"${_install_python_MODULES}\")
set(module_directories \"${_install_python_MODULE_DIRECTORIES}\")
set(fixup_bundle_arguments \"${fixup_bundle_arguments}\")
set(bundle_destination \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")
set(bundle_manifest \"${CMAKE_BINARY_DIR}/install.manifest\")
foreach (python_module IN LISTS python_modules)
superbuild_windows_install_python_module(\"\${CMAKE_INSTALL_PREFIX}\"
\"\${python_module}\" \"\${module_directories}\" \"bin/Lib${_install_python_MODULE_DESTINATION}\")
endforeach ()"
COMPONENT superbuild)
endfunction ()
This diff is collapsed.
......@@ -413,7 +413,7 @@ function (superbuild_apply_patch _name _patch _comment)
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_VARIABLE err
WORKING_DIRECTORY "${CMAKE_BINARY_DIRECTORY}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (res AND NOT res EQUAL 128)
message(FATAL_ERROR "Failed to determine if the build tree is inside of a git repository.")
......@@ -426,7 +426,7 @@ function (superbuild_apply_patch _name _patch _comment)
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_VARIABLE err
WORKING_DIRECTORY "${CMAKE_BINARY_DIRECTORY}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (res)
message(WARNING
......@@ -1214,7 +1214,7 @@ endfunction ()
# Currently "valid" means alphanumeric with a non-numeric prefix.
function (_superbuild_project_check_name name)
if (NOT name MATCHES "^[a-zA-Z][a-zA-Z0-9]*$")
message(FATAL_ERROR "Invalid project name: ${_name}. "
message(FATAL_ERROR "Invalid project name: ${name}. "
"Only alphanumerics are allowed.")
endif ()
endfunction ()
......
......@@ -81,6 +81,20 @@ function (_superbuild_detect_version_git var source_dir default version_file)
set(minor "${CMAKE_MATCH_2}")
set(patch "${CMAKE_MATCH_3}")
set(patch_extra "${CMAKE_MATCH_4}")
elseif (output MATCHES "([0-9]+)\\.([0-9]+)-?(.*)")
message(STATUS "Determined source version for ${project}: ${CMAKE_MATCH_0}")
set(full "${CMAKE_MATCH_0}")
set(major "${CMAKE_MATCH_1}")
set(minor "${CMAKE_MATCH_2}")
set(patch "")
set(patch_extra "${CMAKE_MATCH_3}")
elseif (output MATCHES "([0-9]+)-?(.*)")
message(STATUS "Determined source version for ${project}: ${CMAKE_MATCH_0}")
set(full "${CMAKE_MATCH_0}")
set(major "${CMAKE_MATCH_1}")
set(minor "")
set(patch "")
set(patch_extra "${CMAKE_MATCH_2}")
else ()
message(FATAL_ERROR
"Failed to determine the version for ${var}; got ${output}")
......
......@@ -538,15 +538,15 @@ class Framework(Library):
return '@loader_path/..' # FIXME: ???
def copy_library(destination, library, dry_run=False):
def copy_library(destination, library, dry_run=False, library_dest='Libraries', framework_dest='Frameworks'):
'''Copy a library into the ``.app`` bundle.'''
if library.is_framework:
# Frameworks go into Contents/Frameworks.
print 'Copying %s/%s ==> Contents/Frameworks' % (library.framework_path, library.framework_name)
# Frameworks go into Contents/<framework_dest>.
print 'Copying %s/%s ==> Contents/%s' % (library.framework_path, library.framework_name, framework_dest)
app_dest = os.path.join(destination, 'Contents', 'Frameworks')
app_dest = os.path.join(destination, 'Contents', framework_dest)
binary = os.path.join(app_dest, library.framework_name, library.framework_library)
library.set_installed_id(os.path.join('@executable_path', '..', 'Frameworks', library.framework_name, library.framework_library))
library.set_installed_id(os.path.join('@executable_path', '..', framework_dest, library.framework_name, library.framework_library))
destination = os.path.join(app_dest, library.framework_name)
if not dry_run:
......@@ -557,14 +557,14 @@ def copy_library(destination, library, dry_run=False):
_os_makedirs(app_dest)
shutil.copytree(os.path.join(library.framework_path, library.framework_name), destination, symlinks=True)
else:
# Libraries go into Contents/Libraries.
print 'Copying %s ==> Contents/Libraries' % library.path
# Libraries go into Contents/<library_dest>.
print 'Copying %s ==> Contents/%s' % (library.path, library_dest)
app_dest = os.path.join(destination, 'Contents', 'Libraries')
app_dest = os.path.join(destination, 'Contents', library_dest)
binary = os.path.join(app_dest, library.name)
# FIXME(plugins, frameworks): fix the installed id of the library based
# on what drags it in.
library.set_installed_id(os.path.join('@executable_path', '..', 'Libraries', library.name))
library.set_installed_id(os.path.join('@executable_path', '..', library_dest, library.name))
destination = app_dest
if not dry_run:
......@@ -573,7 +573,7 @@ def copy_library(destination, library, dry_run=False):
# Create any symlinks we found for the library as well.
for symlink in library.symlinks:
print 'Creating symlink to Contents/Libraries/%s ==> %s' % (library.name, symlink)
print 'Creating symlink to Contents/%s/%s ==> %s' % (library_dest, library.name, symlink)
if not dry_run:
symlink_path = os.path.join(app_dest, symlink)
if os.path.exists(symlink_path):
......@@ -586,22 +586,6 @@ def copy_library(destination, library, dry_run=False):
])
ln()
if not dry_run:
# We need to make the library writable first.
chmod = Pipeline([
'chmod',
'u+w',
binary,
])
chmod()
# Set the ID on the binary.
install_name_tool = Pipeline([
'install_name_tool',
'-id', library.installed_id,
binary,
])
install_name_tool()
return binary
......@@ -632,6 +616,9 @@ def _arg_parser():
parser.add_argument('-p', '--plugin', metavar='PATH', action='append',
default=[], dest='plugins',
help='list of plugins to install with an executable')
parser.add_argument('--library', metavar='PATH', action='append',
default=[], dest='libraries',
help='list of additional libraries to install with an executable')
parser.add_argument('-s', '--search', metavar='PATH', action='append',
default=[],
help='add a directory to search for dependent libraries')
......@@ -648,6 +635,12 @@ def _arg_parser():
parser.add_argument('-t', '--type', metavar='TYPE', type=str, required=True,
choices=('executable', 'utility', 'plugin', 'module'),
help='the type of binary to package')
parser.add_argument('-L', '--library-dest', metavar='PATH', type=str,
default='Libraries',
help='where to place libraries in the bundle')
parser.add_argument('-F', '--framework-dest', metavar='PATH', type=str,
default='Frameworks',
help='where to place frameworks in the bundle')
# This flag is here so that plugins which are built for one application can
# bring in the required libraries for another application which doesn't
# have a superset of the libraries required by the plugin provided by its
......@@ -660,7 +653,7 @@ def _arg_parser():
return parser
def _install_binary(binary, is_excluded, bundle_dest, installed, manifest, dry_run=False):
def _install_binary(binary, is_excluded, bundle_dest, installed, manifest, dry_run=False, library_dest='Libraries', framework_dest='Frameworks'):
'''Install the main binary into the package.'''
# Start looking at our main executable's dependencies.
deps = binary.dependencies.values()
......@@ -683,7 +676,7 @@ def _install_binary(binary, is_excluded, bundle_dest, installed, manifest, dry_r
# Add this dependency's dependencies to the pile.
deps.extend(dep.dependencies.values())
# Remember what we installed and where.
installed[dep.path] = (dep, copy_library(bundle_dest, dep, dry_run=dry_run))
installed[dep.path] = (dep, copy_library(bundle_dest, dep, dry_run=dry_run, library_dest=library_dest, framework_dest=framework_dest))
# Install the main executable itself.
app_dest = os.path.join(bundle_dest, binary.bundle_location)
......@@ -706,6 +699,22 @@ def _fix_installed_binaries(installed, dry_run=False):
binary, installed_path = binary_info
print 'Fixing binary references in %s' % binary.path
if not dry_run and binary.installed_id:
# We need to make the library writable first.
chmod = Pipeline([
'chmod',
'u+w',
installed_path,
])
chmod()
# Set the ID on the binary.
install_name_tool = Pipeline([
'install_name_tool',
'-id', os.path.join(binary.installed_id, os.path.basename(installed_path)),
installed_path,
])
install_name_tool()
changes = []
for old_name, library in binary.dependencies.items():
if library.installed_id is not None and \
......@@ -798,11 +807,16 @@ def main(args):
Library.from_manifest(path, installed_id)
installed = {}
_install_binary(main_exe, is_excluded, bundle_dest, installed, manifest, dry_run=opts.dry_run)
_install_binary(main_exe, is_excluded, bundle_dest, installed, manifest, dry_run=opts.dry_run, library_dest=opts.library_dest, framework_dest=opts.framework_dest)
for plugin in opts.plugins:
plugin_bin = Plugin(plugin, fake_exe_path=opts.fake_plugin_paths, search_paths=opts.search)
_install_binary(plugin_bin, is_excluded, bundle_dest, installed, manifest, dry_run=opts.dry_run)
_install_binary(plugin_bin, is_excluded, bundle_dest, installed, manifest, dry_run=opts.dry_run, library_dest=opts.library_dest, framework_dest=opts.framework_dest)
for library in opts.libraries:
library_bin = Module(library, 'Contents/Libraries', search_paths=opts.search)
_install_binary(library_bin, is_excluded, bundle_dest, installed, manifest, dry_run=opts.dry_run)
library_bin.set_installed_id('@executable_path/../Libraries')
_fix_installed_binaries(installed, dry_run=opts.dry_run)
......
......@@ -14,6 +14,5 @@ superbuild_add_extra_cmake_args(
-DHDF5_ROOT:PATH=<INSTALL_DIR>
-DHDF5_NO_FIND_PACKAGE_CONFIG_FILE:BOOL=ON)
# HDF5 on Windows installs a zlib that gets found this way; avoid using it.
superbuild_apply_patch(hdf5 no-zlib-config
"Do not use a system zlib-config.cmake file")
superbuild_apply_patch(hdf5 fix-ext-pkg-find
"Force proper logic for zlib and szip dependencies")
......@@ -9,15 +9,11 @@ superbuild_add_project(netcdf
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DNC_FIND_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DBUILD_TESTING:BOOL=OFF
-DCMAKE_INSTALL_NAME_DIR:PATH=<INSTALL_DIR>/lib
-DENABLE_TESTS:BOOL=OFF
-DBUILD_UTILITIES:BOOL=OFF
-DUSE_SZIP:BOOL=OFF
-DENABLE_DAP:BOOL=OFF
${netcdf_libdir})
superbuild_apply_patch(netcdf vtk-tag
"Add #define to mark API as VTK-modified")
superbuild_apply_patch(netcdf find-hdf5-hl
"Fix use of old, undocumented FindHDF5 variable")
diff -u -U5 -r hdf5-1.10.3/CMakeFilters.cmake hdf5-1.10.3.fix-ext-pkg-find/CMakeFilters.cmake
--- hdf5-1.10.3/CMakeFilters.cmake 2018-08-09 17:36:31.000000000 -0400
+++ hdf5-1.10.3.fix-ext-pkg-find/CMakeFilters.cmake 2019-03-15 11:53:03.238932850 -0400
@@ -39,13 +39,13 @@
#-----------------------------------------------------------------------------
option (HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF)
if (HDF5_ENABLE_Z_LIB_SUPPORT)
if (NOT H5_ZLIB_HEADER)
if (NOT ZLIB_USE_EXTERNAL)
- find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
+ #find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
if (NOT ZLIB_FOUND)
- find_package (ZLIB) # Legacy find
+ find_package (ZLIB MODULE) # Legacy find
if (ZLIB_FOUND)
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES})
set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES})
endif ()
endif ()
@@ -90,16 +90,21 @@
#-----------------------------------------------------------------------------
option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF)
if (HDF5_ENABLE_SZIP_SUPPORT)
option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF)
if (NOT SZIP_USE_EXTERNAL)
- find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
+ #find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
if (NOT SZIP_FOUND)
- find_package (SZIP) # Legacy find
+ if (WIN32)
+ find_package (SZIP CONFIG) # Legacy find
+ else ()
+ find_package (SZIP) # Legacy find
+ endif ()
if (SZIP_FOUND)
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_LIBRARIES})
+ set (SZIP_INCLUDE_DIR ${SZIP_INCLUDE_DIRS})
endif ()
endif ()
endif ()
if (SZIP_FOUND)
set (H5_HAVE_FILTER_SZIP 1)
diff -Nru5 hdf5-1.8.13/CMakeFilters.cmake hdf5-1.8.13.no-zlib-config/CMakeFilters.cmake
--- hdf5-1.8.13/CMakeFilters.cmake 2014-05-05 22:13:24.000000000 -0400
+++ hdf5-1.8.13.no-zlib-config/CMakeFilters.cmake 2016-12-13 17:53:24.386066384 -0500
@@ -41,13 +41,13 @@
#-----------------------------------------------------------------------------
option (HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF)
if (HDF5_ENABLE_Z_LIB_SUPPORT)
if (NOT H5_ZLIB_HEADER)
if (NOT ZLIB_USE_EXTERNAL)
- FIND_PACKAGE (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT})
+ #FIND_PACKAGE (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT})
if (NOT ZLIB_FOUND)
- FIND_PACKAGE (ZLIB) # Legacy find
+ FIND_PACKAGE (ZLIB MODULE) # Legacy find
endif (NOT ZLIB_FOUND)
endif (NOT ZLIB_USE_EXTERNAL)
if (ZLIB_FOUND)
set (H5_HAVE_FILTER_DEFLATE 1)
set (H5_HAVE_ZLIB_H 1)
diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt
index 6603bd0..fcd616a 100644
--- a/liblib/CMakeLists.txt
+++ b/liblib/CMakeLists.txt
@@ -57,6 +57,9 @@ IF(USE_HDF5 OR USE_NETCDF4)
IF(HDF5_hdf5_hl_LIBRARY AND NOT HDF5_HL_LIBRARY)
SET(HDF5_HL_LIBRARY ${HDF5_hdf5_hl_LIBRARY})
ENDIF()
+ IF(HDF5_C_HL_LIBRARIES AND NOT HDF5_HL_LIBRARY)
+ SET(HDF5_HL_LIBRARY ${HDF5_C_HL_LIBRARIES})
+ ENDIF()
SET(TLL_LIBS ${HDF5_C_LIBRARY} ${HDF5_HL_LIBRARY} ${TLL_LIBS} ${SZIP_LIBRARY})
ELSE() # Windows CMake defines HDF5_LIBRARIES.
SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY})
diff --git a/cxx/netcdfcpp.h b/cxx/netcdfcpp.h
index f3e9f19..0db228d 100644
--- a/cxx/netcdfcpp.h
+++ b/cxx/netcdfcpp.h
@@ -10,6 +10,12 @@
#ifndef NETCDF_HH
#define NETCDF_HH
+// We've changed the API from upstream in VTK commits 6223f230 and
+// 64cb89e3 to use size_t* instead of long* for (some) overloads of
+// methods like NcVar::get. This define signals users of this header
+// that they should use size_t for these methods.
+#define VTK_NETCDF_USE_SIZE_T
+
#include "ncvalues.h" // arrays that know their element type
typedef const char* NcToken; // names for netCDF objects
......@@ -4,7 +4,11 @@ else ()
set(python_shared_args --disable-shared --enable-static)
endif ()
set(python_USE_UNICODE "UCS2" CACHE STRING "Enable Unicode support for python")