Skip to content

Commit

Permalink
Update user guide pages (#3)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #3

Update install command with pixi task, which is simpler

Differential Revision: D58612312
  • Loading branch information
jeongseok authored and facebook-github-bot committed Jun 15, 2024
1 parent 7a88a96 commit 626b6c9
Show file tree
Hide file tree
Showing 8 changed files with 212 additions and 144 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
pixi run test
- name: Install Momentum and Build hello_world
run: |
pixi run cmake --build build --target install --parallel
pixi run install
pixi run cmake \
-S momentum/examples/hello_world \
-B momentum/examples/hello_world/build \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
pixi run test
- name: Install Momentum and Build hello_world
run: |
pixi run cmake --build build --target install --parallel
pixi run install
pixi run cmake \
-S momentum/examples/hello_world \
-B momentum/examples/hello_world/build \
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/ci_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ jobs:
pixi run test
- name: Install Momentum and Build hello_world
run: |
pixi run cmake `
--build build `
--config Release `
--target install `
--parallel
pixi run install
pixi run cmake `
-S momentum/examples/hello_world `
-B momentum/examples/hello_world/build
Expand Down
94 changes: 36 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,101 +11,79 @@ numerical optimization solvers to apply human motion in various applications.

## Getting Started

### Supported Environments

* **OS**: Windows, Linux, macOS
This page guides you through the process of building Momentum and running the examples.

### Prerequisite

Complete the following steps only once:

- Install Pixi by following the instructions on https://prefix.dev/

### Install Momentum
1. Install Pixi by following the instructions on https://prefix.dev/

1. Clone the repository and navigate to the root directory:

```
clone https://github.com/facebookincubator/momentum
cd momentum
```

2. Build and install Momentum in a virtual environment using Pixi:

```
pixi run cmake --build build --target install --parallel
```

### Creating Your First Application
```
git clone https://github.com/facebookincubator/momentum
cd momentum
```

#### Writing Source Code
Ensure that all subsequent commands are executed in the project's root directory unless specified otherwise.

Now, let's define a simple Momentum application. Create a new file named `main.cpp` with the following content:
### Build Momentum

```cpp
#include <momentum/math/mesh.h>
After completing the prerequisites, you are ready to build and use Momentum.

using namespace momentum;
- Build the project with the following command (note that the first run may take a few minutes as it installs all dependencies):

int main() {
auto mesh = Mesh();
mesh.updateNormals();
return EXIT_SUCCESS;
}
```
```
pixi run build
```

#### Writing CMake Script
- Run the tests with:

Create a `CMakeLists.txt` file in the same directory as `main.cpp`.
```
pixi run test
```

To add momentum to your CMake project, first find the momentum package using the
`find_package` function and then add the appropriate `momentum::<target>` as a
dependency to your library or executable. For example, if you want to use the
character functionality from momentum, you would add `momentum::character` as a
dependency:
To view all available command lines, run `pixi task list`.

```cmake
cmake_minimum_required(VERSION 3.16.3)
### Running Hello World

project(momentum)
To run the `hello_world` example:

find_package(momentum CONFIG REQUIRED)
add_executable(hello_world main.cpp)
target_link_libraries(hello_world PRIVATE momentum::math)
```
pixi run hello-world
```

Refer to the example project located at `momentum/examples/hello_world/` for the complete source code.

#### Building using CMake

To configure the application, run:
Alternatively, you can directly run the executable:

```
# Linux and macOS
pixi run cmake -S momentum/examples/hello_world -B momentum/examples/hello_world/build -DCMAKE_BUILD_TYPE=Release
./build/hello_world
# Windows
pixi run cmake -S momentum/examples/hello_world -B momentum/examples/hello_world/build
./build/Release/hello_world.exe
```

To build the application, run:
### Running Example

```
# Linux and macOS
pixi run cmake --build momentum/examples/hello_world/build
To run other examples:

# Windows
pixi run cmake --build momentum/examples/hello_world/build --config Release
```
pixi run glb-viewer --help
```

#### Run the Application
For more examples, please refer to the [Examples](https://facebookincubator.github.io/momentum/docs/examples/viewers) page.

Execute the application with:
### Clean Up

If you need to start over for any reason:

```
./momentum/examples/hello_world/build/hello_world
pixi run clean
```

Momentum uses the `build/` directory for CMake builds, `.pixi/` for the Pixi virtual environment, and `.deps/` for building dependencies. You can clean up everything by either manually removing these directories or by running the command above.

## 📖 Documentation

The full documentation for Momentum can be found on our [website][docs].
Expand Down
94 changes: 36 additions & 58 deletions momentum/website/docs/02_user_guide/01_getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,97 +4,75 @@ sidebar_position: 1

# Getting Started

## Supported Environments

* **OS**: Windows, Linux, macOS
This page guides you through the process of building Momentum and running the examples.

## Prerequisite

Complete the following steps only once:

- Install Pixi by following the instructions on https://prefix.dev/

## Install Momentum
1. Install Pixi by following the instructions on https://prefix.dev/

1. Clone the repository and navigate to the root directory:

```
clone https://github.com/facebookincubator/momentum
cd momentum
```

2. Build and install Momentum in a virtual environment using Pixi:

```
pixi run cmake --build build --target install --parallel
```

## Creating Your First Application
```
git clone https://github.com/facebookincubator/momentum
cd momentum
```

### Writing Source Code
Ensure that all subsequent commands are executed in the project's root directory unless specified otherwise.

Now, let's define a simple Momentum application. Create a new file named `main.cpp` with the following content:
## Build Momentum

```cpp
#include <momentum/math/mesh.h>
After completing the prerequisites, you are ready to build and use Momentum.

using namespace momentum;
- Build the project with the following command (note that the first run may take a few minutes as it installs all dependencies):

int main() {
auto mesh = Mesh();
mesh.updateNormals();
return EXIT_SUCCESS;
}
```
```
pixi run build
```

### Writing CMake Script
- Run the tests with:

Create a `CMakeLists.txt` file in the same directory as `main.cpp`.
```
pixi run test
```

To add momentum to your CMake project, first find the momentum package using the
`find_package` function and then add the appropriate `momentum::<target>` as a
dependency to your library or executable. For example, if you want to use the
character functionality from momentum, you would add `momentum::character` as a
dependency:
To view all available command lines, run `pixi task list`.

```cmake
cmake_minimum_required(VERSION 3.16.3)
## Running Hello World

project(momentum)
To run the `hello_world` example:

find_package(momentum CONFIG REQUIRED)
add_executable(hello_world main.cpp)
target_link_libraries(hello_world PRIVATE momentum::math)
```
pixi run hello-world
```

Refer to the example project located at `momentum/examples/hello_world/` for the complete source code.

### Building using CMake

To configure the application, run:
Alternatively, you can directly run the executable:

```
# Linux and macOS
pixi run cmake -S momentum/examples/hello_world -B momentum/examples/hello_world/build -DCMAKE_BUILD_TYPE=Release
./build/hello_world
# Windows
pixi run cmake -S momentum/examples/hello_world -B momentum/examples/hello_world/build
build/Release/hello_world.exe
```

To build the application, run:
## Running Example

```
# Linux and macOS
pixi run cmake --build momentum/examples/hello_world/build
To run other examples:

# Windows
pixi run cmake --build momentum/examples/hello_world/build --config Release
```
pixi run glb-viewer --help
```

### Run the Application
For more examples, please refer to the [Examples](../examples/viewers) page.

Execute the application with:
## Clean Up

If you need to start over for any reason:

```
./momentum/examples/hello_world/build/hello_world
pixi run clean
```

Momentum uses the `build/` directory for CMake builds, `.pixi/` for the Pixi virtual environment, and `.deps/` for building dependencies. You can clean up everything by either manually removing these directories or by running the command above.
Loading

0 comments on commit 626b6c9

Please sign in to comment.