Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: add sanity check for toolchains w/ CXX support #9277

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/pr-compile-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,26 @@ jobs:
run: |
ldd ./bin/fluent-bit
working-directory: build

# Sanity check for compilation w/ CXX support
pr-compile-without-cxx:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
steps:
- name: Setup environment
run: |
sudo apt-get update
sudo apt-get install -y bison cmake flex gcc libssl-dev libyaml-dev

- name: Checkout Fluent Bit code
uses: actions/checkout@v4

- name: Compile w/ CXX support
run: |
export CXX=/bin/false
export nparallel=$(( $(getconf _NPROCESSORS_ONLN) > 8 ? 8 : $(getconf _NPROCESSORS_ONLN) ))
cmake ../
make -j $nparallel
working-directory: build
1 change: 1 addition & 0 deletions cmake/kafka.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# kafka cmake
FLB_OPTION(RDKAFKA_BUILD_CXX Off)
FLB_OPTION(RDKAFKA_BUILD_STATIC On)
FLB_OPTION(RDKAFKA_BUILD_EXAMPLES Off)
FLB_OPTION(RDKAFKA_BUILD_TESTS Off)
Expand Down
18 changes: 15 additions & 3 deletions lib/librdkafka-2.4.0/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ cmake_minimum_required(VERSION 3.2)
include("packaging/cmake/parseversion.cmake")
parseversion("src/rdkafka.h")

project(RdKafka VERSION ${RDKAFKA_VERSION})
project(RdKafka VERSION ${RDKAFKA_VERSION} LANGUAGES C)

option(RDKAFKA_BUILD_CXX "Enable CXX support" ON)
if(RDKAFKA_BUILD_CXX)
enable_language(CXX)
endif()

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/packaging/cmake/Modules/")

Expand Down Expand Up @@ -181,7 +186,11 @@ endif()

option(RDKAFKA_BUILD_STATIC "Build static rdkafka library" OFF)
option(RDKAFKA_BUILD_EXAMPLES "Build examples" ON)
option(RDKAFKA_BUILD_TESTS "Build tests" ON)

if(RDKAFKA_BUILD_CXX)
option(RDKAFKA_BUILD_TESTS "Build tests" ON)
endif()

if(WIN32)
option(WITHOUT_WIN32_CONFIG "Avoid including win32_config.h on cmake builds" ON)
endif(WIN32)
Expand Down Expand Up @@ -279,7 +288,10 @@ install(
)

add_subdirectory(src)
add_subdirectory(src-cpp)

if(RDKAFKA_BUILD_CXX)
add_subdirectory(src-cpp)
endif()

if(RDKAFKA_BUILD_EXAMPLES)
add_subdirectory(examples)
Expand Down
31 changes: 20 additions & 11 deletions lib/librdkafka-2.4.0/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,31 @@ endif(WIN32)
add_executable(producer producer.c ${win32_sources})
target_link_libraries(producer PUBLIC rdkafka)

add_executable(producer_cpp producer.cpp ${win32_sources})
target_link_libraries(producer_cpp PUBLIC rdkafka++)
if(RDKAFKA_BUILD_CXX)
add_executable(producer_cpp producer.cpp ${win32_sources})
target_link_libraries(producer_cpp PUBLIC rdkafka++)
endif()

add_executable(consumer consumer.c ${win32_sources})
target_link_libraries(consumer PUBLIC rdkafka)

add_executable(rdkafka_performance rdkafka_performance.c ${win32_sources})
target_link_libraries(rdkafka_performance PUBLIC rdkafka)

add_executable(rdkafka_example_cpp rdkafka_example.cpp ${win32_sources})
target_link_libraries(rdkafka_example_cpp PUBLIC rdkafka++)
if(RDKAFKA_BUILD_CXX)
add_executable(rdkafka_example_cpp rdkafka_example.cpp ${win32_sources})
target_link_libraries(rdkafka_example_cpp PUBLIC rdkafka++)
endif()

add_executable(rdkafka_complex_consumer_example_cpp rdkafka_complex_consumer_example.cpp ${win32_sources})
target_link_libraries(rdkafka_complex_consumer_example_cpp PUBLIC rdkafka++)
if(RDKAFKA_BUILD_CXX)
add_executable(rdkafka_complex_consumer_example_cpp rdkafka_complex_consumer_example.cpp ${win32_sources})
target_link_libraries(rdkafka_complex_consumer_example_cpp PUBLIC rdkafka++)
endif()

add_executable(openssl_engine_example_cpp openssl_engine_example.cpp ${win32_sources})
target_link_libraries(openssl_engine_example_cpp PUBLIC rdkafka++)
if(RDKAFKA_BUILD_CXX)
add_executable(openssl_engine_example_cpp openssl_engine_example.cpp ${win32_sources})
target_link_libraries(openssl_engine_example_cpp PUBLIC rdkafka++)
endif()

add_executable(misc misc.c ${win32_sources})
target_link_libraries(misc PUBLIC rdkafka)
Expand Down Expand Up @@ -70,7 +78,8 @@ if(NOT WIN32)
add_executable(rdkafka_complex_consumer_example rdkafka_complex_consumer_example.c)
target_link_libraries(rdkafka_complex_consumer_example PUBLIC rdkafka)

add_executable(kafkatest_verifiable_client kafkatest_verifiable_client.cpp)
target_link_libraries(kafkatest_verifiable_client PUBLIC rdkafka++)

if(RDKAFKA_BUILD_CXX)
add_executable(kafkatest_verifiable_client kafkatest_verifiable_client.cpp)
target_link_libraries(kafkatest_verifiable_client PUBLIC rdkafka++)
endif()
endif(NOT WIN32)
4 changes: 2 additions & 2 deletions lib/luajit-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif()

get_directory_property(hasParent PARENT_DIRECTORY)
if(LUAJIT_DIR)
project(luajit)
project(luajit LANGUAGES C)
include(LuaJIT.cmake)
if (hasParent)
set(LUA_TARGET $<TARGET_FILE:luajit> PARENT_SCOPE)
Expand All @@ -24,7 +24,7 @@ if(LUAJIT_DIR)
endif()
endif()
elseif(LUA_DIR)
project(lua)
project(lua LANGUAGES C)
include(lua.cmake)
if (hasParent)
set(LUA_TARGET $<TARGET_FILE:lua> PARENT_SCOPE)
Expand Down
50 changes: 26 additions & 24 deletions lib/nghttp2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

cmake_minimum_required(VERSION 3.0)
# XXX using 1.8.90 instead of 1.9.0-DEV
project(nghttp2 VERSION 1.58.90)
project(nghttp2 VERSION 1.58.90 LANGUAGES C)

# See versioning rule:
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
Expand Down Expand Up @@ -122,29 +122,31 @@ else()
set(HINT_NORETURN)
endif()

include(ExtractValidFlags)
foreach(_cxx1x_flag -std=c++14)
extract_valid_cxx_flags(_cxx1x_flag_supported ${_cxx1x_flag})
if(_cxx1x_flag_supported)
set(CXX1XCXXFLAGS ${_cxx1x_flag})
break()
endif()
endforeach()
if(NOT ENABLE_LIB_ONLY)
include(ExtractValidFlags)
foreach(_cxx1x_flag -std=c++14)
extract_valid_cxx_flags(_cxx1x_flag_supported ${_cxx1x_flag})
if(_cxx1x_flag_supported)
set(CXX1XCXXFLAGS ${_cxx1x_flag})
break()
endif()
endforeach()

include(CMakePushCheckState)
include(CheckCXXSourceCompiles)
cmake_push_check_state()
set(CMAKE_REQUIRED_DEFINITIONS "${CXX1XCXXFLAGS}")
# Check that std::future is available.
check_cxx_source_compiles("
#include <vector>
#include <future>
int main() { std::vector<std::future<int>> v; }" HAVE_STD_FUTURE)
# Check that std::map::emplace is available for g++-4.7.
check_cxx_source_compiles("
#include <map>
int main() { std::map<int, int>().emplace(1, 2); }" HAVE_STD_MAP_EMPLACE)
cmake_pop_check_state()
include(CMakePushCheckState)
include(CheckCXXSourceCompiles)
cmake_push_check_state()
set(CMAKE_REQUIRED_DEFINITIONS "${CXX1XCXXFLAGS}")
# Check that std::future is available.
check_cxx_source_compiles("
#include <vector>
#include <future>
int main() { std::vector<std::future<int>> v; }" HAVE_STD_FUTURE)
# Check that std::map::emplace is available for g++-4.7.
check_cxx_source_compiles("
#include <map>
int main() { std::map<int, int>().emplace(1, 2); }" HAVE_STD_MAP_EMPLACE)
cmake_pop_check_state()
endif()


# Checks for libraries.
Expand Down Expand Up @@ -177,7 +179,7 @@ endif()
# openssl (for src)
include(CheckSymbolExists)
set(HAVE_OPENSSL ${OPENSSL_FOUND})
if(OPENSSL_FOUND)
if(NOT ENABLE_LIB_ONLY AND OPENSSL_FOUND)
set(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
Expand Down
Loading