CROSSTOOLS support
This commit is contained in:
462
CMakeLists.txt
462
CMakeLists.txt
@@ -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,253 +397,259 @@ 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)
|
||||||
# Check if USB is supported
|
if (NOT PIP_FREERTOS)
|
||||||
find_library(usb_FOUND usb SHARED)
|
# Check if USB is supported
|
||||||
if(usb_FOUND)
|
find_library(usb_FOUND usb SHARED)
|
||||||
message(STATUS "Building PIP with USB support")
|
if(usb_FOUND)
|
||||||
import_version(pip_usb pip)
|
message(STATUS "Building PIP with USB support")
|
||||||
set_deploy_property(pip_usb ${PIP_LIB_TYPE}
|
import_version(pip_usb pip)
|
||||||
LABEL "PIP usb support"
|
set_deploy_property(pip_usb ${PIP_LIB_TYPE}
|
||||||
FULLNAME "${_PIP_DOMAIN}.pip_usb"
|
LABEL "PIP usb support"
|
||||||
COMPANY "${_PIP_COMPANY}"
|
FULLNAME "${_PIP_DOMAIN}.pip_usb"
|
||||||
INFO "Platform-Independent Primitives")
|
COMPANY "${_PIP_COMPANY}"
|
||||||
make_rc(pip_usb _RC)
|
INFO "Platform-Independent Primitives")
|
||||||
add_definitions(-DPIP_USB)
|
make_rc(pip_usb _RC)
|
||||||
add_library(pip_usb ${PIP_LIB_TYPE} ${CPP_LIB_USB} ${_RC})
|
add_definitions(-DPIP_USB)
|
||||||
target_link_libraries(pip_usb pip ${usb_FOUND})
|
add_library(pip_usb ${PIP_LIB_TYPE} ${CPP_LIB_USB} ${_RC})
|
||||||
list(APPEND LIBS_STATUS usb)
|
target_link_libraries(pip_usb pip ${usb_FOUND})
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_usb)
|
list(APPEND LIBS_STATUS usb)
|
||||||
else()
|
list(APPEND PIP_LIBS_TARGETS pip_usb)
|
||||||
message(STATUS "Building PIP without USB support")
|
else()
|
||||||
endif()
|
message(STATUS "Building PIP without USB support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Check if PIP support cryptographic encryption/decryption using sodium library
|
# Check if PIP support cryptographic encryption/decryption using sodium library
|
||||||
find_library(sodium_FOUND sodium)
|
find_library(sodium_FOUND sodium)
|
||||||
if(sodium_FOUND)
|
if(sodium_FOUND)
|
||||||
message(STATUS "Building PIP with crypt support")
|
message(STATUS "Building PIP with crypt support")
|
||||||
import_version(pip_crypt pip)
|
import_version(pip_crypt pip)
|
||||||
set_deploy_property(pip_crypt ${PIP_LIB_TYPE}
|
set_deploy_property(pip_crypt ${PIP_LIB_TYPE}
|
||||||
LABEL "PIP crypt support"
|
LABEL "PIP crypt support"
|
||||||
FULLNAME "${_PIP_DOMAIN}.pip_crypt"
|
FULLNAME "${_PIP_DOMAIN}.pip_crypt"
|
||||||
COMPANY "${_PIP_COMPANY}"
|
COMPANY "${_PIP_COMPANY}"
|
||||||
INFO "Platform-Independent Primitives")
|
INFO "Platform-Independent Primitives")
|
||||||
make_rc(pip_crypt _RC)
|
make_rc(pip_crypt _RC)
|
||||||
add_definitions(-DPIP_CRYPT)
|
add_definitions(-DPIP_CRYPT)
|
||||||
add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT} ${_RC})
|
add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT} ${_RC})
|
||||||
target_link_libraries(pip_crypt pip ${sodium_FOUND})
|
target_link_libraries(pip_crypt pip ${sodium_FOUND})
|
||||||
list(APPEND LIBS_STATUS sodium)
|
list(APPEND LIBS_STATUS sodium)
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_crypt)
|
list(APPEND PIP_LIBS_TARGETS pip_crypt)
|
||||||
else()
|
else()
|
||||||
message(STATUS "Building PIP without crypt support")
|
message(STATUS "Building PIP without crypt support")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Check if PIP support compress/decompress using zlib library
|
# Check if PIP support compress/decompress using zlib library
|
||||||
find_library(zlib_FOUND NAMES z zlib)
|
find_library(zlib_FOUND NAMES z zlib)
|
||||||
if(zlib_FOUND)
|
if(zlib_FOUND)
|
||||||
message(STATUS "Building PIP with zlib compress support")
|
message(STATUS "Building PIP with zlib compress support")
|
||||||
import_version(pip_compress pip)
|
import_version(pip_compress pip)
|
||||||
set_deploy_property(pip_compress ${PIP_LIB_TYPE}
|
set_deploy_property(pip_compress ${PIP_LIB_TYPE}
|
||||||
LABEL "PIP compression support"
|
LABEL "PIP compression support"
|
||||||
FULLNAME "${_PIP_DOMAIN}.pip_compress"
|
FULLNAME "${_PIP_DOMAIN}.pip_compress"
|
||||||
COMPANY "${_PIP_COMPANY}"
|
COMPANY "${_PIP_COMPANY}"
|
||||||
INFO "Platform-Independent Primitives")
|
INFO "Platform-Independent Primitives")
|
||||||
make_rc(pip_compress _RC)
|
make_rc(pip_compress _RC)
|
||||||
add_definitions(-DPIP_COMPRESS)
|
add_definitions(-DPIP_COMPRESS)
|
||||||
add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS} ${_RC})
|
add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS} ${_RC})
|
||||||
target_link_libraries(pip_compress pip ${zlib_FOUND})
|
target_link_libraries(pip_compress pip ${zlib_FOUND})
|
||||||
list(APPEND LIBS_STATUS zlib)
|
list(APPEND LIBS_STATUS zlib)
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_compress)
|
list(APPEND PIP_LIBS_TARGETS pip_compress)
|
||||||
else()
|
else()
|
||||||
message(STATUS "Building PIP without compress support")
|
message(STATUS "Building PIP without compress support")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Check if PIP support fftw3 for PIFFT using in math module
|
# Check if PIP support fftw3 for PIFFT using in math module
|
||||||
set(FFTW_LIB_NAME fftw3)
|
set(FFTW_LIB_NAME fftw3)
|
||||||
set(FFTW_LIB_SUFFIXES "" "f" "l" "q")
|
set(FFTW_LIB_SUFFIXES "" "f" "l" "q")
|
||||||
set(FFTW_LIB_SUFFIXES2 "" "-3")
|
set(FFTW_LIB_SUFFIXES2 "" "-3")
|
||||||
set(FFTW_LIBS)
|
set(FFTW_LIBS)
|
||||||
set(FFTW_ABS_LIBS)
|
set(FFTW_ABS_LIBS)
|
||||||
set(PIP_FFTW_FOUND)
|
set(PIP_FFTW_FOUND)
|
||||||
set(CMAKE_REQUIRED_INCLUDES fftw3.h)
|
set(CMAKE_REQUIRED_INCLUDES fftw3.h)
|
||||||
foreach(FFTW_S_ IN LISTS FFTW_LIB_SUFFIXES)
|
foreach(FFTW_S_ IN LISTS FFTW_LIB_SUFFIXES)
|
||||||
set(FFTW_BREAK false)
|
set(FFTW_BREAK false)
|
||||||
foreach(FFTW_S2_ IN LISTS FFTW_LIB_SUFFIXES2)
|
foreach(FFTW_S2_ IN LISTS FFTW_LIB_SUFFIXES2)
|
||||||
if(NOT FFTW_BREAK)
|
if(NOT FFTW_BREAK)
|
||||||
set(FFTW_CLN "${FFTW_LIB_NAME}${FFTW_S_}${FFTW_S2_}")
|
set(FFTW_CLN "${FFTW_LIB_NAME}${FFTW_S_}${FFTW_S2_}")
|
||||||
set(FFTW_CLNT "${FFTW_LIB_NAME}${FFTW_S_}_threads${FFTW_S2_}")
|
set(FFTW_CLNT "${FFTW_LIB_NAME}${FFTW_S_}_threads${FFTW_S2_}")
|
||||||
find_library(${FFTW_CLN}_FOUND ${FFTW_CLN})
|
find_library(${FFTW_CLN}_FOUND ${FFTW_CLN})
|
||||||
find_library(${FFTW_CLNT}_FOUND ${FFTW_CLNT})
|
find_library(${FFTW_CLNT}_FOUND ${FFTW_CLNT})
|
||||||
if(${FFTW_CLN}_FOUND)
|
if(${FFTW_CLN}_FOUND)
|
||||||
list(APPEND FFTW_LIBS "${FFTW_CLN}")
|
list(APPEND FFTW_LIBS "${FFTW_CLN}")
|
||||||
list(APPEND FFTW_ABS_LIBS "${${FFTW_CLN}_FOUND}")
|
list(APPEND FFTW_ABS_LIBS "${${FFTW_CLN}_FOUND}")
|
||||||
#message(STATUS "PIFFTW found ${FFTW_CLN} = ${${FFTW_CLN}_FOUND}")
|
#message(STATUS "PIFFTW found ${FFTW_CLN} = ${${FFTW_CLN}_FOUND}")
|
||||||
set(${FFTW_CLN}_CTS "${FFTW_CLN}")
|
set(${FFTW_CLN}_CTS "${FFTW_CLN}")
|
||||||
if(${FFTW_CLNT}_FOUND)
|
if(${FFTW_CLNT}_FOUND)
|
||||||
list(APPEND FFTW_LIBS "${FFTW_CLNT}")
|
list(APPEND FFTW_LIBS "${FFTW_CLNT}")
|
||||||
list(APPEND FFTW_ABS_LIBS "${${FFTW_CLNT}_FOUND}")
|
list(APPEND FFTW_ABS_LIBS "${${FFTW_CLNT}_FOUND}")
|
||||||
list(APPEND ${FFTW_CLN}_CTS "${FFTW_CLNT}")
|
list(APPEND ${FFTW_CLN}_CTS "${FFTW_CLNT}")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${${FFTW_CLN}_CTS})
|
||||||
|
CHECK_FUNCTION_EXISTS(fftw${FFTW_S_}_make_planner_thread_safe ${FFTW_CLN}_TSFE)
|
||||||
|
add_definitions(-DPIP_FFTW${FFTW_S_})
|
||||||
|
set(PIP_FFTW_FOUND true)
|
||||||
|
if(${FFTW_CLN}_TSFE)
|
||||||
|
add_definitions(-DPIP_FFTW${FFTW_S_}_THREADSAFE)
|
||||||
|
else()
|
||||||
|
message(STATUS "Warning: PIFFTW${FFTW_S_}::preparePlan was not threadsafe")
|
||||||
|
endif()
|
||||||
|
#message(STATUS "${FFTW_CLN} -> ${${FFTW_CLN}_TSFE}")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${${FFTW_CLN}_CTS})
|
|
||||||
CHECK_FUNCTION_EXISTS(fftw${FFTW_S_}_make_planner_thread_safe ${FFTW_CLN}_TSFE)
|
|
||||||
add_definitions(-DPIP_FFTW${FFTW_S_})
|
|
||||||
set(PIP_FFTW_FOUND true)
|
|
||||||
if(${FFTW_CLN}_TSFE)
|
|
||||||
add_definitions(-DPIP_FFTW${FFTW_S_}_THREADSAFE)
|
|
||||||
else()
|
|
||||||
message(STATUS "Warning: PIFFTW${FFTW_S_}::preparePlan was not threadsafe")
|
|
||||||
endif()
|
|
||||||
#message(STATUS "${FFTW_CLN} -> ${${FFTW_CLN}_TSFE}")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endforeach()
|
||||||
endforeach()
|
endforeach()
|
||||||
endforeach()
|
if(FFTW_LIBS)
|
||||||
if(FFTW_LIBS)
|
message(STATUS "Building PIP with fftw3 support: ${FFTW_LIBS}")
|
||||||
message(STATUS "Building PIP with fftw3 support: ${FFTW_LIBS}")
|
import_version(pip_fftw pip)
|
||||||
import_version(pip_fftw pip)
|
set_deploy_property(pip_fftw ${PIP_LIB_TYPE}
|
||||||
set_deploy_property(pip_fftw ${PIP_LIB_TYPE}
|
LABEL "PIP FFTW support"
|
||||||
LABEL "PIP FFTW support"
|
FULLNAME "${_PIP_DOMAIN}.pip_fftw"
|
||||||
FULLNAME "${_PIP_DOMAIN}.pip_fftw"
|
COMPANY "${_PIP_COMPANY}"
|
||||||
|
INFO "Platform-Independent Primitives")
|
||||||
|
make_rc(pip_fftw _RC)
|
||||||
|
add_library(pip_fftw ${PIP_LIB_TYPE} ${CPP_LIB_FFTW} ${_RC})
|
||||||
|
target_link_libraries(pip_fftw pip ${FFTW_ABS_LIBS})
|
||||||
|
list(APPEND LIBS_STATUS ${FFTW_LIBS})
|
||||||
|
list(APPEND PIP_LIBS_TARGETS pip_fftw)
|
||||||
|
else()
|
||||||
|
message(STATUS "Building PIP without fftw3 support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Check if PIP support OpenCL
|
||||||
|
find_package(OpenCL QUIET)
|
||||||
|
if(OpenCL_FOUND)
|
||||||
|
message(STATUS "Building PIP with OpenCL support")
|
||||||
|
import_version(pip_opencl pip)
|
||||||
|
set_deploy_property(pip_opencl ${PIP_LIB_TYPE}
|
||||||
|
LABEL "PIP OpenCL support"
|
||||||
|
FULLNAME "${_PIP_DOMAIN}.pip_opencl"
|
||||||
|
COMPANY "${_PIP_COMPANY}"
|
||||||
|
INFO "Platform-Independent Primitives")
|
||||||
|
make_rc(pip_opencl _RC)
|
||||||
|
if(APPLE)
|
||||||
|
include_directories(${OpenCL_INCLUDE_DIRS}/Headers)
|
||||||
|
else()
|
||||||
|
include_directories(${OpenCL_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
add_definitions(-DPIP_OPENCL)
|
||||||
|
pip_resources(CL_RES "src_opencl/resources.conf")
|
||||||
|
add_library(pip_opencl ${PIP_LIB_TYPE} ${CPP_LIB_OPENCL} ${CL_RES} ${_RC})
|
||||||
|
add_dependencies(pip_opencl pip_rc)
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS "3.7.0")
|
||||||
|
target_link_libraries(pip_opencl pip OpenCL)
|
||||||
|
else()
|
||||||
|
target_link_libraries(pip_opencl pip OpenCL::OpenCL)
|
||||||
|
endif()
|
||||||
|
list(APPEND LIBS_STATUS OpenCL)
|
||||||
|
list(APPEND PIP_LIBS_TARGETS pip_opencl)
|
||||||
|
set(OpenCL_FOUND ${OpenCL_LIBRARIES})
|
||||||
|
else()
|
||||||
|
message(STATUS "Building PIP without OpenCL support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Check if PIP IO Utils library supports crypt
|
||||||
|
set(IO_UTILS_LIBS pip)
|
||||||
|
import_version(pip_io_utils pip)
|
||||||
|
set_deploy_property(pip_io_utils ${PIP_LIB_TYPE}
|
||||||
|
LABEL "PIP I/O utilites"
|
||||||
|
FULLNAME "${_PIP_DOMAIN}.pip_io_utils"
|
||||||
COMPANY "${_PIP_COMPANY}"
|
COMPANY "${_PIP_COMPANY}"
|
||||||
INFO "Platform-Independent Primitives")
|
INFO "Platform-Independent Primitives")
|
||||||
make_rc(pip_fftw _RC)
|
make_rc(pip_io_utils _RC)
|
||||||
add_library(pip_fftw ${PIP_LIB_TYPE} ${CPP_LIB_FFTW} ${_RC})
|
add_library(pip_io_utils ${PIP_LIB_TYPE} ${CPP_LIB_IO_UTILS} ${_RC})
|
||||||
target_link_libraries(pip_fftw pip ${FFTW_ABS_LIBS})
|
if(sodium_FOUND)
|
||||||
list(APPEND LIBS_STATUS ${FFTW_LIBS})
|
message(STATUS "Building PIP IO Utils library with crypt support")
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_fftw)
|
list(APPEND IO_UTILS_LIBS pip_crypt)
|
||||||
else()
|
else()
|
||||||
message(STATUS "Building PIP without fftw3 support")
|
message(STATUS "Building PIP IO Utils library without crypt support, attention!")
|
||||||
endif()
|
endif()
|
||||||
|
target_link_libraries(pip_io_utils ${IO_UTILS_LIBS})
|
||||||
|
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
||||||
|
|
||||||
|
|
||||||
# Check if PIP support OpenCL
|
# Concurrent module
|
||||||
find_package(OpenCL QUIET)
|
set(CONCURRENT_LIBS pip)
|
||||||
if(OpenCL_FOUND)
|
import_version(pip_concurrent pip)
|
||||||
message(STATUS "Building PIP with OpenCL support")
|
set_deploy_property(pip_concurrent ${PIP_LIB_TYPE}
|
||||||
import_version(pip_opencl pip)
|
LABEL "PIP concurrent support"
|
||||||
set_deploy_property(pip_opencl ${PIP_LIB_TYPE}
|
FULLNAME "${_PIP_DOMAIN}.pip_concurrent"
|
||||||
LABEL "PIP OpenCL support"
|
|
||||||
FULLNAME "${_PIP_DOMAIN}.pip_opencl"
|
|
||||||
COMPANY "${_PIP_COMPANY}"
|
COMPANY "${_PIP_COMPANY}"
|
||||||
INFO "Platform-Independent Primitives")
|
INFO "Platform-Independent Primitives")
|
||||||
make_rc(pip_opencl _RC)
|
make_rc(pip_concurrent _RC)
|
||||||
if(APPLE)
|
add_library(pip_concurrent ${PIP_LIB_TYPE} ${CPP_LIB_CONCURRENT} ${_RC})
|
||||||
include_directories(${OpenCL_INCLUDE_DIRS}/Headers)
|
target_link_libraries(pip_concurrent ${CONCURRENT_LIBS})
|
||||||
else()
|
set_property(TARGET pip_concurrent PROPERTY CXX_STANDARD 11)
|
||||||
include_directories(${OpenCL_INCLUDE_DIRS})
|
list(APPEND PIP_LIBS_TARGETS pip_concurrent)
|
||||||
|
|
||||||
|
# Enable build tests for concurrent module
|
||||||
|
if(CONCURRENT_TESTS)
|
||||||
|
add_executable(pip_concurrent_test ${CPP_CONCURRENT_TEST})
|
||||||
|
target_link_libraries(pip_concurrent_test gtest_main gmock_main pip_concurrent)
|
||||||
|
add_test(NAME pip_concurrent_test COMMAND tests)
|
||||||
|
add_custom_target(pip_concurrent_test_perform ALL COMMAND pip_concurrent_test)
|
||||||
endif()
|
endif()
|
||||||
add_definitions(-DPIP_OPENCL)
|
|
||||||
pip_resources(CL_RES "src_opencl/resources.conf")
|
|
||||||
add_library(pip_opencl ${PIP_LIB_TYPE} ${CPP_LIB_OPENCL} ${CL_RES} ${_RC})
|
# Build cloud library if crypt enabled
|
||||||
add_dependencies(pip_opencl pip_rc)
|
if(sodium_FOUND)
|
||||||
if(${CMAKE_VERSION} VERSION_LESS "3.7.0")
|
message(STATUS "Building PICloud support")
|
||||||
target_link_libraries(pip_opencl pip OpenCL)
|
import_version(pip_cloud pip)
|
||||||
else()
|
set_deploy_property(pip_cloud ${PIP_LIB_TYPE}
|
||||||
target_link_libraries(pip_opencl pip OpenCL::OpenCL)
|
LABEL "PIP cloud transport support"
|
||||||
|
FULLNAME "${_PIP_DOMAIN}.pip_cloud"
|
||||||
|
COMPANY "${_PIP_COMPANY}"
|
||||||
|
INFO "Platform-Independent Primitives")
|
||||||
|
make_rc(pip_cloud _RC)
|
||||||
|
add_definitions(-DPIP_CLOUD)
|
||||||
|
add_library(pip_cloud ${PIP_LIB_TYPE} ${CPP_LIB_CLOUD} ${_RC})
|
||||||
|
target_link_libraries(pip_cloud pip pip_crypt)
|
||||||
|
list(APPEND PIP_LIBS_TARGETS pip_cloud)
|
||||||
endif()
|
endif()
|
||||||
list(APPEND LIBS_STATUS OpenCL)
|
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_opencl)
|
|
||||||
set(OpenCL_FOUND ${OpenCL_LIBRARIES})
|
# Test program
|
||||||
|
if(PIP_UTILS)
|
||||||
|
add_executable(pip_test "main.cpp")
|
||||||
|
target_link_libraries(pip_test pip)
|
||||||
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "Building PIP without OpenCL support")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
message(STATUS "Building PIP with crypt support")
|
||||||
# Check if PIP IO Utils library supports crypt
|
add_definitions(-DPIP_CRYPT)
|
||||||
set(IO_UTILS_LIBS pip)
|
add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT})
|
||||||
import_version(pip_io_utils pip)
|
target_link_libraries(pip_crypt pip)
|
||||||
set_deploy_property(pip_io_utils ${PIP_LIB_TYPE}
|
list(APPEND PIP_LIBS_TARGETS pip_crypt)
|
||||||
LABEL "PIP I/O utilites"
|
set(IO_UTILS_LIBS pip)
|
||||||
FULLNAME "${_PIP_DOMAIN}.pip_io_utils"
|
add_library(pip_io_utils ${PIP_LIB_TYPE} ${CPP_LIB_IO_UTILS})
|
||||||
COMPANY "${_PIP_COMPANY}"
|
|
||||||
INFO "Platform-Independent Primitives")
|
|
||||||
make_rc(pip_io_utils _RC)
|
|
||||||
add_library(pip_io_utils ${PIP_LIB_TYPE} ${CPP_LIB_IO_UTILS} ${_RC})
|
|
||||||
if(sodium_FOUND)
|
|
||||||
message(STATUS "Building PIP IO Utils library with crypt support")
|
message(STATUS "Building PIP IO Utils library with crypt support")
|
||||||
list(APPEND IO_UTILS_LIBS pip_crypt)
|
list(APPEND IO_UTILS_LIBS pip_crypt)
|
||||||
else()
|
target_link_libraries(pip_io_utils ${IO_UTILS_LIBS})
|
||||||
message(STATUS "Building PIP IO Utils library without crypt support, attention!")
|
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
||||||
|
message(STATUS "Building PIP with zlib compress support")
|
||||||
|
add_definitions(-DPIP_COMPRESS)
|
||||||
|
add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS})
|
||||||
|
target_link_libraries(pip_compress pip)
|
||||||
|
list(APPEND PIP_LIBS_TARGETS pip_compress)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(pip_io_utils ${IO_UTILS_LIBS})
|
endif()
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
|
||||||
|
|
||||||
|
|
||||||
# Concurrent module
|
|
||||||
set(CONCURRENT_LIBS pip)
|
|
||||||
import_version(pip_concurrent pip)
|
|
||||||
set_deploy_property(pip_concurrent ${PIP_LIB_TYPE}
|
|
||||||
LABEL "PIP concurrent support"
|
|
||||||
FULLNAME "${_PIP_DOMAIN}.pip_concurrent"
|
|
||||||
COMPANY "${_PIP_COMPANY}"
|
|
||||||
INFO "Platform-Independent Primitives")
|
|
||||||
make_rc(pip_concurrent _RC)
|
|
||||||
add_library(pip_concurrent ${PIP_LIB_TYPE} ${CPP_LIB_CONCURRENT} ${_RC})
|
|
||||||
target_link_libraries(pip_concurrent ${CONCURRENT_LIBS})
|
|
||||||
set_property(TARGET pip_concurrent PROPERTY CXX_STANDARD 11)
|
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_concurrent)
|
|
||||||
|
|
||||||
# Enable build tests for concurrent module
|
|
||||||
if(CONCURRENT_TESTS)
|
|
||||||
add_executable(pip_concurrent_test ${CPP_CONCURRENT_TEST})
|
|
||||||
target_link_libraries(pip_concurrent_test gtest_main gmock_main pip_concurrent)
|
|
||||||
add_test(NAME pip_concurrent_test COMMAND tests)
|
|
||||||
add_custom_target(pip_concurrent_test_perform ALL COMMAND pip_concurrent_test)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Build cloud library if crypt enabled
|
|
||||||
if(sodium_FOUND)
|
|
||||||
message(STATUS "Building PICloud support")
|
|
||||||
import_version(pip_cloud pip)
|
|
||||||
set_deploy_property(pip_cloud ${PIP_LIB_TYPE}
|
|
||||||
LABEL "PIP cloud transport support"
|
|
||||||
FULLNAME "${_PIP_DOMAIN}.pip_cloud"
|
|
||||||
COMPANY "${_PIP_COMPANY}"
|
|
||||||
INFO "Platform-Independent Primitives")
|
|
||||||
make_rc(pip_cloud _RC)
|
|
||||||
add_definitions(-DPIP_CLOUD)
|
|
||||||
add_library(pip_cloud ${PIP_LIB_TYPE} ${CPP_LIB_CLOUD} ${_RC})
|
|
||||||
target_link_libraries(pip_cloud pip pip_crypt)
|
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_cloud)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Test program
|
|
||||||
if(PIP_UTILS)
|
|
||||||
add_executable(pip_test "main.cpp")
|
|
||||||
target_link_libraries(pip_test pip)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
else(NOT PIP_FREERTOS)
|
|
||||||
message(STATUS "Building PIP with crypt support")
|
|
||||||
add_definitions(-DPIP_CRYPT)
|
|
||||||
add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT})
|
|
||||||
target_link_libraries(pip_crypt pip)
|
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_crypt)
|
|
||||||
set(IO_UTILS_LIBS pip)
|
|
||||||
add_library(pip_io_utils ${PIP_LIB_TYPE} ${CPP_LIB_IO_UTILS})
|
|
||||||
message(STATUS "Building PIP IO Utils library with crypt support")
|
|
||||||
list(APPEND IO_UTILS_LIBS pip_crypt)
|
|
||||||
target_link_libraries(pip_io_utils ${IO_UTILS_LIBS})
|
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
|
||||||
message(STATUS "Building PIP with zlib compress support")
|
|
||||||
add_definitions(-DPIP_COMPRESS)
|
|
||||||
add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS})
|
|
||||||
target_link_libraries(pip_compress pip)
|
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_compress)
|
|
||||||
endif(NOT PIP_FREERTOS)
|
|
||||||
|
|
||||||
# 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)
|
||||||
install(FILES ${HDRS} DESTINATION ${MINGW_INCLUDE}/pip)
|
if (NOT CROSSTOOLS)
|
||||||
install(TARGETS ${PIP_LIBS_TARGETS} ARCHIVE DESTINATION ${MINGW_LIB})
|
install(FILES ${HDRS} DESTINATION ${MINGW_INCLUDE}/pip)
|
||||||
|
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()
|
||||||
install(FILES ${HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/pip)
|
if (NOT CROSSTOOLS)
|
||||||
|
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
|
||||||
add_subdirectory("${PIP_SRC_MAIN}/auxiliary/piterminal")
|
if (NOT CROSSTOOLS)
|
||||||
|
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)
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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(":"));
|
||||||
|
|||||||
Reference in New Issue
Block a user