Skip to content

Commit

Permalink
Fix hello example include path (#1157)
Browse files Browse the repository at this point in the history
- Fix hello example include path
- Update add_gaia_sdk_gtest include path 
- Remove FDW related files from the `hello` example as FDW is broken.
  • Loading branch information
simone-gaia authored Dec 21, 2021
1 parent 57ee641 commit 0e47ec9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
22 changes: 15 additions & 7 deletions production/cmake/gaia_internal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}..."
Expand All @@ -329,9 +338,8 @@ function(add_gaia_sdk_gtest)
-I ${FLATBUFFERS_INC}
-I ${GAIA_SPDLOG_INC}
-I ${DAC_INCLUDE}
-I ${GAIAT_INCLUDE_PATH}
-stdlib=$<IF:$<CONFIG:Debug>,libc++,libstdc++>
-I $<IF:$<CONFIG:Debug>,${LIBCXX_INCLUDE_DIR},${LIBSTDCXX_INCLUDE_DIR}>
-I ${CLANG_INCLUDE_DIR}
-std=c++${CMAKE_CXX_STANDARD}
COMMAND pkill -f -KILL gaia_db_server &

Expand Down
3 changes: 2 additions & 1 deletion production/examples/hello/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions production/sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0e47ec9

Please sign in to comment.