File tree 12 files changed +122
-82
lines changed
include/substrait/function
12 files changed +122
-82
lines changed Original file line number Diff line number Diff line change
1
+ name : Ubuntu Build & Test
2
+
3
+ on :
4
+ push :
5
+ branches : [main]
6
+ pull_request :
7
+ branches : [main]
8
+
9
+ jobs :
10
+ build :
11
+ runs-on : ubuntu-latest
12
+
13
+ steps :
14
+ - uses : actions/checkout@v3
15
+ with :
16
+ submodules : recursive
17
+ - name : Setup Ubuntu
18
+ run : ./scripts/setup-ubuntu.sh
19
+ - run : mkdir build
20
+ - name : Run cmake
21
+ run : cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug
22
+ - name : Build
23
+ run : ninja -C build
24
+ - name : Test
25
+ run : ctest --test-dir build
Original file line number Diff line number Diff line change 31
31
* .out
32
32
* .app
33
33
34
+ # IDE files
35
+ * ~
36
+ .vscode /
37
+
38
+ # Common CMake Build directory
39
+ build /
40
+
41
+ # Generated code
34
42
src /proto /substrait
Original file line number Diff line number Diff line change @@ -12,13 +12,21 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
12
12
set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
13
13
14
14
option (
15
- BUILD_TESTING
16
- "Enable substrait-cpp tests. This will enable all other build options automatically."
17
- ON )
15
+ SUBSTRAIT_CPP_BUILD_TESTING
16
+ "Enable substrait-cpp tests. This will enable all other build options automatically."
17
+ ON )
18
18
19
19
find_package (Protobuf REQUIRED)
20
20
include_directories (${PROTOBUF_INCLUDE_DIRS} )
21
21
22
22
add_subdirectory (third_party)
23
23
include_directories (include )
24
+
25
+ list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake_modules" )
26
+ include (BuildUtils)
27
+
28
+ if (${SUBSTRAIT_CPP_BUILD_TESTING} )
29
+ enable_testing ()
30
+ endif ()
31
+
24
32
add_subdirectory (substrait)
Original file line number Diff line number Diff line change
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ # This file contains various cmake helper functions that are used throughout the
4
+ # project.
5
+
6
+ # Add a new test case, with or without an executable that should be built.
7
+ #
8
+ # TEST_NAME is the name of the test.
9
+ #
10
+ # SOURCES is the list of C++ source files to compile into the test executable.
11
+ function (ADD_TEST_CASE TEST_NAME)
12
+ set (multi_value_args SOURCES EXTRA_LINK_LIBS EXTRA_INCLUDES
13
+ EXTRA_DEPENDENCIES)
14
+ cmake_parse_arguments (ARG "${options} " "${one_value_args} "
15
+ "${multi_value_args} " ${ARGN} )
16
+ if (ARG_UNPARSED_ARGUMENTS)
17
+ message (
18
+ SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS} " )
19
+ endif ()
20
+
21
+ if (ARG_SOURCES)
22
+ set (SOURCES ${ARG_SOURCES} )
23
+ else ()
24
+ message (SEND_ERROR "Error: SOURCES is a required argument to add_test_case" )
25
+ endif ()
26
+
27
+ add_executable (${TEST_NAME} ${SOURCES} )
28
+ set_target_properties (
29
+ ${TEST_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
30
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /tests)
31
+
32
+ if (ARG_EXTRA_LINK_LIBS)
33
+ target_link_libraries (${TEST_NAME} PRIVATE ${ARG_EXTRA_LINK_LIBS} )
34
+ endif ()
35
+
36
+ if (ARG_EXTRA_INCLUDES)
37
+ target_include_directories (${TEST_NAME} SYSTEM PUBLIC ${ARG_EXTRA_INCLUDES} )
38
+ endif ()
39
+
40
+ if (ARG_EXTRA_DEPENDENCIES)
41
+ add_dependencies (${TEST_NAME} ${ARG_EXTRA_DEPENDENCIES} )
42
+ endif ()
43
+
44
+ add_test (NAME ${TEST_NAME} COMMAND $<TARGET_FILE:${TEST_NAME} >)
45
+ endfunction ()
Original file line number Diff line number Diff line change 2
2
3
3
#pragma once
4
4
5
- #include " substrait/type/Type.h"
5
+ #include < optional>
6
+
6
7
#include " substrait/function/FunctionSignature.h"
8
+ #include " substrait/type/Type.h"
7
9
8
10
namespace io ::substrait {
9
11
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ function cmake_install {
122
122
" ${INSTALL_PREFIX+-DCMAKE_PREFIX_PATH=}${INSTALL_PREFIX-} " \
123
123
" ${INSTALL_PREFIX+-DCMAKE_INSTALL_PREFIX=}${INSTALL_PREFIX-} " \
124
124
-DCMAKE_CXX_FLAGS=" $COMPILER_FLAGS " \
125
- -DBUILD_TESTING =OFF \
125
+ -DSUBSTRAIT_CPP_BUILD_TESTING =OFF \
126
126
" $@ "
127
127
ninja -C " ${BINARY_DIR} " install
128
128
}
Original file line number Diff line number Diff line change @@ -20,52 +20,6 @@ sudo --preserve-env apt install -y \
20
20
ninja-build \
21
21
checkinstall \
22
22
git \
23
- wget
24
-
25
- function run_and_time {
26
- time " $@ "
27
- { echo " + Finished running $* " ; } 2> /dev/null
28
- }
29
-
30
- function prompt {
31
- (
32
- while true ; do
33
- local input=" ${PROMPT_ALWAYS_RESPOND:- } "
34
- echo -n " $( tput bold) $* [Y, n]$( tput sgr0) "
35
- [[ -z " ${input} " ]] && read input
36
- if [[ " ${input} " == " Y" || " ${input} " == " y" || " ${input} " == " " ]]; then
37
- return 0
38
- elif [[ " ${input} " == " N" || " ${input} " == " n" ]]; then
39
- return 1
40
- fi
41
- done
42
- ) 2> /dev/null
43
- }
44
-
45
- function install_protobuf {
46
- wget https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protobuf-all-21.4.tar.gz
47
- tar -xzf protobuf-all-21.4.tar.gz
48
- cd protobuf-21.4
49
- ./configure --prefix=/usr
50
- make " -j$( nproc) "
51
- make install
52
- ldconfig
53
- }
54
-
55
- function install_deps {
56
- run_and_time install_protobuf
57
- }
58
-
59
- (return 2> /dev/null) && return # If script was sourced, don't run commands.
60
-
61
- (
62
- if [[ $# -ne 0 ]]; then
63
- for cmd in " $@ " ; do
64
- run_and_time " ${cmd} "
65
- done
66
- else
67
- install_deps
68
- fi
69
- )
70
-
71
- echo " All deps installed! Now try \" make\" "
23
+ wget \
24
+ libprotobuf-dev \
25
+ libprotobuf23
Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: Apache-2.0
2
2
3
+ string (TOLOWER ${CMAKE_BUILD_TYPE} BUILD_SUBDIR_NAME)
4
+ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
5
+ "${CMAKE_CURRENT_BINARY_DIR} /../${BUILD_SUBDIR_NAME} /lib" )
6
+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY
7
+ "${CMAKE_CURRENT_BINARY_DIR} /../${BUILD_SUBDIR_NAME} /" )
8
+ set (ADDITIONAL_CLEAN_FILES
9
+ "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} ;${CMAKE_RUNTIME_OUTPUT_DIRECTORY} " )
10
+
3
11
add_subdirectory (common)
4
12
add_subdirectory (type )
5
13
add_subdirectory (function)
Original file line number Diff line number Diff line change @@ -12,6 +12,6 @@ target_link_libraries(
12
12
substrait_type
13
13
yaml-cpp)
14
14
15
- if (${BUILD_TESTING } )
15
+ if (${SUBSTRAIT_CPP_BUILD_TESTING } )
16
16
add_subdirectory (tests)
17
17
endif ()
Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: Apache-2.0
2
2
3
- add_executable (
4
- substrait_function_test
5
- FunctionLookupTest.cpp)
6
-
7
- add_test (
8
- substrait_function_test
9
- substrait_function_test)
10
-
11
- target_link_libraries (
12
- substrait_function_test
13
- substrait_function
14
- gtest
15
- gtest_main)
3
+ add_test_case(
4
+ substrait_function_test
5
+ SOURCES
6
+ FunctionLookupTest.cpp
7
+ EXTRA_LINK_LIBS
8
+ substrait_function
9
+ gtest
10
+ gtest_main)
Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ target_link_libraries(
9
9
substrait_type
10
10
substrait_common)
11
11
12
- if (${BUILD_TESTING } )
12
+ if (${SUBSTRAIT_CPP_BUILD_TESTING } )
13
13
add_subdirectory (tests)
14
14
endif ()
Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: Apache-2.0
2
2
3
- add_executable (
4
- substrait_type_test
5
- TypeTest.cpp)
6
-
7
- add_test (
8
- substrait_type_test
9
- substrait_type_test)
10
-
11
- target_link_libraries (
12
- substrait_type_test
13
- substrait_type
14
- gtest
15
- gtest_main)
3
+ add_test_case(
4
+ substrait_type_test
5
+ EXTRA_LINK_LIBS
6
+ substrait_type
7
+ gtest
8
+ gtest_main
9
+ SOURCES
10
+ TypeTest.cpp)
You can’t perform that action at this time.
0 commit comments