build: use treesitter's CMakeLists.txt

This commit is contained in:
dundargoc 2024-09-22 16:59:26 +02:00 committed by dundargoc
parent 327110ff8c
commit e83ce331da
3 changed files with 5 additions and 32 deletions

View File

@ -1,22 +1,12 @@
if(ENABLE_WASMTIME)
if(USE_BUNDLED_WASMTIME)
set(WASMTIME_CACHE_ARGS "-DCMAKE_C_FLAGS:STRING=-I${DEPS_INSTALL_DIR}/include/wasmtime -I${DEPS_INSTALL_DIR}/include")
else()
find_package(Wasmtime 24.0.0 EXACT REQUIRED)
set(WASMTIME_CACHE_ARGS "-DCMAKE_C_FLAGS:STRING=-I${WASMTIME_INCLUDE_DIR}")
endif()
string(APPEND WASMTIME_CACHE_ARGS " -DTREE_SITTER_FEATURE_WASM")
set(WASMTIME_ARGS -D CMAKE_C_STANDARD=11)
set(TREESITTER_ARGS -D TREE_SITTER_FEATURE_WASM=ON)
endif()
get_externalproject_options(treesitter ${DEPS_IGNORE_SHA})
ExternalProject_Add(treesitter
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/treesitter
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/cmake/TreesitterCMakeLists.txt
${DEPS_BUILD_DIR}/src/treesitter/CMakeLists.txt
CMAKE_ARGS ${DEPS_CMAKE_ARGS} ${WASMTIME_ARGS}
CMAKE_CACHE_ARGS ${WASMTIME_CACHE_ARGS}
SOURCE_SUBDIR lib
CMAKE_ARGS ${DEPS_CMAKE_ARGS} ${TREESITTER_ARGS}
${EXTERNALPROJECT_OPTIONS})
if(USE_BUNDLED_WASMTIME)

View File

@ -1,17 +0,0 @@
cmake_minimum_required(VERSION 3.16)
project(treesitter C)
add_compile_options(-w)
add_library(tree-sitter lib/src/lib.c)
target_include_directories(tree-sitter
PRIVATE lib/src lib/src/wasm lib/include)
install(FILES
lib/include/tree_sitter/api.h
DESTINATION include/tree_sitter)
include(GNUInstallDirs)
install(TARGETS tree-sitter DESTINATION ${CMAKE_INSTALL_LIBDIR})
# vim: set ft=cmake:

View File

@ -50,8 +50,8 @@ TREESITTER_QUERY_URL https://github.com/tree-sitter-grammars/tree-sitter-query/a
TREESITTER_QUERY_SHA256 d3a423ab66dc62b2969625e280116678a8a22582b5ff087795222108db2f6a6e
TREESITTER_MARKDOWN_URL https://github.com/tree-sitter-grammars/tree-sitter-markdown/archive/v0.3.2.tar.gz
TREESITTER_MARKDOWN_SHA256 5dac48a6d971eb545aab665d59a18180d21963afc781bbf40f9077c06cb82ae5
TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.23.0.tar.gz
TREESITTER_SHA256 6403b361b0014999e96f61b9c84d6950d42f0c7d6e806be79382e0232e48a11b
TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/99dbbbcbe9d7f3c286057e9f3bcc6e0b42690606.tar.gz
TREESITTER_SHA256 8779f56822cb24e3696b08eda3e9c66b58765d15e0536c2d031fbea2faed60e7
WASMTIME_URL https://github.com/bytecodealliance/wasmtime/archive/v24.0.0.tar.gz
WASMTIME_SHA256 2ccb49bb3bfa4d86907ad4c80d1147aef6156c7b6e3f7f14ed02a39de9761155