Created
December 31, 2022 18:49
-
-
Save LensPlaysGames/c47dac4ef7c2cf0d9fe149800a34faa9 to your computer and use it in GitHub Desktop.
tree-sitter basic CMake project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.14) | |
# NOTE: Just replace all three occurences of `tree-sitter-c` to whatever language grammar you are compiling. Nothing else needs changed. | |
# Then just run `cmake -B bld` and `cmake --build bld` to get a shared object file that can be installed according to https://tree-sitter.github.io/tree-sitter/syntax-highlighting#paths . | |
project(tree-sitter-c) | |
add_library( | |
tree-sitter-c | |
SHARED | |
src/parser.c | |
) | |
target_include_directories( | |
tree-sitter-c | |
PUBLIC | |
src | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you get errors that look like this
you will have to add
src/scanner.c
orsrc/scanner.cc
to the list of sources inadd_library
This is needed because some parsers write their own "external scanner" implementation that the tree sitter parser then uses.