Skip to content

Commit

Permalink
Expose rust *.rs files in VS and add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bitonality committed May 24, 2024
1 parent ee10bbc commit f17c424
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ You may encounter use for the some of the more advanced `xmake` commands. A non-

| Syntax | Aliases | Uses |
| --- | --- | --- |
| `xmake <command> --yes` | `xmake <command> -y` | Automatically confirm any user prompts. |
| `xmake --verbose <command>` | `xmake -v <command>` | Enable verbose level logging. |
| `xmake --Diagnostic <command>` | `xmake -D <command>` | Enable diagnostic level logging. |
| `xmake --verbose --Diagnostic --yes <command>` | `xmake -vDy <command>` | 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 <target>` | `xmake c <target>` | Cleans binaries and intermediates of a specific target. |
Expand All @@ -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

Expand All @@ -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 "<modes>"` command to regenerate the solution.
## Updating git submodules

If you want to update git submodules, you do so one of three ways:
Expand Down
2 changes: 2 additions & 0 deletions deps/first/patternsleuth_bind/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion deps/first/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f17c424

Please sign in to comment.