CROSSTOOLS support

This commit is contained in:
2020-05-04 12:51:01 +03:00
parent 920d13685c
commit 3386c7702c
4 changed files with 253 additions and 232 deletions

View File

@@ -155,9 +155,11 @@ if (NOT DEFINED PIP_CMG)
if (CMAKE_CROSSCOMPILING OR (DEFINED ANDROID_PLATFORM)) if (CMAKE_CROSSCOMPILING OR (DEFINED ANDROID_PLATFORM))
set(PIP_CMG "pip_cmg") set(PIP_CMG "pip_cmg")
set(PIP_RC "pip_rc") set(PIP_RC "pip_rc")
set(PIP_DEPLOY_TOOL "deploy_tool")
else() else()
set(PIP_CMG "${CMAKE_CURRENT_BINARY_DIR}/utils/code_model_generator/pip_cmg") set(PIP_CMG "${CMAKE_CURRENT_BINARY_DIR}/utils/code_model_generator/pip_cmg")
set(PIP_RC "${CMAKE_CURRENT_BINARY_DIR}/utils/resources_compiler/pip_rc") set(PIP_RC "${CMAKE_CURRENT_BINARY_DIR}/utils/resources_compiler/pip_rc")
set(PIP_DEPLOY_TOOL "${CMAKE_CURRENT_BINARY_DIR}/utils/deploy_tool/deploy_tool")
endif() endif()
endif() endif()
@@ -395,7 +397,8 @@ generate_export_header(pip)
list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_export.h") list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_export.h")
target_link_libraries(pip ${PIP_LIBS}) target_link_libraries(pip ${PIP_LIBS})
if (NOT PIP_FREERTOS) if (NOT CROSSTOOLS)
if (NOT PIP_FREERTOS)
# Check if USB is supported # Check if USB is supported
find_library(usb_FOUND usb SHARED) find_library(usb_FOUND usb SHARED)
if(usb_FOUND) if(usb_FOUND)
@@ -616,7 +619,8 @@ if (NOT PIP_FREERTOS)
target_link_libraries(pip_test pip) target_link_libraries(pip_test pip)
endif() endif()
else(NOT PIP_FREERTOS) else()
message(STATUS "Building PIP with crypt support") message(STATUS "Building PIP with crypt support")
add_definitions(-DPIP_CRYPT) add_definitions(-DPIP_CRYPT)
add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT}) add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT})
@@ -633,15 +637,19 @@ else(NOT PIP_FREERTOS)
add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS}) add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS})
target_link_libraries(pip_compress pip) target_link_libraries(pip_compress pip)
list(APPEND PIP_LIBS_TARGETS pip_compress) list(APPEND PIP_LIBS_TARGETS pip_compress)
endif(NOT PIP_FREERTOS)
endif()
endif()
# Install # Install
# Check if system or local install will be used (to system install use "-DLIB=" argument of cmake) # Check if system or local install will be used (to system install use "-DLIB=" argument of cmake)
if(LIB) if(LIB)
if(WIN32) if(WIN32)
if(MINGW) if(MINGW)
if (NOT CROSSTOOLS)
install(FILES ${HDRS} DESTINATION ${MINGW_INCLUDE}/pip) install(FILES ${HDRS} DESTINATION ${MINGW_INCLUDE}/pip)
install(TARGETS ${PIP_LIBS_TARGETS} ARCHIVE DESTINATION ${MINGW_LIB}) install(TARGETS ${PIP_LIBS_TARGETS} ARCHIVE DESTINATION ${MINGW_LIB})
endif()
install(TARGETS ${PIP_LIBS_TARGETS} RUNTIME DESTINATION ${MINGW_BIN}) install(TARGETS ${PIP_LIBS_TARGETS} RUNTIME DESTINATION ${MINGW_BIN})
find_library(STDLIB "stdc++-6" PATHS ${MINGW_BIN} NO_DEFAULT_PATH) find_library(STDLIB "stdc++-6" PATHS ${MINGW_BIN} NO_DEFAULT_PATH)
find_library(STDLIB "stdc++-6") find_library(STDLIB "stdc++-6")
@@ -649,13 +657,16 @@ if(LIB)
if (STDLIB) if (STDLIB)
file(COPY "${STDLIB}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/utils/code_model_generator") file(COPY "${STDLIB}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/utils/code_model_generator")
file(COPY "${STDLIB}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/utils/resources_compiler") file(COPY "${STDLIB}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/utils/resources_compiler")
file(COPY "${STDLIB}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/utils/deploy_tool")
endif() endif()
else() else()
#message("${CMAKE_CURRENT_BINARY_DIR}/pip_export.h") #message("${CMAKE_CURRENT_BINARY_DIR}/pip_export.h")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pip_export.h DESTINATION include) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pip_export.h DESTINATION include)
endif() endif()
else() else()
if (NOT CROSSTOOLS)
install(FILES ${HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/pip) install(FILES ${HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/pip)
endif()
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
endif() endif()
message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"") message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"")
@@ -684,17 +695,18 @@ endif()
if(NOT PIP_FREERTOS) if(NOT PIP_FREERTOS)
# Auxiliary # Auxiliary
if (NOT CROSSTOOLS)
add_subdirectory("${PIP_SRC_MAIN}/auxiliary/piterminal") add_subdirectory("${PIP_SRC_MAIN}/auxiliary/piterminal")
endif()
# Utils # Utils
add_subdirectory("utils/code_model_generator") add_subdirectory("utils/code_model_generator")
add_subdirectory("utils/resources_compiler") add_subdirectory("utils/resources_compiler")
if(PIP_UTILS) add_subdirectory("utils/deploy_tool")
if(PIP_UTILS AND (NOT CROSSTOOLS))
add_subdirectory("utils/system_test") add_subdirectory("utils/system_test")
add_subdirectory("utils/remote_console") add_subdirectory("utils/remote_console")
add_subdirectory("utils/udp_file_transfer") add_subdirectory("utils/udp_file_transfer")
add_subdirectory("utils/deploy_tool")
if(sodium_FOUND) if(sodium_FOUND)
add_subdirectory("utils/system_daemon") add_subdirectory("utils/system_daemon")
add_subdirectory("utils/crypt_tool") add_subdirectory("utils/crypt_tool")
@@ -745,7 +757,7 @@ endif()
# ) # )
# install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc) # install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc)
# endif() # endif()
if (NOT PIP_FREERTOS) if ((NOT PIP_FREERTOS) AND (NOT CROSSTOOLS))
include(PIPDocumentation) include(PIPDocumentation)
find_package(Doxygen) find_package(Doxygen)
if(DOXYGEN_FOUND) if(DOXYGEN_FOUND)

View File

@@ -631,9 +631,14 @@ macro(deploy_target _T)
if (_ICON_NAME) if (_ICON_NAME)
set(_CMD_ ${_CMD_} COMMAND cp ${_VERB} -f ${_ICON_FN} ${_AGD}/usr/share/pixmaps) set(_CMD_ ${_CMD_} COMMAND cp ${_VERB} -f ${_ICON_FN} ${_AGD}/usr/share/pixmaps)
endif() endif()
set(_bintool -l "${CMAKE_LDD}") set(_dt_opts -l "${CMAKE_LDD}")
if (CMAKE_CROSSCOMPILING) if (CMAKE_CROSSCOMPILING)
set(_bintool -L "${CMAKE_READELF}" --dpkg-workdir "${CMAKE_DPKG_WORKDIR}") set(_dt_searchdirs "${CMAKE_PREFIX_PATH}/lib")
if (NOT "x${CMAKE_LIBRARY_ARCHITECTURE}" STREQUAL "x")
set(_dt_searchdirs "${_dt_searchdirs}${_dt_delim}${CMAKE_PREFIX_PATH}/lib/${CMAKE_LIBRARY_ARCHITECTURE}")
set(_dt_searchdirs "${_dt_searchdirs}${_dt_delim}${CMAKE_PREFIX_PATH}/../lib/${CMAKE_LIBRARY_ARCHITECTURE}")
endif()
set(_dt_opts -L "${CMAKE_READELF}" --dpkg-workdir "${CMAKE_DPKG_WORKDIR}" -s "${_dt_searchdirs}")
endif() endif()
set(_deb_name "${_TV}_debian_${_DEB_ARCH}.deb") set(_deb_name "${_TV}_debian_${_DEB_ARCH}.deb")
add_custom_target(deploy_${_T} add_custom_target(deploy_${_T}
@@ -650,7 +655,7 @@ macro(deploy_target _T)
COMMAND echo "Version: ${_DEBVERSION}" ${_C_echo} COMMAND echo "Version: ${_DEBVERSION}" ${_C_echo}
COMMAND echo "Architecture: ${_DEB_ARCH}" ${_C_echo} COMMAND echo "Architecture: ${_DEB_ARCH}" ${_C_echo}
COMMAND echo "Maintainer: ${${_T}_COMPANY} <>" ${_C_echo} COMMAND echo "Maintainer: ${${_T}_COMPANY} <>" ${_C_echo}
COMMAND deploy_tool ${_OPTIONS} --prefix "Depends: " --dependencies ${_bintool} -a "${_DEP_LIBS_CS}" -o "${_AGD}/usr/lib" ${_DEPLOY_DIR}/${_T} ${_ADD_DEPS} ${_C_echo} COMMAND ${PIP_DEPLOY_TOOL} ${_OPTIONS} --prefix "Depends: " --dependencies ${_dt_opts} -a "${_DEP_LIBS_CS}" -o "${_AGD}/usr/lib" ${_DEPLOY_DIR}/${_T} ${_ADD_DEPS} ${_C_echo}
COMMAND echo "Conflicts:" ${_C_echo} COMMAND echo "Conflicts:" ${_C_echo}
COMMAND echo "Replaces:" ${_C_echo} COMMAND echo "Replaces:" ${_C_echo}
COMMAND echo "Section: misc" ${_C_echo} COMMAND echo "Section: misc" ${_C_echo}
@@ -700,7 +705,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${_dt_delim}${MINGW_BIN}${_add_search_path}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" ${_ADD_DEPS} COMMAND ${PIP_DEPLOY_TOOL} ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -P windows,minimal -S windows -q "\"${Qt5_ROOT}\"" -s "\"${CMAKE_PREFIX_PATH}/bin${_dt_delim}${MINGW_BIN}${_add_search_path}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" ${_ADD_DEPS}
# zip # zip
COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -r "\"${_DESTINATION}/${_zip_name}\"" "\"${_TV}_win_${MY_ARCH}\"" COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -r "\"${_DESTINATION}/${_zip_name}\"" "\"${_TV}_win_${MY_ARCH}\""
COMMENT "Generating ${_zip_name}" COMMENT "Generating ${_zip_name}"
@@ -759,7 +764,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${_add_search_path}\"" -o ${_AGD}/Contents/Frameworks -p ${_AGD}/Contents/PlugIns ${_AGD}/Contents/MacOS/${_T} ${_ADD_DEPS} COMMAND ${PIP_DEPLOY_TOOL} ${_VERB} ${_OPTIONS} -M "${CMAKE_OTOOL}" -P cocoa,minimal -S mac -q ${Qt5_ROOT} -s "\"${CMAKE_PREFIX_PATH}/lib${_add_search_path}\"" -o ${_AGD}/Contents/Frameworks -p ${_AGD}/Contents/PlugIns ${_AGD}/Contents/MacOS/${_T} ${_ADD_DEPS}
#${_cmd_int} #${_cmd_int}
# prepare dmg dir # prepare dmg dir
COMMAND rm -rf ${_DMG} COMMAND rm -rf ${_DMG}
@@ -846,7 +851,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${_dt_delim}${Qt5_ROOT}/lib${_add_search_path}" -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}) set(_CMD_ ${_CMD_} COMMAND ${PIP_DEPLOY_TOOL} ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -s "${_a_prefix}/lib${_dt_delim}${Qt5_ROOT}/lib${_add_search_path}" -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

@@ -80,6 +80,7 @@ find_file(PIP_H_INCLUDE "pip.h" HINTS ${_PIP_INCDIR} $ENV{SMSDK_DIR}/include/pip
#endif() #endif()
find_program(PIP_CMG pip_cmg HINTS ${_PIP_BINDIR} ${_PIP_FP_DP}) find_program(PIP_CMG pip_cmg HINTS ${_PIP_BINDIR} ${_PIP_FP_DP})
find_program(PIP_RC pip_rc HINTS ${_PIP_BINDIR} ${_PIP_FP_DP}) find_program(PIP_RC pip_rc HINTS ${_PIP_BINDIR} ${_PIP_FP_DP})
find_program(PIP_DEPLOY_TOOL deploy_tool HINTS ${_PIP_BINDIR} ${_PIP_FP_DP})
if (NOT PIP_LIBRARY) if (NOT PIP_LIBRARY)
message(FATAL_ERROR "Can`t find PIP library!") message(FATAL_ERROR "Can`t find PIP library!")
endif() endif()

View File

@@ -366,7 +366,10 @@ bool procDpkg(const PIString & l) {
PIString dpkgdir; PIString dpkgdir;
if (!dpkg_workdir.isEmpty()) if (!dpkg_workdir.isEmpty())
dpkgdir = " --admindir=" + dpkg_workdir; dpkgdir = " --admindir=" + dpkg_workdir;
PIString cmd = dpkg + dpkgdir + " -S " + l + " 2> /dev/null"; PIFile::FileInfo fi;
fi.path = l;
PIString cmd = dpkg + dpkgdir + " -S " + fi.name() + " 2> /dev/null";
//PICout(true) << cmd;
PIString vs = execute(cmd); PIString vs = execute(cmd);
if (!vs.isEmpty()) { if (!vs.isEmpty()) {
vs = vs.left(vs.find(":")); vs = vs.left(vs.find(":"));