Simplify the clang example template.
parent
be95ee0fc5
commit
81500d3087
9
main.c
9
main.c
|
@ -4,6 +4,8 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "dyn_array.h"
|
#include "dyn_array.h"
|
||||||
|
|
||||||
|
const char *ENV_SPEC_ROOT_DIR = "SPEC_ROOT_DIR";
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
|
||||||
|
@ -12,8 +14,10 @@ int main(int argc, char **argv) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *root_dir = getenv(ENV_SPEC_ROOT_DIR);
|
||||||
|
|
||||||
struct Config config;
|
struct Config config;
|
||||||
switch (load_config(argv[1], &config)) {
|
switch (load_config(root_dir, argv[1], &config)) {
|
||||||
case ENV_SPEC_ROOT_DIR_MISSING:
|
case ENV_SPEC_ROOT_DIR_MISSING:
|
||||||
fprintf(stderr, "Must specify $SPEC_ROOT_DIR environment variable.");
|
fprintf(stderr, "Must specify $SPEC_ROOT_DIR environment variable.");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -23,9 +27,6 @@ int main(int argc, char **argv) {
|
||||||
case INVALID_TARGET:
|
case INVALID_TARGET:
|
||||||
fprintf(stderr, "Target spec `%s` is invalid.", argv[1]);
|
fprintf(stderr, "Target spec `%s` is invalid.", argv[1]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
default:
|
|
||||||
// A return value of `0` indicates no issue.
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free_config(&config);
|
free_config(&config);
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [ -z "$VERSION" ]; then
|
cp -r "template/*" "$OUT"
|
||||||
VERSION="default"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp "$VERSION/flake.nix" "$OUT"
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"versions": [
|
|
||||||
"default"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
use flake
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
description = ''
|
description = ''
|
||||||
An opinionated clang flake.
|
An opinionated clang flake.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
|
@ -14,7 +14,6 @@
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
codelldb = pkgs.writeShellScriptBin "codelldb" ''
|
codelldb = pkgs.writeShellScriptBin "codelldb" ''
|
||||||
#!/usr/bin/env bash
|
|
||||||
exec ${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb "$@"
|
exec ${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb "$@"
|
||||||
'';
|
'';
|
||||||
in
|
in
|
|
@ -0,0 +1,3 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) { return EXIT_SUCCESS; }
|
Loading…
Reference in New Issue