-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update tutorial build step #626
base: gz-math8
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -67,19 +67,47 @@ int main() | |||||||||||||||||
} | ||||||||||||||||||
``` | ||||||||||||||||||
|
||||||||||||||||||
To compile this code on UNIX with pkg-config, use the following command: | ||||||||||||||||||
To compile the code create a `CMakeLists.txt`: | ||||||||||||||||||
|
||||||||||||||||||
```{.bash} | ||||||||||||||||||
c++ $(pkg-config --cflags gz-math8) main.cpp -o main | ||||||||||||||||||
``` | ||||||||||||||||||
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) | ||||||||||||||||||
project(gz-math-cpp-example) | ||||||||||||||||||
|
||||||||||||||||||
find_package(gz-math8 QUIET REQUIRED) | ||||||||||||||||||
|
||||||||||||||||||
add_executable(gz-math-example main.cpp) | ||||||||||||||||||
target_link_libraries(gz-math-example ${GZ-MATH_LIBRARIES}) | ||||||||||||||||||
alesof marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
``` | ||||||||||||||||||
|
||||||||||||||||||
The program can then be run as: | ||||||||||||||||||
Compile the example: | ||||||||||||||||||
|
||||||||||||||||||
``` | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
mkdir build && cd build | ||||||||||||||||||
cmake .. | ||||||||||||||||||
``` | ||||||||||||||||||
|
||||||||||||||||||
For Unix systems: | ||||||||||||||||||
``` | ||||||||||||||||||
make | ||||||||||||||||||
``` | ||||||||||||||||||
Comment on lines
+89
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
For Windows systems: | ||||||||||||||||||
``` | ||||||||||||||||||
cmake --build . --config Release | ||||||||||||||||||
``` | ||||||||||||||||||
Comment on lines
+94
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
Run the example: | ||||||||||||||||||
|
||||||||||||||||||
```{.bash} | ||||||||||||||||||
$ ./main | ||||||||||||||||||
./gz-math-example | ||||||||||||||||||
``` | ||||||||||||||||||
|
||||||||||||||||||
Output should be: | ||||||||||||||||||
```{.bash} | ||||||||||||||||||
Distance from 1 3 5 to 2 4 6 is 1.73205 | ||||||||||||||||||
``` | ||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this new line |
||||||||||||||||||
## Bonus: Vector2 Example | ||||||||||||||||||
|
||||||||||||||||||
The following is an example program that uses Vector2 to perform some simple | ||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.