Skip to content
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
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BraceWrapping:
AfterCaseLabel: true
AfterControlStatement: Always
SplitEmptyFunction: false
BeforeLambdaBody: false
BeforeLambdaBody: true
BeforeCatch: true
BeforeWhile: true
BeforeElse: true
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
build/*
docs/*
deps/*
.cache

.idea
/graph_info.json
/vcpkg_installed/
/node_modules/
/.docusaurus/

7 changes: 4 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"type": "codelldb",
"request": "launch",
"name": "Cli-Debug",
"preLaunchTask": "cmake-install-debug",
"expressions": "native",
"program": "./build/Debug/cli/BraneScriptCli",
"program": "${workspaceFolder}/build/Debug/cli/BraneScriptCli.exe",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/build/Debug/cli/",
"args": [
"exampleScripts/test.bscript"
]
Expand All @@ -21,6 +21,7 @@
"expressions": "native",
"program": "./build/Release/cli/BraneScriptCli",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/build/Release/cli/",
"args": [
"exampleScripts/test.bscript"
]
Expand Down
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files.associations": {
"vector": "cpp",
"type_traits": "cpp"
}
}
105 changes: 105 additions & 0 deletions .vscode/tasks-gcc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"version": "2.0.0",
"showOutput": "always",
"tasks": [
{
"taskName": "cmake-configure-debug",
"label": "cmake-configure-debug",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
},
"command": "cmake -S. -B./build/Debug -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=\"${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBS_BUILD_TESTS=ON",
"presentation": "always"
},
{
"taskName": "cmake-build-debug",
"label": "cmake-build-debug",
"type": "shell",
"dependsOn": [],
"options": {
"cwd": "${workspaceRoot}"
},
"command": "cmake --build ./build/Debug",
"presentation": "always"
},
{
"taskName": "cmake-configure-release",
"label": "cmake-configure-release",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
},
"command": "cmake -S. -B./build/Release -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_C_COMPILER=\".vscode/toolchains/zcc\" -DCMAKE_CXX_COMPILER=\".vscode/toolchains/z++\" -DVCPKG_OVERLAY_TRIPLETS=.vscode/triplets/ -DVCPKG_TARGET_TRIPLET=zig-x64-windows -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=\"${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBS_BUILD_TESTS=ON",
"presentation": "always"
},
{
"taskName": "cmake-build-release",
"label": "cmake-build-release",
"type": "shell",
"dependsOn": [],
"options": {
"cwd": "${workspaceRoot}"
},
"command": "cmake --build ./build/Release"
},
{
"taskName": "build-db-debug",
"label": "build-db-debug",
"type": "shell",
"dependsOn": [
"cmake-configure-debug"
],
"options": {
"cwd": "${workspaceRoot}"
},
"windows": {
"command": "mv ./build/Debug/compile_commands.json ./build/ -Force"
},
"linux": {
"command": "mv ./build/Debug/compile_commands.json ./build/ -f"
}
},
{
"taskName": "build-db-release",
"label": "build-db-release",
"type": "shell",
"dependsOn": [
"cmake-configure-release"
],
"options": {
"cwd": "${workspaceRoot}"
},
"windows": {
"command": "mv ./build/Release/compile_commands.json ./build/ -Force"
},
"linux": {
"command": "mv ./build/Release/compile_commands.json ./build/ -f"
}
},
{
"taskName": "cmake-install-debug",
"label": "cmake-install-debug",
"type": "shell",
"dependsOn": [
"cmake-build-debug"
],
"options": {
"cwd": "${workspaceRoot}/build/Debug"
},
"command": "cmake --install . --component cli --prefix ./cli"
},
{
"taskName": "cmake-install-cli-release",
"label": "cmake-install-cli-release",
"type": "shell",
"dependsOn": [
"cmake-build-release"
],
"options": {
"cwd": "${workspaceRoot}/build/Release"
},
"command": "cmake --install . --component cli --prefix ./cli"
}
]
}
105 changes: 105 additions & 0 deletions .vscode/tasks-zig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"version": "2.0.0",
"showOutput": "always",
"tasks": [
{
"taskName": "cmake-configure-debug",
"label": "cmake-configure-debug",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
},
"command": "cmake -S. -B./build/Debug -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_C_COMPILER=\"${workspaceRoot}/.vscode/toolchains/zcc.cmd\" -DCMAKE_CXX_COMPILER=\"${workspaceRoot}/.vscode/toolchains/z++.cmd\" -DVCPKG_OVERLAY_TRIPLETS=\".vscode/triplets/\" -DVCPKG_TARGET_TRIPLET=zig-x64-windows -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=\"${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBS_BUILD_TESTS=ON -DENABLE_TREESITTER_DEV=ON",
"presentation": "always"
},
{
"taskName": "cmake-build-debug",
"label": "cmake-build-debug",
"type": "shell",
"dependsOn": [],
"options": {
"cwd": "${workspaceRoot}"
},
"command": "cmake --build ./build/Debug",
"presentation": "always"
},
{
"taskName": "cmake-configure-release",
"label": "cmake-configure-release",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
},
"command": "cmake -S. -B./build/Release -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_C_COMPILER=\".vscode/toolchains/zcc\" -DCMAKE_CXX_COMPILER=\".vscode/toolchains/z++\" -DVCPKG_OVERLAY_TRIPLETS=.vscode/triplets/ -DVCPKG_TARGET_TRIPLET=zig-x64-windows -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=\"${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBS_BUILD_TESTS=ON",
"presentation": "always"
},
{
"taskName": "cmake-build-release",
"label": "cmake-build-release",
"type": "shell",
"dependsOn": [],
"options": {
"cwd": "${workspaceRoot}"
},
"command": "cmake --build ./build/Release"
},
{
"taskName": "build-db-debug",
"label": "build-db-debug",
"type": "shell",
"dependsOn": [
"cmake-configure-debug"
],
"options": {
"cwd": "${workspaceRoot}"
},
"windows": {
"command": "mv ./build/Debug/compile_commands.json ./build/ -Force"
},
"linux": {
"command": "mv ./build/Debug/compile_commands.json ./build/ -f"
}
},
{
"taskName": "build-db-release",
"label": "build-db-release",
"type": "shell",
"dependsOn": [
"cmake-configure-release"
],
"options": {
"cwd": "${workspaceRoot}"
},
"windows": {
"command": "mv ./build/Release/compile_commands.json ./build/ -Force"
},
"linux": {
"command": "mv ./build/Release/compile_commands.json ./build/ -f"
}
},
{
"taskName": "cmake-install-debug",
"label": "cmake-install-debug",
"type": "shell",
"dependsOn": [
"cmake-build-debug"
],
"options": {
"cwd": "${workspaceRoot}/build/Debug"
},
"command": "cmake --install . --component cli --prefix ./cli"
},
{
"taskName": "cmake-install-cli-release",
"label": "cmake-install-cli-release",
"type": "shell",
"dependsOn": [
"cmake-build-release"
],
"options": {
"cwd": "${workspaceRoot}/build/Release"
},
"command": "cmake --install . --component cli --prefix ./cli"
}
]
}
12 changes: 4 additions & 8 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@
"options": {
"cwd": "${workspaceRoot}"
},
"command": "cmake -S. -B./build/Debug -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=\"${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBS_BUILD_TESTS=ON",
"command": "cmake -S. -B./build/Debug -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=\"${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBS_BUILD_TESTS=ON",
"presentation": "always"
},
{
"taskName": "cmake-build-debug",
"label": "cmake-build-debug",
"type": "shell",
"dependsOn": [
"cmake-configure-debug"
],
"dependsOn": [],
"options": {
"cwd": "${workspaceRoot}"
},
Expand All @@ -32,16 +30,14 @@
"options": {
"cwd": "${workspaceRoot}"
},
"command": "cmake -S. -B./build/Release -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=\"${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBS_BUILD_TESTS=ON -DTREESITTER_BRANESCRIPT_DIR=../TreeSitterBraneScript",
"command": "cmake -S. -B./build/Release -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=\"${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBS_BUILD_TESTS=ON",
"presentation": "always"
},
{
"taskName": "cmake-build-release",
"label": "cmake-build-release",
"type": "shell",
"dependsOn": [
"cmake-configure-release"
],
"dependsOn": [],
"options": {
"cwd": "${workspaceRoot}"
},
Expand Down
88 changes: 88 additions & 0 deletions .vscode/toolchains/toolchain-zig-linux.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Derived from the mingw pipeline
if(NOT _VCPKG_ZIG_TOOLCHAIN)
set(_VCPKG_ZIG_TOOLCHAIN 1)

list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
VCPKG_CRT_LINKAGE VCPKG_TARGET_ARCHITECTURE
VCPKG_C_FLAGS VCPKG_CXX_FLAGS
VCPKG_C_FLAGS_DEBUG VCPKG_CXX_FLAGS_DEBUG
VCPKG_C_FLAGS_RELEASE VCPKG_CXX_FLAGS_RELEASE
VCPKG_LINKER_FLAGS VCPKG_LINKER_FLAGS_RELEASE VCPKG_LINKER_FLAGS_DEBUG
)

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(CMAKE_SYSTEM_PROCESSOR i686 CACHE STRING "")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(CMAKE_SYSTEM_PROCESSOR x86_64 CACHE STRING "")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(CMAKE_SYSTEM_PROCESSOR armv7 CACHE STRING "")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR aarch64 CACHE STRING "")
endif()

set(CMAKE_SYSTEM_NAME Linux)

foreach(lang C CXX)
set(CMAKE_${lang}_COMPILER_TARGET "${CMAKE_SYSTEM_PROCESSOR}-linux-gnu" CACHE STRING "")
endforeach()

# Select Zig as the compiler
if(WIN32)
find_program(ZCC
NAMES zcc.bat zcc.cmd
PATHS ${CMAKE_CURRENT_LIST_DIR}
NO_DEFAULT_PATH
)
find_program(ZPP
NAMES z++.bat z++.cmd
PATHS ${CMAKE_CURRENT_LIST_DIR}
NO_DEFAULT_PATH
)
else()
find_program(ZCC
NAMES zcc.sh
PATHS ${CMAKE_CURRENT_LIST_DIR}
NO_DEFAULT_PATH
)
find_program(ZPP
NAMES z++.sh
PATHS ${CMAKE_CURRENT_LIST_DIR}
NO_DEFAULT_PATH
)
endif()

if(NOT ZPP)
message(FATAL_ERROR "Could not find zig wrapper script in ${CMAKE_CURRENT_LIST_DIR}")
endif()
message("Using ZIG at ${ZPP}")
set(CMAKE_C_COMPILER "${ZCC}" CACHE STRING "")
set(CMAKE_CXX_COMPILER "${ZPP}" CACHE STRING "")

message("curent c compile flags: ${CMAKE_C_FLAGS_INIT}")
string(APPEND CMAKE_C_FLAGS_INIT "${VCPKG_C_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS_INIT "${VCPKG_CXX_FLAGS} ")
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ")
string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ")

string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")

if(VCPKG_CRT_LINKAGE STREQUAL "static")
string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT "-static ")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT "-static ")
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-static ")
endif()

string(APPEND CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ")
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ")
string(APPEND CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ")
string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ")
endif()



Loading
Loading