Commit 226b69af authored by Jan Möbius's avatar Jan Möbius
Browse files

Dennis: package for macos

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5791 383ad7c9-94d9-4d36-a494-682f7c89f535
parent d9fb7d53
......@@ -36,6 +36,18 @@ if (WIN32)
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_BINDIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_BINDIR})
endif ()
elseif (APPLE)
set (OPENFLIPPER_APPDIR "../Resources/")
set (MAC_OPENFLIPPER_BASEDIR "OpenFlipper.app/Contents/Resources")
set (OPENFLIPPER_DATADIR "${MAC_OPENFLIPPER_BASEDIR}")
set (OPENFLIPPER_PLUGINDIR "${MAC_OPENFLIPPER_BASEDIR}/Plugins")
set (OPENFLIPPER_LIBDIR "${MAC_OPENFLIPPER_BASEDIR}/../MacOS")
set (OPENFLIPPER_BINDIR "${MAC_OPENFLIPPER_BASEDIR}/../MacOS")
add_definitions(
-DOPENFLIPPER_APPDIR="../Resources"
-DOPENFLIPPER_PLUGINDIR="Plugins"
-DOPENFLIPPER_DATADIR="."
)
else ()
set (OPENFLIPPER_APPDIR "..")
set (OPENFLIPPER_DATADIR "share/OpenFlipper")
......@@ -57,7 +69,7 @@ macro (set_target_props target)
BUILD_WITH_INSTALL_RPATH 1
SKIP_BUILD_RPATH 0
)
else ()
elseif (NOT APPLE)
set_target_properties (
${target} PROPERTIES
INSTALL_RPATH "$ORIGIN/../lib/OpenFlipper"
......@@ -228,3 +240,32 @@ function (add_plugins)
add_subdirectory (${CMAKE_SOURCE_DIR}/${_plugin_dir})
endforeach ()
endfunction ()
macro (get_files_in_dir ret dir)
file (GLOB_RECURSE __files RELATIVE "${dir}" "${dir}/*")
foreach (_file ${__files})
if (NOT _file MATCHES ".*svn.*")
list (APPEND ${ret} "${_file}")
endif ()
endforeach ()
endmacro ()
function (copy_after_build target src dst)
of_unset (_files)
get_files_in_dir (_files ${src})
foreach (_file ${_files})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${src}/${_file}" "${dst}/${_file}"
)
endforeach ()
endfunction ()
function (install_dir src dst)
of_unset (_files)
get_files_in_dir (_files ${src})
foreach (_file ${_files})
install(FILES "${src}/${_file}"
DESTINATION "${dst}"
)
endforeach ()
endfunction ()
......@@ -59,7 +59,10 @@ if (WIN32)
)
endif ()
elseif (APPLE)
set (CPACK_GENERATOR "PackageMaker;TGZ")
set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/OpenFlipper/Icons/OpenFlipper_Icon.icns")
set (CPACK_PACKAGING_INSTALL_PREFIX "/")
set (CPACK_PACKAGE_DEFAULT_LOCATION "/Applications")
endif ()
# has to be last
......
......@@ -134,6 +134,7 @@ function (_build_openflipper_plugin plugin)
add_library (Plugin-${plugin} MODULE ${uic_targets} ${sources} ${headers} ${moc_targets})
of_set (OPENFLIPPER_PLUGINS "${OPENFLIPPER_PLUGINS};Plugin-${plugin}")
set_target_properties (
Plugin-${plugin} PROPERTIES
......@@ -165,12 +166,17 @@ function (_build_openflipper_plugin plugin)
target_link_libraries (
Plugin-${plugin}
PluginLib
${QT_LIBRARIES}
)
set_target_properties (
Plugin-${plugin} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR}"
${QT_LIBRARIES}
)
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR})
endif ()
add_custom_command (TARGET Plugin-${plugin} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libPlugin-${plugin}.so
${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR}/libPlugin-${plugin}.so
)
else()
set_target_properties (
Plugin-${plugin} PROPERTIES
......@@ -182,11 +188,13 @@ function (_build_openflipper_plugin plugin)
${${_PLUGIN}_DEPS_LIBRARIES}
${${_PLUGIN}_LIBRARIES}
)
install (
TARGETS Plugin-${plugin}
DESTINATION ${OPENFLIPPER_PLUGINDIR}
)
if (NOT APPLE)
install (
TARGETS Plugin-${plugin}
DESTINATION ${OPENFLIPPER_PLUGINDIR}
)
endif ()
else ()
message (STATUS "[WARNING] One or more dependencies for plugin ${plugin} not found. Skipping 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