Commit 175fbfe2 authored by Jan Möbius's avatar Jan Möbius
Browse files

Dennis CMAKE Documentation

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5865 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9788cab4
This diff is collapsed.
......@@ -39,13 +39,17 @@ endfunction(gp_item_default_embedded_path_override)
include (BundleUtilities)
# copy qt plugins to bundle
file (GLOB _plugins "@CMAKE_BINARY_DIR@/Build/OpenFlipper.app/Contents/Resources/Plugins/*.so")
file (GLOB_RECURSE _qtplugins "@QT_PLUGINS_DIR@/*.dylib")
foreach (_qtp ${_qtplugins})
get_filename_component(_dir "${_qtp}" PATH)
list(APPEND _qtdirs "${_dir}")
endforeach ()
# fix all dependencies
fixup_bundle (@CMAKE_BINARY_DIR@/Build/OpenFlipper.app "${_plugins};${_qtplugins}" "/usr/lib;${_qtdirs}")
# create qt plugin configuration file
file(WRITE "@CMAKE_BINARY_DIR@/Build/OpenFlipper.app/Contents/Resources/qt.conf" "[Paths]\nPlugins = Resources/QtPlugins")
# option to disable inclusion of qmake build system into source package
option (
DISABLE_QMAKE_BUILD
"Disable inclusion of qmake build system into source package"
OFF
)
# set name
set (CPACK_PACKAGE_NAME "OpenFlipper")
set (CPACK_PACKAGE_VENDOR "ACG")
# set version
set (CPACK_PACKAGE_VERSION_MAJOR "1")
set (CPACK_PACKAGE_VERSION_MINOR "0")
set (CPACK_PACKAGE_VERSION_PATCH "0")
set (CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
# addition package info
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenFlipper Mesh manipulation too")
set (CPACK_PACKAGE_EXECUTABLES "OpenFlipper;OpenFlipper")
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set (CPACK_SOURCE_STRIP_FILES "")
......@@ -28,7 +30,10 @@ set (CPACK_SOURCE_STRIP_FILES "")
set (CPACK_STRIP_FILES "bin/OpenFlipper")
set (CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
# source package generation
set (CPACK_SOURCE_GENERATOR "TGZ;TBZ2;ZIP")
# ignored files in source package
set (CPACK_SOURCE_IGNORE_FILES "\\\\.#;/#;.*~")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.git")
list (APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.svn")
......@@ -76,6 +81,7 @@ endforeach ()
if (WIN32)
# window NSIS installer
set (CPACK_GENERATOR "NSIS")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
set (CPACK_NSIS_DISPLAY_NAME "OpenFlipper v${CPACK_PACKAGE_VERSION}")
......@@ -88,6 +94,7 @@ if (WIN32)
# TODO: fillme
# set (CPACK_NSIS_CONTACT "")
# append dll's to installed package
if (EXISTS ${CMAKE_SOURCE_DIR}/WIN)
file (GLOB _files "${CMAKE_SOURCE_DIR}/WIN/DLLs/DLLs 32 debug/*.dll")
install(FILES ${_files}
......@@ -101,6 +108,7 @@ if (WIN32)
)
endif ()
elseif (APPLE)
# apple Drag'n'Drop installer package
set (CPACK_GENERATOR "DragNDrop;TGZ")
set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/OpenFlipper/Icons/OpenFlipper_Icon.icns")
endif ()
......@@ -111,4 +119,11 @@ include (CPack)
if (NOT WIN32 AND NOT APPLE)
# no binary target for linux
file (REMOVE "${CMAKE_BINARY_DIR}/CPackConfig.cmake")
endif ()
\ No newline at end of file
endif ()
# cmake doesn't create a source package target, so we have to add our own
if (EXISTS "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")
add_custom_target (PACKAGE_SOURCE
${CMAKE_CPACK_COMMAND} --config "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake"
)
endif ()
......@@ -86,15 +86,17 @@ endmacro ()
# main function
function (_build_openflipper_plugin plugin)
# base dependencies
find_package (OpenGL)
find_package (GLUT)
find_package (GLEW)
# get upper plugin name
string (TOUPPER ${plugin} _PLUGIN)
# parse parameters
_get_plugin_parameters (${_PLUGIN} ${ARGN})
# check dependencies
of_unset (_${_PLUGIN}_MISSING_DEPS)
......@@ -128,26 +130,31 @@ function (_build_openflipper_plugin plugin)
${${_PLUGIN}_DIRS}
)
# collect all header,source and ui files
append_files (headers "*.hh" ${directories})
append_files (sources "*.cc" ${directories})
append_files (ui "*.ui" ${directories})
# remove template cc files from source file list
drop_templates (sources)
# filter header,source and ui files lists if of_list_filter macro has been defined
if (COMMAND of_list_filter)
of_list_filter (headers)
of_list_filter (sources)
of_list_filter (ui)
endif ()
# genereate uic and moc targets
qt4_autouic (uic_targets ${ui})
qt4_automoc (moc_targets ${headers})
add_library (Plugin-${plugin} MODULE ${uic_targets} ${sources} ${headers} ${moc_targets})
# add this plugin to build plugin list for dependency tracking
of_set (OPENFLIPPER_PLUGINS "${OPENFLIPPER_PLUGINS};Plugin-${plugin}")
# append compiler and linker flags from plugin dependencies
set_target_properties (
Plugin-${plugin} PROPERTIES
COMPILE_FLAGS "${${_PLUGIN}_CFLAGSADD}"
......@@ -155,7 +162,9 @@ function (_build_openflipper_plugin plugin)
)
if (WIN32)
# Visual studio requires our plugins to link with GLUT
find_package (GLUT)
# generate dllinport defines
add_definitions (-DACGDLL -DUSEACG -DPLUGINLIBDLL -DUSEPLUGINLIBDLL)
target_link_libraries (Plugin-${plugin}
OpenMeshCore
......@@ -164,6 +173,10 @@ function (_build_openflipper_plugin plugin)
PluginLib
${GLUT_LIBRARIES}
)
# copy plugin dll file to "Build" directory
# Visual studio will create this file in a subdirectory so we can't use
# LIBRARY_OUTPUT_DIRECTORY directly here
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR})
endif ()
......@@ -180,6 +193,7 @@ function (_build_openflipper_plugin plugin)
PluginLib
${QT_LIBRARIES}
)
# copy plugin so file to application bundle inside "Build" directory
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR})
endif ()
......@@ -189,7 +203,8 @@ function (_build_openflipper_plugin plugin)
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libPlugin-${plugin}.so
${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR}/libPlugin-${plugin}.so
)
else()
else ()
# directly generate plugin in plugin directory
set_target_properties (
Plugin-${plugin} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR}"
......@@ -201,6 +216,8 @@ function (_build_openflipper_plugin plugin)
${${_PLUGIN}_LIBRARIES}
)
# no install on mac, because the whole bundle will be installed in the
# toplevel CMakeLists.txt
if (NOT APPLE)
install (
TARGETS Plugin-${plugin}
......@@ -219,6 +236,7 @@ macro (openflipper_plugin)
string (TOUPPER ${_plugin} _PLUGIN)
# add option to disable plugin build
option (
DISABLE_PLUGIN_${_PLUGIN}
"Disable building of plugin \"${_plugin}\""
......
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