add PIP_BUILD_<MODULE> options for PIP build to force disabling modules

This commit is contained in:
2025-01-09 17:36:40 +03:00
parent f334a6603f
commit 7757ac10ec

View File

@@ -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,30 +394,37 @@ endif()
if (NOT CROSSTOOLS)
if (NOT PIP_FREERTOS)
if (PIP_BUILD_CONSOLE)
pip_module(console "" "PIP console support" "" "" "")
endif()
if (PIP_BUILD_USB)
pip_find_lib(usb)
if(usb_FOUND)
pip_module(usb "usb" "PIP usb support" "" "" "")
endif()
endif()
if (PIP_BUILD_COMPRESS)
pip_find_lib(zlib NAMES z zlib)
if(zlib_FOUND)
pip_module(compress "zlib" "PIP compression support" "" "" "")
endif()
endif()
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()
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")
@@ -459,8 +468,10 @@ if (NOT CROSSTOOLS)
if(FFTW_LIBS)
pip_module(fftw "${FFTW_LIBS}" "PIP FFTW support" "" "" "")
endif()
endif()
if (PIP_BUILD_OPENCL)
if (NOT "x${MINGW_INCLUDE}" STREQUAL "x")
list(APPEND CMAKE_INCLUDE_PATH "${MINGW_INCLUDE}")
endif()
@@ -472,15 +483,19 @@ if (NOT CROSSTOOLS)
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()
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")
@@ -492,7 +507,10 @@ if (NOT CROSSTOOLS)
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)
@@ -521,12 +539,17 @@ if (NOT CROSSTOOLS)
#list(APPEND microhttpd_LIBRARIES "${_microhttpd_add_libs}")
pip_module(http_server "${_microhttpd_add_libs}" "PIP HTTP server" "" "" "")
endif()
endif()
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,10 +570,20 @@ if (NOT CROSSTOOLS)
endif()
else()
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()
string(REPLACE ";" "," PIP_EXPORTS_STR "${PIP_EXPORTS}")