Commit 32b51223 authored by Chris Cantwell's avatar Chris Cantwell

Merge branch 'docker/external-build' into 'master'

Fix CMake install prefix, add external build example

Closes #185

See merge request !1092
parents 4c9e7b95 4b3a17ef
Pipeline #1190 passed with stages
in 9 minutes and 7 seconds
# Files to ignore for export
.gitlab-ci.yml export-ignore
.gitignore export-ignore
.gitattributes export-ignore
.gitmodules export-ignore
......
stages:
- docker-build-env
- docker-build-image
- docker-build-dev
- docker-test-image
- docker-cleanup-image
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
.docker_build_template: &docker_build_template
image: docker:stable
......@@ -13,6 +10,8 @@ before_script:
only:
- master
- /^docker\/.*$/
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker pull ${image_name} || true
- DOCKER_BUILDKIT=1 docker build -t ${image_name} -f ${dockerfile} .
......@@ -22,54 +21,55 @@ before_script:
- docker push ${image_name}:latest
.docker-test-template: &docker_test_template
image: docker:stable
image: ${image_name}
stage: docker-test-image
only:
- master
- /^docker\/.*$/
script:
- docker pull ${image_name} || true
- docker create --name ${container_name}-$CI_COMMIT_SHORT_SHA -t ${image_name}:latest
- docker cp $(pwd)/${test_dir} ${container_name}-$CI_COMMIT_SHORT_SHA:/docker-entrypoint
- docker start ${container_name}-$CI_COMMIT_SHORT_SHA
- docker exec ${container_name}-$CI_COMMIT_SHORT_SHA ${test_cmd}
- docker rm -f ${container_name}-$CI_COMMIT_SHORT_SHA
docker-build-env:
<<: *docker_build_template
stage: docker-build-env
variables:
image_name: nektarpp/nektar-env
dockerfile: pkg/docker/nektar-env/Dockerfile
dockerfile: docker/nektar-env/Dockerfile
only:
refs:
- master
- /^docker\/.*$/
changes:
- pkg/docker/nektar-env/Dockerfile
- docker/nektar-env/Dockerfile
docker-build-nektar:
<<: *docker_build_template
variables:
image_name: nektarpp/nektar
dockerfile: pkg/docker/nektar/Dockerfile
dockerfile: docker/nektar/Dockerfile
docker-build-workbook:
<<: *docker_build_template
variables:
image_name: nektarpp/nektar-workbook
dockerfile: pkg/docker/nektar-workbook/Dockerfile
dockerfile: docker/nektar-workbook/Dockerfile
docker-build-dev:
<<: *docker_build_template
stage: docker-build-dev
variables:
image_name: nektarpp/nektar-dev
dockerfile: docker/nektar-dev/Dockerfile
docker-test-nektar:
<<: *docker_test_template
variables:
image_name: nektarpp/nektar
container_name: nektar
test_dir: solvers/IncNavierStokesSolver/Tests
test_cmd: mpirun -n 3 IncNavierStokesSolver data/ChanFlow_m3_par.xml
script:
- mpirun -n 3 IncNavierStokesSolver $CI_PROJECT_DIR/solvers/IncNavierStokesSolver/Tests/ChanFlow_m3_par.xml
docker-cleanup-nektar:
stage: docker-cleanup-image
when: on_failure
docker-test-nektar-dev:
<<: *docker_test_template
variables:
image_name: nektarpp/nektar-dev
script:
- docker rm -f nektar-$CI_COMMIT_SHORT_SHA
- cd $CI_PROJECT_DIR/templates/executable
- ./test.sh /usr/local/lib64/nektar++/cmake 3
......@@ -214,7 +214,8 @@ v5.0.0
- Extend to support MPI tests with multiple executables (!1085)
**Packaging:**
- Add Dockerfiles and gitlab CI configuration for automatic builds (!1021)
- Add Dockerfiles and gitlab CI configuration for automatic builds (!1021,
!1092)
v4.4.2
------
......
......@@ -162,8 +162,6 @@ OPTION(NEKTAR_BUILD_UNIT_TESTS "Build unit tests." ON)
OPTION(NEKTAR_BUILD_TESTS "Build regression tests." ON)
OPTION(NEKTAR_BUILD_TIMINGS "Build benchmark timing codes." OFF)
OPTION(NEKTAR_BUILD_PYTHON "Build Nektar++ Python bindings" OFF)
OPTION(NEKTAR_BUILD_PACKAGES "Build Nektar++ binary packages" OFF)
MARK_AS_ADVANCED(NEKTAR_BUILD_PACKAGES)
OPTION(NEKTAR_TEST_ALL "Include full set of regression tests to this build." OFF)
OPTION(NEKTAR_TEST_USE_HOSTFILE "Use a hostfile to explicitly specify number of
......@@ -343,7 +341,3 @@ INSTALL(DIRECTORY ${TPDIST}/include/
)
ADD_SUBDIRECTORY(docs)
IF(NEKTAR_BUILD_PACKAGES)
ADD_SUBDIRECTORY(pkg)
ENDIF(NEKTAR_BUILD_PACKAGES)
This diff is collapsed.
......@@ -113,7 +113,7 @@ IF( NEKTAR_USE_HDF5 )
ENDIF( NEKTAR_USE_HDF5 )
# find and add Nektar++ libraries
INCLUDE(${NEKTAR++_LIBRARY_DIRS}/cmake/Nektar++Libraries.cmake)
INCLUDE(@CMAKE_INSTALL_PREFIX@/@NEKTAR_CMAKE_DIR@/Nektar++Libraries.cmake)
# platform dependent options
IF(${CMAKE_SYSTEM} MATCHES "Linux.*")
......
# Packaging
SET(NEKTAR_PACKAGE_GENERATOR "None" CACHE STRING
"Support Packaging: RPM or DEB" )
MARK_AS_ADVANCED(NEKTAR_PACKAGE_GENERATOR)
# Define components
SET(CPACK_COMPONENTS_ALL dev lib demos extra-demos)
#SET(CPACK_RPM_PACKAGE_DEBUG ON)
SET(CPACK_COMPONENT_LIB_NAME "nektar++-lib")
SET(CPACK_COMPONENT_LIB_DISPLAY_NAME "nektar++-lib")
SET(CPACK_COMPONENT_LIB_DESCRIPTION "Nektar++ Libraries")
SET(CPACK_COMPONENT_DEV_NAME "nektar++-dev")
SET(CPACK_COMPONENT_DEV_DISPLAY_NAME "nektar++-dev")
SET(CPACK_COMPONENT_DEV_DESCRIPTION "Development files for Nektar++")
SET(CPACK_COMPONENT_DEV_DEPENDS lib)
SET(CPACK_COMPONENT_DEMOS_NAME "nektar++-demos")
SET(CPACK_COMPONENT_DEMOS_DISPLAY_NAME "nektar++-demos")
SET(CPACK_COMPONENT_DEMOS_DESCRIPTION "Framework demonstration binaries")
SET(CPACK_COMPONENT_DEMOS_DEPENDS lib)
SET(CPACK_COMPONENT_EXTRA-DEMOS_NAME "nektar++-extra-demos")
SET(CPACK_COMPONENT_EXTRA-DEMOS_DISPLAY_NAME "nektar++-extra-demos")
SET(CPACK_COMPONENT_EXTRA-DEMOS_DESCRIPTION
"Framework extra demonstration binaries")
SET(CPACK_COMPONENT_EXTRA-DEMOS_DEPENDS lib)
# CPack setup
IF (NOT ${NEKTAR_PACKAGE_GENERATOR} MATCHES "None")
# Check if we have a valid Package generator selected
IF (NOT ${NEKTAR_PACKAGE_GENERATOR} MATCHES "RPM"
AND NOT ${NEKTAR_PACKAGE_GENERATOR} MATCHES "DEB")
MESSAGE(SEND_ERROR "Unknown packaging generator:
${NEKTAR_PACKAGE_GENERATOR}")
ENDIF()
SET(CPACK_GENERATOR "${NEKTAR_PACKAGE_GENERATOR}")
SET(CPACK_TOPLEVEL_TAG "${CMAKE_SYSTEM_PROCESSOR}")
SET(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_PROCESSOR}")
SET(CPACK_PACKAGE_NAME "nektar++")
SET(CPACK_PACKAGE_VENDOR "Imperial College London")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"Spectral/hp Element Framework for solving PDEs")
SET(CPACK_PACKAGE_DESCRIPTION "
The nektar++ packages provide a spectral/hp element framework for the numerical
solution of partial differential equations (PDEs). Demonstration codes are
provided in the nektar++-demos package, along with a number of time-dependent
solvers in the nektar++-solvers package.")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "nektar++")
SET(CPACK_PACKAGE_CONTACT "Chris Cantwell <c.cantwell@imperial.ac.uk>")
SET(CPACK_PACKAGE_VERSION ${NEKTAR_VERSION})
SET(CPACK_PACKAGE_VERSION_MAJOR ${NEKTAR_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${NEKTAR_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${NEKTAR_VERSION_PATCH})
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
# RPM packaging
IF (${NEKTAR_PACKAGE_GENERATOR} MATCHES "RPM")
MESSAGE(STATUS "Generating Packaging for RPM")
SET(CPACK_RPM_PACKAGE_URL "www.nektar.info")
SET(CPACK_RPM_COMPONENT_INSTALL ON)
SET(CPACK_RPM_PACKAGE_REQUIRES "fftw3, libboost_date_time1_44_0, libboost_filesystem1_44_0, libboost_iostreams1_44_0, libboost_system1_44_0, libboost_thread1_44_0, libboost_timer1_44_0, zlib")
SET(CPACK_RPM_PACKAGE_DESCRIPTION "
The nektar++ packages provide a spectral/hp element framework for the numerical
solution of partial differential equations (PDEs). Demonstration codes are
provided in the nektar++-demos package, along with a number of time-dependent
solvers in the nektar++-solvers package.")
ENDIF()
IF (${NEKTAR_PACKAGE_GENERATOR} MATCHES "DEB")
MESSAGE(STATUS "Generating Packaging for DEB")
SET(CPACK_DEB_PACKAGE_URL "www.nektar.info")
SET(CPACK_DEB_COMPONENT_INSTALL ON)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libfftw3-3,libboost-date-time1.42.0,libboost-filesystem1.42.0,libboost-iostreams1.42.0,libboost-program-options1.42.0,libboost-system1.42.0,libboost-thread1.42.0,libboost-timer1.42.0,zlib1g")
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION
"${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
${CPACK_PACKAGE_DESCRIPTION}")
SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
ENDIF()
# Finally, include the CPack module
INCLUDE(CPack)
ENDIF()
FROM nektarpp/nektar-env:latest AS build
LABEL maintainer="David Moxey <d.moxey@exeter.ac.uk>"
ARG INSTALL_PREFIX=/usr/local
USER root
COPY --from=nektarpp/nektar:latest ${INSTALL_PREFIX} ${INSTALL_PREFIX}
# Set up entrypoint for copying test files.
COPY docker/nektar/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
ln -s /usr/local/bin/docker-entrypoint.sh /
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
USER nektar
WORKDIR /home/nektar
CMD ["/bin/bash"]
# `nektar-dev` image
This image provides a full installation of Nektar++, based on the `nektar`
image, but includes the full set of development headers from the `nektar-env`
image for code development purposes.
## Building
The image is built using `nektarpp/nektar-env` and requires as build context the
path to the Nektar++ source tree. It supports the build environment variable:
- `INSTALL_PREFIX` can be set to adjust the install prefix, which is
`/usr/local` by default.
Then build the image using a command similar to:
```sh
docker build -t nektarpp/nektar-dev -f ~/nektar++/docker/nektar-dev/Dockerfile ~/nektar++
```
......@@ -46,7 +46,7 @@ ARG INSTALL_PREFIX=/usr/local
COPY --from=build ${INSTALL_PREFIX} ${INSTALL_PREFIX}
# Set up entrypoint for copying test files.
COPY pkg/docker/nektar/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
COPY docker/nektar/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
ln -s /usr/local/bin/docker-entrypoint.sh /
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
......
#!/bin/bash
set -e
if [ -d /docker-entrypoint ]; then
mkdir -p $HOME/data
cp -r /docker-entrypoint/* $HOME/data
fi
exec "$@"
function (write_lib_files PKG_INSTALL_LIBS OUTPUT_FILE)
# Find library file and add the versioned form of each library
set(PKG_INSTALL_LIBS_FILES)
foreach(l ${PKG_INSTALL_LIBS})
IF(${CMAKE_MAJOR_VERSION} LESS 3)
get_target_property(TARGET_LOCATION ${l} LOCATION)
ELSE ()
SET(TARGET_LOCATION $<TARGET_LINKER_FILE:${l}>)
ENDIF()
if (NOT TARGET_LOCATION)
message(FATAL_ERROR "Target '${l}' could not be found.")
endif ()
list(APPEND PKG_INSTALL_LIBS_FILES ${TARGET_LOCATION})
if (APPLE)
list(APPEND PKG_INSTALL_LIBS_FILES $<TARGET_FILE:${l}>)
else ()
list(APPEND PKG_INSTALL_LIBS_FILES
${TARGET_LOCATION}.${NEKTAR_VERSION})
endif()
endforeach()
# Output the list of files to be installed in the package
IF(${CMAKE_MAJOR_VERSION} LESS 3)
file(WRITE "${OUTPUT_FILE}" "${PKG_INSTALL_LIBS_FILES}")
ELSE ()
file(GENERATE OUTPUT "${OUTPUT_FILE}"
CONTENT "${PKG_INSTALL_LIBS_FILES}")
ENDIF ()
endfunction ()
function (write_bin_files PKG_INSTALL_BINS OUTPUT_FILE)
# Find binary files
set(PKG_INSTALL_BINS_FILES)
foreach(b ${PKG_INSTALL_BINS})
IF(EXISTS ${b})
get_filename_component(TARGET_LOCATION ${b} REALPATH)
ELSEIF(${CMAKE_MAJOR_VERSION} LESS 3)
get_target_property(TARGET_LOCATION ${b} LOCATION)
ELSE ()
SET(TARGET_LOCATION $<TARGET_FILE:${b}>)
ENDIF ()
if (NOT TARGET_LOCATION)
message(FATAL_ERROR "Target '${b}' could not be found.")
endif ()
list(APPEND PKG_INSTALL_BINS_FILES ${TARGET_LOCATION})
endforeach()
# Output the list of files to be installed in the package
IF(${CMAKE_MAJOR_VERSION} LESS 3)
file(WRITE "${OUTPUT_FILE}" "${PKG_INSTALL_BINS_FILES}")
ELSE ()
file(GENERATE OUTPUT "${OUTPUT_FILE}"
CONTENT "${PKG_INSTALL_BINS_FILES}")
ENDIF ()
endfunction ()
macro (add_nektar_package)
set(options "")
set(oneValueArgs NAME SUMMARY DESCRIPTION TYPE)
set(multiValueArgs INSTALL_LIBS INSTALL_BINS BREAKS CONFLICTS DEPENDS)
cmake_parse_arguments(PKG "${options}"
"${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PKG_NAME}-${PKG_TYPE})
file(MAKE_DIRECTORY "${BUILD_DIR}/targets")
write_lib_files("${PKG_INSTALL_LIBS}"
"${BUILD_DIR}/targets/install_libs.txt")
write_bin_files("${PKG_INSTALL_BINS}"
"${BUILD_DIR}/targets/install_bins.txt")
if(PKG_TYPE STREQUAL "deb")
set(PKG_GENERATOR "DEB")
elseif(PKG_TYPE STREQUAL "rpm")
set(PKG_GENERATOR "RPM")
elseif(PKG_TYPE STREQUAL "pkgmaker")
set(PKG_GENERATOR "PackageMaker")
elseif(PKG_TYPE STREQUAL "tgz")
set(PKG_GENERATOR "TGZ")
else()
message(ERROR "Unknown package type: ${PKG_TYPE}")
endif()
# Configure project for this package
configure_file(NektarPackage.cmake.in ${BUILD_DIR}/CMakeLists.txt @ONLY)
add_custom_target(
pkg-${PKG_TYPE}-${PKG_NAME}
rm -f ${BUILD_DIR}/CPackConfig.cmake
COMMAND ${CMAKE_COMMAND} .
COMMAND ${CMAKE_CPACK_COMMAND} --config CPackConfig.cmake -G ${PKG_GENERATOR}
WORKING_DIRECTORY ${BUILD_DIR}
)
if (PKG_INSTALL_LIBS OR PKG_INSTALL_BINS)
add_dependencies(pkg-${PKG_TYPE}-${PKG_NAME}
${PKG_INSTALL_LIBS} ${PKG_INSTALL_BINS})
endif ()
add_dependencies(pkg-${PKG_TYPE} pkg-${PKG_TYPE}-${PKG_NAME})
endmacro()
# Base packaging target
add_custom_target(pkg)
# Check if we can build DEB files
find_program(DPKG "dpkg")
mark_as_advanced(DPKG)
find_program(DPKGSHLIBDEPS "dpkg-shlibdeps")
mark_as_advanced(DPKGSHLIBDEPS)
if (DPKG)
if (NOT DPKGSHLIBDEPS)
MESSAGE(FATAL_ERROR "dpkg-shlibdeps program not found but is required.")
endif ()
add_custom_target(pkg-deb)
add_dependencies(pkg pkg-deb)
endif (DPKG)
# Check if we can build RPM files
find_program(RPMBUILD "rpmbuild")
mark_as_advanced(RPMBUILD)
if (RPMBUILD)
add_custom_target(pkg-rpm)
add_dependencies(pkg pkg-rpm)
endif (RPMBUILD)
# Check if we can build PackageMaker .pkg files. PackageMaker is technically
# deprecated but still works at least up to OS X 10.11. It could therefore live
# in a bunch of locations, so check common places.
find_program(PKGMAKER "PackageMaker"
PATHS /Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS
/Applications/Utilities/PackageMaker.app/Contents/MacOS
/Applications/PackageMaker.app/Contents/MacOS
/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS
/Developer/Applications/PackageMaker.app/Contents/MacOS)
if (PKGMAKER)
add_custom_target(pkg-pkgmaker)
add_dependencies(pkg pkg-pkgmaker)
endif()
# Binary archive target
add_custom_target(pkg-tgz)
add_dependencies(pkg pkg-tgz)
This diff is collapsed.
cmake_minimum_required(VERSION 2.6)
project("pkg-@PKG_NAME@")
# Files to go in the package
file(READ "targets/install_libs.txt" INSTALL_LIBS_FILES)
file(READ "targets/install_bins.txt" INSTALL_BINS_FILES)
# Put output in builds dir.
set(CPACK_OUTPUT_FILE_PREFIX "../..")
# Package details
set(CPACK_GENERATOR "@PKG_GENERATOR@")
set(CPACK_PACKAGE_NAME "@PKG_NAME@")
set(CPACK_PACKAGE_VENDOR "Imperial College London")
set(CPACK_PACKAGE_CONTACT
"Nektar++ users mailing list <nektar-users@imperial.ac.uk>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "@PKG_SUMMARY@")
set(CPACK_PACKAGE_DESCRIPTION "@PKG_DESCRIPTION@")
set(CPACK_RESOURCE_FILE_LICENSE "@CMAKE_SOURCE_DIR@/LICENSE.txt")
set(CPACK_PACKAGE_VERSION "@NEKTAR_VERSION@-@NEKTAR_PKG_VERSION@")
set(CPACK_PACKAGE_VERSION_MAJOR "@NEKTAR_VERSION_MAJOR@")
set(CPACK_PACKAGE_VERSION_MINOR "@NEKTAR_VERSION_MINOR@")
set(CPACK_PACKAGE_VERSION_PATCH "@NEKTAR_VERSION_PATCH@")
if(CPACK_GENERATOR STREQUAL "DEB")
# Debian packages
execute_process(COMMAND dpkg --print-architecture
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(ARCHITECTURE ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
set(CPACK_DEBIAN_PACKAGE_DEBUG ON)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER
"Chris Cantwell <c.cantwell@imperial.ac.uk>")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.nektar.info")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION
"@PKG_SUMMARY@@PKG_DESCRIPTION@")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "@PKG_DEPENDS@")
if (INSTALL_BINS_FILES OR INSTALL_LIBS_FILES)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
endif ()
elseif(CPACK_GENERATOR STREQUAL "RPM")
execute_process(COMMAND rpm --eval %{_arch}
OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(ARCHITECTURE ${CPACK_RPM_PACKAGE_ARCHITECTURE})
set(CPACK_RPM_PACKAGE_SUMMARY "@PKG_SUMMARY@")
set(CPACK_RPM_PACKAGE_DESCRIPTION "@PKG_DESCRIPTION@")
set(CPACK_RPM_PACKAGE_REQUIRES "@PKG_DEPENDS@")
set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
set(CPACK_RPM_PACKAGE_DEBUG 0)
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-1.${CPACK_RPM_PACKAGE_ARCHITECTURE}")
elseif(CPACK_GENERATOR STREQUAL "PackageMaker")
# OS X .pkg installer -- set install location
set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/nektar++")
set(CPACK_RESOURCE_FILE_WELCOME "@CMAKE_SOURCE_DIR@/pkg/osx-installer.html")
set(CPACK_POSTFLIGHT_SCRIPT "@CMAKE_SOURCE_DIR@/pkg/osx-postflight.sh")
# This is used as part of the identifier, so make it without spaces
set(CPACK_PACKAGE_VENDOR "imperialcollegelondon")
endif()
# Determine architecture if not detected by rpm/dpkg above
if(NOT DEFINED ARCHITECTURE)
execute_process(COMMAND uname -m
OUTPUT_VARIABLE ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# Override the output filename to comply with Debian naming policy
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${ARCHITECTURE}")
endif()
# Install any libraries in the lib directory: exclude OS X, we will copy/patch
# up libraries as we install executables.
if(INSTALL_LIBS_FILES AND NOT APPLE)
install(FILES ${INSTALL_LIBS_FILES} DESTINATION lib
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
endif()
# Install any binaries in the bin directory
if(INSTALL_BINS_FILES)
install(FILES ${INSTALL_BINS_FILES} DESTINATION bin
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
endif()
# This lovely block of code is designed to patch up our executables ready for OS
# X deployment. The strategy is to create a piece of INSTALL code that will
# patch up each executable and copy any libraries that we depend on, so that
# things like ARPACK can be compiled using MacPorts/Homebrew and we don't have
# to bother messing around compiling them ourselves.
#
# The strategy is:
#
# - Examine the library dependencies using the get_prerequisites function from
# the GetPrerequisites CMake module (that essentially runs otool recursively)
# - Copy each of the libraries into dist/lib
# - Run install_name_tool on each library to remove the absolute path to the
# installed library.
# - This is then replaced by @rpath/../lib/libName.dylib so that @rpath can be
# embedded into the executable.
# - Change the library install name so that it follows the same convention
# - Extract the rpaths from our executable using the get_item_rpaths function
# from BundleUtilities
# - Finally, set the rpath of each executable to be @executable_path so that
# everything becomes relative to the executable
#
# All of this makes an entirely self-contained version of Nektar++ that can be
# extracted anywhere on the system and still retain its dependencies.
if(APPLE)
foreach(app ${INSTALL_BINS_FILES})
get_filename_component(appname ${app} NAME)
set(app "\${CMAKE_INSTALL_PREFIX}/bin/${appname}")
install(CODE "
include(GetPrerequisites)
include(BundleUtilities)
get_filename_component(exepath ${app} DIRECTORY)
get_prerequisites(\"${app}\" prereqs 1 1 \"\${exepath}\" \"\" \"\" 1)
message(STATUS \"Fixing executable: ${app}\")
# First pass -- copy libraries and figure out -change command for
# install_name_tool. Note that since install_name_tool doesn't complain
# if the thing you're changing isn't there, we just throw everything
# at every library.
unset(changes)
unset(changes_lib)
foreach(req \${prereqs})
get_filename_component(reqname \${req} NAME)
set(libdest \${CMAKE_INSTALL_PREFIX}/lib/\${reqname})
set(changes \${changes} \"-change\" \"\${req}\" \"@executable_path/../lib/\${reqname}\")
set(changes_lib \${changes_lib} \"-change\" \"\${req}\" \"@loader_path/../lib/\${reqname}\")
# Copy this library
if (NOT EXISTS \${libdest})
file(COPY \${req}
DESTINATION \${CMAKE_INSTALL_PREFIX}/lib
FILE_PERMISSIONS OWNER_WRITE OWNER_READ)
# If the library was symlinked, we follow the symlink and then
# copy that, too.
if (IS_SYMLINK \${req})
# resolve symlink
get_filename_component(req_abs \${req} REALPATH)
file(COPY \${req_abs}
DESTINATION \${CMAKE_INSTALL_PREFIX}/lib
FILE_PERMISSIONS OWNER_WRITE OWNER_READ)
endif()
endif()
endforeach()
# Second pass -- fix up library to use @loader_path/../lib/libName.dylib
foreach(req \${prereqs})
set(searchname \${req})
if (IS_SYMLINK \${req})
get_filename_component(req_abs \${req} REALPATH)
set(req \${req_abs})
endif()
get_filename_component(reqname \${req} NAME)
set(libdest \${CMAKE_INSTALL_PREFIX}/lib/\${reqname})
set(cmd install_name_tool \${changes_lib} \"\${libdest}\")
execute_process(COMMAND \${cmd} RESULT_VARIABLE install_name_tool_result)
# change library install name ID
execute_process(COMMAND install_name_tool -id @loader_path/../lib/\${reqname} \${libdest})
# change @loader_path (used by some boost libs through homebrew)
endforeach()
# Third pass -- fix executable library names
foreach(req \${prereqs})
set(cmd install_name_tool \${changes} \"${app}\")
execute_process(COMMAND \${cmd} RESULT_VARIABLE install_name_tool_result)
endforeach()
# Fix rpath -- unset variables that have been used on previous passes
unset(app_rpaths)
get_item_rpaths(\"${app}\" app_rpaths)
unset(app_rpaths_unique)
unset(rpath_changes)
foreach(rpath \${app_rpaths})
gp_append_unique (app_rpaths_unique \${rpath})
endforeach()
foreach(rpath \${app_rpaths_unique})
set(rpath_changes \${rpath_changes} -delete_rpath \${rpath})
endforeach()
set(rpath_changes \${rpath_changes} -add_rpath @executable_path)
execute_process(COMMAND install_name_tool \${rpath_changes} \"${app}\")
")
ENDFOREACH()
endif()
include(CPack)
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Install Nektar++</title>
<style type="text/css">
body {
font-family: Helvetica;
font-size: 10pt;
}
pre {
background-color: #eee;
border: 1px solid #aaa;
padding: 5px;
margin: 0;
margin-left: 2em;
margin-bottom: 2em;
}
</style>
</head>
<body>
<p>
This package will install the Nektar++ spectral/<i>hp</i> element
framework onto your system.
</p>
<h3>Installing and uninstalling</h3>
<p>
Nektar++ is a command-line application, meaning that to use it you must
use the terminal. Once installed, Nektar++ executables can be found in the
directory <code>/opt/nektar++/bin</code>. To uninstall Nektar++, remove the
directory <code>/opt/nektar++</code> and issue the command
</p>
<pre>sudo pkgutil --forget org.imperialcollegelondon.nektar++-serial</pre><br />
<h3>Caveats</h3>
<p>
Note that this distributed version is for <b>serial execution</b> only and
ships with a reasonably minimal set of features:
</p>
<ul>
<li>Core libraries;</li>
<li>Common solvers and utilities, including the NekMesh generator;</li>
<li>ARPACK for stability analysis and FFTW for homogeneous simulations.
</ul>
<p>
If you are interested in other solvers, development headers, or parallel
execution, then please consider using releases through Homebrew
(<a href="http://brew.sh/">http://brew.sh/</a>) instead:
</p>
<pre>brew tap homebrew/science && brew tap mdave/nektar && brew install nektar</pre><br />
<p>
Alternatively, visit the <a href="http://www.nektar.info/">Nektar++ website</a> for
instructions on compiling from source.
</p>
</body>
</html>
#!/bin/bash
chown -R root:staff /opt/nektar++
......@@ -4,38 +4,42 @@
# projects are marked below.
######################################################
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# Require at least CMake 3.1 for CMAKE_CXX_STANDARD.
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
# TODO - Put the name of your project here.
SET(ProjectName ExampleSolver)
PROJECT(${ProjectName})
PROJECT(ExampleSolver)
# Setup where CMake will look for modules. You probably
# won't need to modify this.
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_MODULE_PATH})
# Finds Nektar++. This may introduce other dependencies, such as Boost.
# Finds Nektar++. This may introduce other dependencies, such as Boost.
FIND_PACKAGE(Nektar++ REQUIRED)
# Require C++11
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add various definitions from Nektar++ CMake file.