From f981156996a1b7c25e3071127c7d3c5050024eb4 Mon Sep 17 00:00:00 2001 From: Justin Karneges Date: Mon, 27 Nov 2023 10:31:06 -0800 Subject: [PATCH] convert rust build from qmake project to plain makefile --- .gitignore | 2 -- postbuild/postbuild.pro | 11 +++---- src/Makefile | 18 +++++++++++ src/rust/rust.pro | 71 ----------------------------------------- src/src.pro | 5 --- 5 files changed, 23 insertions(+), 84 deletions(-) create mode 100644 src/Makefile delete mode 100644 src/rust/rust.pro delete mode 100644 src/src.pro diff --git a/.gitignore b/.gitignore index 3770ee72..76721d87 100644 --- a/.gitignore +++ b/.gitignore @@ -21,11 +21,9 @@ vendor /conf.log /conf.pri /Makefile -/src/Makefile /src/cpp/Makefile /src/cpp/cpp/Makefile /src/cpp/tests/Makefile -/src/rust/Makefile /src/runner/certs/*.crt /src/runner/certs/*.key /postbuild/Makefile diff --git a/postbuild/postbuild.pro b/postbuild/postbuild.pro index 8a6ce4ff..efa71a69 100644 --- a/postbuild/postbuild.pro +++ b/postbuild/postbuild.pro @@ -1,17 +1,16 @@ TEMPLATE = aux -CONFIG -= debug_and_release debug include($$OUT_PWD/../target/postbuild_conf.pri) root_dir = $$PWD/.. bin_dir = $$root_dir/bin -CONFIG(debug, debug|release) { - cargo_flags = - target_dir = $$root_dir/target/debug -} else { - cargo_flags = --release +RELEASE = $$(RELEASE) + +!isEmpty(RELEASE) { target_dir = $$root_dir/target/release +} else { + target_dir = $$root_dir/target/debug } # copy bin files diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 00000000..b6b960fd --- /dev/null +++ b/src/Makefile @@ -0,0 +1,18 @@ +ifdef RELEASE +cargo_flags = --offline --release +else +cargo_flags = +endif + +all: build + +build: + cd .. && cargo build $(cargo_flags) + +clean: + cd .. && cargo clean + +distclean: clean + +check: + cd .. && cargo test $(cargo_flags) diff --git a/src/rust/rust.pro b/src/rust/rust.pro deleted file mode 100644 index f4d80010..00000000 --- a/src/rust/rust.pro +++ /dev/null @@ -1,71 +0,0 @@ -TEMPLATE = aux -CONFIG -= debug_and_release debug - -root_dir = $$PWD/../.. - -CONFIG(debug, debug|release) { - cargo_flags = - target_dir = $$root_dir/target/debug -} else { - cargo_flags = --release - target_dir = $$root_dir/target/debug -} - -check.commands = cd "$$root_dir" && cargo test --offline $$cargo_flags - -rust_build.commands = cd "$$root_dir" && cargo build --offline $$cargo_flags - -rust_clean.commands = cd "$$root_dir" && cargo clean - -condure_build.target = $$target_dir/condure -condure_build.depends = rust_build -condure_build.commands = @: - -m2adapter_build.target = $$target_dir/m2adapter -m2adapter_build.depends = rust_build -m2adapter_build.commands = @: - -proxy_build.target = $$target_dir/pushpin-proxy -proxy_build.depends = rust_build -proxy_build.commands = @: - -handler_build.target = $$target_dir/pushpin-handler -handler_build.depends = rust_build -handler_build.commands = @: - -runner_legacy_build.target = $$target_dir/pushpin-legacy -runner_legacy_build.depends = rust_build -runner_legacy_build.commands = @: - -runner_build.target = $$target_dir/pushpin -runner_build.depends = rust_build -runner_build.commands = @: - -publish_build.target = $$target_dir/pushpin-publish -publish_build.depends = rust_build -publish_build.commands = @: - -QMAKE_EXTRA_TARGETS += \ - check \ - rust_build \ - rust_clean \ - condure_build \ - m2adapter_build \ - proxy_build \ - handler_build \ - runner_legacy_build \ - runner_build \ - publish_build - -# make built-in clean depend on rust_clean -clean.depends = rust_clean -QMAKE_EXTRA_TARGETS += clean - -PRE_TARGETDEPS += \ - $$target_dir/condure \ - $$target_dir/m2adapter \ - $$target_dir/pushpin-proxy \ - $$target_dir/pushpin-handler \ - $$target_dir/pushpin-legacy \ - $$target_dir/pushpin \ - $$target_dir/pushpin-publish diff --git a/src/src.pro b/src/src.pro deleted file mode 100644 index 2b00100d..00000000 --- a/src/src.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -rust.subdir = rust - -SUBDIRS += rust