Added fixup_bundle routines for OpenMesh
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@350 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -1,29 +1,64 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
project (OpenMesh)
|
||||
|
||||
# add our macro directory to cmake search path
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
|
||||
|
||||
# include our cmake files
|
||||
include (ACGCommon)
|
||||
|
||||
acg_get_version ()
|
||||
|
||||
include(OpenMeshPackage)
|
||||
|
||||
include (ACGOutput)
|
||||
|
||||
if (WIN32)
|
||||
add_definitions(
|
||||
-D_USE_MATH_DEFINES -DNOMINMAX
|
||||
)
|
||||
endif ()
|
||||
|
||||
add_subdirectory (src/OpenMesh/Core)
|
||||
add_subdirectory (src/OpenMesh/Tools)
|
||||
add_subdirectory (src/OpenMesh/Apps)
|
||||
add_subdirectory (Doc)
|
||||
|
||||
# display results
|
||||
acg_print_configure_header (OPENMESH "OpenMesh")
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
project (OpenMesh)
|
||||
|
||||
# add our macro directory to cmake search path
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
|
||||
|
||||
# include our cmake files
|
||||
include (ACGCommon)
|
||||
|
||||
acg_get_version ()
|
||||
|
||||
include(OpenMeshPackage)
|
||||
include (ACGOutput)
|
||||
|
||||
if (WIN32)
|
||||
add_definitions(
|
||||
-D_USE_MATH_DEFINES -DNOMINMAX
|
||||
)
|
||||
endif ()
|
||||
|
||||
add_subdirectory (src/OpenMesh/Core)
|
||||
add_subdirectory (src/OpenMesh/Tools)
|
||||
add_subdirectory (src/OpenMesh/Apps)
|
||||
add_subdirectory (Doc)
|
||||
|
||||
# ========================================================================
|
||||
# Bundle generation
|
||||
# ========================================================================
|
||||
|
||||
if (WIN32 )
|
||||
# prepare bundle generation cmake file and add a build target for it
|
||||
configure_file ("${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.win.in"
|
||||
"${CMAKE_BINARY_DIR}/fixbundle.win.cmake" @ONLY IMMEDIATE)
|
||||
|
||||
add_custom_target (fixbundle ALL
|
||||
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.win.cmake" )
|
||||
|
||||
# let bundle generation depend on all targets
|
||||
add_dependencies (fixbundle QtViewer DecimaterGui)
|
||||
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
if (APPLE)
|
||||
# prepare bundle generation cmake file and add a build target for it
|
||||
configure_file ("${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/fixbundle.cmake" @ONLY IMMEDIATE)
|
||||
add_custom_target (fixbundle ALL
|
||||
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.cmake"
|
||||
)
|
||||
# let bundle generation depend on all targets
|
||||
# add_dependencies (fixbundle OpenFlipper PluginLib ${OPENFLIPPER_PLUGINS})
|
||||
|
||||
# install bundle
|
||||
install (DIRECTORY ${CMAKE_BINARY_DIR}/Build/OpenMesh.app DESTINATION .
|
||||
USE_SOURCE_PERMISSIONS)
|
||||
endif ()
|
||||
|
||||
# ========================================================================
|
||||
|
||||
|
||||
# display results
|
||||
acg_print_configure_header (OPENMESH "OpenMesh")
|
||||
|
||||
55
cmake/fixbundle.cmake.in
Normal file
55
cmake/fixbundle.cmake.in
Normal file
@@ -0,0 +1,55 @@
|
||||
# gp_item_default_embedded_path_override item default_embedded_path_var
|
||||
#
|
||||
# Return the path that others should refer to the item by when the item
|
||||
# is embedded inside a bundle.
|
||||
#
|
||||
# This is a project-specific override of BundleUtilities.cmake's
|
||||
# gp_item_default_embedded_path
|
||||
#
|
||||
function(gp_item_default_embedded_path_override item default_embedded_path_var)
|
||||
|
||||
# By default, embed items as set by gp_item_default_embedded_path:
|
||||
#
|
||||
set(path "${${default_embedded_path_var}}")
|
||||
|
||||
# But for OpenFlipper...
|
||||
#
|
||||
# ...embed *.dylib in the Libraries folder:
|
||||
#
|
||||
if(item MATCHES "\\.dylib$")
|
||||
set(path "@executable_path/../Libraries")
|
||||
endif()
|
||||
|
||||
# ...embed qt plugins in the Libraries folder:
|
||||
#
|
||||
if(item MATCHES "@QT_PLUGINS_DIR@" AND item MATCHES "\\.bundle")
|
||||
file (RELATIVE_PATH _plugin "@QT_PLUGINS_DIR@" "${item}")
|
||||
get_filename_component(_dir "${_plugin}" PATH)
|
||||
set(path "@executable_path/../Resources/QtPlugins/${_dir}")
|
||||
endif()
|
||||
|
||||
# ...embed *.so in the Plugins folder:
|
||||
#
|
||||
if(item MATCHES "\\.so$")
|
||||
set(path "@executable_path/../Resources/Plugins")
|
||||
endif()
|
||||
|
||||
set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
|
||||
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@/*.bundle")
|
||||
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")
|
||||
|
||||
28
cmake/fixbundle.cmake.win.in
Normal file
28
cmake/fixbundle.cmake.win.in
Normal file
@@ -0,0 +1,28 @@
|
||||
# gp_item_default_embedded_path_override item default_embedded_path_var
|
||||
#
|
||||
# Return the path that others should refer to the item by when the item
|
||||
# is embedded inside a bundle.
|
||||
#
|
||||
# This is a project-specific override of BundleUtilities.cmake's
|
||||
# gp_item_default_embedded_path
|
||||
#
|
||||
function(gp_item_default_embedded_path_override item default_embedded_path_var)
|
||||
|
||||
# By default, embed items as set by gp_item_default_embedded_path:
|
||||
#
|
||||
set(path "${${default_embedded_path_var}}")
|
||||
|
||||
set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
|
||||
endfunction(gp_item_default_embedded_path_override)
|
||||
|
||||
include (BundleUtilities)
|
||||
|
||||
# Get library paths
|
||||
get_filename_component(_GlutDir "@GLUT_glut_LIBRARY@" PATH)
|
||||
get_filename_component(_GlewDir "@GLEW_LIBRARY@" PATH)
|
||||
|
||||
# fix all dependencies
|
||||
fixup_bundle ("@CMAKE_BINARY_DIR@/Build/ProgViewer.exe" "" "${_GlutDir};${_GlewDir};@QT_BINARY_DIR@")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user