Skip to content

Commit cf68478

Browse files
committed
Switched to CMake for tests
1 parent b559727 commit cf68478

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ jobs:
1515
cd pgvector
1616
make
1717
sudo make install
18-
- run: gcc -Wall -Wextra -Werror -I/usr/include/postgresql -o test/pq test/pq_test.c -lpq
19-
- run: test/pq
18+
- run: cmake -S . -B build
19+
- run: cmake --build build
20+
- run: build/test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/test/pq
1+
build

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cmake_minimum_required(VERSION 3.18)
2+
3+
project(pgvector LANGUAGES C)
4+
5+
option(BUILD_TESTING "" ON)
6+
7+
if(BUILD_TESTING)
8+
find_package(PostgreSQL REQUIRED)
9+
10+
add_executable(test test/pq_test.c)
11+
target_link_libraries(test PRIVATE PostgreSQL::PostgreSQL)
12+
if(NOT MSVC)
13+
target_compile_options(test PRIVATE -Wall -Wextra -Wpedantic -Werror)
14+
endif()
15+
endif()

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ To get started with development:
6767
git clone https://github.com/pgvector/pgvector-c.git
6868
cd pgvector-c
6969
createdb pgvector_c_test
70-
gcc -Wall -Wextra -Werror -o test/pq test/pq_test.c -lpq
71-
test/pq
70+
cmake -S . -B build
71+
cmake --build build
72+
build/test
7273
```

0 commit comments

Comments
 (0)