From 73172ed4f1a7fc530280f3e65423ca2a3ec29bc1 Mon Sep 17 00:00:00 2001 From: George Higashiyama Date: Fri, 17 May 2024 13:57:04 -0700 Subject: [PATCH 1/5] Introduction of the cargo.build rule to manage patternsleuth as a target. (#3) --- deps/first/patternsleuth_bind/Cargo.lock | 694 ------------------ deps/first/patternsleuth_bind/Cargo.toml | 7 - deps/first/patternsleuth_bind/xmake.lua | 6 + deps/first/xmake.lua | 17 +- .../modules/cargo/cargo_helpers.lua | 63 ++ tools/xmakescripts/rules/rust_rules.lua | 176 +++++ xmake.lua | 4 +- 7 files changed, 252 insertions(+), 715 deletions(-) delete mode 100644 deps/first/patternsleuth_bind/Cargo.lock delete mode 100644 deps/first/patternsleuth_bind/Cargo.toml create mode 100644 deps/first/patternsleuth_bind/xmake.lua create mode 100644 tools/xmakescripts/modules/cargo/cargo_helpers.lua create mode 100644 tools/xmakescripts/rules/rust_rules.lua diff --git a/deps/first/patternsleuth_bind/Cargo.lock b/deps/first/patternsleuth_bind/Cargo.lock deleted file mode 100644 index 9ee4d977d..000000000 --- a/deps/first/patternsleuth_bind/Cargo.lock +++ /dev/null @@ -1,694 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "anyhow" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" -dependencies = [ - "cfg-if", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" -dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "memoffset", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown", - "lock_api", - "once_cell", - "parking_lot_core", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - -[[package]] -name = "flate2" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-executor" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", -] - -[[package]] -name = "futures-scopes" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdcf32827e803f1a3cd04c4319feb99156cb5968a3b393f8541efefa1e3b24c" -dependencies = [ - "crossbeam-channel", - "dashmap", - "futures", - "pin-project", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "iced-x86" -version = "1.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd366a53278429c028367e0ba22a46cab6d565a57afb959f06e92c7a69e7828" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "inventory" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8573b2b1fb643a372c73b23f4da5f888677feef3305146d68a539250a9bccc7" - -[[package]] -name = "itertools" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" -dependencies = [ - "either", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" - -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "memchr" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" - -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "flate2", - "memchr", - "ruzstd", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", -] - -[[package]] -name = "patternsleuth" -version = "0.1.0" -dependencies = [ - "anyhow", - "futures", - "futures-scopes", - "iced-x86", - "inventory", - "itertools", - "libc", - "memchr", - "object", - "patternsleuth_scanner", - "rayon", - "strum", - "windows", -] - -[[package]] -name = "patternsleuth_bind" -version = "0.1.0" -dependencies = [ - "patternsleuth", -] - -[[package]] -name = "patternsleuth_scanner" -version = "0.1.0" -dependencies = [ - "anyhow", - "memchr", - "rayon", -] - -[[package]] -name = "pin-project" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "proc-macro2" -version = "1.0.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rayon" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags", -] - -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - -[[package]] -name = "ruzstd" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d" -dependencies = [ - "byteorder", - "derive_more", - "twox-hash", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strum" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.25.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.41", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core", - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" diff --git a/deps/first/patternsleuth_bind/Cargo.toml b/deps/first/patternsleuth_bind/Cargo.toml deleted file mode 100644 index 20cf69b68..000000000 --- a/deps/first/patternsleuth_bind/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "patternsleuth_bind" -version = "0.1.0" -edition = "2021" - -[dependencies] -patternsleuth = { path = "../patternsleuth/patternsleuth", features = ["process-internal"] } diff --git a/deps/first/patternsleuth_bind/xmake.lua b/deps/first/patternsleuth_bind/xmake.lua new file mode 100644 index 000000000..6def5f2b9 --- /dev/null +++ b/deps/first/patternsleuth_bind/xmake.lua @@ -0,0 +1,6 @@ +target("patternsleuth_bind") + set_kind("static") + set_values("rust.cratetype", "staticlib") + add_files("src/lib.rs") + add_deps("patternsleuth") + add_rules("rust.link") \ No newline at end of file diff --git a/deps/first/xmake.lua b/deps/first/xmake.lua index 8f9999feb..d8f127153 100644 --- a/deps/first/xmake.lua +++ b/deps/first/xmake.lua @@ -12,21 +12,14 @@ includes("LuaMadeSimple") includes("LuaRaw") includes("MProgram") includes("ParserBase") +includes("patternsleuth_bind") includes("Profiler") includes("ScopedTimer") includes("SinglePassSigScanner") includes("Unreal") --- Patternsleuth -> START - -add_requires("cargo::patternsleuth_bind", { debug = is_mode_debug(), configs = { cargo_toml = path.join(os.scriptdir(), "patternsleuth_bind/Cargo.toml") } }) - -target("patternsleuth_bind") +-- The patternsleuth target is managed by the cargo.build rule. +target("patternsleuth") set_kind("static") - set_values("rust.cratetype", "staticlib") - add_files("patternsleuth_bind/src/lib.rs") - add_packages("cargo::patternsleuth_bind") - - add_links("ws2_32", "advapi32", "userenv", "ntdll", "oleaut32", "bcrypt", "ole32", { public = true }) - --- Patternsleuth -> END + add_rules("cargo.build", {project_name = "patternsleuth", is_debug = is_mode_debug(), features= {"process-internal"}}) + add_files("patternsleuth/Cargo.toml") diff --git a/tools/xmakescripts/modules/cargo/cargo_helpers.lua b/tools/xmakescripts/modules/cargo/cargo_helpers.lua new file mode 100644 index 000000000..f5f1c9525 --- /dev/null +++ b/tools/xmakescripts/modules/cargo/cargo_helpers.lua @@ -0,0 +1,63 @@ +---@alias rust_mode "dev" | "release" + +--- Takes a target and returns context variables to be used in on_xxx overrides. +---@param target any xmake target +---@param is_debug boolean Should we get the debug or release context? +---@return string cargo_dir The root cargo dir for the project. Ex. Intermediates/Cargo/target/ +---@return string cargo_mode_dir The cargo dir for the debug/release config. Ex. Intermediates/Cargo/target/debug/ +---@return rust_mode rust_mode The rust flavor of mode derrived from is_debug param. +function get_cargo_context(target, is_debug) + local rust_mode = is_debug and "dev" or "release" + local rust_mode_dir = is_debug and "debug" or "release" + local cargo_dir = path.join(get_config("buildir"), "cargo", target:name()) + return cargo_dir, path.join(cargo_dir, rust_mode_dir), rust_mode +end + +--- Parses ".d" files created by Cargo. +---@param file string Path to a ".d" file created by Cargo +---@return string[] cargo_deps A list of any src files that should trigger a rebuild. +function get_dependencies(file) + if not os.exists(file) then + return {} + end + + local data = io.readfile(file) + data = data:trim() + local start = data:find(": ", 1, false) + local deps = data:sub(start + 2):split(" ", {strict = false, plain = true}) + + local parsed_deps = {} + local dep = "" + local dep_idx = 1 + while dep do + dep = deps[dep_idx] + if dep then + while dep:endswith("\\") do + dep_idx = dep_idx + 1 + dep = dep:sub(1, -2) .. " " .. deps[dep_idx] + end + table.insert(parsed_deps, dep) + dep_idx = dep_idx + 1 + end + end + + return parsed_deps +end + +--[[ +The previous function is based on the cargo impl of internal .d parsing. + +let mut deps = line[pos + 2..].split_whitespace(); + +while let Some(s) = deps.next() { + let mut file = s.to_string(); + while file.ends_with('\\') { + file.pop(); + file.push(' '); + file.push_str(deps.next().ok_or_else(|| { + internal("malformed dep-info format, trailing \\".to_string()) + })?); + } + ret.files.push(file.into()); +} +]]-- \ No newline at end of file diff --git a/tools/xmakescripts/rules/rust_rules.lua b/tools/xmakescripts/rules/rust_rules.lua new file mode 100644 index 000000000..dbc5c21b6 --- /dev/null +++ b/tools/xmakescripts/rules/rust_rules.lua @@ -0,0 +1,176 @@ +-- This rule extends xmake's default rust rules in order to support +-- precision linking. This rule makes rust report which static libs it expects +-- to be linked against and those libs are propagated up to anything else that +-- wants to link to the created staticlib. +rule("rust.link") + add_imports("core.project.depend") + + on_load(function(target) + -- Rust expects the native-static-libs dir to exist before we run `rustc`. + os.mkdir(target:dependir()) + + -- Save any native libraries we compiled with so we can add them as links later. + target:add("rcflags", "--print native-static-libs="..path.translate(path.join(target:dependir(), "native-libs.txt"))) + end) + + after_build(function(target) + -- After building, we need to add the `native-libs.txt` file to the .d file. + -- This allows xmake to detect if we need to rebuild if the native libs reported by rust + -- have been regenerated/changed. + local native_libs = path.join(target:dependir(), "native-libs.txt") + local dependinfo = depend.load(target:dependfile()) or {} + table.append(dependinfo.files, native_libs) + -- There might be a way to avoid manual deduping of the dependency files to achieve + -- idempotency, but this should suffice for now. The list of files is small (two files for now). + dependinfo.files = table.unique(dependinfo.files) + depend.save(dependinfo, target:dependfile()) + + -- Load the native lib list that was generated during rustc invocation. + -- We add these native libs as links. + local data = io.readfile(native_libs) + local deps = data:split(" ", {plain = true}) + for _, lib in ipairs(deps) do + -- Windows has another quirk where we have to manually link against the msvcrtd. + -- Even though rust reports that it links against msvcrt, we have to link to the debug runtime. + if lib == "msvcrt.lib" then + if os.is_host("windows") and target:get("runtimes") == "MDd" then + target:add("links", "msvcrtd.lib", {public = true}) + end + else + target:add("links", lib, {public = true}) + end + end + end) + +-- This rule allows for generic pure-rust Cargo.toml projects to have their building +-- marshalled and managed entirely by the Cargo/rustc toolchain. +rule("cargo.build") + set_extensions(".toml") + add_imports("cargo.cargo_helpers", "core.project.depend") + + on_load(function (target) + -- Get the user supplied project to build from the cargo workspace. + local project_name = target:extraconf("rules", "cargo.build", "project_name") + assert(project_name, "No project_name passed to the cargo.build rule.") + + -- Convert the supplied project name to the rust output format. + -- ex. patternsleuth.lib -> libpatternsleuth.rlib + if target:is_static() then + target:set("basename", "lib" .. project_name:gsub("-", "_")) + target:set("extension", ".rlib") + end + + local is_debug = target:extraconf("rules", "cargo.build", "is_debug") + + local _, cargo_output_dir, _ = cargo_helpers.get_cargo_context(target, is_debug) + + -- Add framework dirs so any projects that add_deps() this target can get the proper rust flags. + -- frameworks are in the format of `--extern cratename=dir/to/crate.rlib` + target:add("frameworks", path.join(cargo_output_dir, target:filename()), {public = true}) + -- frameworkdirs are in the format of `-L dependency=dir/to/deps/` + target:add("frameworkdirs", path.join(cargo_output_dir, "deps"), {public = true}) + end) + + on_build_file(function (target, sourcefile, opt) + -- Windows has a quirk where rust will prefer to use the shipped .lib imports from the windows cargo packages. + -- This results in rust reporting that we have to link to windows0.48.5, etc. + -- Instead of having to parse the windows package dependencies and link to their pre-built .lib, + -- we use the windows_raw_dylib to allow rust to resolve and and create the imports automatically. + -- More background on this can be found at https://kennykerr.ca/rust-getting-started/understanding-windows-targets.html + if(os.is_host("windows")) then + os.setenv("RUSTFLAGS", "--cfg windows_raw_dylib") + end + + -- Get the user supplied project to build from the cargo workspace. + local project_name = target:extraconf("rules", "cargo.build", "project_name") + local is_debug = target:extraconf("rules", "cargo.build", "is_debug") + local cargo_dir, cargo_mode_dir, cargo_mode = cargo_helpers.get_cargo_context(target, is_debug) + local targetfile = target:targetfile() + + local argv = { + "rustc", + "--manifest-path="..sourcefile, + -- Only support the cargo lib type for now. + "--lib", + "--profile", + cargo_mode, + "-p", + project_name, + "--crate-type", + "rlib", + "--target-dir="..cargo_dir, + "--quiet" + } + + -- Add any cargo features if we specified them in add_rules(). + local features = target:extraconf("rules", "cargo.build", "features") + if features then + table.append(argv, "-F", table.concat(features, ",")) + end + + -- Support the dry-run logic from xmake. + import("core.base.option") + local dryrun = option.get("dry-run") + + -- The function in depend.on_changed() runs when xmake detects changes that will require a rebuild. + -- The conditions that trigger a rebuild are defined in on_changed(function(), { Conditions }). + depend.on_changed(function () + -- Ensure the user has cargo installed. + import("lib.detect.find_tool") + local cargo = find_tool("cargo") + if not cargo then + raise("cargo not found!") + end + + import("utils.progress") + progress.show(opt.progress or 0, "${color.build.object}compiling.cargo %s", sourcefile) + + if not dryrun then + os.execv(cargo.program, argv) + + -- Copy the .rlib to the Binaries dir so any downstream dependencies automatically know where to find it. + os.cp(path.join(cargo_mode_dir, target:filename()), target:targetfile()) + end + end, { dependfile = target:dependfile(targetfile), + lastmtime = os.mtime(targetfile), + changed = target:is_rebuilt(), + values = argv, + -- Parse cargo's dependent files list and add to this target's dependent files list. + -- This allows us to precisely add any .rs files that should trigger a rebuild. + files = cargo_helpers.get_dependencies(path.join(cargo_mode_dir, target:basename().. ".d")), + dryrun = dryrun}) + + end) + + before_clean(function(target) + local is_debug = target:extraconf("rules", "cargo.build", "is_debug") + local cargo_dir, _, cargo_mode = cargo_helpers.get_cargo_context(target, is_debug) + local project_name = target:extraconf("rules", "cargo.build", "project_name") + + import("lib.detect.find_tool") + local cargo = find_tool("cargo") + if not cargo then + raise("cargo not found!") + end + + -- We use the cargo clean command to clean cargo built targets instead of just nuking the deps folder. + -- This allows for faster builds since we can safely cache most of the rust dependency crates. + for _, sourcefile in ipairs(target:sourcefiles()) do + local argv = { + "clean", + "-p", + project_name, + "--target-dir="..cargo_dir, + "--manifest-path="..sourcefile, + "--profile", + cargo_mode + } + + print(argv) + os.execv(cargo.program, argv) + end + end) + + -- Cargo manages linking when building .rlib files. + -- Override the on_link function to give full control to this cargo rule. + on_link(function(target) end) \ No newline at end of file diff --git a/xmake.lua b/xmake.lua index 1af99b7c8..fec329b45 100644 --- a/xmake.lua +++ b/xmake.lua @@ -11,8 +11,8 @@ set_config("buildir", "Intermediates") -- /modules/rules/my_module.lua import("rules.my_module") add_moduledirs("tools/xmakescripts/modules") --- Load the build_rules file into the global scope. -includes("tools/xmakescripts/rules/build_rules.lua") +-- Load our rule files into the global scope. +includes("tools/xmakescripts/rules/**.lua") -- Generate the mode rules. local modes = generate_compilation_modes() From b63239a9dcf70a2639c7d09794d284a16ac164ff Mon Sep 17 00:00:00 2001 From: George Higashiyama Date: Sat, 18 May 2024 11:39:21 -0700 Subject: [PATCH 2/5] nit: formatting --- deps/first/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/first/xmake.lua b/deps/first/xmake.lua index d8f127153..a05de267a 100644 --- a/deps/first/xmake.lua +++ b/deps/first/xmake.lua @@ -21,5 +21,5 @@ includes("Unreal") -- The patternsleuth target is managed by the cargo.build rule. target("patternsleuth") set_kind("static") - add_rules("cargo.build", {project_name = "patternsleuth", is_debug = is_mode_debug(), features= {"process-internal"}}) + add_rules("cargo.build", {project_name = "patternsleuth", is_debug = is_mode_debug(), features= { "process-internal" }}) add_files("patternsleuth/Cargo.toml") From 3f9df2fd74d2e872d5e08fba90a90d6e7236f04b Mon Sep 17 00:00:00 2001 From: George Higashiyama Date: Sun, 19 May 2024 09:49:30 -0700 Subject: [PATCH 3/5] Improve dependency .d file tracking --- tools/xmakescripts/rules/rust_rules.lua | 29 +++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/tools/xmakescripts/rules/rust_rules.lua b/tools/xmakescripts/rules/rust_rules.lua index dbc5c21b6..a22127e52 100644 --- a/tools/xmakescripts/rules/rust_rules.lua +++ b/tools/xmakescripts/rules/rust_rules.lua @@ -18,6 +18,11 @@ rule("rust.link") -- This allows xmake to detect if we need to rebuild if the native libs reported by rust -- have been regenerated/changed. local native_libs = path.join(target:dependir(), "native-libs.txt") + + if not os.exists(native_libs) then + raise("Cargo target: %s did not export a list of native libs to link against. Try `xmake build --rebuild %s`", target:name(), target:name()) + end + local dependinfo = depend.load(target:dependfile()) or {} table.append(dependinfo.files, native_libs) -- There might be a way to avoid manual deduping of the dependency files to achieve @@ -85,7 +90,7 @@ rule("cargo.build") local project_name = target:extraconf("rules", "cargo.build", "project_name") local is_debug = target:extraconf("rules", "cargo.build", "is_debug") local cargo_dir, cargo_mode_dir, cargo_mode = cargo_helpers.get_cargo_context(target, is_debug) - local targetfile = target:targetfile() + local targetfile = path.join(cargo_mode_dir, target:filename()) local argv = { "rustc", @@ -112,6 +117,14 @@ rule("cargo.build") import("core.base.option") local dryrun = option.get("dry-run") + -- Parse cargo's dependent files list and add to this target's dependent files list. + -- This allows us to precisely add any .rs files that should trigger a rebuild. + local dependent_files = cargo_helpers.get_dependencies(path.join(cargo_mode_dir, target:basename().. ".d")) + -- Detect any changes to Cargo.toml. + table.join2(dependent_files, sourcefile) + -- Detect any changes to the xxx.rlib target file. + table.join2(dependent_files, path.join(cargo_mode_dir, target:filename())) + -- The function in depend.on_changed() runs when xmake detects changes that will require a rebuild. -- The conditions that trigger a rebuild are defined in on_changed(function(), { Conditions }). depend.on_changed(function () @@ -127,19 +140,13 @@ rule("cargo.build") if not dryrun then os.execv(cargo.program, argv) - - -- Copy the .rlib to the Binaries dir so any downstream dependencies automatically know where to find it. - os.cp(path.join(cargo_mode_dir, target:filename()), target:targetfile()) end - end, { dependfile = target:dependfile(targetfile), + end, { dependfile = target:dependfile(target:targetfile()), lastmtime = os.mtime(targetfile), changed = target:is_rebuilt(), values = argv, - -- Parse cargo's dependent files list and add to this target's dependent files list. - -- This allows us to precisely add any .rs files that should trigger a rebuild. - files = cargo_helpers.get_dependencies(path.join(cargo_mode_dir, target:basename().. ".d")), - dryrun = dryrun}) - + files = dependent_files, + dryrun = dryrun}) end) before_clean(function(target) @@ -165,8 +172,6 @@ rule("cargo.build") "--profile", cargo_mode } - - print(argv) os.execv(cargo.program, argv) end end) From ee10bbc784b40797dab5f4bea2bd0863612d4657 Mon Sep 17 00:00:00 2001 From: George Higashiyama Date: Fri, 24 May 2024 11:04:17 -0700 Subject: [PATCH 4/5] Improve documentation, add xmake req ver, configurable rust mode. --- README.md | 54 +- deps/first/patternsleuth_bind/Cargo.lock | 694 +++++++++++++++++++++++ deps/first/patternsleuth_bind/Cargo.toml | 7 + deps/first/patternsleuth_bind/xmake.lua | 23 +- deps/first/xmake.lua | 23 +- xmake.lua | 1 + 6 files changed, 786 insertions(+), 16 deletions(-) create mode 100644 deps/first/patternsleuth_bind/Cargo.lock create mode 100644 deps/first/patternsleuth_bind/Cargo.toml diff --git a/README.md b/README.md index be7b73b1c..a953d848f 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,7 @@ If you are planning on doing mod development using UE4SS, you can do the same as - Visual Studio 2019 (recent versions), and Visual Studio 2022 will work. - More compilers will hopefully be supported in the future. - Rust toolchain 1.73.0 or greater -- [xmake](https://xmake.io/#/) - +- [xmake >= 2.9.2](https://xmake.io/#/) ## Build instructions @@ -68,9 +67,18 @@ If you are planning on doing mod development using UE4SS, you can do the same as There are several different ways you can build UE4SS. -### Building from cli +## Building from cli + +### Configuration settings + +`xmake` allows you to flexibly configure some build options to suit your specific needs. The following is a non-comprehensive list of configuration settings you might find useful. + +> [!IMPORTANT] +> All configuration changes are made by using the `xmake config` command. You can also use `xmake f` as an alias for con**f**ig. -Configure the project using this command: `xmake f -m ""` +After configuring `xmake` with any of the following options, you can build the project with `xmake` or `xmake build`. + +#### Mode The build modes are structured as follows: `____` @@ -89,8 +97,38 @@ Currently supported options for these are: * `Platform` * `Win64` - 64-bit windows +> [!TIP] +> Configure the project using this command: `xmake f -m ""`. `-m` is an alias for --**m**ode=\. + +#### Patternsleuth (Experimental) + +By default, the patternsleuth tool installs itself as an xmake package. If you do not intend on modifying the patternsleuth source code, then you don't have to configure anything special. If you want to be able to modify the patternsleuth source code, you have to supply the `--patternsleuth=local` option to `xmake config` in order to recompile patternsleuth as part of the UE4SS build. + +#### Proxy Path -Now to build it, just run `xmake` +By default, UE4SS generates a proxy based on `C:\Windows\System32\dwmapi.dll`. If you want to change this for any reason, you can supply the `--ue4ssProxyPath=` to the `xmake config` command.. + +#### Profiler Flavor + +By default, UE4SS uses Tracy for profiling. You can pass `--profilerFlavor=` to the `xmake config` command to set the profiler flavor. The currently supported flavors are `Tracy`, `Superluminal`, and `None`. + +### Helpful `xmake` commands + +You may encounter use for the some of the more advanced `xmake` commands. A non-comprehensive list of some useful commands is included below. + +| Syntax | Aliases | Uses | +| --- | --- | --- | +| `xmake config` | `xmake f` | Configure xmake with any of [these options](#configuration-settings). | +| `xmake clean --all` | `xmake c --all` | Cleans binaries and intermediate output of all targets. | +| `xmake clean ` | `xmake c ` | Cleans binaries and intermediates of a specific target. | +| `xmake build` | `xmake b` | Incrementally builds UE4SS using input file detection. | +| `xmake build --rebuild` | `xmake b -r` | Forces a full rebuild of UE4SS. | +| `xmake build ` | `xmake b ` | Incrementally builds a specific target. | +| `xmake show` | | Shows xmake info and current project info. | +| `xmake show --target=` | `xmake show -t ` | Prints lots of information about a target. Useful for debugging scripts, compiler flags, dependency tree, etc. | +| `xmake require --clean` | `xmake q -c` | Clears all package caches and uninstalls all not-referenced packages. | +| `xmake require --force` | `xmake q -f` | Force re-installs all dependency packages. | +| `xmake require --list` | `xmake q -l` | Lists all packages that are needed for the project. | ### Opening in an IDE @@ -102,11 +140,9 @@ Afterwards open the generated `.sln` file inside of the `vsxmake2022` directory Note that you should also commit & push the submodules that you've updated if the reason why you updated was not because someone else pushed an update, and you're just catching up to it. -**Note the following about how xmake interacts with VS** - +> [!WARNING] > The vs. build plugin performs the compile operation by directly calling the xmake command under vs, and also supports intellisense and definition jumps, as well as breakpoint debugging. - -This means that modifying the project properties within Visual Studio will not affect which flags are passed to the build when VS executes `xmake`. XMake provides some configurable project settings +> This means that modifying the project properties within Visual Studio will not affect which flags are passed to the build when VS executes `xmake`. XMake provides some configurable project settings which can be found in VS under the `Project Properties -> Configuration Properties -> Xmake` menu. ## Updating git submodules diff --git a/deps/first/patternsleuth_bind/Cargo.lock b/deps/first/patternsleuth_bind/Cargo.lock new file mode 100644 index 000000000..dd07ac157 --- /dev/null +++ b/deps/first/patternsleuth_bind/Cargo.lock @@ -0,0 +1,694 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "anyhow" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "flate2" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.41", +] + +[[package]] +name = "futures-scopes" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdcf32827e803f1a3cd04c4319feb99156cb5968a3b393f8541efefa1e3b24c" +dependencies = [ + "crossbeam-channel", + "dashmap", + "futures", + "pin-project", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "iced-x86" +version = "1.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdd366a53278429c028367e0ba22a46cab6d565a57afb959f06e92c7a69e7828" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "inventory" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8573b2b1fb643a372c73b23f4da5f888677feef3305146d68a539250a9bccc7" + +[[package]] +name = "itertools" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +dependencies = [ + "either", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "flate2", + "memchr", + "ruzstd", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "patternsleuth" +version = "0.1.0" +dependencies = [ + "anyhow", + "futures", + "futures-scopes", + "iced-x86", + "inventory", + "itertools", + "libc", + "memchr", + "object", + "patternsleuth_scanner", + "rayon", + "strum", + "windows", +] + +[[package]] +name = "patternsleuth_bind" +version = "0.1.0" +dependencies = [ + "patternsleuth", +] + +[[package]] +name = "patternsleuth_scanner" +version = "0.1.0" +dependencies = [ + "anyhow", + "memchr", + "rayon", +] + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.41", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro2" +version = "1.0.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rayon" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ruzstd" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d" +dependencies = [ + "byteorder", + "derive_more", + "twox-hash", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.41", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" \ No newline at end of file diff --git a/deps/first/patternsleuth_bind/Cargo.toml b/deps/first/patternsleuth_bind/Cargo.toml new file mode 100644 index 000000000..25f01784b --- /dev/null +++ b/deps/first/patternsleuth_bind/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "patternsleuth_bind" +version = "0.1.0" +edition = "2021" + +[dependencies] +patternsleuth = { path = "../patternsleuth/patternsleuth", features = ["process-internal"] } \ No newline at end of file diff --git a/deps/first/patternsleuth_bind/xmake.lua b/deps/first/patternsleuth_bind/xmake.lua index 6def5f2b9..2434594ca 100644 --- a/deps/first/patternsleuth_bind/xmake.lua +++ b/deps/first/patternsleuth_bind/xmake.lua @@ -1,6 +1,25 @@ +-- If patternsleuth is configured to install as a package. +add_requires("cargo::patternsleuth_bind", { optional = not is_config("patternsleuth", "package"), debug = is_mode_debug(), configs = { cargo_toml = path.join(os.scriptdir(), "Cargo.toml") } }) + target("patternsleuth_bind") set_kind("static") set_values("rust.cratetype", "staticlib") add_files("src/lib.rs") - add_deps("patternsleuth") - add_rules("rust.link") \ No newline at end of file + + -- If patternsleuth is configured to install as a package. + if is_config("patternsleuth", "package") then + add_packages("cargo::patternsleuth_bind") + add_links("ws2_32", "advapi32", "userenv", "ntdll", "oleaut32", "bcrypt", "ole32", { public = true }) + end + + -- If patternsleuth should be built as part of compilation. + if is_config("patternsleuth", "local") then + add_deps("patternsleuth") + add_rules("rust.link") + end + + -- We need to clean up the non-selected package/local version of patternsleuth when we reconfigure. + -- This just deletes the .lib and keeps cargo deps on disk for faster recompilation. + on_config(function(target) + os.tryrm(target:targetfile()) + end) \ No newline at end of file diff --git a/deps/first/xmake.lua b/deps/first/xmake.lua index a05de267a..ccc5617b5 100644 --- a/deps/first/xmake.lua +++ b/deps/first/xmake.lua @@ -18,8 +18,21 @@ includes("ScopedTimer") includes("SinglePassSigScanner") includes("Unreal") --- The patternsleuth target is managed by the cargo.build rule. -target("patternsleuth") - set_kind("static") - add_rules("cargo.build", {project_name = "patternsleuth", is_debug = is_mode_debug(), features= { "process-internal" }}) - add_files("patternsleuth/Cargo.toml") +if has_config("patternsleuth", "local") then + -- The patternsleuth target is managed by the cargo.build rule. + target("patternsleuth") + set_kind("static") + add_rules("cargo.build", {project_name = "patternsleuth", is_debug = is_mode_debug(), features= { "process-internal" }}) + add_files("patternsleuth/Cargo.toml") +end + +-- This option allows users to choose if patternsleuth should be installed as a package +-- or if patternsleuth should be built as a dependency by xmake. The `package` option +-- should be used if you don't intend on ever modifying the patternsleuth source. +-- The `local` option should be used if you want changes in the patternsleuth +-- submodule to be included as part of the UE4SS build. +option("patternsleuth") + set_default("package") + set_showmenu(true) + set_values("package", "local") + set_description("Install patternsleuth as a package or build it as a dependency.", "package", "local") diff --git a/xmake.lua b/xmake.lua index fec329b45..96e6fc16d 100644 --- a/xmake.lua +++ b/xmake.lua @@ -1,3 +1,4 @@ +set_xmakever("2.9.2") -- We should use `get_config("ue4ssRoot")` instead of `os.projectdir()` or `$(projectdir)`. -- This is because os.projectdir() will return a higher parent dir -- when UE4SS is sub-moduled/`include("UE4SS")` in another xmake project. From f17c424bdda722a3946a57c14145fa3523c6fbb4 Mon Sep 17 00:00:00 2001 From: George Higashiyama Date: Fri, 24 May 2024 12:38:21 -0700 Subject: [PATCH 5/5] Expose rust *.rs files in VS and add documentation --- README.md | 18 +++++++++++++++++- deps/first/patternsleuth_bind/xmake.lua | 2 ++ deps/first/xmake.lua | 4 +++- xmake.lua | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a953d848f..6abf72040 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,10 @@ You may encounter use for the some of the more advanced `xmake` commands. A non- | Syntax | Aliases | Uses | | --- | --- | --- | +| `xmake --yes` | `xmake -y` | Automatically confirm any user prompts. | +| `xmake --verbose ` | `xmake -v ` | Enable verbose level logging. | +| `xmake --Diagnostic ` | `xmake -D ` | Enable diagnostic level logging. | +| `xmake --verbose --Diagnostic --yes ` | `xmake -vDy ` | You can combine most flags into a single `-flagCombo`. | | `xmake config` | `xmake f` | Configure xmake with any of [these options](#configuration-settings). | | `xmake clean --all` | `xmake c --all` | Cleans binaries and intermediate output of all targets. | | `xmake clean ` | `xmake c ` | Cleans binaries and intermediates of a specific target. | @@ -129,12 +133,13 @@ You may encounter use for the some of the more advanced `xmake` commands. A non- | `xmake require --clean` | `xmake q -c` | Clears all package caches and uninstalls all not-referenced packages. | | `xmake require --force` | `xmake q -f` | Force re-installs all dependency packages. | | `xmake require --list` | `xmake q -l` | Lists all packages that are needed for the project. | +| `xmake project --kind=vsxmake2022 --modes="Game__Shipping__Win64"` | `xmake project -k vsxmake2022 -m "Game__Shipping__Win64"` | Generates a [Visual Studio project](#visual-studio--rider) based on your current `xmake config`uration. You can specify multiple modes to generate by supplying `-m "Comma,Separated,Modes"`. If you do not supply any modes, the VS project will generate all [permutations of modes](#mode). | ### Opening in an IDE #### Visual Studio / Rider -To generate Visual Studio project files, run the `xmake project -k vsxmake2022` command. +To generate Visual Studio project files, run the `xmake project -k vsxmake2022 -m "Game__Shipping__Win64"` command. Afterwards open the generated `.sln` file inside of the `vsxmake2022` directory @@ -145,6 +150,17 @@ Note that you should also commit & push the submodules that you've updated if th > This means that modifying the project properties within Visual Studio will not affect which flags are passed to the build when VS executes `xmake`. XMake provides some configurable project settings which can be found in VS under the `Project Properties -> Configuration Properties -> Xmake` menu. +##### Configuring additional modes + +> [!TIP] +> Additional modes can be generated by running `xmake project -k vsxmake2022 -m "Game__Shipping__Win64,Game__Debug__Win64"`. +> [Further explanation can be found in the `xmake` command table](#helpful-xmake-commands). + +##### Regenerating solution best practices + +> [!CAUTION] +> If you change your configuration with `xmake config`, you *may* need to regenerate your Visual Studio solution to pick up on changes to your configuration. You can simply re-run the `xmake project -k vsxmake2022 -m ""` command to regenerate the solution. + ## Updating git submodules If you want to update git submodules, you do so one of three ways: diff --git a/deps/first/patternsleuth_bind/xmake.lua b/deps/first/patternsleuth_bind/xmake.lua index 2434594ca..bd57b28a3 100644 --- a/deps/first/patternsleuth_bind/xmake.lua +++ b/deps/first/patternsleuth_bind/xmake.lua @@ -5,6 +5,8 @@ target("patternsleuth_bind") set_kind("static") set_values("rust.cratetype", "staticlib") add_files("src/lib.rs") + -- Exposes the src/lib.rs files to the Visual Studio project filters. + add_extrafiles("src/lib.rs") -- If patternsleuth is configured to install as a package. if is_config("patternsleuth", "package") then diff --git a/deps/first/xmake.lua b/deps/first/xmake.lua index ccc5617b5..875d9ce34 100644 --- a/deps/first/xmake.lua +++ b/deps/first/xmake.lua @@ -18,12 +18,14 @@ includes("ScopedTimer") includes("SinglePassSigScanner") includes("Unreal") -if has_config("patternsleuth", "local") then +if is_config("patternsleuth", "local") then -- The patternsleuth target is managed by the cargo.build rule. target("patternsleuth") set_kind("static") add_rules("cargo.build", {project_name = "patternsleuth", is_debug = is_mode_debug(), features= { "process-internal" }}) add_files("patternsleuth/Cargo.toml") + -- Exposes the rust *.rs files to the Visual Studio project filters. + add_extrafiles("patternsleuth/**.rs") end -- This option allows users to choose if patternsleuth should be installed as a package diff --git a/xmake.lua b/xmake.lua index 96e6fc16d..71de46775 100644 --- a/xmake.lua +++ b/xmake.lua @@ -37,7 +37,7 @@ set_allowedplats("windows") set_allowedarchs("x64") set_allowedmodes(modes) -if is_plat("windows") then +if is_host("windows") then set_defaultmode("Game__Shipping__Win64") end