|
|
|
|
@@ -8,12 +8,13 @@ include(PIPMacros.cmake)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Options
|
|
|
|
|
option(ICU "Unicode support" 1)
|
|
|
|
|
option(STD_IOSTREAM "Building with std iostream operators support" 0)
|
|
|
|
|
option(INTROSPECTION_CONTAINERS "Build with containers introspection" 0)
|
|
|
|
|
option(INTROSPECTION_THREADS "Build with threads introspection" 0)
|
|
|
|
|
option(LIB "System install" 1)
|
|
|
|
|
option(DEBUG "Build with -g3" 0)
|
|
|
|
|
option(ICU "Unicode support" ON)
|
|
|
|
|
option(STD_IOSTREAM "Building with std iostream operators support" OFF)
|
|
|
|
|
option(INTROSPECTION_CONTAINERS "Build with containers introspection" OFF)
|
|
|
|
|
option(INTROSPECTION_THREADS "Build with threads introspection" OFF)
|
|
|
|
|
option(LIB "System install" ON)
|
|
|
|
|
option(STATIC_LIB OFF)
|
|
|
|
|
option(DEBUG "Build with -g3" OFF)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Basic
|
|
|
|
|
@@ -42,6 +43,18 @@ set(PIP_LIBS_TARGETS pip)
|
|
|
|
|
set(LIBS_MAIN)
|
|
|
|
|
set(LIBS_STATUS)
|
|
|
|
|
|
|
|
|
|
if (DEFINED ENV{QNX_HOST} OR PIP_FREERTOS)
|
|
|
|
|
set(STATIC_LIB ON)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(STATIC_LIB)
|
|
|
|
|
set(PIP_LIB_TYPE STATIC)
|
|
|
|
|
message(STATUS "Building PIP static library")
|
|
|
|
|
else()
|
|
|
|
|
set(PIP_LIB_TYPE SHARED)
|
|
|
|
|
message(STATUS "Building PIP shared library")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
#if(LIB)
|
|
|
|
|
if(WIN32)
|
|
|
|
|
if(MINGW)
|
|
|
|
|
@@ -106,6 +119,12 @@ endif()
|
|
|
|
|
|
|
|
|
|
# Main lib
|
|
|
|
|
set(PIP_FOLDERS "." "core" "containers" "thread" "system" "io_devices" "io_utils" "console" "math" "code" "geo" "resources" "opencl" "crypt")
|
|
|
|
|
if(PIP_FREERTOS)
|
|
|
|
|
list(REMOVE_ITEM PIP_FOLDERS "io_devices")
|
|
|
|
|
include_directories("${PIP_SRC_MAIN}/io_devices")
|
|
|
|
|
list(REMOVE_ITEM PIP_FOLDERS "console")
|
|
|
|
|
include_directories("${PIP_SRC_MAIN}/console")
|
|
|
|
|
endif()
|
|
|
|
|
include_directories("${PIP_SRC_MAIN}")
|
|
|
|
|
set(PIP_MAIN_FOLDERS)
|
|
|
|
|
foreach(F ${PIP_FOLDERS})
|
|
|
|
|
@@ -133,6 +152,12 @@ gather_src("${PIP_SRC_OPENCL}" CPP_LIB_OPENCL HDRS PHDRS)
|
|
|
|
|
gather_src("${PIP_SRC_IO_UTILS}" CPP_LIB_IO_UTILS HDRS PHDRS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(PIP_FREERTOS)
|
|
|
|
|
add_definitions(-DPIP_FREERTOS)
|
|
|
|
|
set(ICU OFF)
|
|
|
|
|
set(LIB OFF)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# Check Bessel functions
|
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES math.h)
|
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES m)
|
|
|
|
|
@@ -178,68 +203,69 @@ CHECK_FUNCTION_EXISTS(timer_delete PIP_TIMER_RT_2)
|
|
|
|
|
if(DEBUG)
|
|
|
|
|
add_definitions(-DPIP_DEBUG)
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
|
|
|
|
|
message(STATUS "Building debug version")
|
|
|
|
|
message(STATUS "Building PIP debug version")
|
|
|
|
|
else()
|
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
|
message(STATUS "Building release version")
|
|
|
|
|
message(STATUS "Building PIP release version")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if std::iostream operators support
|
|
|
|
|
if(STD_IOSTREAM)
|
|
|
|
|
add_definitions(-DPIP_STD_IOSTREAM)
|
|
|
|
|
message(STATUS "Building with std iostream operators support")
|
|
|
|
|
message(STATUS "Building PIP with std iostream operators support")
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building without std iostream operators support")
|
|
|
|
|
message(STATUS "Building PIP without std iostream operators support")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if STL containers is on (to enable use "-DSTL=" argument of cmake)
|
|
|
|
|
if(STL)
|
|
|
|
|
message(STATUS "Building with STL containers")
|
|
|
|
|
message(STATUS "Building PIP with STL containers")
|
|
|
|
|
add_definitions(-DPIP_CONTAINERS_STL)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building with PIP containers")
|
|
|
|
|
message(STATUS "Building PIP with PIP containers")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if ICU used for PIString and PIChar
|
|
|
|
|
if(ICU)
|
|
|
|
|
message(STATUS "Building with ICU")
|
|
|
|
|
message(STATUS "Building PIP with ICU")
|
|
|
|
|
add_definitions(-DPIP_ICU)
|
|
|
|
|
list(APPEND LIBS_MAIN icuuc)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building without ICU, attention!")
|
|
|
|
|
message(STATUS "Building PIP without ICU, attention!")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if PIP should be built with containers introspection
|
|
|
|
|
if(INTROSPECTION_CONTAINERS)
|
|
|
|
|
message(STATUS "Building with containers introspection")
|
|
|
|
|
message(STATUS "Building PIP with containers introspection")
|
|
|
|
|
add_definitions(-DPIP_INTROSPECTION_CONTAINERS)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building without containers introspection")
|
|
|
|
|
message(STATUS "Building PIP without containers introspection")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if PIP should be built with threads introspection
|
|
|
|
|
if(INTROSPECTION_THREADS)
|
|
|
|
|
message(STATUS "Building with threads introspection")
|
|
|
|
|
message(STATUS "Building PIP with threads introspection")
|
|
|
|
|
add_definitions(-DPIP_INTROSPECTION_THREADS)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building without threads introspection")
|
|
|
|
|
message(STATUS "Building PIP without threads introspection")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if RT timers exists
|
|
|
|
|
if(PIP_TIMER_RT_0 AND PIP_TIMER_RT_1 AND PIP_TIMER_RT_2)
|
|
|
|
|
add_definitions(-DPIP_TIMER_RT)
|
|
|
|
|
message(STATUS "Building with timers: Thread, ThreadRT, Pool")
|
|
|
|
|
message(STATUS "Building PIP with timers: Thread, ThreadRT, Pool")
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building with timers: Thread, Pool")
|
|
|
|
|
message(STATUS "Building PIP with timers: Thread, Pool")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add main library
|
|
|
|
|
if(APPLE)
|
|
|
|
|
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
|
|
|
|
|
@@ -266,18 +292,22 @@ else()
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
set(PIP_LIBS)
|
|
|
|
|
foreach(LIB_ ${LIBS_MAIN})
|
|
|
|
|
find_library(${LIB_}_FOUND ${LIB_})
|
|
|
|
|
if(${LIB_}_FOUND)
|
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES ${${LIB_}_FOUND})
|
|
|
|
|
list(APPEND PIP_LIBS ${${LIB_}_FOUND})
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
if(PIP_FREERTOS)
|
|
|
|
|
set(PIP_LIBS ${LIBS_MAIN})
|
|
|
|
|
else()
|
|
|
|
|
foreach(LIB_ ${LIBS_MAIN})
|
|
|
|
|
find_library(${LIB_}_FOUND ${LIB_})
|
|
|
|
|
if(${LIB_}_FOUND)
|
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES ${${LIB_}_FOUND})
|
|
|
|
|
list(APPEND PIP_LIBS ${${LIB_}_FOUND})
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
list(APPEND LIBS_STATUS ${LIBS_MAIN})
|
|
|
|
|
if(WIN32)
|
|
|
|
|
list(APPEND CPP_LIB_MAIN "pip_resource_win.rc")
|
|
|
|
|
add_definitions(-DPSAPI_VERSION=1)
|
|
|
|
|
add_library(pip SHARED ${CPP_LIB_MAIN} ${HDRS} ${PHDRS})
|
|
|
|
|
add_library(pip ${PIP_LIB_TYPE} ${CPP_LIB_MAIN} ${HDRS} ${PHDRS})
|
|
|
|
|
if(${C_COMPILER} STREQUAL "cl.exe")
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Ot /W0")
|
|
|
|
|
else()
|
|
|
|
|
@@ -287,13 +317,11 @@ if(WIN32)
|
|
|
|
|
else()
|
|
|
|
|
set(${CMAKE_CXX_FLAGS} "${CMAKE_CXX_FLAGS} -O3 -fPIC")
|
|
|
|
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
|
|
|
|
if(DEFINED ENV{QNX_HOST})
|
|
|
|
|
if(DEFINED ENV{QNX_HOST} OR PIP_FREERTOS)
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32")
|
|
|
|
|
add_library(pip STATIC ${CPP_LIB_MAIN})
|
|
|
|
|
else()
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
|
|
|
add_library(pip SHARED ${CPP_LIB_MAIN})
|
|
|
|
|
endif()
|
|
|
|
|
add_library(pip ${PIP_LIB_TYPE} ${CPP_LIB_MAIN})
|
|
|
|
|
endif()
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
|
|
|
include(GenerateExportHeader)
|
|
|
|
|
@@ -301,137 +329,137 @@ generate_export_header(pip)
|
|
|
|
|
list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_export.h")
|
|
|
|
|
target_link_libraries(pip ${PIP_LIBS})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if USB is supported
|
|
|
|
|
find_library(usb_FOUND usb SHARED)
|
|
|
|
|
if(usb_FOUND)
|
|
|
|
|
message(STATUS "Building with USB support")
|
|
|
|
|
add_definitions(-DPIP_USB)
|
|
|
|
|
add_library(pip_usb SHARED ${CPP_LIB_USB})
|
|
|
|
|
target_link_libraries(pip_usb pip ${usb_FOUND})
|
|
|
|
|
list(APPEND LIBS_STATUS usb)
|
|
|
|
|
list(APPEND PIP_LIBS_TARGETS pip_usb)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building without USB support")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if PIP support cryptographic encryption/decryption using sodium library
|
|
|
|
|
find_library(sodium_FOUND sodium)
|
|
|
|
|
if(sodium_FOUND)
|
|
|
|
|
message(STATUS "Building with crypt support")
|
|
|
|
|
add_definitions(-DPIP_CRYPT)
|
|
|
|
|
add_library(pip_crypt SHARED ${CPP_LIB_CRYPT})
|
|
|
|
|
target_link_libraries(pip_crypt pip ${sodium_FOUND})
|
|
|
|
|
list(APPEND LIBS_STATUS sodium)
|
|
|
|
|
list(APPEND PIP_LIBS_TARGETS pip_crypt)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building without crypt support")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if PIP support compress/decompress using zlib library
|
|
|
|
|
find_library(zlib_FOUND NAMES z zlib)
|
|
|
|
|
if(zlib_FOUND)
|
|
|
|
|
message(STATUS "Building with zlib compress support")
|
|
|
|
|
add_definitions(-DPIP_COMPRESS)
|
|
|
|
|
add_library(pip_compress SHARED ${CPP_LIB_COMPRESS})
|
|
|
|
|
target_link_libraries(pip_compress pip ${zlib_FOUND})
|
|
|
|
|
list(APPEND LIBS_STATUS zlib)
|
|
|
|
|
list(APPEND PIP_LIBS_TARGETS pip_compress)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building without compress support")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if PIP support fftw3 for PIFFT using in math module
|
|
|
|
|
set(FFTW_LIB_NAME fftw3)
|
|
|
|
|
set(FFTW_LIB_SUFFIXES "" "f" "l" "q")
|
|
|
|
|
set(FFTW_LIB_SUFFIXES2 "" "-3")
|
|
|
|
|
set(FFTW_LIBS)
|
|
|
|
|
set(PIP_FFTW_FOUND)
|
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES fftw3.h)
|
|
|
|
|
foreach(FFTW_S_ IN LISTS FFTW_LIB_SUFFIXES)
|
|
|
|
|
set(FFTW_BREAK false)
|
|
|
|
|
foreach(FFTW_S2_ IN LISTS FFTW_LIB_SUFFIXES2)
|
|
|
|
|
if(NOT FFTW_BREAK)
|
|
|
|
|
set(FFTW_CLN "${FFTW_LIB_NAME}${FFTW_S_}${FFTW_S2_}")
|
|
|
|
|
set(FFTW_CLNT "${FFTW_LIB_NAME}${FFTW_S_}_threads${FFTW_S2_}")
|
|
|
|
|
find_library(${FFTW_CLN}_FOUND ${FFTW_CLN})
|
|
|
|
|
find_library(${FFTW_CLNT}_FOUND ${FFTW_CLNT})
|
|
|
|
|
if(${FFTW_CLN}_FOUND)
|
|
|
|
|
list(APPEND FFTW_LIBS "${FFTW_CLN}")
|
|
|
|
|
#message(STATUS "PIFFTW found ${FFTW_CLN} = ${${FFTW_CLN}_FOUND}")
|
|
|
|
|
set(${FFTW_CLN}_CTS "${FFTW_CLN}")
|
|
|
|
|
if(${FFTW_CLNT}_FOUND)
|
|
|
|
|
list(APPEND FFTW_LIBS "${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()
|
|
|
|
|
endforeach()
|
|
|
|
|
endforeach()
|
|
|
|
|
if(FFTW_LIBS)
|
|
|
|
|
message(STATUS "Building with fftw3 support: ${FFTW_LIBS}")
|
|
|
|
|
add_library(pip_fftw SHARED ${CPP_LIB_FFTW})
|
|
|
|
|
target_link_libraries(pip_fftw pip ${FFTW_LIBS})
|
|
|
|
|
list(APPEND LIBS_STATUS ${FFTW_LIBS})
|
|
|
|
|
list(APPEND PIP_LIBS_TARGETS pip_fftw)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building without fftw3 support")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if PIP support OpenCL
|
|
|
|
|
find_package(OpenCL QUIET)
|
|
|
|
|
if(OpenCL_FOUND)
|
|
|
|
|
message(STATUS "Building with OpenCL support")
|
|
|
|
|
if(APPLE)
|
|
|
|
|
include_directories(${OpenCL_INCLUDE_DIRS}/Headers)
|
|
|
|
|
if (NOT PIP_FREERTOS)
|
|
|
|
|
# Check if USB is supported
|
|
|
|
|
find_library(usb_FOUND usb SHARED)
|
|
|
|
|
if(usb_FOUND)
|
|
|
|
|
message(STATUS "Building PIP with USB support")
|
|
|
|
|
add_definitions(-DPIP_USB)
|
|
|
|
|
add_library(pip_usb ${PIP_LIB_TYPE} ${CPP_LIB_USB})
|
|
|
|
|
target_link_libraries(pip_usb pip ${usb_FOUND})
|
|
|
|
|
list(APPEND LIBS_STATUS usb)
|
|
|
|
|
list(APPEND PIP_LIBS_TARGETS pip_usb)
|
|
|
|
|
else()
|
|
|
|
|
include_directories(${OpenCL_INCLUDE_DIRS})
|
|
|
|
|
message(STATUS "Building PIP without USB support")
|
|
|
|
|
endif()
|
|
|
|
|
add_definitions(-DPIP_OPENCL)
|
|
|
|
|
pip_resources(CL_RES "src_opencl/resources.conf")
|
|
|
|
|
add_library(pip_opencl SHARED ${CPP_LIB_OPENCL} ${CL_RES})
|
|
|
|
|
add_dependencies(pip_opencl pip_rc)
|
|
|
|
|
target_link_libraries(pip_opencl pip OpenCL::OpenCL)
|
|
|
|
|
list(APPEND LIBS_STATUS OpenCL)
|
|
|
|
|
list(APPEND PIP_LIBS_TARGETS pip_opencl)
|
|
|
|
|
set(OpenCL_FOUND ${OpenCL_LIBRARIES})
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building without OpenCL support")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if PIP IO Utils library supports crypt
|
|
|
|
|
set(IO_UTILS_LIBS pip)
|
|
|
|
|
add_library(pip_io_utils SHARED ${CPP_LIB_IO_UTILS})
|
|
|
|
|
if(sodium_FOUND)
|
|
|
|
|
message(STATUS "Building IO Utils library with crypt support")
|
|
|
|
|
list(APPEND IO_UTILS_LIBS pip_crypt)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building IO Utils library without crypt support, attention!")
|
|
|
|
|
endif()
|
|
|
|
|
target_link_libraries(pip_io_utils ${IO_UTILS_LIBS})
|
|
|
|
|
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
|
|
|
|
# Check if PIP support cryptographic encryption/decryption using sodium library
|
|
|
|
|
find_library(sodium_FOUND sodium)
|
|
|
|
|
if(sodium_FOUND)
|
|
|
|
|
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 ${sodium_FOUND})
|
|
|
|
|
list(APPEND LIBS_STATUS sodium)
|
|
|
|
|
list(APPEND PIP_LIBS_TARGETS pip_crypt)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building PIP without crypt support")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if PIP support compress/decompress using zlib library
|
|
|
|
|
find_library(zlib_FOUND NAMES z zlib)
|
|
|
|
|
if(zlib_FOUND)
|
|
|
|
|
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 ${zlib_FOUND})
|
|
|
|
|
list(APPEND LIBS_STATUS zlib)
|
|
|
|
|
list(APPEND PIP_LIBS_TARGETS pip_compress)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building PIP without compress support")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# Test program
|
|
|
|
|
add_executable(pip_test "main.cpp")
|
|
|
|
|
target_link_libraries(pip_test pip)
|
|
|
|
|
|
|
|
|
|
# Check if PIP support fftw3 for PIFFT using in math module
|
|
|
|
|
set(FFTW_LIB_NAME fftw3)
|
|
|
|
|
set(FFTW_LIB_SUFFIXES "" "f" "l" "q")
|
|
|
|
|
set(FFTW_LIB_SUFFIXES2 "" "-3")
|
|
|
|
|
set(FFTW_LIBS)
|
|
|
|
|
set(PIP_FFTW_FOUND)
|
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES fftw3.h)
|
|
|
|
|
foreach(FFTW_S_ IN LISTS FFTW_LIB_SUFFIXES)
|
|
|
|
|
set(FFTW_BREAK false)
|
|
|
|
|
foreach(FFTW_S2_ IN LISTS FFTW_LIB_SUFFIXES2)
|
|
|
|
|
if(NOT FFTW_BREAK)
|
|
|
|
|
set(FFTW_CLN "${FFTW_LIB_NAME}${FFTW_S_}${FFTW_S2_}")
|
|
|
|
|
set(FFTW_CLNT "${FFTW_LIB_NAME}${FFTW_S_}_threads${FFTW_S2_}")
|
|
|
|
|
find_library(${FFTW_CLN}_FOUND ${FFTW_CLN})
|
|
|
|
|
find_library(${FFTW_CLNT}_FOUND ${FFTW_CLNT})
|
|
|
|
|
if(${FFTW_CLN}_FOUND)
|
|
|
|
|
list(APPEND FFTW_LIBS "${FFTW_CLN}")
|
|
|
|
|
#message(STATUS "PIFFTW found ${FFTW_CLN} = ${${FFTW_CLN}_FOUND}")
|
|
|
|
|
set(${FFTW_CLN}_CTS "${FFTW_CLN}")
|
|
|
|
|
if(${FFTW_CLNT}_FOUND)
|
|
|
|
|
list(APPEND FFTW_LIBS "${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()
|
|
|
|
|
endforeach()
|
|
|
|
|
endforeach()
|
|
|
|
|
if(FFTW_LIBS)
|
|
|
|
|
message(STATUS "Building PIP with fftw3 support: ${FFTW_LIBS}")
|
|
|
|
|
add_library(pip_fftw ${PIP_LIB_TYPE} ${CPP_LIB_FFTW})
|
|
|
|
|
target_link_libraries(pip_fftw pip ${FFTW_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")
|
|
|
|
|
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})
|
|
|
|
|
add_dependencies(pip_opencl pip_rc)
|
|
|
|
|
target_link_libraries(pip_opencl pip OpenCL::OpenCL)
|
|
|
|
|
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)
|
|
|
|
|
add_library(pip_io_utils ${PIP_LIB_TYPE} ${CPP_LIB_IO_UTILS})
|
|
|
|
|
if(sodium_FOUND)
|
|
|
|
|
message(STATUS "Building PIP IO Utils library with crypt support")
|
|
|
|
|
list(APPEND IO_UTILS_LIBS pip_crypt)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Building PIP IO Utils library without crypt support, attention!")
|
|
|
|
|
endif()
|
|
|
|
|
target_link_libraries(pip_io_utils ${IO_UTILS_LIBS})
|
|
|
|
|
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Test program
|
|
|
|
|
add_executable(pip_test "main.cpp")
|
|
|
|
|
target_link_libraries(pip_test pip)
|
|
|
|
|
|
|
|
|
|
endif(NOT PIP_FREERTOS)
|
|
|
|
|
|
|
|
|
|
# Install
|
|
|
|
|
# Check if system or local install will be used (to system install use "-DLIB=" argument of cmake)
|
|
|
|
|
@@ -473,39 +501,46 @@ if(LIB)
|
|
|
|
|
file(GLOB CMAKES "*.cmake")
|
|
|
|
|
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
|
|
|
|
|
else()
|
|
|
|
|
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION bin)
|
|
|
|
|
install(FILES ${HDRS} DESTINATION include)
|
|
|
|
|
message(STATUS "Install ${PROJECT_NAME} to local \"bin\"")
|
|
|
|
|
if(NOT PIP_FREERTOS)
|
|
|
|
|
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION bin)
|
|
|
|
|
install(FILES ${HDRS} DESTINATION include)
|
|
|
|
|
message(STATUS "Install ${PROJECT_NAME} to local \"bin\"")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(NOT PIP_FREERTOS)
|
|
|
|
|
|
|
|
|
|
# Auxiliary
|
|
|
|
|
add_subdirectory("${PIP_SRC_MAIN}/auxiliary/piterminal")
|
|
|
|
|
add_subdirectory("${PIP_SRC_MAIN}/auxiliary/piterminal")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Utils
|
|
|
|
|
add_subdirectory("utils/system_test")
|
|
|
|
|
add_subdirectory("utils/remote_console")
|
|
|
|
|
add_subdirectory("utils/code_model_generator")
|
|
|
|
|
add_subdirectory("utils/resources_compiler")
|
|
|
|
|
add_subdirectory("utils/udp_file_transfer")
|
|
|
|
|
if(sodium_FOUND)
|
|
|
|
|
add_subdirectory("utils/system_daemon")
|
|
|
|
|
add_subdirectory("utils/crypt_tool")
|
|
|
|
|
add_subdirectory("utils/system_test")
|
|
|
|
|
add_subdirectory("utils/remote_console")
|
|
|
|
|
add_subdirectory("utils/code_model_generator")
|
|
|
|
|
add_subdirectory("utils/resources_compiler")
|
|
|
|
|
add_subdirectory("utils/udp_file_transfer")
|
|
|
|
|
if(sodium_FOUND)
|
|
|
|
|
add_subdirectory("utils/system_daemon")
|
|
|
|
|
add_subdirectory("utils/crypt_tool")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Libraries messages
|
|
|
|
|
message(STATUS "Building modules: ${PIP_LIBS_TARGETS}")
|
|
|
|
|
message(STATUS "Building PIP modules: ${PIP_LIBS_TARGETS}")
|
|
|
|
|
if(DEFINED LIBPROJECT)
|
|
|
|
|
set(PIP_LIBS_TARGETS ${PIP_LIBS_TARGETS} PARENT_SCOPE)
|
|
|
|
|
endif()
|
|
|
|
|
foreach(LIB_ ${LIBS_STATUS})
|
|
|
|
|
message(STATUS "Library ${LIB_} -> " ${${LIB_}_FOUND})
|
|
|
|
|
if(NOT ${LIB_}_FOUND)
|
|
|
|
|
message(WARNING "Library ${LIB_} not found, please install it")
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
if(NOT PIP_FREERTOS)
|
|
|
|
|
foreach(LIB_ ${LIBS_STATUS})
|
|
|
|
|
message(STATUS "Library ${LIB_} -> " ${${LIB_}_FOUND})
|
|
|
|
|
if(NOT ${LIB_}_FOUND)
|
|
|
|
|
message(WARNING "Library ${LIB_} not found, please install it")
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
@@ -514,7 +549,7 @@ endforeach()
|
|
|
|
|
|
|
|
|
|
# find_package(Doxygen QUIET)
|
|
|
|
|
# if(Doxygen_FOUND)
|
|
|
|
|
# message(STATUS "Building with documentation via Doxygen")
|
|
|
|
|
# message(STATUS "Building PIP with documentation via Doxygen")
|
|
|
|
|
|
|
|
|
|
# #set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in)
|
|
|
|
|
# set(DOXYFILE ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
|
|
|
|
|
@@ -532,28 +567,29 @@ endforeach()
|
|
|
|
|
# )
|
|
|
|
|
# install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc)
|
|
|
|
|
# endif()
|
|
|
|
|
|
|
|
|
|
include(PIPDocumentation.cmake)
|
|
|
|
|
find_package(Doxygen)
|
|
|
|
|
if(DOXYGEN_FOUND)
|
|
|
|
|
set(DOXY_PROJECT_NUMBER "${_PIP_FULL_VERSION}")
|
|
|
|
|
set(DOXY_QHP_CUST_FILTER_ATTRS "\"PIP ${_PIP_FULL_VERSION}\"")
|
|
|
|
|
set(DOXY_QHP_SECT_FILTER_ATTRS "\"PIP ${_PIP_FULL_VERSION}\"")
|
|
|
|
|
set(DOXY_EXAMPLE_PATH "\"${PROJECT_SOURCE_DIR}/doc/examples\"")
|
|
|
|
|
set(DOXY_IMAGE_PATH "\"${PROJECT_SOURCE_DIR}/doc/images\"")
|
|
|
|
|
if(DOXYGEN_DOT_EXECUTABLE)
|
|
|
|
|
string(REPLACE "\\" "" _DOT_PATH "${DOXYGEN_DOT_PATH}")
|
|
|
|
|
set(DOXY_DOT_PATH "\"${_DOT_PATH}\"")
|
|
|
|
|
set(DOXY_MSCGEN_PATH "\"${_DOT_PATH}\"")
|
|
|
|
|
set(DOXY_DIA_PATH "\"${_DOT_PATH}\"")
|
|
|
|
|
if (NOT PIP_FREERTOS)
|
|
|
|
|
include(PIPDocumentation.cmake)
|
|
|
|
|
find_package(Doxygen)
|
|
|
|
|
if(DOXYGEN_FOUND)
|
|
|
|
|
set(DOXY_PROJECT_NUMBER "${_PIP_FULL_VERSION}")
|
|
|
|
|
set(DOXY_QHP_CUST_FILTER_ATTRS "\"PIP ${_PIP_FULL_VERSION}\"")
|
|
|
|
|
set(DOXY_QHP_SECT_FILTER_ATTRS "\"PIP ${_PIP_FULL_VERSION}\"")
|
|
|
|
|
set(DOXY_EXAMPLE_PATH "\"${PROJECT_SOURCE_DIR}/doc/examples\"")
|
|
|
|
|
set(DOXY_IMAGE_PATH "\"${PROJECT_SOURCE_DIR}/doc/images\"")
|
|
|
|
|
if(DOXYGEN_DOT_EXECUTABLE)
|
|
|
|
|
string(REPLACE "\\" "" _DOT_PATH "${DOXYGEN_DOT_PATH}")
|
|
|
|
|
set(DOXY_DOT_PATH "\"${_DOT_PATH}\"")
|
|
|
|
|
set(DOXY_MSCGEN_PATH "\"${_DOT_PATH}\"")
|
|
|
|
|
set(DOXY_DIA_PATH "\"${_DOT_PATH}\"")
|
|
|
|
|
endif()
|
|
|
|
|
set(DOXY_INPUT)
|
|
|
|
|
foreach(F ${PIP_SRC_DIRS})
|
|
|
|
|
list(APPEND DOXY_INPUT "\"${PROJECT_SOURCE_DIR}/${F}\"")
|
|
|
|
|
endforeach(F)
|
|
|
|
|
string(REPLACE ";" " " DOXY_INPUT "${DOXY_INPUT}")
|
|
|
|
|
string(REPLACE ";" " " DOXY_INCLUDE_PATH "${PIP_MAIN_FOLDERS}")
|
|
|
|
|
add_documentation(doc Doxyfile.in)
|
|
|
|
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION ../share/doc/pip COMPONENT doc EXCLUDE_FROM_ALL OPTIONAL)
|
|
|
|
|
endif()
|
|
|
|
|
set(DOXY_INPUT)
|
|
|
|
|
foreach(F ${PIP_SRC_DIRS})
|
|
|
|
|
list(APPEND DOXY_INPUT "\"${PROJECT_SOURCE_DIR}/${F}\"")
|
|
|
|
|
endforeach(F)
|
|
|
|
|
string(REPLACE ";" " " DOXY_INPUT "${DOXY_INPUT}")
|
|
|
|
|
string(REPLACE ";" " " DOXY_INCLUDE_PATH "${PIP_MAIN_FOLDERS}")
|
|
|
|
|
add_documentation(doc Doxyfile.in)
|
|
|
|
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION ../share/doc/pip COMPONENT doc EXCLUDE_FROM_ALL OPTIONAL)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|