diff --git a/scripts/test_ports/vcpkg-ci-rocksdb/portfile.cmake b/scripts/test_ports/vcpkg-ci-rocksdb/portfile.cmake new file mode 100644 index 0000000000..d1ab44ac5a --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-rocksdb/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-rocksdb/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-rocksdb/project/CMakeLists.txt new file mode 100644 index 0000000000..1806e440ec --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-rocksdb/project/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.16) +project(vcpkg-ci-rocksdb) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +find_package(RocksDB CONFIG REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE RocksDB::rocksdb) diff --git a/scripts/test_ports/vcpkg-ci-rocksdb/project/main.cpp b/scripts/test_ports/vcpkg-ci-rocksdb/project/main.cpp new file mode 100644 index 0000000000..c4f301d702 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-rocksdb/project/main.cpp @@ -0,0 +1,23 @@ +#include +#include +#include +#include +#include + +int main() { + std::filesystem::path tmp = std::filesystem::temp_directory_path() / "vcpkg-ci-rocksdb-test"; + std::filesystem::remove_all(tmp); + std::unique_ptr db; + rocksdb::Options options; + options.create_if_missing = true; + rocksdb::Status status = rocksdb::DB::Open(options, tmp.string(), &db); + assert(status.ok()); + status = db->Put(rocksdb::WriteOptions(), "hello", "rocksdb"); + assert(status.ok()); + std::string value; + status = db->Get(rocksdb::ReadOptions(), "hello", &value); + assert(status.ok()); + assert(value == "rocksdb"); + std::filesystem::remove_all(tmp); + return 0; +} diff --git a/scripts/test_ports/vcpkg-ci-rocksdb/vcpkg.json b/scripts/test_ports/vcpkg-ci-rocksdb/vcpkg.json new file mode 100644 index 0000000000..fb3aed7a00 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-rocksdb/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "vcpkg-ci-rocksdb", + "version-string": "ci", + "description": "Validates rocksdb", + "dependencies": [ + { + "name": "rocksdb", + "features": [ + "bzip2", + "liburing", + "lz4", + "numa", + "snappy", + "tbb", + "zlib", + "zstd" + ] + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +}