add PIP_BUILD_<MODULE> options for PIP build to force disabling modules
This commit is contained in:
257
CMakeLists.txt
257
CMakeLists.txt
@@ -94,6 +94,8 @@ set(PIP_EXPORTS)
|
||||
set(PIP_SRC_MODULES "console;crypt;compress;usb;fftw;opencl;io_utils;client_server;cloud;lua;http_client;http_server")
|
||||
foreach(_m ${PIP_SRC_MODULES})
|
||||
set(PIP_MSG_${_m} "no")
|
||||
string(TOUPPER "${_m}" _mu)
|
||||
option(PIP_BUILD_${_mu} "Build \"${_m}\" module" ON)
|
||||
endforeach()
|
||||
|
||||
macro(pip_module NAME LIBS LABEL INCLUDES SOURCES MSG)
|
||||
@@ -392,142 +394,163 @@ endif()
|
||||
if (NOT CROSSTOOLS)
|
||||
if (NOT PIP_FREERTOS)
|
||||
|
||||
if (PIP_BUILD_CONSOLE)
|
||||
pip_module(console "" "PIP console support" "" "" "")
|
||||
endif()
|
||||
|
||||
pip_module(console "" "PIP console support" "" "" "")
|
||||
|
||||
|
||||
pip_find_lib(usb)
|
||||
if(usb_FOUND)
|
||||
pip_module(usb "usb" "PIP usb support" "" "" "")
|
||||
if (PIP_BUILD_USB)
|
||||
pip_find_lib(usb)
|
||||
if(usb_FOUND)
|
||||
pip_module(usb "usb" "PIP usb support" "" "" "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
pip_find_lib(zlib NAMES z zlib)
|
||||
if(zlib_FOUND)
|
||||
pip_module(compress "zlib" "PIP compression support" "" "" "")
|
||||
if (PIP_BUILD_COMPRESS)
|
||||
pip_find_lib(zlib NAMES z zlib)
|
||||
if(zlib_FOUND)
|
||||
pip_module(compress "zlib" "PIP compression support" "" "" "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
pip_find_lib(sodium)
|
||||
if(sodium_FOUND)
|
||||
pip_module(crypt "sodium" "PIP crypt support" "" "" "")
|
||||
pip_module(client_server "pip_io_utils" "PIP client-server helper" "" "" "")
|
||||
pip_module(cloud "pip_io_utils" "PIP cloud support" "" "" "")
|
||||
if (PIP_BUILD_CRYPT)
|
||||
pip_find_lib(sodium)
|
||||
if(sodium_FOUND)
|
||||
pip_module(crypt "sodium" "PIP crypt support" "" "" "")
|
||||
pip_module(client_server "pip_io_utils" "PIP client-server helper" "" "" "")
|
||||
pip_module(cloud "pip_io_utils" "PIP cloud support" "" "" "")
|
||||
endif()
|
||||
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(FFTW_ABS_LIBS)
|
||||
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}_LIBRARIES ${FFTW_CLN})
|
||||
find_library(${FFTW_CLNT}_LIBRARIES ${FFTW_CLNT})
|
||||
set(${FFTW_CLN}_FOUND FALSE)
|
||||
set(${FFTW_CLNT}_FOUND FALSE)
|
||||
if(${FFTW_CLN}_LIBRARIES)
|
||||
set(${FFTW_CLN}_FOUND TRUE)
|
||||
list(APPEND FFTW_LIBS "${FFTW_CLN}")
|
||||
list(APPEND FFTW_ABS_LIBS "${${FFTW_CLN}_LIBRARIES}")
|
||||
set(${FFTW_CLN}_CTS "${FFTW_CLN}")
|
||||
if(${FFTW_CLNT}_FLIBRARIES)
|
||||
set(${FFTW_CLNT}_FOUND TRUE)
|
||||
list(APPEND FFTW_LIBS "${FFTW_CLNT}")
|
||||
list(APPEND FFTW_ABS_LIBS "${${FFTW_CLNT}_LIBRARIES}")
|
||||
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_})
|
||||
if(${FFTW_CLN}_TSFE)
|
||||
add_definitions(-DPIP_FFTW${FFTW_S_}_THREADSAFE)
|
||||
else()
|
||||
message(STATUS "Warning: PIFFTW${FFTW_S_}::preparePlan was not threadsafe")
|
||||
if (PIP_BUILD_FFTW)
|
||||
# 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(FFTW_ABS_LIBS)
|
||||
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}_LIBRARIES ${FFTW_CLN})
|
||||
find_library(${FFTW_CLNT}_LIBRARIES ${FFTW_CLNT})
|
||||
set(${FFTW_CLN}_FOUND FALSE)
|
||||
set(${FFTW_CLNT}_FOUND FALSE)
|
||||
if(${FFTW_CLN}_LIBRARIES)
|
||||
set(${FFTW_CLN}_FOUND TRUE)
|
||||
list(APPEND FFTW_LIBS "${FFTW_CLN}")
|
||||
list(APPEND FFTW_ABS_LIBS "${${FFTW_CLN}_LIBRARIES}")
|
||||
set(${FFTW_CLN}_CTS "${FFTW_CLN}")
|
||||
if(${FFTW_CLNT}_FLIBRARIES)
|
||||
set(${FFTW_CLNT}_FOUND TRUE)
|
||||
list(APPEND FFTW_LIBS "${FFTW_CLNT}")
|
||||
list(APPEND FFTW_ABS_LIBS "${${FFTW_CLNT}_LIBRARIES}")
|
||||
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_})
|
||||
if(${FFTW_CLN}_TSFE)
|
||||
add_definitions(-DPIP_FFTW${FFTW_S_}_THREADSAFE)
|
||||
else()
|
||||
message(STATUS "Warning: PIFFTW${FFTW_S_}::preparePlan was not threadsafe")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endforeach()
|
||||
if(FFTW_LIBS)
|
||||
pip_module(fftw "${FFTW_LIBS}" "PIP FFTW support" "" "" "")
|
||||
endif()
|
||||
|
||||
|
||||
if (NOT "x${MINGW_INCLUDE}" STREQUAL "x")
|
||||
list(APPEND CMAKE_INCLUDE_PATH "${MINGW_INCLUDE}")
|
||||
endif()
|
||||
find_package(OpenCL QUIET) #OpenCL_VERSION_STRING
|
||||
if(OpenCL_FOUND)
|
||||
set(_opencl_inc "${OpenCL_INCLUDE_DIRS}")
|
||||
if(APPLE)
|
||||
set(_opencl_inc "${OpenCL_INCLUDE_DIRS}/Headers")
|
||||
if(FFTW_LIBS)
|
||||
pip_module(fftw "${FFTW_LIBS}" "PIP FFTW support" "" "" "")
|
||||
endif()
|
||||
pip_module(opencl "OpenCL" "PIP OpenCL support" "${_opencl_inc}" "" " (${OpenCL_VERSION_STRING})")
|
||||
endif()
|
||||
|
||||
|
||||
if(sodium_FOUND)
|
||||
pip_module(io_utils "pip_crypt" "PIP I/O support" "" "" " (+crypt)")
|
||||
else()
|
||||
pip_module(io_utils "" "PIP I/O support" "" "" "")
|
||||
endif()
|
||||
|
||||
|
||||
# Lua module
|
||||
set(_lua_src_dir "${CMAKE_CURRENT_SOURCE_DIR}/3rd/lua")
|
||||
set(_lua_bri_dir "${CMAKE_CURRENT_SOURCE_DIR}/libs/lua/3rd")
|
||||
set(_lua_src_hdr "${_lua_src_dir}/lua.hpp" "${_lua_src_dir}/lua.h" "${_lua_src_dir}/luaconf.h" "${_lua_src_dir}/lualib.h")
|
||||
pip_module(lua "" "PIP Lua support" "${_lua_src_dir};${_lua_bri_dir}" "${_lua_src_dir}" " (internal)")
|
||||
target_include_directories(pip_lua PUBLIC "${_lua_src_dir}" "${_lua_bri_dir}")
|
||||
if (WIN32)
|
||||
target_compile_definitions(pip_lua PRIVATE LUA_BUILD_AS_DLL LUA_CORE)
|
||||
endif()
|
||||
list(APPEND HDR_DIRS "${_lua_bri_dir}/LuaBridge")
|
||||
list(APPEND HDRS ${_lua_src_hdr})
|
||||
|
||||
# libmicrohttpd
|
||||
pip_find_lib(microhttpd HINTS "${MINGW_LIB}")
|
||||
if (microhttpd_FOUND)
|
||||
set(_microhttpd_add_libs microhttpd)
|
||||
if(WIN32)
|
||||
if("${C_COMPILER}" STREQUAL "cl.exe")
|
||||
else()
|
||||
list(APPEND _microhttpd_add_libs ws2_32)
|
||||
if (PIP_BUILD_OPENCL)
|
||||
if (NOT "x${MINGW_INCLUDE}" STREQUAL "x")
|
||||
list(APPEND CMAKE_INCLUDE_PATH "${MINGW_INCLUDE}")
|
||||
endif()
|
||||
find_package(OpenCL QUIET) #OpenCL_VERSION_STRING
|
||||
if(OpenCL_FOUND)
|
||||
set(_opencl_inc "${OpenCL_INCLUDE_DIRS}")
|
||||
if(APPLE)
|
||||
set(_opencl_inc "${OpenCL_INCLUDE_DIRS}/Headers")
|
||||
endif()
|
||||
pip_module(opencl "OpenCL" "PIP OpenCL support" "${_opencl_inc}" "" " (${OpenCL_VERSION_STRING})")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (PIP_BUILD_IO_UTILS)
|
||||
if(sodium_FOUND)
|
||||
pip_module(io_utils "pip_crypt" "PIP I/O support" "" "" " (+crypt)")
|
||||
else()
|
||||
list(APPEND _microhttpd_add_libs dl)
|
||||
find_library(tls_lib gnutls)
|
||||
if (tls_lib)
|
||||
set(gnutls_FOUND TRUE)
|
||||
set(gnutls_LIBRARIES "${tls_lib}")
|
||||
list(APPEND _microhttpd_add_libs gnutls)
|
||||
endif()
|
||||
if(DEFINED ENV{QNX_HOST})
|
||||
list(APPEND _microhttpd_add_libs socket)
|
||||
pip_module(io_utils "" "PIP I/O support" "" "" "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (PIP_BUILD_LUA)
|
||||
# Lua module
|
||||
set(_lua_src_dir "${CMAKE_CURRENT_SOURCE_DIR}/3rd/lua")
|
||||
set(_lua_bri_dir "${CMAKE_CURRENT_SOURCE_DIR}/libs/lua/3rd")
|
||||
set(_lua_src_hdr "${_lua_src_dir}/lua.hpp" "${_lua_src_dir}/lua.h" "${_lua_src_dir}/luaconf.h" "${_lua_src_dir}/lualib.h")
|
||||
pip_module(lua "" "PIP Lua support" "${_lua_src_dir};${_lua_bri_dir}" "${_lua_src_dir}" " (internal)")
|
||||
target_include_directories(pip_lua PUBLIC "${_lua_src_dir}" "${_lua_bri_dir}")
|
||||
if (WIN32)
|
||||
target_compile_definitions(pip_lua PRIVATE LUA_BUILD_AS_DLL LUA_CORE)
|
||||
endif()
|
||||
list(APPEND HDR_DIRS "${_lua_bri_dir}/LuaBridge")
|
||||
list(APPEND HDRS ${_lua_src_hdr})
|
||||
endif()
|
||||
|
||||
|
||||
if (PIP_BUILD_HTTP_SERVER)
|
||||
# libmicrohttpd
|
||||
pip_find_lib(microhttpd HINTS "${MINGW_LIB}")
|
||||
if (microhttpd_FOUND)
|
||||
set(_microhttpd_add_libs microhttpd)
|
||||
if(WIN32)
|
||||
if("${C_COMPILER}" STREQUAL "cl.exe")
|
||||
else()
|
||||
list(APPEND _microhttpd_add_libs ws2_32)
|
||||
endif()
|
||||
else()
|
||||
if (NOT DEFINED ANDROID_PLATFORM)
|
||||
list(APPEND _microhttpd_add_libs pthread util)
|
||||
list(APPEND _microhttpd_add_libs dl)
|
||||
find_library(tls_lib gnutls)
|
||||
if (tls_lib)
|
||||
set(gnutls_FOUND TRUE)
|
||||
set(gnutls_LIBRARIES "${tls_lib}")
|
||||
list(APPEND _microhttpd_add_libs gnutls)
|
||||
endif()
|
||||
if(DEFINED ENV{QNX_HOST})
|
||||
list(APPEND _microhttpd_add_libs socket)
|
||||
else()
|
||||
if (NOT DEFINED ANDROID_PLATFORM)
|
||||
list(APPEND _microhttpd_add_libs pthread util)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
#list(APPEND microhttpd_LIBRARIES "${_microhttpd_add_libs}")
|
||||
pip_module(http_server "${_microhttpd_add_libs}" "PIP HTTP server" "" "" "")
|
||||
endif()
|
||||
#list(APPEND microhttpd_LIBRARIES "${_microhttpd_add_libs}")
|
||||
pip_module(http_server "${_microhttpd_add_libs}" "PIP HTTP server" "" "" "")
|
||||
endif()
|
||||
|
||||
# libcurl
|
||||
pip_find_lib(curl HINTS "${MINGW_LIB}")
|
||||
if (curl_FOUND)
|
||||
pip_module(http_client curl "PIP HTTP client" "" "" "")
|
||||
|
||||
if (PIP_BUILD_HTTP_CLIENT)
|
||||
# libcurl
|
||||
pip_find_lib(curl HINTS "${MINGW_LIB}")
|
||||
if (curl_FOUND)
|
||||
pip_module(http_client curl "PIP HTTP client" "" "" "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Test program
|
||||
if(PIP_UTILS)
|
||||
|
||||
@@ -547,9 +570,19 @@ if (NOT CROSSTOOLS)
|
||||
endif()
|
||||
|
||||
else()
|
||||
pip_module(crypt "" "PIP crypt support" "" "" "")
|
||||
pip_module(compress "" "PIP compression support" "" "" "")
|
||||
pip_module(io_utils "pip_crypt" "PIP I/O support" "" "" " (+crypt)")
|
||||
|
||||
if (PIP_BUILD_CRYPT)
|
||||
pip_module(crypt "" "PIP crypt support" "" "" "")
|
||||
endif()
|
||||
|
||||
if (PIP_BUILD_COMPRESS)
|
||||
pip_module(compress "" "PIP compression support" "" "" "")
|
||||
endif()
|
||||
|
||||
if (PIP_BUILD_IO_UTILS)
|
||||
pip_module(io_utils "pip_crypt" "PIP I/O support" "" "" " (+crypt)")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user