diff --git a/recipes/ada-url/CMakeLists.txt b/recipes/ada-url/CMakeLists.txt new file mode 100644 index 0000000000000..2c5e397d9948e --- /dev/null +++ b/recipes/ada-url/CMakeLists.txt @@ -0,0 +1,25 @@ +# This is for testing +cmake_minimum_required(VERSION 3.15) + +project(test_ada_install VERSION 0.1.0 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(ada REQUIRED) + +# You can provide your own code, this is just an example: +file(WRITE main.cpp " +#include \"ada.h\" +#include + +int main(int , char *[]) { + ada::result url = ada::parse(\"https://www.google.com\"); + url->set_protocol(\"http\"); + std::cout << url->get_protocol() << std::endl; + std::cout << url->get_host() << std::endl; + return EXIT_SUCCESS; +}") + +add_executable(main main.cpp) +target_link_libraries(main PUBLIC ada::ada) diff --git a/recipes/ada-url/recipe.yaml b/recipes/ada-url/recipe.yaml new file mode 100644 index 0000000000000..ec2fa967746aa --- /dev/null +++ b/recipes/ada-url/recipe.yaml @@ -0,0 +1,84 @@ +context: + version: "2.9.2" + build: 0 + +package: + name: ada-url + version: ${{ version }} + +source: + url: "https://github.com/ada-url/ada/archive/refs/tags/v${{ version }}.tar.gz" + sha256: f41575ad7eec833afd9f6a0d6101ee7dc2f947fdf19ae8f1b54a71d59f4ba5ec + +build: + number: ${{ build|int + (microarch_level|int) * 100 }} + script: + - if: win + then: | + cmake -G Ninja ^ + %CMAKE_ARGS% ^ + -DADA_TESTING=OFF ^ + -DADA_TOOLS=OFF ^ + -DADA_BENCHMARKS=OFF ^ + -B build -S %SRC_DIR% + cmake --build build --target install + else: | + cmake -G Ninja \ + $CMAKE_ARGS \ + -DADA_TESTING=OFF \ + -DADA_TOOLS=OFF \ + -DADA_BENCHMARKS=OFF \ + -S $SRC_DIR -B build + cmake --build build --target install + +requirements: + build: + - if: microarch_level|int > 0 + then: x86_64-microarch-level ${{ microarch_level }} + - "${{ compiler('cxx') }}" + - "${{ stdlib('c') }}" + - cmake + - ninja + +tests: + - script: + - if: win + then: | + cmake -GNinja %CMAKE_ARGS% -B build -S . + cmake --build build + .\build\main.exe + else: | + cmake -GNinja $CMAKE_ARGS -B build -S . + cmake --build build + ./build/main + requirements: + build: + - "${{ compiler('cxx') }}" + - "${{ stdlib('c') }}" + - cmake + - ninja + + files: + recipe: + - CMakeLists.txt + + - package_contents: + include: + - ada.h + +about: + homepage: "https://ada-url.com/" + summary: 'WHATWG-compliant and fast URL parser written in modern C++' + description: | + WHATWG-compliant and fast URL parser written in modern C++, part of + Node.js, Clickhouse, Redpanda, Kong, Telegram and Cloudflare Workers. + license: "MIT OR Apache-2.0" + license_file: + - LICENSE-APACHE + - LICENSE-MIT + documentation: https://ada-url.com/introduction/ + repository: https://github.com/ada-url/ada + +extra: + recipe-maintainers: + - rHermes diff --git a/recipes/ada-url/variants.yaml b/recipes/ada-url/variants.yaml new file mode 100644 index 0000000000000..1b23cca359955 --- /dev/null +++ b/recipes/ada-url/variants.yaml @@ -0,0 +1,7 @@ +microarch_level: + - if: not(unix and x86_64) + then: + - 0 + else: + - 1 + - 3