Skip to content
Snippets Groups Projects
Commit 0146902d authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

CMake: first working darwin bundle based on path

parent 958f6626
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ if(BORNAGAIN_MAN)
add_subdirectory(Doc/UserManual)
endif()
set(CMAKE_MACOSX_RPATH 1)
#set(CMAKE_MACOSX_RPATH 0)
add_subdirectory(Core)
add_subdirectory(ThirdParty/gtest)
......
......@@ -23,16 +23,7 @@ set(source_files
set(include_files)
# MH: disabled crashhandler
#if(BORNAGAIN_CRASHHADLER)
# list(APPEND source_files crashhandlersetup.cpp stacktracesetup.cpp)
# list(APPEND include_files crashhandlersetup.h stacktracesetup.h)
# list(APPEND source_files stacktracesetup.cpp)
# list(APPEND include_files stacktracesetup.h)
#endif()
# Application icon
if(WIN32)
set(RC_FILE bornagain.rc)
if ( CONSOLE )
......@@ -44,6 +35,7 @@ endif()
if(APPLE AND CREATE_BUNDLE)
# set(CMAKE_MACOSX_RPATH 0)
add_executable(${executable_name} MACOSX_BUNDLE ${source_files} ${include_files})
# get_filename_component(PYTHON_REAL_LIBRARY "${PYTHON_LIBRARY}" REALPATH)
# add_library(Python SHARED IMPORTED)
......@@ -97,6 +89,17 @@ endif( WIN32 )
# --- Installation ---
IF(APPLE AND CREATE_BUNDLE)
set(link_flags "-Wl,-rpath,@loader_path/../")
set_target_properties(${executable_name}
PROPERTIES
# INSTALL_RPATH "@loader_path/.."
LINK_FLAGS ${link_flags}
)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
# set(CMAKE_INSTALL_RPATH "@loader_path/..")
set(plugin_dest_dir ${INBUNDLE}/Contents/PlugIns)
set(qtconf_dest_dir ${INBUNDLE}/Contents/Resources)
set(APPS "\${CMAKE_INSTALL_PREFIX}/${INBUNDLE}")
......@@ -130,8 +133,9 @@ IF(APPLE AND CREATE_BUNDLE)
BUNDLE DESTINATION . COMPONENT Applications
RUNTIME DESTINATION ${destination_bin} COMPONENT Runtime)
# set_target_properties(${executable_name} PROPERTIES INSTALL_RPATH "@loader_path/../" MACOSX_RPATH 1)
# install(DIRECTORY "$ENV{QTDIR}/plugins/platforms" DESTINATION ${plugin_dest_dir} COMPONENT Runtime)
install(DIRECTORY "$ENV{QTDIR}/plugins/platforms" DESTINATION ${plugin_dest_dir} COMPONENT Runtime)
# set(qtconf_text "
#[Paths]
......@@ -158,8 +162,6 @@ IF(APPLE AND CREATE_BUNDLE)
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/FixBundle.cmake.in ${CMAKE_BINARY_DIR}/FixBundle.cmake @ONLY)
install(SCRIPT ${CMAKE_BINARY_DIR}/FixBundle.cmake COMPONENT Runtime)
# include(BundleUtilities)
# fixup_bundle(${CMAKE_INSTALL_PREFIX}/BornAgain.app "" "")
else()
install (TARGETS ${executable_name} DESTINATION ${destination_bin} COMPONENT Applications)
......
......@@ -7,7 +7,7 @@ set ( INBUNDLE BornAgain.app )
set(destination_bin ${INBUNDLE}/Contents/MacOs)
set(destination_lib ${INBUNDLE}/Contents/MacOs)
set(destination_lib ${INBUNDLE}/Contents/lib/BornAgain-${BornAgain_VERSION_MAJOR}.${BornAgain_VERSION_MINOR})
set(destination_include ${INBUNDLE}/Contents/Resources/Headers)
set(destination_examples ${INBUNDLE}/Contents/SharedSupport/Examples)
......
set ( bundle ${CMAKE_INSTALL_PREFIX}/BornAgain.app )
message("AAAAA @CMAKE_SOURCE_DIR@")
#set(GP_RPATH_DIR ${bundle}/Contents)
set(BU_CHMOD_BUNDLE_ITEMS True)
set(BU_COPY_FULL_FRAMEWORK_CONTENTS False)
#set(GP_RPATH_DIR "@loader_path/../")
#include (BundleUtilities)
include (@CMAKE_SOURCE_DIR@/cmake/modules/BundleUtilitiesWithRPath.cmake)
#message("AAAAA @CMAKE_SOURCE_DIR@ ${GP_RPATH_DIR}")
file ( GLOB pyqt_libs ${bundle}/Contents/MacOS/PyQt4/*.so )
file ( GLOB mantid_plugins ${bundle}/plugins/*.dylib )
......@@ -18,9 +26,35 @@ function(gp_resolved_file_type_override resolved_file type_var)
if(file MATCHES "Qt")
message("XXX resolving file as _embedded : ${file}")
set(${type_var} embedded PARENT_SCOPE)
elseif(file MATCHES "Python.framework")
elseif(item MATCHES "PlugIns/platforms")
message("XXX resolving file as _embedded : ${file}")
set(${type_var} embedded PARENT_SCOPE)
elseif(file MATCHES "Python.framework/Resources")
message("XXX resolving file as _embedded : ${file}")
set(${type_var} system PARENT_SCOPE)
elseif(file MATCHES "Python.framework/Versions")
message("XXX resolving file as _embedded : ${file}")
set(${type_var} embedded PARENT_SCOPE)
elseif(file MATCHES "/opt")
message("XXX resolving file as _embedded : ${file}")
set(${type_var} embedded PARENT_SCOPE)
elseif(file MATCHES "libBornAgain")
message("XXX resolving file as _embedded : ${file}")
set(${type_var} embedded PARENT_SCOPE)
elseif(file MATCHES "libManhattanStyle")
message("XXX resolving file as _embedded : ${file}")
set(${type_var} embedded PARENT_SCOPE)
# elseif(file MATCHES "Python.framework")
# message("XXX resolving file as _embedded : ${file}")
# set(${type_var} embedded PARENT_SCOPE)
else()
message("XXX resolving file as _system : ${file}")
set(${type_var} system PARENT_SCOPE)
......@@ -58,8 +92,20 @@ function(gp_item_default_embedded_path_override item default_embedded_path_var)
if(item MATCHES "[^/]+\\.framework/")
set(path "@fixup_path@/Frameworks")
endif()
elseif(item MATCHES "PlugIns/platforms")
set(path "@fixup_path@/PlugIns/platforms")
elseif(item MATCHES "libBornAgain")
set(path "@fixup_path@/lib/BornAgain-@BornAgain_VERSION_MAJOR@.@BornAgain_VERSION_MINOR@")
elseif(item MATCHES "libManhattanStyle")
set(path "@fixup_path@/lib/BornAgain-@BornAgain_VERSION_MAJOR@.@BornAgain_VERSION_MINOR@")
elseif(item MATCHES "\\.(dylib|so)$")
set(path "@fixup_path@/lib/ThirdParty")
endif()
# if(item MATCHES "Python.framework")
## set( path "@rpath" )
......@@ -76,12 +122,6 @@ function(gp_item_default_embedded_path_override item default_embedded_path_var)
endfunction(gp_item_default_embedded_path_override)
set(BU_CHMOD_BUNDLE_ITEMS True)
set(BU_COPY_FULL_FRAMEWORK_CONTENTS False)
#include (BundleUtilities)
include (@CMAKE_SOURCE_DIR@/cmake/modules/BundleUtilitiesWithRPath.cmake)
#set ( mantidpydir ${bundle}/Contents/MacOS/mantid )
#set ( mantidpylibs ${mantidpydir}/kernel/_kernel.so
# ${mantidpydir}/geometry/_geometry.so
......@@ -94,6 +134,33 @@ include (@CMAKE_SOURCE_DIR@/cmake/modules/BundleUtilitiesWithRPath.cmake)
#set ( dirs "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@" "@CMAKE_LIBRARY_PATH@" /Library/Frameworks /opt/intel/lib )
file(GLOB_RECURSE QTPLUGINS
"@CMAKE_INSTALL_PREFIX@/@plugin_dest_dir@/*@CMAKE_SHARED_LIBRARY_SUFFIX@")
message("QQQQ QTPLUGINS ${QTPLUGINS}")
set(qtconf_text "
[Paths]
Plugins = PlugIns
")
file(WRITE "@CMAKE_INSTALL_PREFIX@/@qtconf_dest_dir@/qt.conf" "${qtconf_text}")
set(dirs
"@CMAKE_BINARY_DIR@/lib"
"$ENV{QTDIR}"
"$ENV{QTDIR}/plugins"
)
set(other_libs
${QTPLUGINS}
)
message("QQQQ QTPLUGINS ${QTPLUGINS} dirs ${dirs}")
fixup_bundle ( "${bundle}" "${other_libs}" "${dirs}" ) # This will fix up the dependencies for the hard dependencies: MantidKernel etc
####################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment