mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-05 19:06:44 +00:00
new(build): add options to use bundled yamlcpp and njson
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
This commit is contained in:
parent
736277d3d5
commit
97806a98fb
@ -32,6 +32,8 @@ else()
|
|||||||
set(CPPHTTPLIB_SRC "${PROJECT_BINARY_DIR}/cpp-httplib-prefix/src/cpp-httplib")
|
set(CPPHTTPLIB_SRC "${PROJECT_BINARY_DIR}/cpp-httplib-prefix/src/cpp-httplib")
|
||||||
set(CPPHTTPLIB_INCLUDE "${CPPHTTPLIB_SRC}")
|
set(CPPHTTPLIB_INCLUDE "${CPPHTTPLIB_SRC}")
|
||||||
|
|
||||||
|
message(STATUS "Using bundled cpp-httplib in ${CPPHTTPLIB_SRC}")
|
||||||
|
|
||||||
ExternalProject_Add(cpp-httplib
|
ExternalProject_Add(cpp-httplib
|
||||||
PREFIX "${PROJECT_BINARY_DIR}/cpp-httplib-prefix"
|
PREFIX "${PROJECT_BINARY_DIR}/cpp-httplib-prefix"
|
||||||
URL "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.13.1.tar.gz"
|
URL "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.13.1.tar.gz"
|
||||||
|
@ -44,5 +44,5 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT TARGET cxxopts)
|
if(NOT TARGET cxxopts)
|
||||||
add_custom_target(cxxopts)
|
add_custom_target(cxxopts)
|
||||||
endif()
|
endif()
|
||||||
|
@ -83,7 +83,6 @@ set(BUILD_LIBSCAP_EXAMPLES OFF CACHE BOOL "")
|
|||||||
|
|
||||||
set(USE_BUNDLED_TBB ON CACHE BOOL "")
|
set(USE_BUNDLED_TBB ON CACHE BOOL "")
|
||||||
set(USE_BUNDLED_JSONCPP ON CACHE BOOL "")
|
set(USE_BUNDLED_JSONCPP ON CACHE BOOL "")
|
||||||
set(USE_BUNDLED_NLOHMANN_JSON ON CACHE BOOL "")
|
|
||||||
set(USE_BUNDLED_VALIJSON ON CACHE BOOL "")
|
set(USE_BUNDLED_VALIJSON ON CACHE BOOL "")
|
||||||
set(USE_BUNDLED_RE2 ON CACHE BOOL "")
|
set(USE_BUNDLED_RE2 ON CACHE BOOL "")
|
||||||
set(USE_BUNDLED_UTHASH ON CACHE BOOL "")
|
set(USE_BUNDLED_UTHASH ON CACHE BOOL "")
|
||||||
|
@ -12,16 +12,34 @@
|
|||||||
# specific language governing permissions and limitations under the License.
|
# specific language governing permissions and limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
if(USE_BUNDLED_NLOHMANN_JSON)
|
#
|
||||||
|
# njson (https://github.com/nlohmann/json)
|
||||||
|
#
|
||||||
|
|
||||||
|
option(USE_BUNDLED_NLOHMANN_JSON "Enable building of the bundled nlohmann-json" ${USE_BUNDLED_DEPS})
|
||||||
|
|
||||||
|
if(nlohmann_json_INCLUDE_DIRS)
|
||||||
|
# we already have nlohmnann-json
|
||||||
|
elseif(NOT USE_BUNDLED_NLOHMANN_JSON)
|
||||||
|
find_path(nlohmann_json_INCLUDE_DIRS NAMES nlohmann)
|
||||||
|
|
||||||
|
if(nlohmann_json_INCLUDE_DIRS)
|
||||||
|
message(STATUS "Found nlohmann-json: include: ${nlohmann_json_INCLUDE_DIRS}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Couldn't find system nlohmann-json")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(nlohmann_json_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/njson-prefix/include")
|
||||||
|
|
||||||
|
message(STATUS "Using bundled nlohmann-json in ${nlohmann_json_INCLUDE_DIRS}")
|
||||||
|
|
||||||
ExternalProject_Add(njson
|
ExternalProject_Add(njson
|
||||||
URL "https://github.com/nlohmann/json/archive/v3.3.0.tar.gz"
|
URL "https://github.com/nlohmann/json/archive/v3.3.0.tar.gz"
|
||||||
URL_HASH "SHA256=2fd1d207b4669a7843296c41d3b6ac5b23d00dec48dba507ba051d14564aa801"
|
URL_HASH "SHA256=2fd1d207b4669a7843296c41d3b6ac5b23d00dec48dba507ba051d14564aa801"
|
||||||
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/njson-prefix -DJSON_BuildTests=OFF -DBUILD_TESTING=OFF
|
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/njson-prefix -DJSON_BuildTests=OFF -DBUILD_TESTING=OFF
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(nlohmann_json_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/njson-prefix/include)
|
if(NOT TARGET njson)
|
||||||
else()
|
|
||||||
find_package(nlohmann_json CONFIG REQUIRED)
|
|
||||||
get_target_property(nlohmann_json_INCLUDE_DIRS nlohmann_json::nlohmann_json INTERFACE_INCLUDE_DIRECTORIES)
|
|
||||||
add_custom_target(njson)
|
add_custom_target(njson)
|
||||||
endif()
|
endif()
|
||||||
|
@ -11,31 +11,46 @@
|
|||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations under the License.
|
# specific language governing permissions and limitations under the License.
|
||||||
#
|
#
|
||||||
mark_as_advanced(YAMLCPP_INCLUDE_DIR YAMLCPP_LIB)
|
|
||||||
if(NOT USE_BUNDLED_DEPS)
|
#
|
||||||
find_path(YAMLCPP_INCLUDE_DIR NAMES yaml-cpp/yaml.h)
|
# yamlcpp (https://github.com/jbeder/yaml-cpp)
|
||||||
find_library(YAMLCPP_LIB NAMES yaml-cpp)
|
#
|
||||||
if(YAMLCPP_INCLUDE_DIR AND YAMLCPP_LIB)
|
|
||||||
message(STATUS "Found yamlcpp: include: ${YAMLCPP_INCLUDE_DIR}, lib: ${YAMLCPP_LIB}")
|
option(USE_BUNDLED_YAMLCPP "Enable building of the bundled yamlcpp" ${USE_BUNDLED_DEPS})
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Couldn't find system yamlcpp")
|
if(YAMLCPP_INCLUDE_DIR)
|
||||||
endif()
|
# we already have yamlcpp
|
||||||
add_custom_target(yamlcpp)
|
elseif(NOT USE_BUNDLED_YAMLCPP)
|
||||||
|
find_path(YAMLCPP_INCLUDE_DIR NAMES yaml-cpp/yaml.h)
|
||||||
|
find_library(YAMLCPP_LIB NAMES yaml-cpp)
|
||||||
|
|
||||||
|
if(YAMLCPP_INCLUDE_DIR)
|
||||||
|
message(STATUS "Found yamlcpp: include: ${YAMLCPP_INCLUDE_DIR}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Couldn't find system yamlcpp")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set(YAMLCPP_SRC "${PROJECT_BINARY_DIR}/yamlcpp-prefix/src/yamlcpp")
|
set(YAMLCPP_SRC "${PROJECT_BINARY_DIR}/yamlcpp-prefix/src/yamlcpp")
|
||||||
message(STATUS "Using bundled yaml-cpp in '${YAMLCPP_SRC}'")
|
set(YAMLCPP_INCLUDE_DIR "${YAMLCPP_SRC}/include")
|
||||||
if(NOT WIN32)
|
|
||||||
set(YAMLCPP_LIB "${YAMLCPP_SRC}/libyaml-cpp.a")
|
message(STATUS "Using bundled yaml-cpp in '${YAMLCPP_SRC}'")
|
||||||
else()
|
|
||||||
set(YAMLCPP_LIB "${YAMLCPP_SRC}/${CMAKE_BUILD_TYPE}/yaml-cpp.lib")
|
if(NOT WIN32)
|
||||||
endif()
|
set(YAMLCPP_LIB "${YAMLCPP_SRC}/libyaml-cpp.a")
|
||||||
set(YAMLCPP_INCLUDE_DIR "${YAMLCPP_SRC}/include")
|
else()
|
||||||
ExternalProject_Add(
|
set(YAMLCPP_LIB "${YAMLCPP_SRC}/${CMAKE_BUILD_TYPE}/yaml-cpp.lib")
|
||||||
yamlcpp
|
endif()
|
||||||
URL "https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.7.0.tar.gz"
|
|
||||||
URL_HASH "SHA256=43e6a9fcb146ad871515f0d0873947e5d497a1c9c60c58cb102a97b47208b7c3"
|
ExternalProject_Add(
|
||||||
BUILD_BYPRODUCTS ${YAMLCPP_LIB}
|
yamlcpp
|
||||||
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DYAML_MSVC_SHARED_RT=Off -DYAML_BUILD_SHARED_LIBS=Off -DYAML_CPP_BUILD_TESTS=Off -DYAML_CPP_BUILD_TOOLS=OFF -DYAML_CPP_BUILD_CONTRIB=OFF -DCMAKE_DEBUG_POSTFIX=''
|
URL "https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.7.0.tar.gz"
|
||||||
BUILD_IN_SOURCE 1
|
URL_HASH "SHA256=43e6a9fcb146ad871515f0d0873947e5d497a1c9c60c58cb102a97b47208b7c3"
|
||||||
INSTALL_COMMAND "")
|
BUILD_BYPRODUCTS ${YAMLCPP_LIB}
|
||||||
|
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DYAML_MSVC_SHARED_RT=Off -DYAML_BUILD_SHARED_LIBS=Off -DYAML_CPP_BUILD_TESTS=Off -DYAML_CPP_BUILD_TOOLS=OFF -DYAML_CPP_BUILD_CONTRIB=OFF -DCMAKE_DEBUG_POSTFIX=''
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
INSTALL_COMMAND "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET yamlcpp)
|
||||||
|
add_custom_target(yamlcpp)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user