File tree Expand file tree Collapse file tree 4 files changed +34
-19
lines changed Expand file tree Collapse file tree 4 files changed +34
-19
lines changed Original file line number Diff line number Diff line change @@ -15,27 +15,21 @@ jobs:
15
15
cd pgvector
16
16
make
17
17
sudo make install
18
- - run : |
19
- git clone --branch 7.10.0 https://github.com/jtv/libpqxx.git
20
- cd libpqxx
21
- CXXFLAGS=-std=c++17 ./configure
22
- make
23
- sudo make install
24
18
25
- - run : g++ -std=c++17 -Wall -Wextra -Werror -o test/main test/main.cpp test/pqxx_test.cpp -lpqxx -lpq
26
- - run : test/main
19
+ - run : cmake -S . -B build -DBUILD_TESTING=ON -DCMAKE_CXX_STANDARD=17
20
+ - run : cmake --build build
21
+ - run : build/test
27
22
28
- - run : g++ -std=c++20 -Wall -Wextra -Werror -o test/main test/main.cpp test/pqxx_test.cpp -lpqxx -lpq
29
- - run : test/main
23
+ - run : cmake -S . -B build -DBUILD_TESTING=ON -DCMAKE_CXX_STANDARD=20
24
+ - run : cmake --build build
25
+ - run : build/test
30
26
31
- - run : g++ -std=c++23 -Wall -Wextra -Werror -o test/main test/main.cpp test/pqxx_test.cpp -lpqxx -lpq
32
- - run : test/main
27
+ - run : cmake -S . -B build -DBUILD_TESTING=ON -DCMAKE_CXX_STANDARD=23
28
+ - run : cmake --build build
29
+ - run : build/test
33
30
34
31
- run : |
35
32
sudo apt-get install valgrind
36
- valgrind --leak-check=yes test/main
33
+ valgrind --leak-check=yes build/test
37
34
38
- # test install
39
- - run : cmake -S . -B build
40
- - run : cmake --build build
41
35
- run : sudo cmake --install build
Original file line number Diff line number Diff line change 1
1
build
2
- /test /main
Original file line number Diff line number Diff line change @@ -19,3 +19,24 @@ install(
19
19
DIRECTORY "${PROJECT_SOURCE_DIR} /include/"
20
20
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} "
21
21
)
22
+
23
+ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR )
24
+ option (BUILD_TESTING "" OFF )
25
+
26
+ if (BUILD_TESTING )
27
+ include (FetchContent )
28
+
29
+ # for libpqxx
30
+ set (CMAKE_CXX_FLAGS "-Wno-unknown-attributes" )
31
+ set (SKIP_BUILD_TEST ON )
32
+
33
+ FetchContent_Declare (libpqxx GIT_REPOSITORY https://github.com/jtv/libpqxx.git GIT_TAG 7.10.0 )
34
+ FetchContent_MakeAvailable (libpqxx )
35
+
36
+ add_executable (test test /halfvec_test.cpp test /main.cpp test /pqxx_test.cpp test /sparsevec_test.cpp test /vector_test.cpp )
37
+ target_link_libraries (test PRIVATE libpqxx::pqxx pgvector::pgvector )
38
+ if (NOT MSVC )
39
+ target_compile_options (test PRIVATE -Wall -Wextra -Wpedantic -Werror )
40
+ endif ()
41
+ endif ()
42
+ endif ()
Original file line number Diff line number Diff line change @@ -162,8 +162,9 @@ To get started with development:
162
162
git clone https://github.com/pgvector/pgvector-cpp.git
163
163
cd pgvector-cpp
164
164
createdb pgvector_cpp_test
165
- g++ -std=c++17 -Wall -Wextra -Wno-unknown-attributes -Werror -o test/main test/main.cpp test/vector_test.cpp test/halfvec_test.cpp test/sparsevec_test.cpp test/pqxx_test.cpp -lpqxx -lpq
166
- test/main
165
+ cmake -S . -B build -DBUILD_TESTING=ON
166
+ cmake --build build
167
+ build/test
167
168
```
168
169
169
170
To run an example:
You can’t perform that action at this time.
0 commit comments