sim: Move Cargo package to top level

Instead of having to cd into the 'sim' directory, create a top-level
Cargo.toml file that adds the sim as a workspace.

For the most part, this doesn't change how the simulator works.  It is
still possible to run `cargo test ...` within the `sim` directory.
However, the `target` directory will reside at the top-level of the tree
instead of within the sim directory.

One change is that running cargo commands at the top of the tree will
run those commands on all of the packages found within the tree.
Specific packages can be tested by either changing to the directory of
that package, or passing `-p <dir>` to the cargo test command (i.e.
`cargo test -p bootsim`).

The other visible change from this commit is that the 'target' directory
will always be at the top of the tree, rather than in particular
directory where the test is run.  Any scripts or tools that expect this
to be in a certainly location, will have to be modified.

Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2021-08-19 11:06:57 -06:00 committed by David Brown
parent 7f8c0a2c4e
commit 6d56cd8a5f
4 changed files with 16 additions and 10 deletions

3
.gitignore vendored
View File

@ -25,3 +25,6 @@ rusty-tags.*
# Python egg metadata, regenerated from source files by setuptools. # Python egg metadata, regenerated from source files by setuptools.
/scripts/*.egg-info /scripts/*.egg-info
/scripts/*.egg /scripts/*.egg
# The target directory from Rust development
/target/

View File

13
Cargo.toml Normal file
View File

@ -0,0 +1,13 @@
[workspace]
members = ["sim"]
exclude = ["ptest"]
# The simulator runs very slowly without optimization. A value of 1
# compiles in about half the time, but runs about 5-6 times slower. 2
# and 3 are hardly different in either compile time or performance.
# Use 2 in case that makes the code slightly more debuggable.
[profile.test]
opt-level = 2
[profile.dev]
opt-level = 2

View File

@ -49,13 +49,3 @@ cipher = "0.3"
aes = { version = "0.7.4", features = ["ctr"] } aes = { version = "0.7.4", features = ["ctr"] }
base64 = "0.13.0" base64 = "0.13.0"
typenum = "1.13.0" typenum = "1.13.0"
# The simulator runs very slowly without optimization. A value of 1
# compiles in about half the time, but runs about 5-6 times slower. 2
# and 3 are hardly different in either compile time or performance.
# Use 2 in case that makes the code slightly more debuggable.
[profile.test]
opt-level = 2
[profile.dev]
opt-level = 2