Commit c012dd80 authored by cfouard's avatar cfouard
Browse files

NEW tools, components and action can now be needed internally within a CEP

FIXED use of #if defined(_WIN32) && !defined(__MINGW32__) instead of #ifdef Q_CC_WIN32 in Core.cpp

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@648 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 066583bb
......@@ -138,11 +138,15 @@ endmacro()
# - the other one is used at installation time and puts everything in
# ${CAMITK_INSTALL_ROOT}/include/${GroupName}/${ComponentName}/${SubdirName}
#
# Note: if you use the CEP option, CMAKE_BINARY_DIR is used instead of CAMITK_BUILD_DIR
# and CMAKE_INSTALL_PREFIX is used instead of CAMITK_INSTALL_ROOT
#
# usage:
# export_headers(HeaderFile1.h HeaderFile2.h ...
# COMPONENT ComponentName
# [GROUP GroupName]
# [SUBDIRECTORY SubdirName]
# [CEP]
# )
#
# FILES = list of files to install
......@@ -151,25 +155,36 @@ endmacro()
# GROUP = the name of the group this install should be using group will be
# prepend to the component name.
# SUBDIRECTORY = optional subdirectory to use in ${CAMITK_INCLUDE_DIR}/include/${ComponentName}
# CEP = optional, states that the files should installed CEP wise
macro(export_headers)
parse_arguments(EXPORT_HEADER
"COMPONENT;SUBDIRECTORY;GROUP" # possible lists
"" # possible options
"COMPONENT;SUBDIRECTORY;GROUP;" # possible lists
"CEP" # possible options
${ARGN}
)
# special case for components: remove prefix for the destination directory
string(REGEX REPLACE "^component-|^action-" "" EXPORT_HEADER_DESTINATION ${EXPORT_HEADER_COMPONENT})
# Do things CEP wise
if(NOT EXPORT_HEADER_CEP)
set(EXPORT_HEADER_INCLUDE_DIR ${CAMITK_INCLUDE_DIR})
set(EXPORT_HEADER_INSTALL_ROOT ${CAMITK_INSTALL_ROOT})
else()
# this is a CEP
set(EXPORT_HEADER_INCLUDE_DIR ${CMAKE_BINARY_DIR}/include)
set(EXPORT_HEADER_INSTALL_ROOT ${CMAKE_INSTALL_PREFIX})
endif()
# Check group
if(EXPORT_HEADER_GROUP)
# check directory
if (NOT EXISTS ${CAMITK_INCLUDE_DIR}/${EXPORT_HEADER_GROUP})
if (NOT EXISTS ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_GROUP})
add_custom_command(TARGET ${EXPORT_HEADER_COMPONENT}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${CAMITK_INCLUDE_DIR}/${EXPORT_HEADER_GROUP}
COMMENT "Creating build-time group include dir ${CAMITK_INCLUDE_DIR}/${EXPORT_HEADER_GROUP}"
COMMAND ${CMAKE_COMMAND} -E make_directory ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_GROUP}
COMMENT "Creating build-time group include dir ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_GROUP}"
VERBATIM
)
endif()
......@@ -177,11 +192,11 @@ macro(export_headers)
endif()
# check that the directory exists otherwise create it
if (NOT EXISTS ${CAMITK_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION})
if (NOT EXISTS ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION})
add_custom_command(TARGET ${EXPORT_HEADER_COMPONENT}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${CAMITK_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}
COMMENT "Creating build-time include dir ${CAMITK_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}"
COMMAND ${CMAKE_COMMAND} -E make_directory ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}
COMMENT "Creating build-time include dir ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}"
VERBATIM
)
endif()
......@@ -190,11 +205,11 @@ macro(export_headers)
if(EXPORT_HEADER_SUBDIRECTORY)
set(EXPORT_HEADER_DESTINATION ${EXPORT_HEADER_DESTINATION}/${EXPORT_HEADER_SUBDIRECTORY})
# create subdirectory if it does not exists
if (NOT EXISTS ${CAMITK_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION})
if (NOT EXISTS ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION})
add_custom_command(TARGET ${EXPORT_HEADER_COMPONENT}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${CAMITK_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}
COMMENT "Creating build-time include subdir ${CAMITK_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}"
COMMAND ${CMAKE_COMMAND} -E make_directory ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}
COMMENT "Creating build-time include subdir ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}"
VERBATIM
)
endif()
......@@ -209,7 +224,7 @@ macro(export_headers)
# copy after build, only if there was a change
add_custom_command(TARGET ${EXPORT_HEADER_COMPONENT}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE_TO_COPY} ${CAMITK_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE_TO_COPY} ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}/
COMMENT "Installing build-time header ${HEADER}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
......@@ -218,7 +233,7 @@ macro(export_headers)
# during installation, copy the files to install directory
install(FILES ${EXPORT_HEADER_DEFAULT_ARGS}
DESTINATION ${CAMITK_INSTALL_ROOT}/include/${CAMITK_SHORT_VERSION_STRING}/${EXPORT_HEADER_DESTINATION}/
DESTINATION ${EXPORT_HEADER_INSTALL_ROOT}/include/${CAMITK_SHORT_VERSION_STRING}/${EXPORT_HEADER_DESTINATION}/
COMPONENT ${EXPORT_HEADER_COMPONENT}
)
......@@ -283,7 +298,7 @@ macro(camitk_extension)
get_directory_name(${CMAKE_CURRENT_SOURCE_DIR} EXTENSION_NAME)
parse_arguments(${EXTENSION_NAME_CMAKE} #prefix
"NEEDS_TOOL;NEEDS_COMPONENT_EXTENSION;NEEDS_ACTION_EXTENSION;INCLUDE_DIRECTORIES;LIBRARIES;HEADERS_TO_INSTALL;DEFINES;EXTERNAL_SOURCES" # possible lists
"NEEDS_TOOL;NEEDS_CEP_TOOL;NEEDS_COMPONENT_EXTENSION;NEEDS_ACTION_EXTENSION;INCLUDE_DIRECTORIES;LIBRARIES;HEADERS_TO_INSTALL;DEFINES;EXTERNAL_SOURCES" # possible lists
"ACTION_EXTENSION;COMPONENT_EXTENSION;DEFAULT;NEEDS_XERCESC;NEEDS_ITK;NEEDS_LIBXML2;NEEDS_XSD;NEEDS_QTXML;NEEDS_OPENCV;NEEDS_IGSTK;INSTALL_ALL_HEADERS" # possible options
${ARGN}
)
......@@ -347,7 +362,8 @@ macro(camitk_extension)
string(TOUPPER ${TOOL_NEEDED} ${TOOL_NEEDED}_INTERNAL)
set(TOOL_${${TOOL_NEEDED}_INTERNAL} ON CACHE BOOL "Required by action extension ${EXTENSION_NAME}" FORCE )
set(TOOL_LIBRARIES ${TOOL_LIBRARIES} ${TOOL_NEEDED})
include_directories(${CAMITK_INCLUDE_DIR}/${TOOL_NEEDED})
include_directories(${CAMITK_INCLUDE_DIR}/${TOOL_NEEDED}) # TODO remove this
include_directories(${CMAKE_BINARY_DIR}/include/${TOOL_NEEDED})
endforeach()
endif()
......@@ -468,6 +484,11 @@ macro(camitk_extension)
${CAMITK_INSTALL_ROOT}/bin/actions
${CMAKE_CURRENT_BINARY_DIR}/../../bin/components
${CMAKE_CURRENT_BINARY_DIR}/../../bin/actions
# For CEP
${CMAKE_BINARY_DIR}/bin/components
${CMAKE_BINARY_DIR}/bin/actions
${CMAKE_BINARY_DIR}/bin
${CMAKE_BINARY_DIR}/lib
)
# get all headers, sources and do what is needed for Qt
......
......@@ -188,7 +188,7 @@ const QString Core::getTestDataDir() {
const QString Core::hasBuildTypeDirectory() {
QString buildType;
// take care of system specificities
#if defined(Q_CC_MSVC)
#if defined(_WIN32) && !defined(__MINGW32__)
// get the executable path
QDir binDir ( qApp->applicationDirPath() );
......
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