git-svn-id: svn://db.shs.com.ru/pip@1018 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2020-04-16 07:24:03 +00:00
parent 9643bc7f57
commit d093942330
2 changed files with 22 additions and 13 deletions

View File

@@ -133,6 +133,7 @@ set(_modules_dir "${CMAKE_ROOT}/Modules")
if (LIBPROJECT) if (LIBPROJECT)
set(_modules_dir ${PIP_CMAKE_MODULE_PATH}) set(_modules_dir ${PIP_CMAKE_MODULE_PATH})
endif() endif()
set(_dt_delim "::")
macro(set_version _T) macro(set_version _T)
@@ -491,7 +492,7 @@ macro(deploy_target _T)
#message("depend on ${_L}") #message("depend on ${_L}")
get_target_property(_LT ${_L} TYPE) get_target_property(_LT ${_L} TYPE)
if ("x${_LT}" STREQUAL "xSHARED_LIBRARY") if ("x${_LT}" STREQUAL "xSHARED_LIBRARY")
set(_DEP_LIBPATH "${_DEP_LIBPATH}!$<TARGET_FILE_DIR:${_L}>") set(_DEP_LIBPATH "${_DEP_LIBPATH}${_dt_delim}$<TARGET_FILE_DIR:${_L}>")
set(_DEP_LIBS_CS "${_DEP_LIBS_CS};$<TARGET_FILE_DIR:${_L}>/$<TARGET_FILE_NAME:${_L}>") set(_DEP_LIBS_CS "${_DEP_LIBS_CS};$<TARGET_FILE_DIR:${_L}>/$<TARGET_FILE_NAME:${_L}>")
set(_DEP_LIBS "${_DEP_LIBS}" "$<TARGET_FILE_DIR:${_L}>/$<TARGET_FILE_NAME:${_L}>") set(_DEP_LIBS "${_DEP_LIBS}" "$<TARGET_FILE_DIR:${_L}>/$<TARGET_FILE_NAME:${_L}>")
endif() endif()
@@ -601,7 +602,7 @@ macro(deploy_target _T)
# gather dir # gather dir
${_CMD_} ${_CMD_}
COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -P windows,minimal -S windows -q "\"${Qt5_ROOT}\"" -s "\"${CMAKE_PREFIX_PATH}/bin!${MINGW_BIN}!${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" ${_ADD_DEPS} COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -P windows,minimal -S windows -q "\"${Qt5_ROOT}\"" -s "\"${CMAKE_PREFIX_PATH}/bin${_dt_delim}${MINGW_BIN}${_dt_delim}${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" ${_ADD_DEPS}
# zip # zip
COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -r "\"${_DESTINATION}/${_TV}.zip\"" "\"${_TV}_win_${MY_ARCH}\"" COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -r "\"${_DESTINATION}/${_TV}.zip\"" "\"${_TV}_win_${MY_ARCH}\""
COMMENT "Generating ${_TV}.zip" COMMENT "Generating ${_TV}.zip"
@@ -627,6 +628,12 @@ macro(deploy_target _T)
if (_ICON_NAME) if (_ICON_NAME)
set(_CMD_ ${_CMD_} COMMAND cp ${_VERB} -f ${_ICON_FN} ${_AGD}/Contents/Resources) set(_CMD_ ${_CMD_} COMMAND cp ${_VERB} -f ${_ICON_FN} ${_AGD}/Contents/Resources)
endif() endif()
if (NOT CMAKE_OTOOL)
set(CMAKE_OTOOL "otool")
endif()
if (NOT CMAKE_PREFIX_PATH)
set(CMAKE_PREFIX_PATH "/usr/local")
endif()
add_custom_target(deploy_${_T} add_custom_target(deploy_${_T}
# gather .app dir # gather .app dir
COMMAND mkdir ${_VERB} -p ${_AGD}/Contents/Resources COMMAND mkdir ${_VERB} -p ${_AGD}/Contents/Resources
@@ -635,7 +642,7 @@ macro(deploy_target _T)
${_CMD_} ${_CMD_}
#COMMAND cp ${_ICON_FN} ${_AGD}/Contents/Resources #COMMAND cp ${_ICON_FN} ${_AGD}/Contents/Resources
#COMMAND cp -r ${_DEPLOY_DIR}/lang ${_AGD}/Contents/Resources #COMMAND cp -r ${_DEPLOY_DIR}/lang ${_AGD}/Contents/Resources
COMMAND deploy_tool ${_VERB} ${_OPTIONS} -M "${CMAKE_OTOOL}" -P cocoa,minimal -S mac -q ${Qt5_ROOT} -s "\"${CMAKE_PREFIX_PATH}/lib!${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD}/Contents/Frameworks -p ${_AGD}/Contents/PlugIns ${_AGD}/Contents/MacOS/${_T} ${_ADD_DEPS} COMMAND deploy_tool ${_VERB} ${_OPTIONS} -M "${CMAKE_OTOOL}" -P cocoa,minimal -S mac -q ${Qt5_ROOT} -s "\"${CMAKE_PREFIX_PATH}/lib${_dt_delim}${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD}/Contents/Frameworks -p ${_AGD}/Contents/PlugIns ${_AGD}/Contents/MacOS/${_T} ${_ADD_DEPS}
# prepare dmg dir # prepare dmg dir
COMMAND rm -rf ${_DMG} COMMAND rm -rf ${_DMG}
COMMAND mkdir ${_VERB} -p ${_DMG} COMMAND mkdir ${_VERB} -p ${_DMG}
@@ -721,7 +728,7 @@ macro(deploy_target _T)
string(REPLACE "${ANDROID_SYSROOT_${ANDROID_ABI}}" "${ANDROID_SYSROOT_${_a}}" _lib_${_a} "${_lib_}") string(REPLACE "${ANDROID_SYSROOT_${ANDROID_ABI}}" "${ANDROID_SYSROOT_${_a}}" _lib_${_a} "${_lib_}")
#message("search = ${_a_prefix}/lib") #message("search = ${_a_prefix}/lib")
__make_copy(_CMD_ _empty _lib_${_a} "${_AGD}/libs/${_a}") __make_copy(_CMD_ _empty _lib_${_a} "${_AGD}/libs/${_a}")
set(_CMD_ ${_CMD_} COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -s "${_a_prefix}/lib!${Qt5_ROOT}/lib" -o "\"${_AGD}/libs/${_a}\"" --ignore "\"c!m!dl\"" "\"${_AGD}/libs/${_a}/lib${_AT}_${_a}.so\"" ${_ADD_DEPS}) set(_CMD_ ${_CMD_} COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -s "${_a_prefix}/lib${_dt_delim}${Qt5_ROOT}/lib" -o "\"${_AGD}/libs/${_a}\"" --ignore "\"c${_dt_delim}m${_dt_delim}z${_dt_delim}dl${_dt_delim}log\"" "\"${_AGD}/libs/${_a}/lib${_AT}_${_a}.so\"" ${_ADD_DEPS})
#message("c++_${_a} -> ${_lib_${_a}}") #message("c++_${_a} -> ${_lib_${_a}}")
endif() endif()
endforeach() endforeach()

View File

@@ -2,6 +2,8 @@
#include <pidir.h> #include <pidir.h>
#include <piprocess.h> #include <piprocess.h>
#define DELIM "::"
using namespace PICoutManipulators; using namespace PICoutManipulators;
PIString cmd_copy, cmd_copydir, cmd_suffix; PIString cmd_copy, cmd_copydir, cmd_suffix;
@@ -36,8 +38,8 @@ void usage() {
piCout << "If some Qt dependency found, copy corresponding Qt plugins."; piCout << "If some Qt dependency found, copy corresponding Qt plugins.";
piCout << "Styles and platforms selected by -S and -P flags,"; piCout << "Styles and platforms selected by -S and -P flags,";
piCout << "any other plugins described by --qt-plugins flag in next format:"; piCout << "any other plugins described by --qt-plugins flag in next format:";
piCout << "\"[*=!]<plugins>=<regexp>,<regexp>!<plugins>=<regexp>,<regexp>\", e.g."; piCout << "\"[*="DELIM"]<plugins>=<regexp>,<regexp>"DELIM"<plugins>=<regexp>,<regexp>\", e.g.";
piCout << "\"sqldrivers=lite,mysql!geoservices=!position=nmea\"."; piCout << "\"sqldrivers=lite,mysql"DELIM"geoservices="DELIM"position=nmea\".";
piCout << "If no regexp specified for plugins, nothing will be copied."; piCout << "If no regexp specified for plugins, nothing will be copied.";
piCout << "Default regexp set by \"*=<regexp>\"."; piCout << "Default regexp set by \"*=<regexp>\".";
piCout << "\"*=\" disable optional plugins."; piCout << "\"*=\" disable optional plugins.";
@@ -54,8 +56,8 @@ void usage() {
piCout << ""; piCout << "";
piCout << Bold << "Processing control"; piCout << Bold << "Processing control";
piCout << "-f, --fake " << Green << "- don`t copy, only print"; piCout << "-f, --fake " << Green << "- don`t copy, only print";
piCout << "-s <search_path> " << Green << "- set search pathes for system libraries, may be separated by \"!\", default \"/usr/lib\""; piCout << "-s <search_path> " << Green << "- set search pathes for system libraries, may be separated by \""DELIM"\", default \"/usr/lib\"";
piCout << "--ignore <libs> " << Green << "- ignore libraries names, may be separated by \"!\", default \"\""; piCout << "--ignore <libs> " << Green << "- ignore libraries names, may be separated by \""DELIM"\", default \"\"";
piCout << "-l <ldd> " << Green << "- \"ldd\" path, default \"/usr/bin/ldd\""; piCout << "-l <ldd> " << Green << "- \"ldd\" path, default \"/usr/bin/ldd\"";
piCout << "-L <readelf> " << Green << "- \"readelf\" path, overrides \"ldd\""; piCout << "-L <readelf> " << Green << "- \"readelf\" path, overrides \"ldd\"";
piCout << "-W <objdump> " << Green << "- \"objdump\" path, overrides \"ldd\""; piCout << "-W <objdump> " << Green << "- \"objdump\" path, overrides \"ldd\"";
@@ -79,7 +81,7 @@ void usage() {
piCout << ""; piCout << "";
piCout << Bold << "Input control"; piCout << Bold << "Input control";
piCout << "<file> ... " << Green << "- executable to process"; piCout << "<file> ... " << Green << "- executable to process";
piCout << "-a <add_libs> " << Green << "- additional libs, separated by \"!\". Libraries will be searched in <search_path>"; piCout << "-a <add_libs> " << Green << "- additional libs, separated by \""DELIM"\". Libraries will be searched in <search_path>";
} }
struct QtDep { struct QtDep {
@@ -391,9 +393,9 @@ int main(int argc, char * argv[]) {
piDebug = cli.hasArgument("verbose"); piDebug = cli.hasArgument("verbose");
is_deps = cli.hasArgument("dependencies"); is_deps = cli.hasArgument("dependencies");
out_dir = cli.argumentValue("output"); out_dir = cli.argumentValue("output");
lib_dirs = cli.argumentValue("search_path").split("!"); lib_dirs = cli.argumentValue("search_path").split(DELIM);
add_libs = cli.argumentValue("add_libs").split("!"); add_libs = cli.argumentValue("add_libs").split(DELIM);
ignore_libs = cli.argumentValue("ignore").split("!"); ignore_libs = cli.argumentValue("ignore").split(DELIM);
qt_dir = cli.argumentValue("qtdir"); qt_dir = cli.argumentValue("qtdir");
ldd = cli.argumentValue("ldd"); ldd = cli.argumentValue("ldd");
readelf = cli.argumentValue("Lreadelf"); readelf = cli.argumentValue("Lreadelf");
@@ -446,7 +448,7 @@ int main(int argc, char * argv[]) {
platforms = qplatforms.split(","); platforms = qplatforms.split(",");
styles = cli.argumentValue("Styles").split(","); styles = cli.argumentValue("Styles").split(",");
if (styles.isEmpty()) styles << ""; if (styles.isEmpty()) styles << "";
PIStringList qpd = cli.argumentValue("qt-plugins").toLowerCase().split("!"); PIStringList qpd = cli.argumentValue("qt-plugins").toLowerCase().split(DELIM);
piForeachC (PIString & qp, qpd) { piForeachC (PIString & qp, qpd) {
int _i = qp.indexOf("="); int _i = qp.indexOf("=");
if (_i < 0) continue; if (_i < 0) continue;