diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42c04d4..4408b3b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: build on: [push, pull_request] jobs: build: - runs-on: ubuntu-24.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: ankane/setup-postgres@v1 @@ -16,6 +16,13 @@ jobs: make sudo make install + - run: | + git clone --branch 7.10.1 https://github.com/jtv/libpqxx.git + cd libpqxx + cmake . + cmake --build . + sudo cmake --install . + - run: cmake -S . -B build -DBUILD_TESTING=ON -DCMAKE_CXX_STANDARD=17 - run: cmake --build build - run: build/test diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f5e98a..4e3beb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,10 +24,7 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) option(BUILD_TESTING "" OFF) if(BUILD_TESTING) - include(FetchContent) - - FetchContent_Declare(libpqxx GIT_REPOSITORY https://github.com/jtv/libpqxx.git GIT_TAG 7.10.1) - FetchContent_MakeAvailable(libpqxx) + find_package(libpqxx REQUIRED) add_executable(test test/halfvec_test.cpp test/main.cpp test/pqxx_test.cpp test/sparsevec_test.cpp test/vector_test.cpp) target_link_libraries(test PRIVATE libpqxx::pqxx pgvector::pgvector) diff --git a/include/pgvector/pqxx.hpp b/include/pgvector/pqxx.hpp index 8c0812e..ed1bc62 100644 --- a/include/pgvector/pqxx.hpp +++ b/include/pgvector/pqxx.hpp @@ -21,7 +21,7 @@ /// @cond namespace pqxx { -template <> std::string const type_name{"vector"}; +template <> inline std::string const type_name{"vector"}; template <> struct nullness : pqxx::no_null {}; @@ -66,7 +66,7 @@ template <> struct string_traits { } }; -template <> std::string const type_name{"halfvec"}; +template <> inline std::string const type_name{"halfvec"}; template <> struct nullness : pqxx::no_null {}; @@ -111,7 +111,7 @@ template <> struct string_traits { } }; -template <> std::string const type_name{"sparsevec"}; +template <> inline std::string const type_name{"sparsevec"}; template <> struct nullness : pqxx::no_null {};