Commit 94639e1d authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] - split install-targets into multiple components. Better for packaging.

parent 78322ce3
......@@ -77,10 +77,16 @@ by using the common routine:
cd build
cmake ../src
make
make install -- this is optional
make install -- this is optional and installs everything.
After that, OpenWalnut can be used inside the build directory.
If you want to install only a part of OpenWalnut, you can issue
make list_install_tarets
The listed targets will then only install the specified part.
Compilation on Windows and Mac:
-------------------------------
......
......@@ -82,14 +82,8 @@ ENDIF()
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# mimic layout of install dir for build:
SET( OW_CONFIG_DIR_RELATIVE "share/openwalnut" )
SET( OW_CONFIG_DIR ${PROJECT_BINARY_DIR}/${OW_CONFIG_DIR_RELATIVE} )
SET( OW_SHARE_DIR_RELATIVE "share/openwalnut" )
SET( OW_SHARE_DIR ${PROJECT_BINARY_DIR}/${OW_SHARE_DIR_RELATIVE} )
SET( OW_MAN_DIR_RELATIVE "share/man" )
SET( OW_MAN_DIR "${PROJECT_BINARY_DIR}/share/man" )
SET( OW_DOC_DIR_RELATIVE "share/doc/openwalnut" )
SET( OW_DOC_DIR ${PROJECT_BINARY_DIR}/${OW_DOC_DIR_RELATIVE} )
# these dirs are the same for all parts of OW
SET( OW_RUNTIME_DIR_RELATIVE "bin" )
SET( OW_RUNTIME_DIR ${PROJECT_BINARY_DIR}/${OW_RUNTIME_DIR_RELATIVE} )
SET( OW_LIBRARY_DIR_RELATIVE "lib" )
......@@ -98,6 +92,12 @@ SET( OW_ARCHIVE_DIR_RELATIVE "lib" )
SET( OW_ARCHIVE_DIR ${PROJECT_BINARY_DIR}/${OW_ARCHIVE_DIR_RELATIVE} )
SET( OW_MODULE_DIR_RELATIVE "lib/openwalnut" )
SET( OW_MODULE_DIR ${PROJECT_BINARY_DIR}/${OW_MODULE_DIR_RELATIVE} )
SET( OW_MAN_DIR_RELATIVE "share/man" )
SET( OW_MAN_DIR "${PROJECT_BINARY_DIR}/share/man" )
# One could also define this for every part of OW, but it does not make sense. It is "share" because it is shared among the different parts
SET( OW_SHARE_DIR_RELATIVE "share/openwalnut" )
SET( OW_SHARE_DIR ${PROJECT_BINARY_DIR}/${OW_SHARE_DIR_RELATIVE} )
# set our paths for install targets
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OW_RUNTIME_DIR} )
......@@ -355,42 +355,10 @@ ADD_CUSTOM_TARGET( vtest
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
# Resource/Doc Copy
# - This simply copies the structure from ../resources to the build directory
# - Additonaly takes care that the user doc and manual pages get placed where they belong.
# - Resource copy is done by the OW parts. This just copies additional helpers
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Setup everything in ../resources
SETUP_RESOURCES()
SETUP_ADDITIONAL_FILES( ${OW_DOC_DIR_RELATIVE}
"SHARE"
"${PROJECT_SOURCE_DIR}/../README"
"${PROJECT_SOURCE_DIR}/../AUTHORS"
"${PROJECT_SOURCE_DIR}/../CONTRIBUTORS"
)
# If the user did not disable license-copying, do it
# NOTE: use this "double-negative" to use the fact that undefined variables yield FALSE.
IF( NOT OW_PACKAGE_NOCOPY_LICENSE )
SETUP_ADDITIONAL_FILES( ${OW_DOC_DIR_RELATIVE}
"SHARE"
"${PROJECT_SOURCE_DIR}/../COPYING"
"${PROJECT_SOURCE_DIR}/../COPYING.LESSER"
)
ENDIF()
# also copy all the user documentation we have
SETUP_ADDITIONAL_DIRECTORY( ${OW_DOC_DIR_RELATIVE}
${PROJECT_SOURCE_DIR}/../doc/user/
"SHARE"
TRUE # this denotes that the contents of doc/user should be copied instead of user directly
)
SETUP_ADDITIONAL_DIRECTORY( ${OW_MAN_DIR_RELATIVE}
${PROJECT_SOURCE_DIR}/../doc/man/
"SHARE"
TRUE # this denotes that the contents of doc/man should be copied instead of user directly
)
# copy our debug utilities. This is only useful if compiled debug or RelWithDebInfo
IF( NOT cmake_build_type_tolower STREQUAL "release" )
# NOTE: DO NOT add and install target here. Debugging tools are not useful and wished in an OpenWalnut installation.
......@@ -488,6 +456,42 @@ ADD_CUSTOM_TARGET( many
COMMENT "Make many special make targets in combination."
)
# some convenience install targets:
ADD_CUSTOM_TARGET( list_install_tarets
COMMAND echo The following components can be installed:
COMMAND echo " * install - install everything."
COMMAND echo " * install_runtime - install only openwalnut-qt4."
COMMAND echo " * install_lib - install only libopenwalnut."
COMMAND echo " * install_modules - install only the compiled modules."
COMMAND echo " * install_dev - install the development headers for libopenwalnut."
COMMENT "List installation targets."
)
# install targets for different parts
ADD_CUSTOM_TARGET( install_runtime
${CMAKE_COMMAND}
-DCOMPONENT=QT4GUI
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
ADD_CUSTOM_TARGET( install_lib
${CMAKE_COMMAND}
-DCOMPONENT=CORE
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
${CMAKE_COMMAND}
-DCOMPONENT=EXT
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
ADD_CUSTOM_TARGET( install_modules
${CMAKE_COMMAND}
-DCOMPONENT=MODULES
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
ADD_CUSTOM_TARGET( install_dev
${CMAKE_COMMAND}
-DCOMPONENT=CORE_DEV
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
# Compilation Targets
......
......@@ -58,16 +58,16 @@ SETUP_USE_VERSION_HEADER( ${LibName} )
# Set the version of the library.
SET_TARGET_PROPERTIES( ${LibName} PROPERTIES
VERSION ${OW_VERSION}
SOVERSION ${OW_SOVERSION}
VERSION ${OW_VERSION}
SOVERSION ${OW_SOVERSION}
)
# Do not forget the install targets
SETUP_LIB_INSTALL( ${LibName} ${OW_LIBRARY_DIR_RELATIVE} "LIB" )
SETUP_LIB_INSTALL( ${LibName} ${OW_LIBRARY_DIR_RELATIVE} "CORE" )
# Core contains the headers which are needed for any developer release. Install them.
# NOTE: do not use ${TARGET_H_FILES}. The command requires a list
SETUP_DEV_INSTALL( ${LibName} ${OW_LIBRARY_DIR_RELATIVE} TARGET_H_FILES "include/openwalnut/core" "DEV" )
SETUP_DEV_INSTALL( ${LibName} ${OW_LIBRARY_DIR_RELATIVE} TARGET_H_FILES "include/openwalnut/core" "CORE_DEV" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Test Setup
......@@ -76,12 +76,23 @@ SETUP_DEV_INSTALL( ${LibName} ${OW_LIBRARY_DIR_RELATIVE} TARGET_H_FILES "include
# Setup tests of this target
SETUP_TESTS( "${TARGET_TEST_FILES}" "${LibName}" "" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Copy local resources
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# copy our own resources
SETUP_RESOURCES( "core" "CORE" )
# where to put doc files?
SET( OW_DOC_DIR_RELATIVE "share/doc/libopenwalnut" )
SETUP_COMMON_DOC( ${OW_DOC_DIR_RELATIVE} "CORE" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Copy Shaders
# ---------------------------------------------------------------------------------------------------------------------------------------------------
COLLECT_SHADER_FILES( ${CMAKE_CURRENT_SOURCE_DIR} TARGET_GLSL_FILES )
SETUP_SHADERS( "${TARGET_GLSL_FILES}" "${OW_SHARE_DIR_RELATIVE}/shaders" "LIB" )
SETUP_SHADERS( "${TARGET_GLSL_FILES}" "${OW_SHARE_DIR_RELATIVE}/shaders" "CORE" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Style Checker
......
......@@ -57,7 +57,7 @@ void WPathHelper::setAppPath( boost::filesystem::path appPath )
{
m_appPath = appPath;
m_sharePath = m_appPath / "../share/openwalnut";
m_docPath = m_appPath / "../share/doc/openwalnut";
m_docPath = m_appPath / "../share/doc";
m_configPath = m_appPath / "../share/openwalnut";
m_libPath = m_appPath / "../lib";
m_modulePath = m_libPath / "openwalnut";
......
......@@ -37,5 +37,5 @@ INSTALL( TARGETS ${OWExtBioSigName}
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
NAMELINK_SKIP
COMPONENT "LIB"
COMPONENT "EXT"
)
......@@ -37,5 +37,5 @@ INSTALL( TARGETS ${OWExtBioSigName}
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
NAMELINK_SKIP
COMPONENT "LIB"
COMPONENT "EXT"
)
......@@ -40,5 +40,5 @@ INSTALL( TARGETS ${OWExtEEPName}
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
NAMELINK_SKIP
COMPONENT "LIB"
COMPONENT "EXT"
)
......@@ -73,5 +73,5 @@ INSTALL( TARGETS ${NIFTI_NIFTILIB_NAME} ${NIFTI_ZNZLIB_NAME}
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
NAMELINK_SKIP
COMPONENT "LIB"
COMPONENT "EXT"
)
......@@ -73,7 +73,7 @@ INSTALL( TARGETS ${BinName}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
COMPONENT "RUNTIME"
COMPONENT "QT4GUI"
)
# TODO(all): comment this stuff. I do not know what the purpose is
......@@ -93,10 +93,29 @@ SETUP_TESTS( "${TARGET_TEST_FILES}" "${BinName}" "" )
# Copy local resources
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# copy our own resources
SETUP_RESOURCES( ${LibName} "QT4GUI" )
# where to put doc files?
SET( OW_DOC_DIR_RELATIVE "share/doc/openwalnut-qt4" )
SETUP_COMMON_DOC( ${OW_DOC_DIR_RELATIVE} "QT4GUI" )
# also copy all the user documentation we have for qt4gui
SETUP_ADDITIONAL_DIRECTORY( ${OW_DOC_DIR_RELATIVE}
${PROJECT_SOURCE_DIR}/../doc/${LibName}/help/
"QT4GUI"
TRUE # this denotes that the contents of doc/user should be copied instead of user directly
)
SETUP_ADDITIONAL_DIRECTORY( ${OW_MAN_DIR_RELATIVE}
${PROJECT_SOURCE_DIR}/../doc/${LibName}/man/
"QT4GUI"
TRUE # this denotes that the contents of doc/man should be copied instead of user directly
)
# Our user-help needs the icons too. Copy them.
SETUP_ADDITIONAL_DIRECTORY( "${OW_DOC_DIR_RELATIVE}/${LibName}/icons"
SETUP_ADDITIONAL_DIRECTORY( "${OW_DOC_DIR_RELATIVE}/icons"
"${CMAKE_CURRENT_SOURCE_DIR}/icons"
"SHARE"
"QT4GUI"
FALSE # this denoted that the whole directory icons should be copied instead of its contents
)
......
......@@ -782,14 +782,14 @@ void WMainWindow::openAboutQtDialog()
void WMainWindow::openAboutDialog()
{
std::string filename( WPathHelper::getDocPath().file_string() + "/qt4gui/OpenWalnutAbout.html" );
std::string filename( WPathHelper::getDocPath().file_string() + "/openwalnut-qt4/OpenWalnutAbout.html" );
std::string content = readFileIntoString( filename );
QMessageBox::about( this, "About OpenWalnut", content.c_str() );
}
void WMainWindow::openOpenWalnutHelpDialog()
{
std::string filename( WPathHelper::getDocPath().file_string() + "/qt4gui/OpenWalnutHelp.html" );
std::string filename( WPathHelper::getDocPath().file_string() + "/openwalnut-qt4/OpenWalnutHelp.html" );
std::string content = readFileIntoString( filename );
QWidget* window = new QWidget( this, Qt::Window );
......@@ -802,7 +802,7 @@ void WMainWindow::openOpenWalnutHelpDialog()
window->show();
QWebView *view = new QWebView( this );
QString location( QString( "file://" ) + WPathHelper::getDocPath().file_string().c_str() + "/qt4gui/" );
QString location( QString( "file://" ) + WPathHelper::getDocPath().file_string().c_str() + "/openwalnut-qt4/" );
view->setHtml( content.c_str(), QUrl( location ) );
view->show();
layout->addWidget( view );
......
......@@ -234,10 +234,12 @@ ENDFUNCTION( SETUP_STYLECHECKER )
# This function handles local resources needed for program execution. Place your resources in "${CMAKE_CURRENT_SOURCE_DIR}/../resources/". They
# get copied to the build directory and a proper install target is provided too
FUNCTION( SETUP_RESOURCES )
# _component the component to which the resources belong
# _resource the exact resource under resources-directory
FUNCTION( SETUP_RESOURCES _resource _component )
# as all the resources with the correct directory structure reside in ../resources, this target is very easy to handle
SET( ResourcesPath "${CMAKE_CURRENT_SOURCE_DIR}/../resources/" )
ADD_CUSTOM_TARGET( ResourceConfiguration
SET( ResourcesPath "${PROJECT_SOURCE_DIR}/../resources/${_resource}/" )
ADD_CUSTOM_TARGET( ResourceConfiguration_${_component}
ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory "${ResourcesPath}" "${PROJECT_BINARY_DIR}/"
COMMENT "Copying resources to build directory"
......@@ -246,7 +248,7 @@ FUNCTION( SETUP_RESOURCES )
# Also specify install target
INSTALL( DIRECTORY ${ResourcesPath}
DESTINATION "."
COMPONENT "SHARE"
COMPONENT ${_component}
PATTERN "bin/*" # binaries need to be executable
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
......@@ -255,6 +257,28 @@ FUNCTION( SETUP_RESOURCES )
ENDFUNCTION( SETUP_RESOURCES )
# This function copies the typical source docs (README, AUTHORS, CONTRIBUTORS and Licence files to the specified directory.
# _component the component to which the resources belong
# _targetDirRelative the relative target dir.
FUNCTION( SETUP_COMMON_DOC _target _component )
SETUP_ADDITIONAL_FILES( ${_target}
${_component}
"${PROJECT_SOURCE_DIR}/../README"
"${PROJECT_SOURCE_DIR}/../AUTHORS"
"${PROJECT_SOURCE_DIR}/../CONTRIBUTORS"
)
# If the user did not disable license-copying, do it
# NOTE: use this "double-negative" to use the fact that undefined variables yield FALSE.
IF( NOT OW_PACKAGE_NOCOPY_LICENSE )
SETUP_ADDITIONAL_FILES( ${_target}
${_component}
"${PROJECT_SOURCE_DIR}/../COPYING"
"${PROJECT_SOURCE_DIR}/../COPYING.LESSER"
)
ENDIF()
ENDFUNCTION( SETUP_COMMON_DOC )
# This function eases the process of copying and installing additional files which not reside in the resource path.
# It creates a target (ALL is depending on it) AND the INSTALL operation.
# _destination where to put them. This MUST be relative to the build dir and install dir.
......@@ -265,7 +289,7 @@ FUNCTION( SETUP_ADDITIONAL_FILES _destination _component )
FILE_TO_TARGETSTRING( ${_file} fileTarget )
# add a copy target
ADD_CUSTOM_TARGET( CopyAdditionalFile_${fileTarget}
ADD_CUSTOM_TARGET( CopyAdditionalFile_${fileTarget}_${_component}
ALL
COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_BINARY_DIR}/${_destination}/"
COMMAND ${CMAKE_COMMAND} -E copy "${_file}" "${PROJECT_BINARY_DIR}/${_destination}/"
......@@ -293,7 +317,7 @@ FUNCTION( SETUP_ADDITIONAL_DIRECTORY _destination _directory _component _content
# add a copy target
# this copies the CONTENTS of the specified directory into the specified destination dir.
# NOTE: cmake -E says, that copying a directory with the copy command is pssible. But on my system it isn't.
ADD_CUSTOM_TARGET( CopyAdditionalDirectory_${directoryTarget}
ADD_CUSTOM_TARGET( CopyAdditionalDirectory_${directoryTarget}_${_component}
ALL
COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_BINARY_DIR}/${_destination}/"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${_directory}" "${PROJECT_BINARY_DIR}/${_destination}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment