From fa0b5953773225af800733e09417fa079b06cf2d Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Mon, 6 Mar 2023 20:56:37 +0800 Subject: [PATCH] build: using cargo workspace --- .gitignore | 6 +- src/CMakeLists.txt | 6 +- src/{assets => }/Cargo.lock | 80 +++++++++++++++++++++ src/Cargo.toml | 6 ++ src/assets/cbindgen.toml | 2 +- src/to-json/Cargo.lock | 140 ------------------------------------ src/utils/CMakeLists.txt | 1 + 7 files changed, 90 insertions(+), 151 deletions(-) rename src/{assets => }/Cargo.lock (94%) create mode 100644 src/Cargo.toml delete mode 100644 src/to-json/Cargo.lock diff --git a/.gitignore b/.gitignore index 10d9370..d081224 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,7 @@ /bin/ -/build/ /.idea/ /assets/*.txt - +/src/target/ /cmake-build/ /cmake-build-debug/ /cmake-build-release/ - -/src/assets/target/ -/src/to-json/target/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3a06801..44b62f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,8 +7,7 @@ include_directories(${PROJECT_SOURCE_DIR}/include/bcrypt) include_directories(${PROJECT_SOURCE_DIR}/include/common) include_directories(${PROJECT_SOURCE_DIR}/include/loader) -link_directories(${PROJECT_SOURCE_DIR}/src/assets/target/release) -link_directories(${PROJECT_SOURCE_DIR}/src/to-json/target/release) +link_directories(${PROJECT_SOURCE_DIR}/src/target/release) add_subdirectory(utils) add_subdirectory(applet) @@ -18,6 +17,3 @@ add_subdirectory(loader) add_executable(cleardns cleardns.c) target_link_libraries(cleardns utils applet bcrypt common loader) - -# TODO: just for test -target_link_libraries(cleardns assets ssl crypto) diff --git a/src/assets/Cargo.lock b/src/Cargo.lock similarity index 94% rename from src/assets/Cargo.lock rename to src/Cargo.lock index ac298b5..6621f5f 100644 --- a/src/assets/Cargo.lock +++ b/src/Cargo.lock @@ -779,6 +779,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -791,6 +800,19 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_yaml" +version = "0.9.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f82e6c8c047aa50a7328632d067bcae6ef38772a79e28daf32f735e0e4f3dd10" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "slab" version = "0.4.8" @@ -858,6 +880,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "to_json" +version = "0.1.0" +dependencies = [ + "serde_json", + "serde_yaml", + "toml", +] + [[package]] name = "tokio" version = "1.26.0" @@ -911,6 +942,40 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -964,6 +1029,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unsafe-libyaml" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c" + [[package]] name = "url" version = "2.3.1" @@ -1185,6 +1256,15 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +[[package]] +name = "winnow" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c95fb4ff192527911dd18eb138ac30908e7165b8944e528b6af93aa4c842d345" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.10.1" diff --git a/src/Cargo.toml b/src/Cargo.toml new file mode 100644 index 0000000..150e4f8 --- /dev/null +++ b/src/Cargo.toml @@ -0,0 +1,6 @@ +[workspace] + +members = [ + "assets", + "to-json" +] diff --git a/src/assets/cbindgen.toml b/src/assets/cbindgen.toml index cb8d3fd..0555597 100644 --- a/src/assets/cbindgen.toml +++ b/src/assets/cbindgen.toml @@ -1,3 +1,3 @@ language = "C" pragma_once = true -include_version = true +include_version = false diff --git a/src/to-json/Cargo.lock b/src/to-json/Cargo.lock deleted file mode 100644 index d4ecb0f..0000000 --- a/src/to-json/Cargo.lock +++ /dev/null @@ -1,140 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "indexmap" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "itoa" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "ryu" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" - -[[package]] -name = "serde" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" - -[[package]] -name = "serde_json" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_yaml" -version = "0.9.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82e6c8c047aa50a7328632d067bcae6ef38772a79e28daf32f735e0e4f3dd10" -dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - -[[package]] -name = "to_json" -version = "0.1.0" -dependencies = [ - "serde_json", - "serde_yaml", - "toml", -] - -[[package]] -name = "toml" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "unsafe-libyaml" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c" - -[[package]] -name = "winnow" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95fb4ff192527911dd18eb138ac30908e7165b8944e528b6af93aa4c842d345" -dependencies = [ - "memchr", -] diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index bb1d68d..23ebb99 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -1,3 +1,4 @@ cmake_minimum_required(VERSION 2.8.12) add_library(utils cJSON.c assets.c logger.c process.c) +target_link_libraries(utils assets ssl crypto)