diff --git a/production/cmake/gaia_internal.cmake b/production/cmake/gaia_internal.cmake index dbd4ba6a4fd7..d6f88797722e 100644 --- a/production/cmake/gaia_internal.cmake +++ b/production/cmake/gaia_internal.cmake @@ -312,11 +312,20 @@ function(add_gaia_sdk_gtest) # Unlike clang, gaiat isn't smart enough to know where system include dirs are # for intrinsics and stdlib headers, so we need to define them explicitly. - # Since our internal builds target only Ubuntu 20.04, we assume that the - # default version (9) of libstdc++ is installed. - set(CLANG_INCLUDE_DIR "/usr/include/clang/13/include/") - set(LIBCXX_INCLUDE_DIR "/usr/lib/llvm-13/include/c++/v1/") - set(LIBSTDCXX_INCLUDE_DIR "/usr/include/c++/9/") + set(GAIAT_INCLUDE_PATH "") + + # We use libc++ in debug and its header must be manually included. + # Note: the order of inclusion is relevant and libc++ headers must be + # defined first when libc++ is used. + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(LIBCXX_INCLUDE_DIR "/usr/lib/llvm-13/include/c++/v1/") + string(APPEND GAIAT_INCLUDE_PATH "-I;${LIBCXX_INCLUDE_DIR};") + endif() + + foreach(INCLUDE_PATH ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) + # Have to use ; instead of space otherwise custom_command will try to escape it + string(APPEND GAIAT_INCLUDE_PATH "-I;${INCLUDE_PATH};") + endforeach() add_custom_command( COMMENT "Compiling ${RULESET_FILE}..." @@ -329,9 +338,8 @@ function(add_gaia_sdk_gtest) -I ${FLATBUFFERS_INC} -I ${GAIA_SPDLOG_INC} -I ${DAC_INCLUDE} + -I ${GAIAT_INCLUDE_PATH} -stdlib=$,libc++,libstdc++> - -I $,${LIBCXX_INCLUDE_DIR},${LIBSTDCXX_INCLUDE_DIR}> - -I ${CLANG_INCLUDE_DIR} -std=c++${CMAKE_CXX_STANDARD} COMMAND pkill -f -KILL gaia_db_server & diff --git a/production/examples/hello/build.sh b/production/examples/hello/build.sh index ac99fd7dc69e..8c1857856729 100755 --- a/production/examples/hello/build.sh +++ b/production/examples/hello/build.sh @@ -10,6 +10,7 @@ gaiac -g hello.ddl -d hello -o . -gaiat hello.ruleset -output hello_ruleset.cpp -- -I /usr/include/clang/10 -I /opt/gaia/include +CLANG_INCLUDE_PATH="$(clang++-10 -print-resource-dir)/include" +gaiat hello.ruleset -output hello_ruleset.cpp -- -I "$CLANG_INCLUDE_PATH" -I /opt/gaia/include clang++-10 hello.cpp hello_ruleset.cpp gaia_hello.cpp /usr/local/lib/libgaia.so -I /opt/gaia/include -Wl,-rpath,/usr/local/lib -lpthread -o hello diff --git a/production/sdk/CMakeLists.txt b/production/sdk/CMakeLists.txt index 6544a5768515..c60da4d6d94f 100644 --- a/production/sdk/CMakeLists.txt +++ b/production/sdk/CMakeLists.txt @@ -184,11 +184,12 @@ install(FILES ${GAIA_REPO}/production/examples/hello/README.md DESTINATION examp install(FILES ${GAIA_REPO}/production/examples/hello/hello.ddl DESTINATION examples/hello) install(FILES ${GAIA_REPO}/production/examples/hello/hello.ruleset DESTINATION examples/hello) install(FILES ${GAIA_REPO}/production/examples/hello/hello.cpp DESTINATION examples/hello) -install(FILES ${GAIA_REPO}/production/examples/hello/setup.sql DESTINATION examples/hello) -install(PROGRAMS ${GAIA_REPO}/production/examples/hello/setup.sh DESTINATION examples/hello) install(PROGRAMS ${GAIA_REPO}/production/examples/hello/build.sh DESTINATION examples/hello) install(PROGRAMS ${GAIA_REPO}/production/examples/hello/run.sh DESTINATION examples/hello) install(FILES ${GAIA_REPO}/production/examples/hello/CMakeLists.txt DESTINATION examples/hello) +# Disabling FDW related files until we officially support it. +#install(FILES ${GAIA_REPO}/production/examples/hello/setup.sql DESTINATION examples/hello) +#install(PROGRAMS ${GAIA_REPO}/production/examples/hello/setup.sh DESTINATION examples/hello) # Place incubator example. install(FILES ${GAIA_REPO}/production/examples/incubator/incubator.ddl DESTINATION examples/incubator)