Skip to content

Commit 0e47ec9

Browse files
authored
Fix hello example include path (#1157)
- Fix hello example include path - Update add_gaia_sdk_gtest include path - Remove FDW related files from the `hello` example as FDW is broken.
1 parent 57ee641 commit 0e47ec9

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

production/cmake/gaia_internal.cmake

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,20 @@ function(add_gaia_sdk_gtest)
312312

313313
# Unlike clang, gaiat isn't smart enough to know where system include dirs are
314314
# for intrinsics and stdlib headers, so we need to define them explicitly.
315-
# Since our internal builds target only Ubuntu 20.04, we assume that the
316-
# default version (9) of libstdc++ is installed.
317-
set(CLANG_INCLUDE_DIR "/usr/include/clang/13/include/")
318-
set(LIBCXX_INCLUDE_DIR "/usr/lib/llvm-13/include/c++/v1/")
319-
set(LIBSTDCXX_INCLUDE_DIR "/usr/include/c++/9/")
315+
set(GAIAT_INCLUDE_PATH "")
316+
317+
# We use libc++ in debug and its header must be manually included.
318+
# Note: the order of inclusion is relevant and libc++ headers must be
319+
# defined first when libc++ is used.
320+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
321+
set(LIBCXX_INCLUDE_DIR "/usr/lib/llvm-13/include/c++/v1/")
322+
string(APPEND GAIAT_INCLUDE_PATH "-I;${LIBCXX_INCLUDE_DIR};")
323+
endif()
324+
325+
foreach(INCLUDE_PATH ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
326+
# Have to use ; instead of space otherwise custom_command will try to escape it
327+
string(APPEND GAIAT_INCLUDE_PATH "-I;${INCLUDE_PATH};")
328+
endforeach()
320329

321330
add_custom_command(
322331
COMMENT "Compiling ${RULESET_FILE}..."
@@ -329,9 +338,8 @@ function(add_gaia_sdk_gtest)
329338
-I ${FLATBUFFERS_INC}
330339
-I ${GAIA_SPDLOG_INC}
331340
-I ${DAC_INCLUDE}
341+
-I ${GAIAT_INCLUDE_PATH}
332342
-stdlib=$<IF:$<CONFIG:Debug>,libc++,libstdc++>
333-
-I $<IF:$<CONFIG:Debug>,${LIBCXX_INCLUDE_DIR},${LIBSTDCXX_INCLUDE_DIR}>
334-
-I ${CLANG_INCLUDE_DIR}
335343
-std=c++${CMAKE_CXX_STANDARD}
336344
COMMAND pkill -f -KILL gaia_db_server &
337345

production/examples/hello/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
gaiac -g hello.ddl -d hello -o .
1212

13-
gaiat hello.ruleset -output hello_ruleset.cpp -- -I /usr/include/clang/10 -I /opt/gaia/include
13+
CLANG_INCLUDE_PATH="$(clang++-10 -print-resource-dir)/include"
14+
gaiat hello.ruleset -output hello_ruleset.cpp -- -I "$CLANG_INCLUDE_PATH" -I /opt/gaia/include
1415

1516
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

production/sdk/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,12 @@ install(FILES ${GAIA_REPO}/production/examples/hello/README.md DESTINATION examp
184184
install(FILES ${GAIA_REPO}/production/examples/hello/hello.ddl DESTINATION examples/hello)
185185
install(FILES ${GAIA_REPO}/production/examples/hello/hello.ruleset DESTINATION examples/hello)
186186
install(FILES ${GAIA_REPO}/production/examples/hello/hello.cpp DESTINATION examples/hello)
187-
install(FILES ${GAIA_REPO}/production/examples/hello/setup.sql DESTINATION examples/hello)
188-
install(PROGRAMS ${GAIA_REPO}/production/examples/hello/setup.sh DESTINATION examples/hello)
189187
install(PROGRAMS ${GAIA_REPO}/production/examples/hello/build.sh DESTINATION examples/hello)
190188
install(PROGRAMS ${GAIA_REPO}/production/examples/hello/run.sh DESTINATION examples/hello)
191189
install(FILES ${GAIA_REPO}/production/examples/hello/CMakeLists.txt DESTINATION examples/hello)
190+
# Disabling FDW related files until we officially support it.
191+
#install(FILES ${GAIA_REPO}/production/examples/hello/setup.sql DESTINATION examples/hello)
192+
#install(PROGRAMS ${GAIA_REPO}/production/examples/hello/setup.sh DESTINATION examples/hello)
192193

193194
# Place incubator example.
194195
install(FILES ${GAIA_REPO}/production/examples/incubator/incubator.ddl DESTINATION examples/incubator)

0 commit comments

Comments
 (0)