Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): remove deps and use download based cmake #4

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.16)

project(ada
DESCRIPTION "Fast spec-compliant URL parser"
LANGUAGES C CXX
VERSION 2.9.0
)

set(CMAKE_CXX_STANDARD 17)

# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()

include(FetchContent)

FetchContent_Declare(
ada
URL https://github.com/ada-url/ada/releases/download/v2.9.0/singleheader.zip
URL_HASH SHA256=20b09948cf58362abe4de20b8e709d5041477fb798350fd1a02cde6aad121e08
)

FetchContent_MakeAvailable(ada)

add_library(ada SHARED _deps/ada-src/ada.cpp)

install(TARGETS ada DESTINATION lib)
49 changes: 25 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
.PHONY: deps lint test unit docs
.PHONY: build copy-library luarocks-install lint unit coverage test docs clean install

BUILD_DIR := $(shell mktemp -d)
LIBRARY := libada.so
ifeq ($(shell uname), Darwin)
LIBRARY := libada.dylib
endif

deps:
@cmake -S deps/ada -B $(BUILD_DIR)
@cmake --build $(BUILD_DIR)
@cp $(BUILD_DIR)/libada.* .
@rm -Rf $(BUILD_DIR)
build:
@cmake -B build
@cmake --build build

lint:
@luacheck -q ./lib
copy-library: build
@cp $ build/$(LIBRARY) .

test: deps
luarocks-install:
@luarocks make
@busted
@luacov
@echo
@awk '/File/,0' luacov.report.out
@echo
@echo Lint
@echo -----------------------------------------------------------------------------------
@luacheck -q ./lib
@echo

lint:
@luacheck ./lib

unit:
@luarocks make
@busted

coverage: unit
@luacov
@echo
@awk '/File/,0' luacov.report.out
@echo
@echo Lint
@echo -----------------------------------------------------------------------------------
@luacheck -q ./lib
@echo

test: copy-library luarocks-install coverage lint

docs:
@ldoc .

clean:
@rm -Rf build luacov.stats.out luacov.report.out $(LIBRARY)

install: deps
@luarocks make
@cmake --install build
20 changes: 0 additions & 20 deletions deps/ada/BUILD.bazel

This file was deleted.

11 changes: 0 additions & 11 deletions deps/ada/CMakeLists.txt

This file was deleted.

201 changes: 0 additions & 201 deletions deps/ada/LICENSE-APACHE.txt

This file was deleted.

18 changes: 0 additions & 18 deletions deps/ada/LICENSE-MIT.txt

This file was deleted.

Empty file removed deps/ada/MODULE.bazel
Empty file.
Empty file removed deps/ada/WORKSPACE
Empty file.
Loading