Refactored CMakeLists.txt
* new pip_module() macro * fixed exports * automatic gather all exports and pass them to Doxygen and PICodeParser
This commit is contained in:
444
CMakeLists.txt
444
CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||
project(pip)
|
||||
set(_PIP_MAJOR 1)
|
||||
set(_PIP_MINOR 99)
|
||||
set(_PIP_REVISION 2)
|
||||
set(_PIP_REVISION 3)
|
||||
set(_PIP_SUFFIX _prebeta)
|
||||
set(_PIP_COMPANY SHS)
|
||||
set(_PIP_DOMAIN org.SHS)
|
||||
@@ -14,6 +14,7 @@ endif()
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(PIP_BUILD 1)
|
||||
include(CheckFunctionExists)
|
||||
include(GenerateExportHeader)
|
||||
include(DeployMacros)
|
||||
include(PIPMacros)
|
||||
if(NOT DEFINED BUILD_NUMBER)
|
||||
@@ -45,60 +46,89 @@ set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
|
||||
# Basic
|
||||
macro(gather_src DIR CPP H H_P)
|
||||
set(CS)
|
||||
set(HS)
|
||||
set(PHS)
|
||||
file(GLOB CS "${DIR}/*.cpp")
|
||||
file(GLOB HS "${DIR}/*.h")
|
||||
file(GLOB PHS "${DIR}/*_p.h")
|
||||
list(REMOVE_ITEM HS "${PHS}")
|
||||
list(APPEND ${CPP} ${CS})
|
||||
list(APPEND ${H} ${HS})
|
||||
list(APPEND ${H_P} ${PHS})
|
||||
endmacro()
|
||||
|
||||
set(PIP_SRC_MAIN "lib/main")
|
||||
set(PIP_SRC_CONSOLE "lib/console")
|
||||
set(PIP_SRC_CRYPT "lib/crypt")
|
||||
set(PIP_SRC_COMPRESS "lib/compress")
|
||||
set(PIP_SRC_USB "lib/usb")
|
||||
set(PIP_SRC_FFTW "lib/fftw")
|
||||
set(PIP_SRC_OPENCL "lib/opencl")
|
||||
set(PIP_SRC_IO_UTILS "lib/io_utils")
|
||||
set(PIP_SRC_CLOUD "lib/cloud")
|
||||
set(PIP_SRC_LUA "lib/lua")
|
||||
set(PIP_SRC_DIRS ${PIP_SRC_MAIN}
|
||||
${PIP_SRC_CONSOLE}
|
||||
${PIP_SRC_CRYPT}
|
||||
${PIP_SRC_COMPRESS}
|
||||
${PIP_SRC_USB}
|
||||
${PIP_SRC_FFTW}
|
||||
${PIP_SRC_OPENCL}
|
||||
${PIP_SRC_IO_UTILS}
|
||||
${PIP_SRC_CLOUD}
|
||||
${PIP_SRC_LUA}
|
||||
)
|
||||
set(PIP_LIBS_TARGETS pip)
|
||||
set(PIP_MODULES)
|
||||
set(LIBS_MAIN)
|
||||
set(LIBS_STATUS)
|
||||
set(HDRS)
|
||||
set(PHDRS)
|
||||
set(HDR_DIRS)
|
||||
|
||||
set(PIP_STD_IOSTREAM "no")
|
||||
set(PIP_ICU "no")
|
||||
set(PIP_INTROSPECTION "no")
|
||||
set(PIP_USB "no")
|
||||
set(PIP_CRYPT "no")
|
||||
set(PIP_CLOUD "no")
|
||||
set(PIP_COMPRESS "no")
|
||||
set(PIP_FFTW "no")
|
||||
set(PIP_OPENCL "no")
|
||||
set(PIP_LUA "no")
|
||||
set(PIP_IOUTILS "yes")
|
||||
set(PIP_UTILS_LIST)
|
||||
set(PIP_TESTS_LIST)
|
||||
set(PIP_EXPORTS)
|
||||
|
||||
set(PIP_SRC_MODULES "console;crypt;compress;usb;fftw;opencl;io_utils;cloud;lua")
|
||||
foreach(_m ${PIP_SRC_MODULES})
|
||||
set(PIP_MSG_${_m} "no")
|
||||
endforeach()
|
||||
|
||||
macro(pip_module NAME LIBS LABEL INCLUDES MSG)
|
||||
set(CPPS)
|
||||
set(HS)
|
||||
set(PHS)
|
||||
set(CRES)
|
||||
file(GLOB_RECURSE CPPS "lib/${NAME}/*.cpp")
|
||||
file(GLOB_RECURSE HS "lib/${NAME}/*.h")
|
||||
file(GLOB_RECURSE PHS "lib/${NAME}/*_p.h")
|
||||
file(GLOB_RECURSE RES "lib/${NAME}/*conf.h")
|
||||
list(REMOVE_ITEM HS "${PHS}")
|
||||
list(APPEND HDRS ${HS})
|
||||
list(APPEND PHDRS ${PHS})
|
||||
|
||||
set(_target "pip_${NAME}")
|
||||
set(_libs "${LIBS}")
|
||||
if ("${NAME}" STREQUAL "main")
|
||||
set(_target "pip")
|
||||
else()
|
||||
list(APPEND _libs "pip")
|
||||
endif()
|
||||
string(TOUPPER "${_target}" DEF_NAME)
|
||||
|
||||
set(PIP_MSG_${NAME} "yes${MSG}")
|
||||
import_version(${_target} PIP)
|
||||
set_deploy_property(${_target} ${PIP_LIB_TYPE}
|
||||
LABEL "${LABEL}"
|
||||
FULLNAME "${_PIP_DOMAIN}.${_target}"
|
||||
COMPANY "${_PIP_COMPANY}"
|
||||
INFO "Platform-Independent Primitives")
|
||||
make_rc(${_target} _RC)
|
||||
|
||||
set(LINK_LIBS)
|
||||
foreach (_l ${_libs})
|
||||
if (${${_l}_FOUND})
|
||||
list(APPEND LINK_LIBS ${${_l}_LIBRARIES})
|
||||
else()
|
||||
list(APPEND LINK_LIBS ${_l})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (NOT "${RES}" STREQUAL "")
|
||||
pip_resources(CRES "${RES}")
|
||||
endif()
|
||||
add_definitions(-D${DEF_NAME})
|
||||
add_library(${_target} ${PIP_LIB_TYPE} ${CPPS} ${CRES} ${_RC})
|
||||
if (NOT "${RES}" STREQUAL "")
|
||||
add_dependencies(${_target} pip_rc)
|
||||
endif()
|
||||
if (NOT "${INCLUDES}" STREQUAL "")
|
||||
target_include_directories(${_target} PRIVATE ${INCLUDES})
|
||||
endif()
|
||||
generate_export_header(${_target})
|
||||
list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/${_target}_export.h")
|
||||
list(APPEND PIP_EXPORTS "${DEF_NAME}_EXPORT")
|
||||
target_link_libraries(${_target} ${LINK_LIBS})
|
||||
list(APPEND PIP_MODULES ${_target})
|
||||
if (NOT "${LIBS}" STREQUAL "")
|
||||
list(APPEND LIBS_STATUS ${LIBS})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(pip_find_lib NAME)
|
||||
find_library(${NAME}_LIBRARIES ${NAME} ${ARGN})
|
||||
set(${NAME}_FOUND FALSE)
|
||||
if(${NAME}_LIBRARIES)
|
||||
set(${NAME}_FOUND TRUE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if (DEFINED ENV{QNX_HOST} OR PIP_FREERTOS)
|
||||
set(STATIC_LIB ON)
|
||||
@@ -122,11 +152,6 @@ set_version(PIP
|
||||
BUILD "${BUILD_NUMBER}"
|
||||
SUFFIX "${_PIP_SUFFIX}"
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/piversion.h")
|
||||
set_deploy_property(pip ${PIP_LIB_TYPE}
|
||||
LABEL "PIP main library"
|
||||
FULLNAME "${_PIP_DOMAIN}.pip"
|
||||
COMPANY "${_PIP_COMPANY}"
|
||||
INFO "Platform-Independent Primitives")
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PIP_SRC_MAIN}/piversion.h")
|
||||
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/${PIP_SRC_MAIN}/piversion.h")
|
||||
endif()
|
||||
@@ -184,49 +209,25 @@ endif()
|
||||
get_filename_component(C_COMPILER "${CMAKE_C_COMPILER}" NAME)
|
||||
|
||||
|
||||
# Sources
|
||||
|
||||
# Main lib
|
||||
set(PIP_FOLDERS "." "core" "containers" "thread" "system" "io_devices" "io_utils" "console" "math" "code" "geo" "resources" "opencl" "crypt" "introspection" "cloud" "lua")
|
||||
include_directories("${PIP_SRC_MAIN}")
|
||||
#set(PIP_FOLDERS ".;core;containers;thread;system;io_devices;io_utils;console;math;code;geo;resources;opencl;crypt;introspection;cloud;lua")
|
||||
file(GLOB PIP_FOLDERS LIST_DIRECTORIES TRUE "${CMAKE_CURRENT_SOURCE_DIR}/lib/main/*")
|
||||
list(APPEND PIP_FOLDERS "${CMAKE_CURRENT_SOURCE_DIR}/lib/main")
|
||||
set(PIP_MAIN_FOLDERS)
|
||||
foreach(F ${PIP_FOLDERS})
|
||||
list(APPEND PIP_MAIN_FOLDERS "\"${PROJECT_SOURCE_DIR}/${PIP_SRC_MAIN}/${F}\"")
|
||||
include_directories("${PIP_SRC_MAIN}/${F}")
|
||||
gather_src("${PIP_SRC_MAIN}/${F}" CPP_LIB_MAIN HDRS PHDRS)
|
||||
if (IS_DIRECTORY "${F}")
|
||||
list(APPEND PIP_MAIN_FOLDERS "${F}")
|
||||
include_directories("${F}")
|
||||
endif()
|
||||
endforeach(F)
|
||||
if (DEFINED LIBPROJECT)
|
||||
set(PIP_MAIN_FOLDERS "${PIP_MAIN_FOLDERS}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if (TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
# Crypt lib
|
||||
gather_src("${PIP_SRC_CRYPT}" CPP_LIB_CRYPT HDRS PHDRS)
|
||||
|
||||
# Console lib
|
||||
gather_src("${PIP_SRC_CONSOLE}" CPP_LIB_CONSOLE HDRS PHDRS)
|
||||
|
||||
# Compress lib
|
||||
gather_src("${PIP_SRC_COMPRESS}" CPP_LIB_COMPRESS HDRS PHDRS)
|
||||
|
||||
# USB lib
|
||||
gather_src("${PIP_SRC_USB}" CPP_LIB_USB HDRS PHDRS)
|
||||
|
||||
# FFTW lib
|
||||
gather_src("${PIP_SRC_FFTW}" CPP_LIB_FFTW HDRS PHDRS)
|
||||
|
||||
# OpenCL lib
|
||||
gather_src("${PIP_SRC_OPENCL}" CPP_LIB_OPENCL HDRS PHDRS)
|
||||
|
||||
# IO Utils lib
|
||||
gather_src("${PIP_SRC_IO_UTILS}" CPP_LIB_IO_UTILS HDRS PHDRS)
|
||||
|
||||
# Cloud lib
|
||||
gather_src("${PIP_SRC_CLOUD}" CPP_LIB_CLOUD HDRS PHDRS)
|
||||
|
||||
# LUA lib
|
||||
gather_src("${PIP_SRC_LUA}" CPP_LIB_LUA HDRS PHDRS)
|
||||
|
||||
if(PIP_FREERTOS)
|
||||
add_definitions(-DPIP_FREERTOS)
|
||||
set(ICU OFF)
|
||||
@@ -269,9 +270,9 @@ if((NOT DEFINED ENV{QNX_HOST}) AND (NOT APPLE) AND (NOT WIN32) AND (NOT DEFINED
|
||||
list(APPEND LIBS_MAIN rt)
|
||||
set(CMAKE_REQUIRED_LIBRARIES rt)
|
||||
endif()
|
||||
CHECK_FUNCTION_EXISTS(timer_create PIP_TIMER_RT_0)
|
||||
CHECK_FUNCTION_EXISTS(timer_create PIP_TIMER_RT_0)
|
||||
CHECK_FUNCTION_EXISTS(timer_settime PIP_TIMER_RT_1)
|
||||
CHECK_FUNCTION_EXISTS(timer_delete PIP_TIMER_RT_2)
|
||||
CHECK_FUNCTION_EXISTS(timer_delete PIP_TIMER_RT_2)
|
||||
|
||||
|
||||
# Check if build debug version
|
||||
@@ -286,6 +287,7 @@ endif()
|
||||
|
||||
|
||||
# Check if std::iostream operators support
|
||||
set(PIP_STD_IOSTREAM "no")
|
||||
if(STD_IOSTREAM)
|
||||
set(PIP_STD_IOSTREAM "yes")
|
||||
add_definitions(-DPIP_STD_IOSTREAM)
|
||||
@@ -293,6 +295,7 @@ endif()
|
||||
|
||||
|
||||
# Check if ICU used for PIString and PIChar
|
||||
set(PIP_ICU "no")
|
||||
if(ICU)
|
||||
set(PIP_ICU "yes")
|
||||
add_definitions(-DPIP_ICU)
|
||||
@@ -303,6 +306,7 @@ endif()
|
||||
# Check if PIP should be built with introspection
|
||||
set(_PIP_DEFS "")
|
||||
set(_PIP_DEFS_FILE "${CMAKE_CURRENT_BINARY_DIR}/pip_defs.h")
|
||||
set(PIP_INTROSPECTION "no")
|
||||
if(INTROSPECTION)
|
||||
set(PIP_INTROSPECTION "yes")
|
||||
add_definitions(-DPIP_INTROSPECTION)
|
||||
@@ -360,21 +364,12 @@ if(PIP_FREERTOS)
|
||||
set(PIP_LIBS ${LIBS_MAIN})
|
||||
else()
|
||||
foreach(LIB_ ${LIBS_MAIN})
|
||||
find_library(${LIB_}_LIBRARIES ${LIB_})
|
||||
set(${LIB_}_FOUND FALSE)
|
||||
if(${LIB_}_LIBRARIES)
|
||||
set(${LIB_}_FOUND TRUE)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${${LIB_}_LIBRARIES})
|
||||
list(APPEND PIP_LIBS ${${LIB_}_LIBRARIES})
|
||||
endif()
|
||||
pip_find_lib(${LIB_})
|
||||
endforeach()
|
||||
endif()
|
||||
list(APPEND LIBS_STATUS ${LIBS_MAIN})
|
||||
import_version(pip PIP)
|
||||
if(WIN32)
|
||||
make_rc(pip _RC)
|
||||
add_definitions(-DPSAPI_VERSION=1)
|
||||
add_library(pip ${PIP_LIB_TYPE} ${CPP_LIB_MAIN} ${HDRS} ${PHDRS} ${_RC})
|
||||
if(${C_COMPILER} STREQUAL "cl.exe")
|
||||
set(CMAKE_CXX_FLAGS "/O2 /Ob2 /Ot /W0")
|
||||
endif()
|
||||
@@ -382,93 +377,37 @@ else()
|
||||
set(${CMAKE_CXX_FLAGS} "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
if(DEFINED ENV{QNX_HOST} OR PIP_FREERTOS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32")
|
||||
else()
|
||||
endif()
|
||||
add_library(pip ${PIP_LIB_TYPE} ${CPP_LIB_MAIN})
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
include(GenerateExportHeader)
|
||||
generate_export_header(pip)
|
||||
list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_export.h")
|
||||
target_link_libraries(pip ${PIP_LIBS})
|
||||
|
||||
|
||||
pip_module(main "${LIBS_MAIN}" "PIP main library" "" "")
|
||||
|
||||
|
||||
if (NOT CROSSTOOLS)
|
||||
if (NOT PIP_FREERTOS)
|
||||
# Check if USB is supported
|
||||
find_library(usb_LIBRARIES usb SHARED)
|
||||
set(usb_FOUND FALSE)
|
||||
if(usb_LIBRARIES)
|
||||
set(usb_FOUND TRUE)
|
||||
set(PIP_USB "yes")
|
||||
import_version(pip_usb pip)
|
||||
set_deploy_property(pip_usb ${PIP_LIB_TYPE}
|
||||
LABEL "PIP usb support"
|
||||
FULLNAME "${_PIP_DOMAIN}.pip_usb"
|
||||
COMPANY "${_PIP_COMPANY}"
|
||||
INFO "Platform-Independent Primitives")
|
||||
make_rc(pip_usb _RC)
|
||||
add_definitions(-DPIP_USB)
|
||||
add_library(pip_usb ${PIP_LIB_TYPE} ${CPP_LIB_USB} ${_RC})
|
||||
target_link_libraries(pip_usb pip ${usb_LIBRARIES})
|
||||
list(APPEND LIBS_STATUS usb)
|
||||
list(APPEND PIP_LIBS_TARGETS pip_usb)
|
||||
|
||||
|
||||
pip_module(console "" "PIP console support" "" "")
|
||||
|
||||
|
||||
pip_find_lib(usb)
|
||||
if(usb_FOUND)
|
||||
pip_module(usb "usb" "PIP usb support" "" "")
|
||||
endif()
|
||||
|
||||
|
||||
# Add console library
|
||||
import_version(pip_console pip)
|
||||
set_deploy_property(pip_console ${PIP_LIB_TYPE}
|
||||
LABEL "PIP console support"
|
||||
FULLNAME "${_PIP_DOMAIN}.pip_console"
|
||||
COMPANY "${_PIP_COMPANY}"
|
||||
INFO "Platform-Independent Primitives")
|
||||
make_rc(pip_console _RC)
|
||||
add_library(pip_console ${PIP_LIB_TYPE} ${CPP_LIB_CONSOLE} ${_RC})
|
||||
target_link_libraries(pip_console pip)
|
||||
list(APPEND PIP_LIBS_TARGETS pip_console)
|
||||
|
||||
|
||||
# Check if PIP support cryptographic encryption/decryption using sodium library
|
||||
find_library(sodium_LIBRARIES sodium)
|
||||
set(sodium_FOUND FALSE)
|
||||
if(sodium_LIBRARIES)
|
||||
set(sodium_FOUND TRUE)
|
||||
set(PIP_CRYPT "yes")
|
||||
set(PIP_IOUTILS "yes (+crypt)")
|
||||
set(PIP_CLOUD "yes")
|
||||
import_version(pip_crypt pip)
|
||||
set_deploy_property(pip_crypt ${PIP_LIB_TYPE}
|
||||
LABEL "PIP crypt support"
|
||||
FULLNAME "${_PIP_DOMAIN}.pip_crypt"
|
||||
COMPANY "${_PIP_COMPANY}"
|
||||
INFO "Platform-Independent Primitives")
|
||||
make_rc(pip_crypt _RC)
|
||||
add_definitions(-DPIP_CRYPT)
|
||||
add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT} ${_RC})
|
||||
target_link_libraries(pip_crypt pip ${sodium_LIBRARIES})
|
||||
list(APPEND LIBS_STATUS sodium)
|
||||
list(APPEND PIP_LIBS_TARGETS pip_crypt)
|
||||
pip_find_lib(zlib NAMES z zlib)
|
||||
if(zlib_FOUND)
|
||||
pip_module(compress "zlib" "PIP compression support" "" "")
|
||||
endif()
|
||||
|
||||
|
||||
# Check if PIP support compress/decompress using zlib library
|
||||
find_library(zlib_LIBRARIES NAMES z zlib)
|
||||
set(zlib_FOUND FALSE)
|
||||
if(zlib_LIBRARIES)
|
||||
set(zlib_FOUND TRUE)
|
||||
set(PIP_COMPRESS "yes")
|
||||
import_version(pip_compress pip)
|
||||
set_deploy_property(pip_compress ${PIP_LIB_TYPE}
|
||||
LABEL "PIP compression support"
|
||||
FULLNAME "${_PIP_DOMAIN}.pip_compress"
|
||||
COMPANY "${_PIP_COMPANY}"
|
||||
INFO "Platform-Independent Primitives")
|
||||
make_rc(pip_compress _RC)
|
||||
add_definitions(-DPIP_COMPRESS)
|
||||
add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS} ${_RC})
|
||||
target_link_libraries(pip_compress pip ${zlib_LIBRARIES})
|
||||
list(APPEND LIBS_STATUS zlib)
|
||||
list(APPEND PIP_LIBS_TARGETS pip_compress)
|
||||
pip_find_lib(sodium)
|
||||
if(sodium_FOUND)
|
||||
pip_module(crypt "sodium" "PIP crypt support" "" "")
|
||||
pip_module(cloud "pip_crypt" "PIP crypt support" "" "")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -513,106 +452,38 @@ if (NOT CROSSTOOLS)
|
||||
endforeach()
|
||||
endforeach()
|
||||
if(FFTW_LIBS)
|
||||
set(PIP_FFTW "yes (${FFTW_LIBS})")
|
||||
import_version(pip_fftw pip)
|
||||
set_deploy_property(pip_fftw ${PIP_LIB_TYPE}
|
||||
LABEL "PIP FFTW support"
|
||||
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)
|
||||
pip_module(fftw "${FFTW_LIBS}" "PIP FFTW support" "" "")
|
||||
endif()
|
||||
|
||||
|
||||
# Check if PIP support OpenCL
|
||||
find_package(OpenCL QUIET)
|
||||
find_package(OpenCL QUIET) #OpenCL_VERSION_STRING
|
||||
if(OpenCL_FOUND)
|
||||
set(PIP_OPENCL "yes (${OpenCL_VERSION_STRING})")
|
||||
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 "${PIP_SRC_OPENCL}/resources.conf")
|
||||
add_library(pip_opencl ${PIP_LIB_TYPE} ${CPP_LIB_OPENCL} ${CL_RES} ${_RC})
|
||||
add_dependencies(pip_opencl pip_rc)
|
||||
set(_opencl_lib OpenCL::OpenCL)
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.7.0")
|
||||
target_link_libraries(pip_opencl pip OpenCL)
|
||||
else()
|
||||
target_link_libraries(pip_opencl pip OpenCL::OpenCL)
|
||||
target_link_libraries(_opencl_lib OpenCL)
|
||||
endif()
|
||||
list(APPEND LIBS_STATUS OpenCL)
|
||||
list(APPEND PIP_LIBS_TARGETS pip_opencl)
|
||||
pip_module(opencl "${_opencl_lib}" "PIP OpenCL support" "" " (${OpenCL_VERSION_STRING})")
|
||||
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}"
|
||||
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)
|
||||
list(APPEND IO_UTILS_LIBS pip_crypt)
|
||||
pip_module(io_utils "pip_crypt" "PIP I/O support" "" " (+crypt)")
|
||||
else()
|
||||
pip_module(io_utils "" "PIP I/O support" "" "")
|
||||
endif()
|
||||
target_link_libraries(pip_io_utils ${IO_UTILS_LIBS})
|
||||
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
||||
|
||||
|
||||
# Build cloud library if crypt enabled
|
||||
if(sodium_FOUND)
|
||||
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()
|
||||
|
||||
# Check Lua support
|
||||
if(MINGW)
|
||||
set(LUA_INCLUDE_DIR ${MINGW_INCLUDE})
|
||||
endif()
|
||||
find_package(Lua QUIET)
|
||||
if (LUA_FOUND)
|
||||
set(PIP_LUA "yes (${LUA_VERSION_STRING})")
|
||||
import_version(pip_lua pip)
|
||||
set_deploy_property(pip_lua ${PIP_LIB_TYPE}
|
||||
LABEL "PIP Lua support"
|
||||
FULLNAME "${_PIP_DOMAIN}.pip_lua"
|
||||
COMPANY "${_PIP_COMPANY}"
|
||||
INFO "Platform-Independent Primitives")
|
||||
make_rc(pip_lua _RC)
|
||||
add_definitions(-DPIP_LUA)
|
||||
include_directories(${LUA_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd)
|
||||
pip_module(lua "LUA" "PIP Lua support" "${LUA_INCLUDE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd" " (${LUA_VERSION_STRING})")
|
||||
list(APPEND HDR_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd/LuaBridge")
|
||||
add_library(pip_lua ${PIP_LIB_TYPE} ${CPP_LIB_LUA} ${_RC})
|
||||
target_link_libraries(pip_lua pip ${LUA_LIBRARIES})
|
||||
list(APPEND LIBS_STATUS LUA)
|
||||
list(APPEND PIP_LIBS_TARGETS pip_lua)
|
||||
endif()
|
||||
|
||||
|
||||
# Test program
|
||||
if(PIP_UTILS)
|
||||
add_executable(pip_test "main.cpp")
|
||||
@@ -624,25 +495,29 @@ if (NOT CROSSTOOLS)
|
||||
|
||||
else()
|
||||
|
||||
set(PIP_CRYPT "yes")
|
||||
set(PIP_COMPRESS "yes")
|
||||
set(PIP_MSG_crypt "yes")
|
||||
set(PIP_MSG_compress "yes")
|
||||
set(PIP_MODULES pip)
|
||||
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)
|
||||
list(APPEND PIP_MODULES pip_crypt)
|
||||
set(IO_UTILS_LIBS pip)
|
||||
add_library(pip_io_utils ${PIP_LIB_TYPE} ${CPP_LIB_IO_UTILS})
|
||||
list(APPEND IO_UTILS_LIBS pip_crypt)
|
||||
target_link_libraries(pip_io_utils ${IO_UTILS_LIBS})
|
||||
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
||||
list(APPEND PIP_MODULES pip_io_utils)
|
||||
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)
|
||||
list(APPEND PIP_MODULES pip_compress)
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" "," PIP_EXPORTS_STR "${PIP_EXPORTS}")
|
||||
target_compile_definitions(pip PRIVATE "PICODE_DEFINES=\"${PIP_EXPORTS_STR}\"")
|
||||
|
||||
# Install
|
||||
# Check if system or local install will be used (to system install use "-DLIB=" argument of cmake)
|
||||
if(LIB)
|
||||
@@ -654,9 +529,9 @@ if(LIB)
|
||||
if(HDR_DIRS)
|
||||
install(DIRECTORY ${HDR_DIRS} DESTINATION ${MINGW_INCLUDE}/pip)
|
||||
endif()
|
||||
install(TARGETS ${PIP_LIBS_TARGETS} ARCHIVE DESTINATION ${MINGW_LIB})
|
||||
install(TARGETS ${PIP_MODULES} ARCHIVE DESTINATION ${MINGW_LIB})
|
||||
endif()
|
||||
install(TARGETS ${PIP_LIBS_TARGETS} RUNTIME DESTINATION ${MINGW_BIN})
|
||||
install(TARGETS ${PIP_MODULES} RUNTIME DESTINATION ${MINGW_BIN})
|
||||
find_library(STDLIB "stdc++-6" PATHS ${MINGW_BIN} NO_DEFAULT_PATH)
|
||||
find_library(STDLIB "stdc++-6")
|
||||
#message("${STDLIB}")
|
||||
@@ -675,17 +550,17 @@ if(LIB)
|
||||
install(DIRECTORY ${HDR_DIRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/pip)
|
||||
endif()
|
||||
endif()
|
||||
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
install(TARGETS ${PIP_MODULES} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
endif()
|
||||
file(GLOB CMAKES "cmake/*.cmake" "cmake/*.in" "cmake/android_debug.keystore")
|
||||
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
|
||||
else()
|
||||
if(NOT PIP_FREERTOS)
|
||||
if(WIN32)
|
||||
install(TARGETS ${PIP_LIBS_TARGETS} RUNTIME DESTINATION bin)
|
||||
install(TARGETS ${PIP_LIBS_TARGETS} ARCHIVE DESTINATION lib)
|
||||
install(TARGETS ${PIP_MODULES} RUNTIME DESTINATION bin)
|
||||
install(TARGETS ${PIP_MODULES} ARCHIVE DESTINATION lib)
|
||||
else()
|
||||
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION lib)
|
||||
install(TARGETS ${PIP_MODULES} DESTINATION lib)
|
||||
endif()
|
||||
install(FILES ${HDRS} DESTINATION include/pip)
|
||||
if(HDR_DIRS)
|
||||
@@ -698,7 +573,7 @@ if(NOT PIP_FREERTOS)
|
||||
|
||||
# Auxiliary
|
||||
if (NOT CROSSTOOLS)
|
||||
add_subdirectory("${PIP_SRC_MAIN}/auxiliary/piterminal")
|
||||
add_subdirectory("utils/piterminal")
|
||||
endif()
|
||||
|
||||
# Utils
|
||||
@@ -720,8 +595,8 @@ endif()
|
||||
|
||||
# Libraries messages
|
||||
if(DEFINED LIBPROJECT)
|
||||
set(PIP_LIBS_TARGETS ${PIP_LIBS_TARGETS} PARENT_SCOPE)
|
||||
list(APPEND _ALL_TARGETS ${PIP_LIBS_TARGETS})
|
||||
set(PIP_MODULES ${PIP_MODULES} PARENT_SCOPE)
|
||||
list(APPEND _ALL_TARGETS ${PIP_MODULES})
|
||||
set(_ALL_TARGETS ${_ALL_TARGETS} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
@@ -735,8 +610,9 @@ if ((NOT PIP_FREERTOS) AND (NOT CROSSTOOLS))
|
||||
set(DOXY_PROJECT_NUMBER "${PIP_VERSION}")
|
||||
set(DOXY_QHP_CUST_FILTER_ATTRS "\"PIP ${PIP_VERSION}\"")
|
||||
set(DOXY_QHP_SECT_FILTER_ATTRS "\"PIP ${PIP_VERSION}\"")
|
||||
set(DOXY_EXAMPLE_PATH "\"${PROJECT_SOURCE_DIR}/doc/examples\"")
|
||||
set(DOXY_IMAGE_PATH "\"${PROJECT_SOURCE_DIR}/doc/images\"")
|
||||
set(DOXY_EXAMPLE_PATH "\"${CMAKE_CURRENT_SOURCE_DIR}/doc/examples\"")
|
||||
set(DOXY_IMAGE_PATH "\"${CMAKE_CURRENT_SOURCE_DIR}/doc/images\"")
|
||||
set(DOXY_EXCLUDE "\"${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd\"")
|
||||
if(DOXYGEN_DOT_EXECUTABLE)
|
||||
string(REPLACE "\\" "" _DOT_PATH "${DOXYGEN_DOT_PATH}")
|
||||
set(DOXY_DOT_PATH "\"${_DOT_PATH}\"")
|
||||
@@ -744,11 +620,12 @@ if ((NOT PIP_FREERTOS) AND (NOT CROSSTOOLS))
|
||||
set(DOXY_DIA_PATH "\"${_DOT_PATH}\"")
|
||||
endif()
|
||||
set(DOXY_INPUT)
|
||||
foreach(F ${PIP_SRC_DIRS})
|
||||
list(APPEND DOXY_INPUT "\"${PROJECT_SOURCE_DIR}/${F}\"")
|
||||
foreach(F ${PIP_MAIN_FOLDERS})
|
||||
list(APPEND DOXY_INPUT "\"${F}\"")
|
||||
endforeach(F)
|
||||
string(REPLACE ";" " " DOXY_INPUT "${DOXY_INPUT}")
|
||||
string(REPLACE ";" " " DOXY_INCLUDE_PATH "${PIP_MAIN_FOLDERS}")
|
||||
string(REPLACE ";" " " DOXY_INPUT "\"${CMAKE_CURRENT_SOURCE_DIR}/lib\"")
|
||||
string(REPLACE ";" " " DOXY_INCLUDE_PATH "${DOXY_INPUT}")
|
||||
string(REPLACE ";" " " DOXY_DEFINES "${PIP_EXPORTS};DOXYGEN;PIOBJECT;PIOBJECT_SUBCLASS")
|
||||
add_documentation(doc doc/Doxyfile.in)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION ../share/doc/pip COMPONENT doc EXCLUDE_FROM_ALL OPTIONAL)
|
||||
endif()
|
||||
@@ -756,6 +633,7 @@ endif()
|
||||
|
||||
|
||||
|
||||
list(REMOVE_ITEM LIBS_STATUS ${PIP_MODULES})
|
||||
message("----------PIP----------")
|
||||
message(" Version: ${PIP_VERSION} ")
|
||||
message(" Linkage: ${PIP_LIB_TYPE_MSG}")
|
||||
@@ -778,15 +656,9 @@ if(INTROSPECTION)
|
||||
endif()
|
||||
message("")
|
||||
message(" Modules:")
|
||||
message(" USB : ${PIP_USB}")
|
||||
message(" Console : yes")
|
||||
message(" Crypt : ${PIP_CRYPT}")
|
||||
message(" Compress : ${PIP_COMPRESS}")
|
||||
message(" FFTW : ${PIP_FFTW}")
|
||||
message(" OpenCL : ${PIP_OPENCL}")
|
||||
message(" IOUtils : ${PIP_IOUTILS}")
|
||||
message(" Cloud : ${PIP_CLOUD}")
|
||||
message(" Lua : ${PIP_LUA}")
|
||||
foreach(_m ${PIP_SRC_MODULES})
|
||||
message(" ${_m}: ${PIP_MSG_${_m}}")
|
||||
endforeach()
|
||||
if (PIP_TESTS_LIST)
|
||||
message("")
|
||||
message(" Tests:")
|
||||
@@ -803,10 +675,12 @@ if(NOT PIP_FREERTOS)
|
||||
message("")
|
||||
message(" Using libraries:")
|
||||
foreach(LIB_ ${LIBS_STATUS})
|
||||
if(${LIB_}_FOUND)
|
||||
message(" ${LIB_} -> ${${LIB_}_LIBRARIES}")
|
||||
else()
|
||||
message(" ${LIB_} not found, may fail")
|
||||
if (NOT TARGET ${LIB_})
|
||||
if(${LIB_}_FOUND)
|
||||
message(" ${LIB_} -> ${${LIB_}_LIBRARIES}")
|
||||
else()
|
||||
message(" ${LIB_} not found, may fail")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user