Compare commits
3 commits
b7e340b562
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| bfea21078e | |||
| 162ab2001b | |||
| 7ab1c3defc |
5 changed files with 84 additions and 7 deletions
21
Makefile
21
Makefile
|
|
@ -1,15 +1,28 @@
|
||||||
build: clean
|
build: clean
|
||||||
mkdir -p ./bin/
|
mkdir -p ./bin/debug/
|
||||||
odin build ./src/ -out:bin/odin_runner.exe -debug
|
odin build ./src/ -out:bin/debug/odin_runner.exe -debug
|
||||||
|
|
||||||
|
build_rel: clean_rel
|
||||||
|
mkdir -p ./bin/release/
|
||||||
|
odin build ./src/ -out:bin/release/odin_runner.exe
|
||||||
|
|
||||||
run:
|
run:
|
||||||
./bin/odin_runner.exe
|
./bin/debug/odin_runner.exe
|
||||||
|
|
||||||
|
run_rel:
|
||||||
|
./bin/release/odin_runner.exe
|
||||||
|
|
||||||
check:
|
check:
|
||||||
odin check ./src/
|
odin check ./src/
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf ./bin/odin_runner.*
|
rm -rf ./bin/debug/
|
||||||
|
|
||||||
|
clean_rel:
|
||||||
|
rm -rf ./bin/release/
|
||||||
|
|
||||||
|
cleanall:
|
||||||
|
rm -rf ./bin/
|
||||||
|
|
||||||
nuke:
|
nuke:
|
||||||
rm -rf ./bin
|
rm -rf ./bin
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
"collections": [],
|
"collections": [],
|
||||||
"flags": [],
|
"flags": [],
|
||||||
"source": "./src/",
|
"source": "./src/",
|
||||||
"output_dir": "./bin/",
|
"output_dir": "",
|
||||||
"binary_name": "binary_name.bin"
|
"binary_name": ""
|
||||||
},
|
},
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,13 @@
|
||||||
Because I can.
|
Because I can.
|
||||||
|
|
||||||
# How to use
|
# How to use
|
||||||
Usage:
|
|
||||||
|
Usage examples:
|
||||||
|
```
|
||||||
* `odin_runner` - Run the default command with the defautl configuration (i.e. build with the defaults)
|
* `odin_runner` - Run the default command with the defautl configuration (i.e. build with the defaults)
|
||||||
* `odin_runner build` - Same as above
|
* `odin_runner build` - Same as above
|
||||||
* `odin_runner build debug` - Same as above but with an explicit configuration (`debug`)
|
* `odin_runner build debug` - Same as above but with an explicit configuration (`debug`)
|
||||||
* `odin_runner check` - Runs odin check with the defaults
|
* `odin_runner check` - Runs odin check with the defaults
|
||||||
* `odin_runner check debug` - Same as above but with an explicit configuration (`debug`)
|
* `odin_runner check debug` - Same as above but with an explicit configuration (`debug`)
|
||||||
* `odin_runner clean debug` - Cleans up build artefacts in the build directory of an explicit configuration (`debug`)
|
* `odin_runner clean debug` - Cleans up build artefacts in the build directory of an explicit configuration (`debug`)
|
||||||
|
```
|
||||||
|
|
|
||||||
BIN
src.bin
BIN
src.bin
Binary file not shown.
|
|
@ -16,6 +16,26 @@ execute_command :: proc(
|
||||||
configuration: ConfigurationTargets,
|
configuration: ConfigurationTargets,
|
||||||
) -> (
|
) -> (
|
||||||
error: ExecutionError,
|
error: ExecutionError,
|
||||||
|
) {
|
||||||
|
if command == .CHECK || command == .BUILD {
|
||||||
|
return build_or_check(command, target_name, configuration)
|
||||||
|
}
|
||||||
|
if command == .CLEAN {
|
||||||
|
return clean(command, target_name, configuration)
|
||||||
|
}
|
||||||
|
if command == .TEST {
|
||||||
|
return test(command, target_name, configuration)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
build_or_check :: proc(
|
||||||
|
command: Command,
|
||||||
|
target_name: TargetName,
|
||||||
|
configuration: ConfigurationTargets,
|
||||||
|
) -> (
|
||||||
|
error: ExecutionError,
|
||||||
) {
|
) {
|
||||||
target_config, found_target_in_config := configuration[target_name]
|
target_config, found_target_in_config := configuration[target_name]
|
||||||
if !found_target_in_config && target_name != "" {
|
if !found_target_in_config && target_name != "" {
|
||||||
|
|
@ -32,6 +52,7 @@ execute_command :: proc(
|
||||||
strings.write_string(&sb, command_to_string(command))
|
strings.write_string(&sb, command_to_string(command))
|
||||||
strings.write_byte(&sb, ' ')
|
strings.write_byte(&sb, ' ')
|
||||||
|
|
||||||
|
// Append the command
|
||||||
if def_config, ok := configuration[DEFAULT_TARGET_NAME]; ok && !found_target_in_config {
|
if def_config, ok := configuration[DEFAULT_TARGET_NAME]; ok && !found_target_in_config {
|
||||||
strings.write_string(&sb, string(def_config.source))
|
strings.write_string(&sb, string(def_config.source))
|
||||||
} else if found_target_in_config {
|
} else if found_target_in_config {
|
||||||
|
|
@ -69,6 +90,26 @@ execute_command :: proc(
|
||||||
strings.write_string(&sb, flag)
|
strings.write_string(&sb, flag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Append the output dir
|
||||||
|
if command == .BUILD {
|
||||||
|
output_dir: Path;binary_name: string
|
||||||
|
if def_config, ok := configuration[DEFAULT_TARGET_NAME]; ok {
|
||||||
|
if len(def_config.output_dir) != 0 && len(def_config.binary_name) != 0 {
|
||||||
|
output_dir = def_config.output_dir
|
||||||
|
binary_name = def_config.binary_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if found_target_in_config {
|
||||||
|
output_dir = target_config.output_dir
|
||||||
|
binary_name = target_config.binary_name
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(output_dir) > 0 && len(binary_name) > 0 {
|
||||||
|
strings.write_string(&sb, " -out:")
|
||||||
|
strings.write_string(&sb, string(output_dir))
|
||||||
|
strings.write_string(&sb, binary_name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
compile_flags = strings.to_string(sb)
|
compile_flags = strings.to_string(sb)
|
||||||
|
|
||||||
|
|
@ -78,3 +119,23 @@ execute_command :: proc(
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clean :: proc(
|
||||||
|
command: Command,
|
||||||
|
target_name: TargetName,
|
||||||
|
configuration: ConfigurationTargets,
|
||||||
|
) -> (
|
||||||
|
error: ExecutionError,
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
test :: proc(
|
||||||
|
command: Command,
|
||||||
|
target_name: TargetName,
|
||||||
|
configuration: ConfigurationTargets,
|
||||||
|
) -> (
|
||||||
|
error: ExecutionError,
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue