mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-10 02:59:38 +00:00
update: adapt cmake setup for non-linux and emscripten builds
Co-authored-by: Rohith Raju <rohithraju488@gmail.com> Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
@@ -20,6 +20,11 @@ option(MINIMAL_BUILD "Build a minimal version of Falco, containing only the engi
|
|||||||
option(MUSL_OPTIMIZED_BUILD "Enable if you want a musl optimized build" OFF)
|
option(MUSL_OPTIMIZED_BUILD "Enable if you want a musl optimized build" OFF)
|
||||||
option(BUILD_FALCO_UNIT_TESTS "Build falco unit tests" OFF)
|
option(BUILD_FALCO_UNIT_TESTS "Build falco unit tests" OFF)
|
||||||
|
|
||||||
|
if(EMSCRIPTEN)
|
||||||
|
set(USE_BUNDLED_DEPS ON CACHE BOOL "" FORCE)
|
||||||
|
set(BUILD_DRIVER OFF CACHE BOOL "" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# gVisor is currently only supported on Linux x86_64
|
# gVisor is currently only supported on Linux x86_64
|
||||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
|
||||||
option(BUILD_FALCO_GVISOR "Build gVisor support for Falco" ON)
|
option(BUILD_FALCO_GVISOR "Build gVisor support for Falco" ON)
|
||||||
@@ -160,23 +165,26 @@ include(b64)
|
|||||||
# yaml-cpp
|
# yaml-cpp
|
||||||
include(yaml-cpp)
|
include(yaml-cpp)
|
||||||
|
|
||||||
if(NOT MINIMAL_BUILD)
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
|
||||||
# OpenSSL
|
# OpenSSL
|
||||||
include(openssl)
|
include(openssl)
|
||||||
|
|
||||||
# libcurl
|
# libcurl
|
||||||
include(curl)
|
include(curl)
|
||||||
|
|
||||||
|
# todo(jasondellaluce,rohith-raju): support webserver for non-linux builds too
|
||||||
# cpp-httlib
|
# cpp-httlib
|
||||||
include(cpp-httplib)
|
include(cpp-httplib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(cxxopts)
|
include(cxxopts)
|
||||||
|
|
||||||
# One TBB
|
if (NOT EMSCRIPTEN)
|
||||||
include(tbb)
|
include(tbb)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT MINIMAL_BUILD)
|
# One TBB
|
||||||
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
|
||||||
include(zlib)
|
include(zlib)
|
||||||
include(cares)
|
include(cares)
|
||||||
include(protobuf)
|
include(protobuf)
|
||||||
@@ -212,7 +220,7 @@ add_subdirectory(scripts)
|
|||||||
add_subdirectory(userspace/engine)
|
add_subdirectory(userspace/engine)
|
||||||
add_subdirectory(userspace/falco)
|
add_subdirectory(userspace/falco)
|
||||||
|
|
||||||
if(NOT MUSL_OPTIMIZED_BUILD)
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MUSL_OPTIMIZED_BUILD)
|
||||||
include(plugins)
|
include(plugins)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@ set(CPACK_INSTALL_CMAKE_PROJECTS
|
|||||||
"${CMAKE_CURRENT_BINARY_DIR};${FALCO_COMPONENT_NAME};${FALCO_COMPONENT_NAME};/"
|
"${CMAKE_CURRENT_BINARY_DIR};${FALCO_COMPONENT_NAME};${FALCO_COMPONENT_NAME};/"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR};${DRIVER_COMPONENT_NAME};${DRIVER_COMPONENT_NAME};/"
|
"${CMAKE_CURRENT_BINARY_DIR};${DRIVER_COMPONENT_NAME};${DRIVER_COMPONENT_NAME};/"
|
||||||
)
|
)
|
||||||
if(NOT MUSL_OPTIMIZED_BUILD) # static builds do not have plugins
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MUSL_OPTIMIZED_BUILD) # static builds do not have plugins
|
||||||
list(APPEND CPACK_INSTALL_CMAKE_PROJECTS
|
list(APPEND CPACK_INSTALL_CMAKE_PROJECTS
|
||||||
"${CMAKE_CURRENT_BINARY_DIR};${PLUGINS_COMPONENT_NAME};${PLUGINS_COMPONENT_NAME};/"
|
"${CMAKE_CURRENT_BINARY_DIR};${PLUGINS_COMPONENT_NAME};${PLUGINS_COMPONENT_NAME};/"
|
||||||
)
|
)
|
||||||
|
@@ -90,7 +90,7 @@ if(USE_BUNDLED_DEPS)
|
|||||||
list(APPEND FALCO_DEPENDENCIES yamlcpp)
|
list(APPEND FALCO_DEPENDENCIES yamlcpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT MINIMAL_BUILD)
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
|
||||||
list(
|
list(
|
||||||
APPEND FALCO_SOURCES
|
APPEND FALCO_SOURCES
|
||||||
outputs_grpc.cpp
|
outputs_grpc.cpp
|
||||||
@@ -119,7 +119,7 @@ if(NOT MINIMAL_BUILD)
|
|||||||
"${CARES_INCLUDE}"
|
"${CARES_INCLUDE}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(USE_BUNDLED_GRPC)
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND USE_BUNDLED_GRPC)
|
||||||
list(APPEND FALCO_DEPENDENCIES grpc)
|
list(APPEND FALCO_DEPENDENCIES grpc)
|
||||||
list(APPEND FALCO_LIBRARIES "${GRPC_LIBRARIES}")
|
list(APPEND FALCO_LIBRARIES "${GRPC_LIBRARIES}")
|
||||||
endif()
|
endif()
|
||||||
@@ -161,7 +161,7 @@ add_dependencies(falco falco_application ${FALCO_DEPENDENCIES})
|
|||||||
target_link_libraries(falco falco_application ${FALCO_LIBRARIES})
|
target_link_libraries(falco falco_application ${FALCO_LIBRARIES})
|
||||||
target_include_directories(falco PUBLIC ${FALCO_INCLUDE_DIRECTORIES})
|
target_include_directories(falco PUBLIC ${FALCO_INCLUDE_DIRECTORIES})
|
||||||
|
|
||||||
if(NOT MINIMAL_BUILD)
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT
|
OUTPUT
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/version.grpc.pb.cc
|
${CMAKE_CURRENT_BINARY_DIR}/version.grpc.pb.cc
|
||||||
|
Reference in New Issue
Block a user