Commit 8b3237c8 authored by Jan Möbius's avatar Jan Möbius
Browse files

dos2unix

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10704 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9f21f404
# This module provides the following macro: # This module provides the following macro:
# #
# openflipper_plugin ( [DIRS dir1 dir2 ...] # openflipper_plugin ( [DIRS dir1 dir2 ...]
# [DEPS dep1 dep2 ...] # [DEPS dep1 dep2 ...]
# [OPTDEPS dep1 dep2 ...] # [OPTDEPS dep1 dep2 ...]
# [LDFLAGSADD flag1 flag2 ...] # [LDFLAGSADD flag1 flag2 ...]
# [CFLAGSADD flag1 flag2 ...] # [CFLAGSADD flag1 flag2 ...]
# [LIBRARIES lib1 lib2 ...] # [LIBRARIES lib1 lib2 ...]
# [LIBDIRS dir1 dir2 ...] # [LIBDIRS dir1 dir2 ...]
# [INCDIRS dir1 dir2 ...] # [INCDIRS dir1 dir2 ...]
# [ADDSRC file1 file2 ...] # [ADDSRC file1 file2 ...]
# [INSTALLDATA dir1 dir2 ...] # [INSTALLDATA dir1 dir2 ...]
# [TRANSLATION_LANGUAGES lang1 lang2 ...] # [TRANSLATION_LANGUAGES lang1 lang2 ...]
# [TRANSLATION_ADDFILES file1 file2 ...] # [TRANSLATION_ADDFILES file1 file2 ...]
# [LICENSEMANAGER]) # [LICENSEMANAGER])
# #
# DIRS = additional directories with source files # DIRS = additional directories with source files
# DEPS = required dependencies for find_package macro # DEPS = required dependencies for find_package macro
# OPTDEPS = optional dependencies for find_package macro # OPTDEPS = optional dependencies for find_package macro
# LDFLAGSADD = flags added to the link command # LDFLAGSADD = flags added to the link command
# CFLAGSADD = flags added to the compile command # CFLAGSADD = flags added to the compile command
# LIBRARIES = libraries added to link command # LIBRARIES = libraries added to link command
# LIBDIRS = additional link directories # LIBDIRS = additional link directories
# INCDIRS = additional include directories # INCDIRS = additional include directories
# ADDSRC = additional source files # ADDSRC = additional source files
# INSTALLDATA = directories that will be installed into the openflipper data directory # INSTALLDATA = directories that will be installed into the openflipper data directory
# #
# TRANSLATION_LANGUAGES = language codes for translation # TRANSLATION_LANGUAGES = language codes for translation
# TRANSLATION_ADDFILES = additional files that should be included into the translation files # TRANSLATION_ADDFILES = additional files that should be included into the translation files
# #
# LICENSEMANAGER = Compile plugin with license management # LICENSEMANAGER = Compile plugin with license management
# #
# Plugins can implement a acg_list_filter ("listname") macro to filter out # Plugins can implement a acg_list_filter ("listname") macro to filter out
# unneeded headers, sources and ui files from the autogenerated # unneeded headers, sources and ui files from the autogenerated
# build sources lists (see common.cmake drop_templates macro) # build sources lists (see common.cmake drop_templates macro)
# #
include (ACGCommon) include (ACGCommon)
# get plugin name from directory name # get plugin name from directory name
macro (_get_plugin_name var) macro (_get_plugin_name var)
string (REGEX MATCH "Plugin-.+[/\\]?$" _dir ${CMAKE_CURRENT_SOURCE_DIR}) string (REGEX MATCH "Plugin-.+[/\\]?$" _dir ${CMAKE_CURRENT_SOURCE_DIR})
string (REPLACE "Plugin-" "" ${var} ${_dir}) string (REPLACE "Plugin-" "" ${var} ${_dir})
endmacro () endmacro ()
# parse plugin macro parameter # parse plugin macro parameter
macro (_get_plugin_parameters _prefix) macro (_get_plugin_parameters _prefix)
set (_current_var _foo) set (_current_var _foo)
set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD LIBRARIES LIBDIRS INCDIRS ADDSRC INSTALLDATA TRANSLATION_LANGUAGES TRANSLATION_ADDFILES) set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD LIBRARIES LIBDIRS INCDIRS ADDSRC INSTALLDATA TRANSLATION_LANGUAGES TRANSLATION_ADDFILES)
set (_supported_flags LICENSEMANAGER) set (_supported_flags LICENSEMANAGER)
foreach (_val ${_supported_var}) foreach (_val ${_supported_var})
set (${_prefix}_${_val}) set (${_prefix}_${_val})
endforeach () endforeach ()
foreach (_val ${_supported_flags}) foreach (_val ${_supported_flags})
set (${_prefix}_${_val} 0) set (${_prefix}_${_val} 0)
endforeach () endforeach ()
foreach (_val ${ARGN}) foreach (_val ${ARGN})
set (_found FALSE) set (_found FALSE)
foreach (_find ${_supported_var}) foreach (_find ${_supported_var})
if ("${_find}" STREQUAL "${_val}") if ("${_find}" STREQUAL "${_val}")
set (_found TRUE) set (_found TRUE)
endif () endif ()
endforeach () endforeach ()
foreach (_find ${_supported_flags}) foreach (_find ${_supported_flags})
if ("${_find}" STREQUAL "${_val}") if ("${_find}" STREQUAL "${_val}")
set (${_prefix}_${_val} 1) set (${_prefix}_${_val} 1)
endif () endif ()
endforeach () endforeach ()
if (_found) if (_found)
set (_current_var ${_prefix}_${_val}) set (_current_var ${_prefix}_${_val})
else () else ()
list (APPEND ${_current_var} ${_val}) list (APPEND ${_current_var} ${_val})
endif () endif ()
endforeach () endforeach ()
endmacro () endmacro ()
# check dependencies # check dependencies
macro (_check_plugin_deps _prefix) macro (_check_plugin_deps _prefix)
set (${_prefix}_HAS_DEPS TRUE) set (${_prefix}_HAS_DEPS TRUE)
foreach (_val ${ARGN}) foreach (_val ${ARGN})
string (TOUPPER ${_val} _VAL) string (TOUPPER ${_val} _VAL)
find_package(${_val}) find_package(${_val})
if (${_val}_FOUND OR ${_VAL}_FOUND) if (${_val}_FOUND OR ${_VAL}_FOUND)
foreach (_name ${_val} ${_VAL}) foreach (_name ${_val} ${_VAL})
if (DEFINED ${_name}_INCLUDE_PATH) if (DEFINED ${_name}_INCLUDE_PATH)
list (APPEND ${_prefix}_DEPS_INCDIRS "${${_name}_INCLUDE_PATH}") list (APPEND ${_prefix}_DEPS_INCDIRS "${${_name}_INCLUDE_PATH}")
endif () endif ()
if (DEFINED ${_name}_INCLUDE_DIRS) if (DEFINED ${_name}_INCLUDE_DIRS)
list (APPEND ${_prefix}_DEPS_INCDIRS "${${_name}_INCLUDE_DIRS}") list (APPEND ${_prefix}_DEPS_INCDIRS "${${_name}_INCLUDE_DIRS}")
endif () endif ()
if (DEFINED ${_name}_INCLUDE_DIR) if (DEFINED ${_name}_INCLUDE_DIR)
list (APPEND ${_prefix}_DEPS_INCDIRS "${${_name}_INCLUDE_DIR}") list (APPEND ${_prefix}_DEPS_INCDIRS "${${_name}_INCLUDE_DIR}")
endif () endif ()
if (DEFINED ${_name}_LIBRARY_DIRS) if (DEFINED ${_name}_LIBRARY_DIRS)
list (APPEND ${_prefix}_DEPS_LIBDIRS "${${_name}_LIBRARY_DIRS}") list (APPEND ${_prefix}_DEPS_LIBDIRS "${${_name}_LIBRARY_DIRS}")
endif () endif ()
if (DEFINED ${_name}_LIBRARY_DIR) if (DEFINED ${_name}_LIBRARY_DIR)
list (APPEND ${_prefix}_DEPS_LIBDIRS "${${_name}_LIBRARY_DIR}") list (APPEND ${_prefix}_DEPS_LIBDIRS "${${_name}_LIBRARY_DIR}")
endif () endif ()
if (DEFINED ${_name}_LIBRARIES) if (DEFINED ${_name}_LIBRARIES)
list (APPEND ${_prefix}_DEPS_LIBRARIES "${${_name}_LIBRARIES}") list (APPEND ${_prefix}_DEPS_LIBRARIES "${${_name}_LIBRARIES}")
endif () endif ()
if (DEFINED ${_name}_LIBRARY) if (DEFINED ${_name}_LIBRARY)
list (APPEND ${_prefix}_DEPS_LIBRARIES "${${_name}_LIBRARY}") list (APPEND ${_prefix}_DEPS_LIBRARIES "${${_name}_LIBRARY}")
endif () endif ()
if (DEFINED ${_name}_LINKER_FLAGS) if (DEFINED ${_name}_LINKER_FLAGS)
list (APPEND ${_prefix}_DEPS_LINKER_FLAGS "${${_name}_LINKER_FLAGS}") list (APPEND ${_prefix}_DEPS_LINKER_FLAGS "${${_name}_LINKER_FLAGS}")
endif () endif ()
endforeach () endforeach ()
else () else ()
set (${_prefix}_HAS_DEPS FALSE) set (${_prefix}_HAS_DEPS FALSE)
acg_set (_${_prefix}_MISSING_DEPS "${_${_prefix}_MISSING_DEPS} ${_val}") acg_set (_${_prefix}_MISSING_DEPS "${_${_prefix}_MISSING_DEPS} ${_val}")
endif () endif ()
endforeach () endforeach ()
endmacro () endmacro ()
macro (_plugin_licensemanagement) macro (_plugin_licensemanagement)
acg_append_files (headers "*.hh" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager") acg_append_files (headers "*.hh" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager")
acg_append_files (sources "*.cc" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager") acg_append_files (sources "*.cc" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager")
# acg_append_files (ui "*.ui" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager") # acg_append_files (ui "*.ui" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager")
acg_append_files (keygen_hdr "*.hh" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen") acg_append_files (keygen_hdr "*.hh" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen")
acg_append_files (keygen_src "*.cc" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen") acg_append_files (keygen_src "*.cc" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen")
acg_append_files (keygen_ui "*.ui" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen") acg_append_files (keygen_ui "*.ui" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen")
# genereate uic and moc targets # genereate uic and moc targets
acg_qt4_autouic (keygen_uic ${keygen_ui}) acg_qt4_autouic (keygen_uic ${keygen_ui})
acg_qt4_automoc (keygen_moc ${keygen_hdr}) acg_qt4_automoc (keygen_moc ${keygen_hdr})
add_executable (Plugin-${plugin}-keygen ${keygen_uic} ${keygen_moc} ${keygen_hdr} ${keygen_src}) add_executable (Plugin-${plugin}-keygen ${keygen_uic} ${keygen_moc} ${keygen_hdr} ${keygen_src})
target_link_libraries ( target_link_libraries (
Plugin-${plugin}-keygen Plugin-${plugin}-keygen
${QT_LIBRARIES} ${QT_LIBRARIES}
) )
# create our output directroy # create our output directroy
if (NOT EXISTS ${CMAKE_BINARY_DIR}/LicenseManagement) if (NOT EXISTS ${CMAKE_BINARY_DIR}/LicenseManagement)
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/LicenseManagement) file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/LicenseManagement)
endif () endif ()
if (WIN32) if (WIN32)
# copy exe file to "Build" directory # copy exe file to "Build" directory
# Visual studio will create this file in a subdirectory so we can't use # Visual studio will create this file in a subdirectory so we can't use
# RUNTIME_OUTPUT_DIRECTORY directly here # RUNTIME_OUTPUT_DIRECTORY directly here
add_custom_command (TARGET Plugin-${plugin}-keygen POST_BUILD add_custom_command (TARGET Plugin-${plugin}-keygen POST_BUILD
COMMAND ${CMAKE_COMMAND} -E COMMAND ${CMAKE_COMMAND} -E
copy_if_different copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Plugin-${plugin}-keygen.exe ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Plugin-${plugin}-keygen.exe
${CMAKE_BINARY_DIR}/LicenseManagement/Plugin-${plugin}-keygen.exe) ${CMAKE_BINARY_DIR}/LicenseManagement/Plugin-${plugin}-keygen.exe)
else () else ()
set_target_properties ( set_target_properties (
Plugin-${plugin}-keygen PROPERTIES Plugin-${plugin}-keygen PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/LicenseManagement" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/LicenseManagement"
) )
endif () endif ()
endmacro () endmacro ()
# main function # main function
function (_build_openflipper_plugin plugin) function (_build_openflipper_plugin plugin)
acg_set (OPENFLIPPER_${_PLUGIN}_BUILD "0") acg_set (OPENFLIPPER_${_PLUGIN}_BUILD "0")
# get upper plugin name # get upper plugin name
string (TOUPPER ${plugin} _PLUGIN) string (TOUPPER ${plugin} _PLUGIN)
# parse parameters #============================================================================================
_get_plugin_parameters (${_PLUGIN} ${ARGN}) # parse parameters
#============================================================================================
# check dependencies _get_plugin_parameters (${_PLUGIN} ${ARGN})
acg_unset (_${_PLUGIN}_MISSING_DEPS)
set (${_PLUGIN}_HAS_DEPS) #============================================================================================
_check_plugin_deps (${_PLUGIN} ${${_PLUGIN}_OPTDEPS}) # Collect dependencies
#============================================================================================
acg_unset (_${_PLUGIN}_MISSING_DEPS)
set (${_PLUGIN}_HAS_DEPS) # check dependencies
_check_plugin_deps (${_PLUGIN} ${${_PLUGIN}_DEPS}) acg_unset (_${_PLUGIN}_MISSING_DEPS)
set (${_PLUGIN}_HAS_DEPS)
if (${_PLUGIN}_HAS_DEPS) _check_plugin_deps (${_PLUGIN} ${${_PLUGIN}_OPTDEPS})
include_directories (
. acg_unset (_${_PLUGIN}_MISSING_DEPS)
${CMAKE_SOURCE_DIR} set (${_PLUGIN}_HAS_DEPS)
${CMAKE_SOURCE_DIR}/OpenMesh/src _check_plugin_deps (${_PLUGIN} ${${_PLUGIN}_DEPS})
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} #============================================================================================
${${_PLUGIN}_DEPS_INCDIRS} # Remember Lib dirs for bundle generation
${${_PLUGIN}_INCDIRS} #============================================================================================
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR} # On Windows we collect the library paths in a global property.
${GLUT_INCLUDE_DIR} # These paths will be used in the toplevel cmakefile
${CMAKE_BINARY_DIR}/OpenFlipper/PluginLib # to configure the fixup_bundle to copy the required libs to the bundle.
) if (WIN32)
# Get the required directories and remeber them to build the bundle later
# Linking for apple is special here as the linker pulls in the dependencies, we have to set them like in PluginLib! list(APPEND WINDOWS_COPY_LIBDIRS ${${_PLUGIN}_DEPS_LIBDIRS} )
if( APPLE ) # Remove duplicates from the list
list(REMOVE_DUPLICATES WINDOWS_COPY_LIBDIRS)
# search all ObjectTypes in the ObjectType directory for additional build information # Has to be a global property because we need it in the main cmakefile
file ( set_property(GLOBAL APPEND PROPERTY WINDOWS_LIBRARY_DIR_LIST "${WINDOWS_COPY_LIBDIRS}")
GLOB _plugin_buildinfos endif(WIN32)
RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/ObjectTypes/*/CMakeLists.txt" if (${_PLUGIN}_HAS_DEPS)
) include_directories (
.
${CMAKE_SOURCE_DIR}
# include all cmake files found for objecttypes here ${CMAKE_SOURCE_DIR}/OpenMesh/src
foreach ( _buildInfo ${_plugin_buildinfos}) ${CMAKE_CURRENT_SOURCE_DIR}
include ("${CMAKE_SOURCE_DIR}/${_buildInfo}") ${CMAKE_CURRENT_BINARY_DIR}
endforeach () ${${_PLUGIN}_DEPS_INCDIRS}
${${_PLUGIN}_INCDIRS}
link_directories ( ${OPENGL_INCLUDE_DIR}
${${_PLUGIN}_DEPS_LIBDIRS} ${GLEW_INCLUDE_DIR}
${${_PLUGIN}_LIBDIRS} ${GLUT_INCLUDE_DIR}
${ADDITIONAL_PLUGINLIB_LINK_DIRS} ${CMAKE_BINARY_DIR}/OpenFlipper/PluginLib
) )
else (APPLE) # Linking for apple is special here as the linker pulls in the dependencies, we have to set them like in PluginLib!
link_directories ( if( APPLE )
${${_PLUGIN}_DEPS_LIBDIRS}
${${_PLUGIN}_LIBDIRS} # search all ObjectTypes in the ObjectType directory for additional build information
) file (
endif(APPLE) GLOB _plugin_buildinfos
RELATIVE "${CMAKE_SOURCE_DIR}"
set (directories "${CMAKE_SOURCE_DIR}/ObjectTypes/*/CMakeLists.txt"
. )
${${_PLUGIN}_DIRS}
)
# include all cmake files found for objecttypes here
# Add documentation target foreach ( _buildInfo ${_plugin_buildinfos})
add_custom_target(doc-${plugin} COMMENT "Building documentation for plugin ${plugin}" VERBATIM) include ("${CMAKE_SOURCE_DIR}/${_buildInfo}")
endforeach ()
# make doc builds this plugin's documentation as well
add_dependencies(doc doc-${plugin}) link_directories (
${${_PLUGIN}_DEPS_LIBDIRS}
set(plugin_doc_dir "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/Plugin-${plugin}") ${${_PLUGIN}_LIBDIRS}
${ADDITIONAL_PLUGINLIB_LINK_DIRS}
# Target for plugin documentation )
if(TARGET doc-${plugin})
# Add plugin documentation else (APPLE)
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Documentation) link_directories (
# Test if html folder exists. If so, just copy it and ignore ${${_PLUGIN}_DEPS_LIBDIRS}
# the doxygen branch ${${_PLUGIN}_LIBDIRS}
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html) )
# Create target directories endif(APPLE)
if(NOT (IS_DIRECTORY ${plugin_doc_dir}))
file(MAKE_DIRECTORY ${plugin_doc_dir}) set (directories
endif() .
# Copy the html folder ${${_PLUGIN}_DIRS}
acg_copy_after_build (doc-${plugin} "${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html" "${plugin_doc_dir}/html") )
generate_qhp_file("${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html" "Plugin-${plugin}")
if(WIN32) # Add documentation target
add_custom_command(TARGET doc-${plugin} POST_BUILD add_custom_target(doc-${plugin} COMMENT "Building documentation for plugin ${plugin}" VERBATIM)
COMMAND ${QT_BINARY_DIR}/qhelpgenerator.exe
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html/Plugin-${plugin}.qhp) # make doc builds this plugin's documentation as well
else() add_dependencies(doc doc-${plugin})
add_custom_command(TARGET doc-${plugin} POST_BUILD
COMMAND ${QT_BINARY_DIR}/qhelpgenerator set(plugin_doc_dir "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/Plugin-${plugin}")
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html/Plugin-${plugin}.qhp)
endif() # Target for plugin documentation
add_custom_command(TARGET doc-${plugin} POST_BUILD if(TARGET doc-${plugin})
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html/Plugin-${plugin}.qch" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Help/Plugin-${plugin}.qch" # Add plugin documentation
) if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Documentation)
else (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/doxy.config.in) # Test if html folder exists. If so, just copy it and ignore
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/CMakeLists.txt) # the doxygen branch
# Create directories in order to avoid doxygen warnings if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html)
if(NOT (IS_DIRECTORY ${plugin_doc_dir})) # Create target directories
file(MAKE_DIRECTORY ${plugin_doc_dir}) if(NOT (IS_DIRECTORY ${plugin_doc_dir}))
file(MAKE_DIRECTORY ${plugin_doc_dir}/html) file(MAKE_DIRECTORY ${plugin_doc_dir})
file(MAKE_DIRECTORY ${plugin_doc_dir}/qthelp) endif()
endif() # Copy the html folder
# Add documentation sources to build tree acg_copy_after_build (doc-${plugin} "${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html" "${plugin_doc_dir}/html")
add_subdirectory(Documentation) generate_qhp_file("${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html" "Plugin-${plugin}")
# Copy qch file to OpenFlipper's Help dir if(WIN32)
acg_copy_after_build (doc-${plugin} "${plugin_doc_dir}/qthelp" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Help/") add_custom_command(TARGET doc-${plugin} POST_BUILD
endif() COMMAND ${QT_BINARY_DIR}/qhelpgenerator.exe
endif() ARGS ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html/Plugin-${plugin}.qhp)
endif() # documentation dir exists else()
endif() # target add_custom_command(TARGET doc-${plugin} POST_BUILD
COMMAND ${QT_BINARY_DIR}/qhelpgenerator
# collect all header,source and ui files ARGS ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html/Plugin-${plugin}.qhp)
acg_append_files (headers "*.hh" ${directories}) endif()
acg_append_files (sources "*.cc" ${directories}) add_custom_command(TARGET doc-${plugin} POST_BUILD
acg_append_files (sources "*.cpp" ${directories}) COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/Documentation/html/Plugin-${plugin}.qch" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Help/Plugin-${plugin}.qch"
acg_append_files (sources "*.c" ${directories}) )
acg_append_files (ui "*.ui" ${directories}) else (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/doxy.config.in)
acg_append_files (qrc "*.qrc" ${directories}) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/CMakeLists.txt)
# Create directories in order to avoid doxygen warnings
# remove template cc files from source file list if(NOT (IS_DIRECTORY ${plugin_doc_dir}))
acg_drop_templates (sources) file(MAKE_DIRECTORY ${plugin_doc_dir})
file(MAKE_DIRECTORY ${plugin_doc_dir}/html)
# filter header,source and ui files lists if acg_list_filter macro has been defined file(MAKE_DIRECTORY ${plugin_doc_dir}/qthelp)
if (COMMAND acg_list_filter) endif()
acg_list_filter (headers) # Add documentation sources to build tree
acg_list_filter (sources) add_subdirectory(Documentation)
acg_list_filter (ui) # Copy qch file to OpenFlipper's Help dir
endif () acg_copy_after_build (doc-${plugin} "${plugin_doc_dir}/qthelp" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Help/")
endif()
if (${_PLUGIN}_LICENSEMANAGER) endif()
_plugin_licensemanagement () endif() # documentation dir exists
endif () endif() # target
# genereate uic and moc targets # collect all header,source and ui files
acg_qt4_autouic (uic_targets ${ui}) acg_append_files (headers "*.hh" ${directories})
acg_qt4_automoc (moc_targets ${headers}) acg_append_files (sources "*.cc" ${directories})
acg_qt4_autoqrc (qrc_targets ${qrc}) acg_append_files (sources "*.cpp" ${directories})
acg_append_files (sources "*.c" ${directories})
add_library (Plugin-${plugin} MODULE ${uic_targets} ${sources} ${headers} ${moc_targets} ${qrc_targets} ${${_PLUGIN}_ADDSRC}) acg_append_files (ui "*.ui" ${directories})
acg_append_files (qrc "*.qrc" ${directories})
# add this plugin to build plugin list for dependency tracking
acg_set (OPENFLIPPER_PLUGINS "${OPENFLIPPER_PLUGINS};Plugin-${plugin}") # remove template cc files from source file list
acg_set (OPENFLIPPER_${_PLUGIN}_BUILD "1") acg_drop_templates (sources)
# append compiler and linker flags from plugin dependencies # filter header,source and ui files lists if acg_list_filter macro has been defined
set_target_properties ( if (COMMAND acg_list_filter)
Plugin-${plugin} PROPERTIES acg_list_filter (headers)
COMPILE_FLAGS "${${_PLUGIN}_CFLAGSADD}" acg_list_filter (sources)
LINK_FLAGS "${${_PLUGIN}_LDFLAGSADD} ${${_PLUGIN}_DEPS_LINKER_FLAGS}" acg_list_filter (ui)
) endif ()
if (WIN32) if (${_PLUGIN}_LICENSEMANAGER)
# Visual studio requires our plugins to link with GLUT _plugin_licensemanagement ()
find_package (GLUT) endif ()
# generate dllinport defines
add_definitions (-DACGDLL -DUSEACG -DPLUGINLIBDLL -DUSEPLUGINLIBDLL) # genereate uic and moc targets
target_link_libraries (Plugin-${plugin} acg_qt4_autouic (uic_targets ${ui})
OpenMeshCore acg_qt4_automoc (moc_targets ${headers})
OpenMeshTools acg_qt4_autoqrc (qrc_targets ${qrc})
ACG
PluginLib add_library (Plugin-${plugin} MODULE ${uic_targets} ${sources} ${headers} ${moc_targets} ${qrc_targets} ${${_PLUGIN}_ADDSRC})
${GLUT_LIBRARIES}
) # add this plugin to build plugin list for dependency tracking