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:
Jason Dellaluce
2023-06-20 15:25:22 +00:00
committed by poiana
parent e7c5139563
commit 86e76924a1
3 changed files with 17 additions and 9 deletions

View File

@@ -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(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
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)
@@ -160,23 +165,26 @@ include(b64)
# yaml-cpp
include(yaml-cpp)
if(NOT MINIMAL_BUILD)
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
# OpenSSL
include(openssl)
# libcurl
include(curl)
# todo(jasondellaluce,rohith-raju): support webserver for non-linux builds too
# cpp-httlib
include(cpp-httplib)
endif()
include(cxxopts)
# One TBB
include(tbb)
if (NOT EMSCRIPTEN)
include(tbb)
endif()
if(NOT MINIMAL_BUILD)
# One TBB
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
include(zlib)
include(cares)
include(protobuf)
@@ -212,7 +220,7 @@ add_subdirectory(scripts)
add_subdirectory(userspace/engine)
add_subdirectory(userspace/falco)
if(NOT MUSL_OPTIMIZED_BUILD)
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MUSL_OPTIMIZED_BUILD)
include(plugins)
endif()

View File

@@ -30,7 +30,7 @@ set(CPACK_INSTALL_CMAKE_PROJECTS
"${CMAKE_CURRENT_BINARY_DIR};${FALCO_COMPONENT_NAME};${FALCO_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
"${CMAKE_CURRENT_BINARY_DIR};${PLUGINS_COMPONENT_NAME};${PLUGINS_COMPONENT_NAME};/"
)

View File

@@ -90,7 +90,7 @@ if(USE_BUNDLED_DEPS)
list(APPEND FALCO_DEPENDENCIES yamlcpp)
endif()
if(NOT MINIMAL_BUILD)
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
list(
APPEND FALCO_SOURCES
outputs_grpc.cpp
@@ -119,7 +119,7 @@ if(NOT MINIMAL_BUILD)
"${CARES_INCLUDE}"
)
if(USE_BUNDLED_GRPC)
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND USE_BUNDLED_GRPC)
list(APPEND FALCO_DEPENDENCIES grpc)
list(APPEND FALCO_LIBRARIES "${GRPC_LIBRARIES}")
endif()
@@ -161,7 +161,7 @@ add_dependencies(falco falco_application ${FALCO_DEPENDENCIES})
target_link_libraries(falco falco_application ${FALCO_LIBRARIES})
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(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/version.grpc.pb.cc