diff --git a/deploy_tool/main.cpp b/deploy_tool/main.cpp index 98c843b..6de7b30 100644 --- a/deploy_tool/main.cpp +++ b/deploy_tool/main.cpp @@ -4,13 +4,14 @@ using namespace PICoutManipulators; -PIString cmd_copy, cmd_copydir; +PIString cmd_copy, cmd_copydir, cmd_suffix; PIString qplatforms; void setCommands() { #ifdef WINDOWS cmd_copy = "copy /y "; cmd_copydir = "copy /y "; + cmd_suffix = " 1> NUL"; qplatforms = "windows"; #else cmd_copy = "cp -f "; @@ -206,9 +207,9 @@ void copyWildcard(const PIString & from, const PIString & to) { PIDir(to).make(); #ifdef WINDOWS PIFile::FileInfo fi; fi.path = from; - system("robocopy \"" + fi.dir() + "\" \"" + to + "\" \"" + fi.name() + "\" /NJH /NJS /NP /NDL /NS /NC /NFL"); + system("robocopy \"" + fi.dir() + "\" \"" + to + "\" \"" + fi.name() + "\" /NJH /NJS /NP /NDL /NS /NC /NFL 1> NUL"); #else - system(cmd_copy + from + " \"" + to + "/\""); + system(cmd_copy + from + " \"" + to + "/\"" + cmd_suffix); #endif } @@ -357,7 +358,7 @@ int main(int argc, char * argv[]) { piForeachC (PIString & l, clibs) { piCout << "copy" << l; if (!fake) - system(cmd_copy + "\"" + l + "\" \"" + out_dir + "\""); + system(cmd_copy + "\"" + l + "\" \"" + out_dir + "\"" + cmd_suffix); } PIVector fwdirs = frameworks.toVector(); piForeachC (PIString & f, fwdirs) { @@ -365,7 +366,7 @@ int main(int argc, char * argv[]) { if (!fd.isEmpty()) { piCout << "copy framework" << f; if (!fake) - system(cmd_copydir + "\"" + fd + "\" \"" + out_dir + "\""); + system(cmd_copydir + "\"" + fd + "\" \"" + out_dir + "\"" + cmd_suffix); } else miss_frameworks << f; } diff --git a/qad/CMakeLists.txt b/qad/CMakeLists.txt index 88ecab4..6b8e8d1 100644 --- a/qad/CMakeLists.txt +++ b/qad/CMakeLists.txt @@ -112,7 +112,7 @@ macro(qad_plugin NAME _MODULES _LIBS) qt_wrap(${SRC} CPPS out_CPP QMS out_QM) qt_add_library(${PROJ_NAME} SHARED out_CPP) qt_target_link_libraries(${PROJ_NAME} ${_LIBS} qad_${NAME} ${_${NAME}_PLUGIN_LIBS}) - qt_install(TARGETS ${PROJ_NAME} DESTINATION QtPlugins/designer) + qt_install(TARGETS ${PROJ_NAME} RUNTIME DESTINATION QtPlugins/designer) endif() endif() endmacro() diff --git a/qad/QADDeploy.cmake b/qad/QADDeploy.cmake index c3cde59..ecefa72 100644 --- a/qad/QADDeploy.cmake +++ b/qad/QADDeploy.cmake @@ -164,6 +164,40 @@ macro(deploy_target _T) endif() endforeach() #message("app depend libpath ${_DEP_LIBPATH}") + if (WIN32) + if (NOT CMAKE_OBJDUMP) + find_program(CMAKE_OBJDUMP objdump) + endif() + set(_AGD "${_DEPLOY_DIR}/${_TV}") + set(_SEP "/") + set(_COPY "cp" "-rf") + set(_COPY_SUFFIX) + set(_MKDIR "mkdir" "-p" "${_AGD}") + set(_MKDIR_L "mkdir" "-p" "${_AGD}/lang") + if ("x${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "xWindows") + set(_SEP "\\") + set(_COPY "xcopy" "/y" "/r") + set(_COPY_SUFFIX "1>" "NUL") + file(TO_NATIVE_PATH "${_AGD}/" _AGD) + file(TO_NATIVE_PATH "${_DEPLOY_DIR}/" _DEPLOY_DIR) + string(REPLACE "/" "\\" _AGD "${_AGD}") + string(REPLACE "/" "\\" _DEPLOY_DIR "${_DEPLOY_DIR}") + string(REPLACE "/" "\\" CMAKE_OBJDUMP "${CMAKE_OBJDUMP}") + set(_MKDIR "if" "not" "exist" "\"${_AGD}\"" "mkdir" "\"${_AGD}\"") + set(_MKDIR_L "if" "not" "exist" "\"${_AGD}lang\"" "mkdir" "\"${_AGD}lang\"") + endif() + add_custom_target(deploy + # gather dir + COMMAND ${_MKDIR} + COMMAND ${_MKDIR_L} + COMMAND ${_COPY} "\"${_DEPLOY_DIR}${_T}.exe\"" "\"${_AGD}\"" ${_COPY_SUFFIX} + COMMAND ${_COPY} "\"${_DEPLOY_DIR}lang${_SEP}*\"" "\"${_AGD}lang${_SEP}\"" ${_COPY_SUFFIX} + COMMAND deploy_tool -W "\"${CMAKE_OBJDUMP}\"" -P windows -S windows -q "\"${Qt5_ROOT}\"" -s "\"${CMAKE_PREFIX_PATH}/bin\;${MINGW_BIN};${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" + # zip + COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -r "\"${_DESTINATION}/${_TV}.zip\"" "\"${_TV}\"" + COMMENT "Generating ${_TV}.zip" + ) + endif() if (APPLE) set(MACOSX_BUNDLE_GUI_IDENTIFIER "${${_T}_FULLNAME}") set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${${_T}_VERSION}") diff --git a/qglengine/plugin/CMakeLists.txt b/qglengine/plugin/CMakeLists.txt index 5e6097b..d95c556 100644 --- a/qglengine/plugin/CMakeLists.txt +++ b/qglengine/plugin/CMakeLists.txt @@ -10,5 +10,5 @@ if (DESIGNER_PLUGINS) qt_wrap(${SRC} CPPS out_CPP QMS out_QM) qt_add_library(${PROJECT_NAME} SHARED out_CPP) qt_target_link_libraries(${PROJECT_NAME} qglengine) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION QtPlugins/designer) + qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtPlugins/designer) endif() diff --git a/qglview/plugin/CMakeLists.txt b/qglview/plugin/CMakeLists.txt index 4e8cac3..9f6154c 100644 --- a/qglview/plugin/CMakeLists.txt +++ b/qglview/plugin/CMakeLists.txt @@ -10,5 +10,5 @@ if (DESIGNER_PLUGINS) qt_wrap(${SRC} CPPS out_CPP QMS out_QM) qt_add_library(${PROJECT_NAME} SHARED out_CPP) qt_target_link_libraries(${PROJECT_NAME} qglview) - qt_install(TARGETS ${PROJECT_NAME} DESTINATION QtPlugins/designer) + qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtPlugins/designer) endif()