-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use CMake's FetchContent module to (optionally) download and build FMILibrary #23
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a11efdf
[cmake] Downlaod FMILibrary using FetchContent if not found
prashanthr05 166be2a
Merge branch 'master' of https://github.com/robotology-playground/gaz…
prashanthr05 6393d1c
[cmake] Adding USES_SYSTEM_FMILIBRARY option to switch between find_p…
prashanthr05 9a6adaf
Merge branch 'master' into cmake/fetchContent
prashanthr05 714bf45
[cmake] fix USE_SYSTEM_FMILIBRARY option
prashanthr05 d7dbcb6
Merge branch 'cmake/fetchContent' of https://github.com/robotology-pl…
prashanthr05 b1df7b5
[cmake] formatting
prashanthr05 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
|
||
|
||
# About versioning | ||
The project is undergoing _heavy_ development: APIs may still be subject to changes, and some functionalities may be broken. | ||
The project is undergoing _heavy_ development: APIs may still be subject to changes, and some functionalities may be broken. | ||
|
||
|
||
# Background | ||
|
@@ -28,10 +28,12 @@ gazebo-fmi depends on | |
- [Gazebo](http://gazebosim.org/) - `version >= 7` | ||
- [FMILibrary](https://jmodelica.org/) (see https://github.com/svn2github/FMILibrary for an updated GitHub mirror) - `version >= 2.0.3` | ||
|
||
We recommend to install Gazebo as described in [official documentation](http://gazebosim.org/tutorials?cat=install), | ||
while for FMILibrary the easiest option is to compile it as any CMake project and then add its installation prefix to [`CMAKE_PREFIX_PATH`](https://cmake.org/cmake/help/v3.10/variable/CMAKE_PREFIX_PATH.html). | ||
We recommend to install Gazebo as described in [official documentation](http://gazebosim.org/tutorials?cat=install). | ||
For FMILibrary, one option is to compile it as any CMake project and then add its installation prefix to [`CMAKE_PREFIX_PATH`](https://cmake.org/cmake/help/v3.10/variable/CMAKE_PREFIX_PATH.html). | ||
See [CGold guide](https://cgold.readthedocs.io/en/latest/first-step.html) if you need some details on how to build a CMake project. | ||
|
||
An easier option is provided by the gazebo-fmi repository which downloads and compiles the FMILibrary internally within its build folder using CMake's FetchContent option. This is performed when FMILibrary package is not already existing in the system or if the FMILibrary related environment variable (`FMILibrary_ROOT`) is not set, making gazebo-fmi unable to find FMILibrary package. To use this option, the CMake option `USES_SYSTEM_FMILIBRARY` should be set to `OFF`. | ||
|
||
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.
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. Update the docs considering the name variable change. |
||
# Build the plugins | ||
Use the following commands to build and install the plugin. | ||
|
||
|
@@ -66,7 +68,8 @@ See plugin-specific documentation on how to use each plugin: | |
# Test the plugins | ||
For running the automatic tests of the plugins contained in this repo, you need the additional dependency of the [OpenModelica](https://openmodelica.org/) compiler. The OpenModelica compiler is used to generate test FMUs from [Modelica](https://www.modelica.org/) models. We recommend to use OpenModelica at least version 1.13 (the `nightly` version as of August 2018) as OpenModelica 1.12 has several bugs related to FMU generation (see https://github.com/robotology/gazebo-fmi/issues/5 and https://trac.openmodelica.org/OpenModelica/ticket/4135 ). | ||
|
||
Once you installed OpenModelica on your system, you can regenerated the project with the `BUILD_TESTING` CMake option set to `ON` to compile the tests. Once test are compiled, you can run them using [ctest](https://cmake.org/cmake/help/latest/manual/ctest.1.html), for example run: | ||
|
||
Once you installed OpenModelica on your system, you can regenerated the project with the `BUILD_TESTING` CMake option set to `ON` to compile the tests. Once test are compiled, you can run them using [ctest](https://cmake.org/cmake/help/latest/manual/ctest.1.html), for example run: | ||
```cmake | ||
$ ctest [-VV] | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright (C) 2018 Fondazione Istituto Italiano di Tecnologia | ||
# | ||
# Licensed under either the GNU Lesser General Public License v3.0 : | ||
# https://www.gnu.org/licenses/lgpl-3.0.html | ||
# or the GNU Lesser General Public License v2.1 : | ||
# https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html | ||
# at your option. | ||
|
||
# Fetch FMI library for downloading and installing | ||
include(FetchContent) | ||
FetchContent_Declare(FMILibrary | ||
GIT_REPOSITORY https://github.com/svn2github/FMILibrary.git) | ||
|
||
FetchContent_GetProperties(FMILibrary) | ||
if(NOT FMILibrary_POPULATED) | ||
FetchContent_Populate(FMILibrary) | ||
set(BUILD_SHARED_LIBS OFF) | ||
option (FMILIB_BUILD_TESTS "Build tests" OFF) | ||
add_subdirectory(${fmilibrary_SOURCE_DIR} ${fmilibrary_BINARY_DIR}) | ||
set(BUILD_SHARED_LIBS ON) | ||
endif() | ||
|
||
add_library(FMILibrary_FMILibrary INTERFACE) | ||
target_include_directories(FMILibrary_FMILibrary INTERFACE ${fmilibrary_SOURCE_DIR}/src/CAPI/include | ||
${fmilibrary_SOURCE_DIR}/src/Import/include | ||
${fmilibrary_SOURCE_DIR}/src/Util/include | ||
${fmilibrary_SOURCE_DIR}/src/XML/include | ||
${fmilibrary_SOURCE_DIR}/src/ZIP/include | ||
${fmilibrary_SOURCE_DIR}/ThirdParty/FMI/default | ||
${fmilibrary_SOURCE_DIR}/Config.cmake | ||
${fmilibrary_BINARY_DIR}) | ||
target_link_libraries(FMILibrary_FMILibrary INTERFACE fmilib) | ||
add_library(FMILibrary::FMILibrary ALIAS FMILibrary_FMILibrary) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
3 spaces, instead of 4