Convert wslpath to makefile
This commit is contained in:
parent
6bcc871966
commit
16f8f103e0
|
@ -0,0 +1,16 @@
|
||||||
|
BUILD_PROFILE ?= debug
|
||||||
|
CARGO_CMD ?= build
|
||||||
|
WINDOWS_TARGET ?= x86_64-pc-windows-gnu
|
||||||
|
UNIX_TARGET ?= x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
WINDOWS_ARTIFACT = ./target/$(WINDOWS_TARGET)/$(BUILD_PROFILE)/$(ARTIFACT).exe
|
||||||
|
UNIX_ARTIFACT = ./target/$(UNIX_TARGET)/$(BUILD_PROFILE)/$(ARTIFACT)
|
||||||
|
|
||||||
|
define cp_artifact
|
||||||
|
$(if $(findstring build,$(CARGO_CMD)),
|
||||||
|
@mkdir -p $(dir $(1))
|
||||||
|
@cp $(1) $(2)
|
||||||
|
)
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Windows build requires "rustup target add x86_64-pc-windows-gnu" and "sudo apt-get install mingw-w64"
|
|
@ -5,10 +5,30 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"cargo_task": [
|
||||||
|
"wslpath all!Unix: wslpath",
|
||||||
|
"wslpath all-windows!Windows: wslpath"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "cargo2",
|
||||||
|
"type": "shell",
|
||||||
|
"group": {
|
||||||
|
"kind": "build"
|
||||||
|
},
|
||||||
|
"windows": {
|
||||||
|
"command": "wsl --shell-type login make -C ./${input:windows_cargo_task} CARGO_CMD=${input:cargo cmd} BUILD_PROFILE=${input:build cfg}"
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"command": "make -C ./${input:linux_cargo_task} BUILD_PROFILE=${input:build cfg}"
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"label": "all",
|
"label": "all",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
|
@ -62,6 +82,28 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"inputs": [
|
"inputs": [
|
||||||
|
{
|
||||||
|
"id": "windows_cargo_task",
|
||||||
|
"type": "command",
|
||||||
|
"command": "shellCommand.execute",
|
||||||
|
"args": {
|
||||||
|
"command": "powershell",
|
||||||
|
"commandArgs": ["-command", "'${config:cargo_task}'.Replace(',',\"`n\")"],
|
||||||
|
"fieldSeparator": "!"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": "planschi",
|
||||||
|
"type": "command",
|
||||||
|
"command": "shellCommand.execute",
|
||||||
|
"args": {
|
||||||
|
"command": "printf A!B\\nB!C",
|
||||||
|
"fieldSeparator": "!"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "build cfg",
|
"id": "build cfg",
|
||||||
"type": "pickString",
|
"type": "pickString",
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
include ../Common.mk
|
||||||
|
|
||||||
|
ARTIFACT = wslpath
|
||||||
|
|
||||||
|
.PHONY: $(WINDOWS_ARTIFACT) $(UNIX_ARTIFACT)
|
||||||
|
$(WINDOWS_ARTIFACT):
|
||||||
|
cargo $(CARGO_CMD) --$(BUILD_PROFILE) --target=$(WINDOWS_TARGET)
|
||||||
|
$(call cp_artifact,$(WINDOWS_ARTIFACT), ../../../bin/$(ARTIFACT).exe)
|
||||||
|
|
||||||
|
$(UNIX_ARTIFACT):
|
||||||
|
cargo $(CARGO_CMD) --$(BUILD_PROFILE) --target=$(UNIX_TARGET)
|
||||||
|
$(call cp_artifact,$(UNIX_ARTIFACT), ../../../bin/$(ARTIFACT))
|
||||||
|
|
||||||
|
all-windows: $(WINDOWS_ARTIFACT)
|
||||||
|
all: $(UNIX_ARTIFACT)
|
Loading…
Reference in New Issue