Initial Template
This commit is contained in:
commit
6b9827d26a
32 changed files with 855 additions and 0 deletions
16
.gitattributes
vendored
Normal file
16
.gitattributes
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
# See https://git-scm.com/docs/gitattributes
|
||||
# See https://help.github.com/articles/dealing-with-line-endings/
|
||||
|
||||
# Default behavior, if core.autocrlf is unset.
|
||||
* text=auto
|
||||
|
||||
# Files to be converted to native line endings on checkout.
|
||||
*.cpp text
|
||||
*.h text
|
||||
|
||||
# Text files to always have CRLF (dos) line endings on checkout.
|
||||
*.bat text eol=crlf
|
||||
|
||||
# Text files to always have LF (unix) line endings on checkout.
|
||||
*.sh text eol=lf
|
||||
*.zig text eol=lf
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
zig-cache/
|
||||
build_runner.zig
|
308
.vscode/launch.json
vendored
Normal file
308
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,308 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "day 01",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day01.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 01",
|
||||
},
|
||||
{
|
||||
"name": "day 02",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day02.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 02",
|
||||
},
|
||||
{
|
||||
"name": "day 03",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day03.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 03",
|
||||
},
|
||||
{
|
||||
"name": "day 04",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day04.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 04",
|
||||
},
|
||||
{
|
||||
"name": "day 05",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day05.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 05",
|
||||
},
|
||||
{
|
||||
"name": "day 06",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day06.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 06",
|
||||
},
|
||||
{
|
||||
"name": "day 07",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day07.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 07",
|
||||
},
|
||||
{
|
||||
"name": "day 08",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day08.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 08",
|
||||
},
|
||||
{
|
||||
"name": "day 09",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day09.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 09",
|
||||
},
|
||||
{
|
||||
"name": "day 10",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day10.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 10",
|
||||
},
|
||||
{
|
||||
"name": "day 11",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day11.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 11",
|
||||
},
|
||||
{
|
||||
"name": "day 12",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day12.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 12",
|
||||
},
|
||||
{
|
||||
"name": "day 13",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day13.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 13",
|
||||
},
|
||||
{
|
||||
"name": "day 14",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day14.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 14",
|
||||
},
|
||||
{
|
||||
"name": "day 15",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day15.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 15",
|
||||
},
|
||||
{
|
||||
"name": "day 16",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day16.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 16",
|
||||
},
|
||||
{
|
||||
"name": "day 17",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day17.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 17",
|
||||
},
|
||||
{
|
||||
"name": "day 18",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day18.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 18",
|
||||
},
|
||||
{
|
||||
"name": "day 19",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day19.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 19",
|
||||
},
|
||||
{
|
||||
"name": "day 20",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day20.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 20",
|
||||
},
|
||||
{
|
||||
"name": "day 21",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day21.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 21",
|
||||
},
|
||||
{
|
||||
"name": "day 22",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day22.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 22",
|
||||
},
|
||||
{
|
||||
"name": "day 23",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day23.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 23",
|
||||
},
|
||||
{
|
||||
"name": "day 24",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day24.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 24",
|
||||
},
|
||||
{
|
||||
"name": "day 25",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/day25.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "build day 25",
|
||||
},
|
||||
]
|
||||
}
|
225
.vscode/tasks.json
vendored
Normal file
225
.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,225 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build day 01",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day01"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 02",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day02"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 03",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day03"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 04",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day04"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 05",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day05"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 06",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day06"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 07",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day07"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 08",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day08"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 09",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day09"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 10",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day10"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 11",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day11"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 12",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day12"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 13",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day13"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 14",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day14"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 15",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day15"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 16",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day16"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 17",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day17"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 18",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day18"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 19",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day19"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 20",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day20"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 21",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day21"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 22",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day22"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 23",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day23"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 24",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day24"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "build day 25",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "install_day25"], // add -Drelease-safe=true or -Drelease-fast=true to optimize
|
||||
"problemMatcher": [],
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "test",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["build", "test"],
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "format",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["fmt", "${file}"],
|
||||
"problemMatcher": [],
|
||||
},
|
||||
]
|
||||
}
|
24
LICENSE
Normal file
24
LICENSE
Normal file
|
@ -0,0 +1,24 @@
|
|||
Copyright (c) 2020 Martin Wickham
|
||||
Dear Imgui is Copyright (c) 2014-2020 Omar Cornut
|
||||
cimgui is Copyright (c) 2015 Stephan Dilly
|
||||
cgltf is Copyright (c) 2018 Johannes Kuhlmann
|
||||
ENet is Copyright (c) 2002-2020 Lee Salzman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
11
README.md
Normal file
11
README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Advent Of Code Zig Template
|
||||
|
||||
This repo provides a template for Advent of Code participants using Zig. It contains a main file for each day, a build.zig file set up with targets for each day, and Visual Studio Code files for debugging.
|
||||
|
||||
### How to use this template:
|
||||
|
||||
The src/ directory contains a main file for each day. Put your code there. The build command `zig build dayXX [target and mode options] -- [program args]` will build and run the specified day. You can also use `zig build install_dayXX [target and mode options]` to build the executable for a day and put it into `zig-cache/bin` without executing it. By default this template does not link libc, but you can set `should_link_libc` to `true` in build.zig to change that. If you have files with tests, add those files to the list of test files in build.zig. The command `zig build test` will run tests in all of these files.
|
||||
|
||||
This repo also contains Visual Studio Code project files for debugging. These are meant to work with the C/C++ plugin. There is a debug configuration for each day. By default all days are built in debug mode, but this can be changed by editing `.vscode/tasks.json` if you have a need for speed.
|
||||
|
||||
If you would like to contribute project files for other development environments, please send a PR.
|
69
build.zig
Normal file
69
build.zig
Normal file
|
@ -0,0 +1,69 @@
|
|||
const std = @import("std");
|
||||
const Builder = std.build.Builder;
|
||||
const LibExeObjStep = std.build.LibExeObjStep;
|
||||
|
||||
// set this to true to link libc
|
||||
const should_link_libc = false;
|
||||
|
||||
const test_files = [_][]const u8 {
|
||||
// list any zig files with tests here
|
||||
};
|
||||
|
||||
fn linkObject(b: *Builder, obj: *LibExeObjStep) void {
|
||||
if (should_link_libc) obj.linkLibC();
|
||||
|
||||
// Add linking for packages or third party libraries here
|
||||
}
|
||||
|
||||
pub fn build(b: *Builder) void {
|
||||
// Standard target options allows the person running `zig build` to choose
|
||||
// what target to build for. Here we do not override the defaults, which
|
||||
// means any target is allowed, and the default is native. Other options
|
||||
// for restricting supported target set are available.
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
// Standard release options allow the person running `zig build` to select
|
||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
||||
const mode = b.standardReleaseOptions();
|
||||
|
||||
// Set up an exe for each day
|
||||
comptime var day = 1;
|
||||
inline while (day <= 25) : (day += 1) {
|
||||
@setEvalBranchQuota(100000); // this comptimePrint is pretty expensive
|
||||
const dayString = comptime std.fmt.comptimePrint("day{:0>2}", .{ day });
|
||||
const zigFile = "src/" ++ dayString ++ ".zig";
|
||||
|
||||
|
||||
const exe = b.addExecutable(dayString, zigFile);
|
||||
exe.setTarget(target);
|
||||
exe.setBuildMode(mode);
|
||||
linkObject(b, exe);
|
||||
|
||||
exe.install();
|
||||
|
||||
const install_cmd = b.addInstallArtifact(exe);
|
||||
|
||||
const install_step = b.step("install_" ++ dayString, "Install " ++ dayString ++ ".exe");
|
||||
install_step.dependOn(&install_cmd.step);
|
||||
|
||||
const run_cmd = exe.run();
|
||||
run_cmd.step.dependOn(&install_cmd.step);
|
||||
if (b.args) |args| {
|
||||
run_cmd.addArgs(args);
|
||||
}
|
||||
|
||||
const run_step = b.step(dayString, "Run " ++ dayString);
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
}
|
||||
|
||||
// Set up a step to run all tests
|
||||
const test_step = b.step("test", "Run all tests");
|
||||
for (test_files) |file| {
|
||||
const test_cmd = b.addTest(file);
|
||||
test_cmd.setTarget(target);
|
||||
test_cmd.setBuildMode(mode);
|
||||
linkObject(b, test_cmd);
|
||||
|
||||
test_step.dependOn(&test_cmd.step);
|
||||
}
|
||||
}
|
8
src/day01.zig
Normal file
8
src/day01.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day02.zig
Normal file
8
src/day02.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day03.zig
Normal file
8
src/day03.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day04.zig
Normal file
8
src/day04.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day05.zig
Normal file
8
src/day05.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day06.zig
Normal file
8
src/day06.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day07.zig
Normal file
8
src/day07.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day08.zig
Normal file
8
src/day08.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day09.zig
Normal file
8
src/day09.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day10.zig
Normal file
8
src/day10.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day11.zig
Normal file
8
src/day11.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day12.zig
Normal file
8
src/day12.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day13.zig
Normal file
8
src/day13.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day14.zig
Normal file
8
src/day14.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day15.zig
Normal file
8
src/day15.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day16.zig
Normal file
8
src/day16.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day17.zig
Normal file
8
src/day17.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day18.zig
Normal file
8
src/day18.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day19.zig
Normal file
8
src/day19.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day20.zig
Normal file
8
src/day20.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day21.zig
Normal file
8
src/day21.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day22.zig
Normal file
8
src/day22.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day23.zig
Normal file
8
src/day23.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day24.zig
Normal file
8
src/day24.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
8
src/day25.zig
Normal file
8
src/day25.zig
Normal file
|
@ -0,0 +1,8 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const print = std.debug.print;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
}
|
Loading…
Reference in a new issue