Skip to content
Snippets Groups Projects
Commit 6933d557 authored by Ammar Nejati's avatar Ammar Nejati
Browse files

[fixPkgName] Improvements to CI ()

Merging branch 'fixPkgName'  into 'main'.

* Corrected and unified the name of the installer on all platforms.  
  The installer name is `<Project-Name>-<Project-Version>-python<Python-Version>-<architecture>`; e.g.,
  `BornAgain-20.0-python3.11-linux_x64.sh` on Debian or `BornAgain-20.0-python3.9-mac_arm.dmg` on MacOS-M1.
* Corrected the path of Qt on Debian CI-machine since the required Qt plugins were not found due to an incorrect Qt path.
*  MacOS:  
   * Added linker flags to remove unneeded symbols/objects and dynamically-linked libraries.
   * Increased the minimum OSX version to 11.
   * Renamed the OS label to `mac` (instead of `macosx`).
* Corrected the installation directory for man pages on Linux, so that no root access is required.
* Slightly improved CI scripts.

See merge request !1558
parents 1a478360 672e01a1
No related branches found
No related tags found
1 merge request!1558Improvements to CI
Pipeline #95317 passed
......@@ -13,6 +13,7 @@ native_Debian_clang:
- export CC=gcc; export CXX=g++
- export PYTHONPATH=$CI_PROJECT_DIR/build/lib
- export MPLBACKEND=Agg
- QTCMAKE="/usr/local/Qt6/6.2.3/gcc_64/lib/cmake"
- cmake --version
- clang --version
stage: build
......@@ -20,15 +21,15 @@ native_Debian_clang:
- env
- mkdir build
- cd build
- time cmake .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBA_PY_PACKAGE=ON -DCMAKE_PREFIX_PATH=$QCMAKE -DZERO_TOLERANCE=ON
- time cmake .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBA_PY_PACKAGE=ON -DCMAKE_PREFIX_PATH=$QTCMAKE -DZERO_TOLERANCE=ON
- time make -j24
- time xvfb-run -a ctest -j16 --output-on-failure
- time make package_source
- time bash var/mk_pypack_linux.sh
- time cpack -B ./package .
- time cpack -B ./installer .
artifacts:
paths:
- build/package/BornAgain*.sh
- build/installer/BornAgain*.sh
- build/PythonPackage/py*/wheel/*.whl
expire_in: 10 days
......@@ -43,7 +44,7 @@ versiondocs:
- hugo version
- mkdir build
- cd build
- time cmake .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_PREFIX_PATH=$QCMAKE
- time cmake .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_PREFIX_PATH=$QTCMAKE
- time make -j8
- time make -j8 webdoc
- rm -rf ~www/ba/git-main/hugo-public
......@@ -68,10 +69,10 @@ mac_x64:
- make -j$NPROC
- ctest -j3 --output-on-failure
- zsh var/mk_pypack_macos.zsh
- cpack .
- cpack -B ./installer .
artifacts: &mac_artifacts
paths:
- build/*.dmg
- build/installer/*.dmg
- build/PythonPackage/py*/wheel/*.whl
expire_in: 10 days
......@@ -123,14 +124,14 @@ windows:
- pwd
# configure, make, test, pack
- cmake --version
- cmake -G "Visual Studio 17 2022" -A x64 -T host=x64 -DCMAKE_PREFIX_PATH="$OPT_DIR;$QTCMake_DIR" -DQTDIR="$QT_MSVC_DIR" -DCMAKE_INCLUDE_PATH="$BOOST_INCLUDE_DIR" -DCMAKE_LIBRARY_PATH="$BOOST_LIB_DIR" -DBA_PY_PACKAGE=ON -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -B. ..
- cmake -G "Visual Studio 17 2022" -A x64 -T host=x64 -DCMAKE_PREFIX_PATH="$OPT_DIR;$QTCMake_DIR" -DCMAKE_INCLUDE_PATH="$BOOST_INCLUDE_DIR" -DCMAKE_LIBRARY_PATH="$BOOST_LIB_DIR" -DBA_PY_PACKAGE=ON -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -B. ..
- pwd
- if($CI_PIPELINE_SOURCE -eq "schedule") { cmake --build . --target clean; echo "redundant target purge done" }
- cmake --build . --config Release
- ctest -C Release --parallel 8 --output-on-failure
- cpack -C Release -B ./winpackage
- cpack -C Release -B ./installer .
artifacts:
paths:
- build/winpackage/BornAgain*.exe
- build/installer/BornAgain*.exe
- build/PythonPackage/py*/wheel/*.whl
expire_in: 10 days
......@@ -116,28 +116,28 @@ if(BA_APPLE_BUNDLE)
RENAME qt.conf)
# adjust MacOS bundle
set(MACPK_ROOT_DIR "${CMAKE_INSTALL_PREFIX}/${destination_prefix}")
set(MACPK_MAIN_EXE "${executable_name}")
set(MACPK_QTDIR "${Qt_DIR}")
set(MACPKG_ROOT_DIR "${CMAKE_INSTALL_PREFIX}/${destination_prefix}")
set(MACPKG_MAIN_EXE "${executable_name}")
# NOTE: Only cerf and formfactor libraries should be passed;
# other libraries will be found automatically.
set(MACPK_EXTRA_LIBS
set(MACPKG_EXTRA_LIBS
${Cerf_LIBRARIES}
${FormFactor_LIBRARIES}
)
# list of required Qt plugins (paths relative to Qt root dir)
set(MACPK_QT_PLUGINS
plugins/platforms/libqcocoa.dylib
plugins/iconengines/libqsvgicon.dylib
plugins/imageformats/libqjpeg.dylib
plugins/imageformats/libqsvg.dylib
plugins/styles/libqmacstyle.dylib
set(MACPKG_QT_PLUGINS_RELDIR "${QT6_INSTALL_PLUGINS}")
set(MACPKG_QT_PLUGINS
platforms/libqcocoa.dylib
iconengines/libqsvgicon.dylib
imageformats/libqjpeg.dylib
imageformats/libqsvg.dylib
styles/libqmacstyle.dylib
)
# Qt plugins directory in within the MacOS bundle
set(MACPK_QT_PLUGINS_DIR PlugIns) # conform to settings in `qt.conf`
set(MACPKG_QT_PLUGINS_DIR PlugIns) # conform to settings in `qt.conf`
# convert CMake list to space-separated lists
string(REPLACE ";" " " MACPK_EXTRA_LIBS "${MACPK_EXTRA_LIBS}")
string(REPLACE ";" " " MACPK_QT_PLUGINS "${MACPK_QT_PLUGINS}")
string(REPLACE ";" " " MACPKG_EXTRA_LIBS "${MACPKG_EXTRA_LIBS}")
string(REPLACE ";" " " MACPKG_QT_PLUGINS "${MACPKG_QT_PLUGINS}")
configure_file("${CMAKE_SOURCE_DIR}/devtools/deploy/mac/adjust_mac_bundle.zsh.in"
"${BUILD_VAR_DIR}/adjust_mac_bundle.zsh" @ONLY)
......@@ -157,25 +157,16 @@ if(WIN32)
# extract Qt root-dir
# 'C:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6' => 'C:/Qt/6.2.4/msvc2019_64'
file(TO_CMAKE_PATH "${Qt_DIR}" qt_dir_str)
string(REGEX MATCH "(.*)/lib/cmake.*" _v "${qt_dir_str}")
set(Qt_ROOT_DIR "${CMAKE_MATCH_1}")
message(STATUS "Qt root directory: '${Qt_ROOT_DIR}'")
install(FILES
${Qt_ROOT_DIR}/bin/opengl32sw.dll
${Qt_DIR}/bin/opengl32sw.dll
DESTINATION ${destination_lib} COMPONENT Libraries)
set(Qt_PLUGINS_DIR "${Qt_ROOT_DIR}/plugins")
message(STATUS "Qt plugins directory: '${Qt_PLUGINS_DIR}'")
install(FILES
${Qt_PLUGINS_DIR}/platforms/qwindows.dll
DESTINATION bin/platforms COMPONENT Libraries)
install(FILES
${Qt_PLUGINS_DIR}/iconengines/qsvgicon.dll
DESTINATION bin/iconengines COMPONENT Libraries)
install(FILES
${Qt_PLUGINS_DIR}/imageformats/qjpeg.dll
${Qt_PLUGINS_DIR}/imageformats/qsvg.dll
......
......@@ -58,7 +58,7 @@ if(BA_PY_PLATFORM)
endif()
option(BUILD_DEBIAN "Build a debian package" OFF)
option(BA_APPLE_BUNDLE "Create a Mac OS X bundle" OFF)
option(BA_APPLE_BUNDLE "Create a MacOS bundle" OFF)
option(BA_CPP_API "Install header files" OFF)
# note on a non-options: macro SWIG is defined when code is processed by the tool Swig.
......
......@@ -71,6 +71,5 @@ set_target_properties(${lib} PROPERTIES
)
install(TARGETS ${lib}
LIBRARY DESTINATION ${destination_lib}
RUNTIME DESTINATION ${destination_lib}
COMPONENT Libraries)
LIBRARY DESTINATION ${destination_lib} COMPONENT Libraries
RUNTIME DESTINATION ${destination_lib} COMPONENT Libraries)
......@@ -90,11 +90,8 @@ set(destination_share ${destination_root}share/${destination_suffix}/)
set(destination_examples ${destination_share}Examples/)
set(destination_images ${destination_share}Images/)
set(destination_man ${destination_share}man/man1)
if(LINUX)
set(destination_man ${CMAKE_INSTALL_PREFIX}/man/man1)
endif(LINUX)
list(APPEND dstIds bin lib include share examples images)
list(APPEND dstIds bin lib include share examples images man)
message(STATUS "Destination directories:")
foreach(dstId IN LISTS dstIds)
......
......@@ -4,7 +4,7 @@ set(BA_PLATFORM linux)
if(CMAKE_SIZEOF_VOID_P GREATER 4)
message(STATUS "Found a 64bit system")
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL x86_64)
set(BA_ARCHITECTURE linux-x86_64)
set(BA_ARCHITECTURE linux_x64)
endif()
else()
message(STATUS "Found a 32bit system, not covered by our CI tests - proceed on your own risk")
......
set(BA_ARCHITECTURE macosx)
set(BA_PLATFORM macosx)
set(BA_PLATFORM mac)
if(NOT CMAKE_SYSTEM_NAME MATCHES Darwin)
message(FATAL_ERROR "Found a non-Darwin system, currently unsupported")
......@@ -11,10 +10,10 @@ execute_process(COMMAND sw_vers "-productVersion"
execute_process(COMMAND sw_vers "-productVersion"
COMMAND cut -d . -f 2
OUTPUT_VARIABLE MACOSX_MINOR OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Found a Mac OS X System ${MACOSX_VERSION}, minor ${MACOSX_MINOR}")
message(STATUS "Found a MacOS System ${MACOSX_VERSION}, minor ${MACOSX_MINOR}")
if((${MACOSX_VERSION} EQ 10) AND (${MACOSX_MINOR} LESS 15))
message(FATAL_ERROR "Found a MacOS X < 10.15, which is unsupported")
if(${MACOSX_VERSION} LESS 11)
message(FATAL_ERROR "Found a MacOS < 11.0, which is unsupported")
endif()
#TODO: check haveconfig and rpath -> set rpath true
......@@ -24,13 +23,25 @@ execute_process(COMMAND /usr/sbin/sysctl machdep.cpu.extfeatures OUTPUT_VARIABLE
if(NOT ${SYSCTL_OUTPUT} MATCHES 64)
message(FATAL "Found a 32bit system - no longer supported")
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES arm)
# arch = arm64
set(BA_ARCHITECTURE "${BA_PLATFORM}_arm")
else()
# arch = x86_64
set(BA_ARCHITECTURE "${BA_PLATFORM}_x64")
endif()
# On OS X, the `-dead_strip` flag removes unneeded symbols/object files, and
# `-dead_strip_dylibs` flag removes unneeded libraries [see `man ld` on OSX]
set(DEADSTRIP_LFLAGS "-dead_strip -dead_strip_dylibs")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(APPEND CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS " -m64")
string(APPEND CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS " -m64")
string(APPEND CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS " -m64 ${DEADSTRIP_LFLAGS}")
string(APPEND CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS " -m64 ${DEADSTRIP_LFLAGS}")
string(APPEND CMAKE_CXX_FLAGS " -m64 -I${CMAKE_SOURCE_DIR}/Wrap")
string(APPEND CMAKE_C_FLAGS " -m64")
string(APPEND CMAKE_C_LINK_FLAGS " -bind_at_load -m64")
string(APPEND CMAKE_CXX_LINK_FLAGS " -bind_at_load -m64")
# string(APPEND CMAKE_C_LINK_FLAGS " -bind_at_load -m64")
# string(APPEND CMAKE_CXX_LINK_FLAGS " -bind_at_load -m64")
if(CMAKE_COMPILER_IS_GNUCXX)
......
......@@ -36,7 +36,7 @@ function(MakeLib name lib tmpdir withPython)
# see 'Dynamic-Link Library Search Order'
# <https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order>
if(APPLE AND BA_APPLE_BUNDLE)
if(APPLE AND (BA_APPLE_BUNDLE OR BA_PY_PACKAGE))
# Add proper RPATHs as hints to load the dependencies at run-time
set(link_flags "-Wl,-rpath,@loader_path -Wl,-rpath,@loader_path/extra")
set_target_properties(${lib} PROPERTIES LINK_FLAGS ${link_flags})
......
......@@ -12,6 +12,9 @@ set(CPACK_PACKAGE_RELOCATABLE True)
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_SOURCE_PACKAGE_FILE_NAME})
set(SELECTED_PYTHON_VERSION "python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(_pkgname ${CPACK_SOURCE_PACKAGE_FILE_NAME}-${SELECTED_PYTHON_VERSION}-${BA_ARCHITECTURE})
if(WIN32)
include(BornAgain/PackWindows)
elseif(APPLE)
......@@ -21,12 +24,20 @@ elseif(UNIX)
include(BornAgain/PackDebian)
endif()
set(CPACK_BINARY_TZ OFF)
set(CPACK_BINARY_TGZ OFF)
include(BornAgain/PackSource)
endif()
set(CPACK_PACKAGE_FILE_NAME ${_pkgname})
# NOTE: The 'Unspecified' component is a _default_ component of CPack needed to finalize
# the installer. It must be at the end of all other components.
set(CPACK_COMPONENTS_ALL Libraries Headers Examples Applications Runtime Unspecified)
include(CPack)
set(CPACK_COMPONENTS_ALL Libraries Headers Examples Applications Runtime)
# reset package name (CPack bug: the original value is overwritten by CPack module)
set(CPACK_PACKAGE_FILE_NAME ${_pkgname})
message(STATUS "Installer name: ${CPACK_PACKAGE_FILE_NAME}")
message(STATUS "Source package name: ${CPACK_SOURCE_PACKAGE_FILE_NAME}")
......
# BornAgain Mac packaging
set(SELECTED_PYTHON_VERSION "python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(CPACK_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${SELECTED_PYTHON_VERSION}-${BA_ARCHITECTURE}")
set(CPACK_BINARY_DRAGNDROP ON)
set(CPACK_GENERATOR "DragNDrop")
# BornAgain Windows packaging
set(SELECTED_PYTHON_VERSION "python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(CPACK_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${SELECTED_PYTHON_VERSION}-${BA_ARCHITECTURE}")
set(CPACK_GENERATOR "NSIS")
set(CPACK_NSIS_INSTALL_ROOT "C:")
......@@ -12,7 +7,6 @@ set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_MENU_LINKS "bin\\\\BornAgain.exe" "BornAgain")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/GUI\\\\images\\\\BornAgain.ico" )
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/GUI\\\\images\\\\BornAgain.ico" )
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/GUI\\\\images\\\\BornAgain.ico" )
......
......@@ -11,15 +11,23 @@ elseif(${Qt6Core_VERSION} VERSION_GREATER_EQUAL "6.2")
string(APPEND CMAKE_CXX_FLAGS " -DQT_NO_DEPRECATED_WARNINGS")
endif()
set(Qt_DIR "${Qt6_DIR}" CACHE INTERNAL "")
set(Qt_DIR "${QT6_INSTALL_PREFIX}" CACHE INTERNAL "")
set(Qt_VERSION "${Qt6Core_VERSION}" CACHE INTERNAL "")
set(Qt_INCLUDE_DIR "${Qt6Widgets_INCLUDE_DIRS}" CACHE INTERNAL "")
set(Qt_INCLUDE_DIR "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_HEADERS}" CACHE INTERNAL "")
set(Qt_PLUGINS_DIR "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_PLUGINS}" CACHE INTERNAL "")
set(Qt_LIBS_DIR "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_LIBS}" CACHE INTERNAL "")
set(Qt_BIN_DIR "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_BINS}" CACHE INTERNAL "")
foreach(cmp Core Gui Widgets PrintSupport Svg OpenGL)
string(APPEND qt_libs " ${Qt6${cmp}_LIBRARIES}")
endforeach()
set(Qt_LIBRARIES "${qt_libs}" CACHE INTERNAL "")
message(STATUS " Qt ${Qt6Core_VERSION} directory: ${Qt_DIR}")
message(STATUS " Qt ${Qt_VERSION} directory: ${Qt_DIR}")
message(STATUS " Qt include directory: '${Qt_INCLUDE_DIR}'")
message(STATUS " Qt libraries directory: '${Qt_LIBS_DIR}'")
message(STATUS " Qt plugins directory: '${Qt_PLUGINS_DIR}'")
message(STATUS " Qt binaries directory: '${Qt_BIN_DIR}'")
get_target_property(Qt6Widgets_location Qt6::Widgets LOCATION_Release)
message(STATUS " ${Qt6Widgets_LIBRARIES} ${Qt6Widgets_location}")
......@@ -29,5 +37,3 @@ get_target_property(Qt6Gui_location Qt6::Gui LOCATION_Release)
message(STATUS " ${Qt6Gui_LIBRARIES} ${Qt6Gui_location}")
get_target_property(Qt6OpenGL_location Qt6::OpenGL LOCATION_Release)
message(STATUS " ${Qt6OpenGL_LIBRARIES} ${Qt6OpenGL_location}")
message(STATUS " Includes: ${Qt6Widgets_INCLUDE_DIRS}")
......@@ -20,6 +20,9 @@
pkg_root_dir="$1"
main_exe="@LINUXPKG_MAIN_EXE@"
framework_dir="$pkg_root_dir/@LINUXPKG_FRAMEWORK_DEST@"
qt_root_dir="@Qt_DIR@"
qt_plugins_dir="@Qt_PLUGINS_DIR@"
qt_libs_dir="@Qt_LIBS_DIR@"
# constants
TITLE="Linux Package"
......@@ -82,15 +85,9 @@ deps_kv_re='s/'$ldd_re'/lib\1\2'$KVFS'\3/p'
deps=$(ldd $main_exe)
#-- Qt extra dependencies
# obtain Qt root directory
# eg. `/lib/x86_64-linux-gnu/libQt5Core.so.5` => `/lib/x86_64-linux-gnu`
qtdir=$(echo "$deps" | sed -nE 's;.+ =>[[:blank:]]*(.+)/libQt.+;\1;p' | head -n1)
# obtain Qt major version
# eg. `/lib/x86_64-linux-gnu/libQt5Core.so.5.1.12` => `5`
qtversion=$(echo "$deps" | sed -nE 's;.+ =>[[:blank:]]*.+/libQt.+\.so\.([1-9]).+;\1;p' | head -n1)
# Qt root dir
qtrootdir="$qtdir/.." # eg. `/lib/x86_64-linux-gnu/qt5`
qtpluginsdir="$qtrootdir/plugins" # eg. `/lib/x86_64-linux-gnu/qt5/plugins`
qt_version=$(echo "$deps" | sed -nE 's;.+ =>[[:blank:]]*.+/libQt.+\.so\.([1-9]).+;\1;p' | head -n1)
#-- Qt for X11 requirements
# see <https://doc.qt.io/qt-5/linux-requirements.html>
......@@ -103,13 +100,14 @@ imageformats="libqgif.so libqico.so libqjpeg.so libqsvg.so"
xcbglintegrations="libqxcb-egl-integration.so libqxcb-glx-integration.so"
# add extra dependencies from the Qt platforms plugin
deps="$deps\n"$(ldd "$qtpluginsdir/platforms/libqxcb.so")
deps="$deps\n"$(ldd "$qt_plugins_dir/platforms/libqxcb.so")
for plg in $imageformats; do
deps="$deps\n"$(ldd "$qtpluginsdir/imageformats/$plg")
deps="$deps\n"$(ldd "$qt_plugins_dir/imageformats/$plg")
done
echo "$TITLE: Qt root dir = '$qtrootdir'"
echo "$TITLE: Qt major version = '$qtversion'"
echo "$TITLE: Qt root dir = '$qt_root_dir'"
echo "$TITLE: Qt major version = '$qt_version'"
echo "$TITLE: Qt plugins dir = '$qt_plugins_dir'"
# collect all the package dependencies (discard duplicates)
deps=$(echo "$deps" | sed -nE $deps_kv_re)
......@@ -145,25 +143,25 @@ for lib in $framework_dir/*.so*; do
done
# copy required Qt plugins to the corresponding directory
pkg_pluginsdir="$pkg_root_dir/plugins"
echo "$TITLE: Copying Qt plugins to '$pkg_pluginsdir'..."
pkg_plugins_dir="$pkg_root_dir/plugins"
echo "$TITLE: Copying Qt plugins from '$qt_plugins_dir' to '$pkg_plugins_dir'..."
# platform plugins
dst="$pkg_pluginsdir/platforms"
dst="$pkg_plugins_dir/platforms"
$MKDIR "$dst"
for plg in $platforms; do
$COPY "$qtpluginsdir/platforms/$plg" "$dst/$plg"
$COPY "$qt_plugins_dir/platforms/$plg" "$dst/$plg"
done
# xcb-GL integrations
dst="$pkg_pluginsdir/xcbglintegrations"
dst="$pkg_plugins_dir/xcbglintegrations"
$MKDIR "$dst"
for plg in $xcbglintegrations; do
$COPY "$qtpluginsdir/xcbglintegrations/$plg" "$dst/$plg"
$COPY "$qt_plugins_dir/xcbglintegrations/$plg" "$dst/$plg"
done
# image formats
dst="$pkg_pluginsdir/imageformats"
dst="$pkg_plugins_dir/imageformats"
$MKDIR "$dst"
for plg in $imageformats; do
$COPY "$qtpluginsdir/imageformats/$plg" "$dst/$plg"
$COPY "$qt_plugins_dir/imageformats/$plg" "$dst/$plg"
done
# final message
......
......@@ -60,14 +60,16 @@ declare -r TITLE="* MacOS Package"
#-- directories for the package binaries
pkg_root="$1" # root dir, eg. '/tmp/bornagain.app/Contents'
main_exe="$pkg_root/MacOS/@MACPK_MAIN_EXE@"
extra_libs="@MACPK_EXTRA_LIBS@"
main_exe="$pkg_root/MacOS/@MACPKG_MAIN_EXE@"
extra_libs="@MACPKG_EXTRA_LIBS@"
# eg. input Qt dir = '/usr/local/opt/qt@5/lib/cmake/Qt'
# => '/usr/local/opt/qt@5'
qtdir="@MACPK_QTDIR@"
qt_framework_root="${qtdir%/lib/*}"
qtdir="@Qt_DIR@"
# Qt plugins paths relative to Qt root dir
qt_plugins_rel_dir="@MACPKG_QT_PLUGINS_RELDIR@"
qt_framework_root="$qtdir"
# list of required Qt plugins
qt_plugins="@MACPK_QT_PLUGINS@"
qt_plugins="@MACPKG_QT_PLUGINS@"
declare -ar qt_plugins=( ${=qt_plugins} )
if [[ -z "$pkg_root" ]]
......@@ -99,7 +101,7 @@ declare -A pkgbindir=(
"exlib" "Library" # external libraries dir
"FW" "$fwdir" # frameworks dir
"FW_qt" "$fwdir" # Qt framework dir
"FW_qt_plug" "@MACPK_QT_PLUGINS_DIR@" # Qt plugins dir
"FW_qt_plug" "@MACPKG_QT_PLUGINS_DIR@" # Qt plugins dir
)
#-- copy extra libraries to the Framework-libraries dir;
......@@ -129,10 +131,10 @@ pkg_plugins_dir="$pkg_root/$pkgbindir[FW_qt_plug]"
for plg in $qt_plugins; do
# full path of the plugin;
# eg. '/opt/qt@5/plugins/platforms/libqcocoa.dylib'
plgpth0="$qt_framework_root/share/qt/$plg"
plgpth0="$qt_framework_root/$qt_plugins_rel_dir/$plg"
# copy the plugin to the same directory under the _package_ plugins dir;
# eg. '<Package>/PlugIns/platforms/libqcocoa.dylib'
pth="$pkg_plugins_dir/${plg#*/}"
pth="$pkg_plugins_dir/$plg"
mkdir -p "${pth%/*}"
cp -fv "$plgpth0" "$pth"
# add Qt plugin to the list of initial binaries
......
......@@ -63,7 +63,7 @@ $test_timer.Stop()
echo "#--- PACKAGING ---"
# build package via NSIS
cpack -C Release -B ./winpackage
cpack -C Release -B ./installer .
echo "----------------------------------------"
echo "#--- Total Build Time = $($build_timer.Elapsed.TotalMinutes) min(s)."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment