compiled-in LUA

This commit is contained in:
2021-04-19 23:59:56 +03:00
parent 7bed88b4e5
commit eb2bc2a641
62 changed files with 23154 additions and 107 deletions

View File

@@ -52,18 +52,22 @@ foreach(_m ${PIP_SRC_MODULES})
set(PIP_MSG_${_m} "no")
endforeach()
macro(pip_module NAME LIBS LABEL INCLUDES MSG)
macro(pip_module NAME LIBS LABEL INCLUDES SOURCES MSG)
set(CPPS)
set(HS)
set(PHS)
set(CRES)
file(GLOB_RECURSE CPPS "libs/${NAME}/*.cpp")
file(GLOB_RECURSE CPPS "libs/${NAME}/*.cpp" "libs/${NAME}/*.c")
file(GLOB_RECURSE HS "libs/${NAME}/*.h")
file(GLOB_RECURSE PHS "libs/${NAME}/*_p.h")
file(GLOB_RECURSE RES "libs/${NAME}/*.conf")
if (NOT "x${PHS}" STREQUAL "x")
list(REMOVE_ITEM HS ${PHS})
endif()
if (NOT "x${SOURCES}" STREQUAL "x")
file(GLOB_RECURSE ASRC "${SOURCES}/*.cpp" "${SOURCES}/*.c")
list(APPEND CPPS ${ASRC})
endif()
list(APPEND HDRS ${HS})
list(APPEND PHDRS ${PHS})
@@ -324,7 +328,7 @@ endif()
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
pip_module(main "${LIBS_MAIN}" "PIP main library" "" "")
pip_module(main "${LIBS_MAIN}" "PIP main library" "" "" "")
generate_export_header(pip)
list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_export.h")
@@ -340,25 +344,25 @@ if (NOT CROSSTOOLS)
if (NOT PIP_FREERTOS)
pip_module(console "" "PIP console support" "" "")
pip_module(console "" "PIP console support" "" "" "")
pip_find_lib(usb)
if(usb_FOUND)
pip_module(usb "usb" "PIP usb support" "" "")
pip_module(usb "usb" "PIP usb support" "" "" "")
endif()
pip_find_lib(zlib NAMES z zlib)
if(zlib_FOUND)
pip_module(compress "zlib" "PIP compression support" "" "")
pip_module(compress "zlib" "PIP compression support" "" "" "")
endif()
pip_find_lib(sodium)
if(sodium_FOUND)
pip_module(crypt "sodium" "PIP crypt support" "" "")
pip_module(cloud "pip_io_utils" "PIP cloud support" "" "")
pip_module(crypt "sodium" "PIP crypt support" "" "" "")
pip_module(cloud "pip_io_utils" "PIP cloud support" "" "" "")
endif()
@@ -403,7 +407,7 @@ if (NOT CROSSTOOLS)
endforeach()
endforeach()
if(FFTW_LIBS)
pip_module(fftw "${FFTW_LIBS}" "PIP FFTW support" "" "")
pip_module(fftw "${FFTW_LIBS}" "PIP FFTW support" "" "" "")
endif()
@@ -417,26 +421,26 @@ if (NOT CROSSTOOLS)
if(APPLE)
set(_opencl_inc "${OpenCL_INCLUDE_DIRS}/Headers")
endif()
pip_module(opencl "${_opencl_lib}" "PIP OpenCL support" "${_opencl_inc}" " (${OpenCL_VERSION_STRING})")
pip_module(opencl "${_opencl_lib}" "PIP OpenCL support" "${_opencl_inc}" "" " (${OpenCL_VERSION_STRING})")
endif()
if(sodium_FOUND)
pip_module(io_utils "pip_crypt" "PIP I/O support" "" " (+crypt)")
pip_module(io_utils "pip_crypt" "PIP I/O support" "" "" " (+crypt)")
else()
pip_module(io_utils "" "PIP I/O support" "" "")
pip_module(io_utils "" "PIP I/O support" "" "" "")
endif()
# Check Lua support
if(MINGW)
set(LUA_INCLUDE_DIR ${MINGW_INCLUDE})
endif()
find_package(Lua QUIET)
if (LUA_FOUND)
pip_module(lua "LUA" "PIP Lua support" "${LUA_INCLUDE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libs/lua/3rd" " (${LUA_VERSION_STRING})")
list(APPEND HDR_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/libs/lua/3rd/LuaBridge")
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}")
target_compile_definitions(pip_lua PRIVATE LUA_BUILD_AS_DLL LUA_CORE)
list(APPEND HDR_DIRS "${_lua_bri_dir}/LuaBridge")
list(APPEND HDRS ${_lua_src_hdr})
# Test program
@@ -445,16 +449,13 @@ if (NOT CROSSTOOLS)
#target_link_libraries(pip_plugin pip)
add_executable(pip_test "main.cpp")
target_link_libraries(pip_test pip pip_cloud)
if (LUA_FOUND)
target_link_libraries(pip_test pip_lua ${LUA_LIBRARIES})
endif()
target_link_libraries(pip_test pip pip_cloud pip_lua)
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)")
pip_module(crypt "" "PIP crypt support" "" "" "")
pip_module(compress "" "PIP compression support" "" "" "")
pip_module(io_utils "pip_crypt" "PIP I/O support" "" "" " (+crypt)")
endif()
endif()