Skip to content

Commit

Permalink
Merge branch 'RoboCup-SSL:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo authored May 28, 2024
2 parents c0a48bc + d14caf2 commit 588c6c2
Show file tree
Hide file tree
Showing 19 changed files with 399 additions and 160 deletions.
9 changes: 9 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": [
"config:base",
"schedule:yearly"
],
"labels": [
"dependencies"
]
}
72 changes: 39 additions & 33 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,62 @@ on:
push:
branches:
- master
- windows-github-actions
pull_request:
jobs:
build-linux:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ ubuntu-18.04, ubuntu-20.04 ]
os: [ ubuntu-20.04, ubuntu-22.04 ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: "Update dependencies"
run: sudo apt-get update
- name: "Install dependencies"
run: sudo apt-get install -y build-essential cmake pkg-config qt5-default libqt5opengl5-dev libgl1-mesa-dev libglu1-mesa-dev libprotobuf-dev protobuf-compiler libode-dev libboost-dev
run: sudo apt-get install -y build-essential cmake pkg-config qtbase5-dev libqt5opengl5-dev libgl1-mesa-dev libglu1-mesa-dev libprotobuf-dev protobuf-compiler libode-dev libboost-dev
- name: "Build"
run: mkdir build && cd build && cmake .. && make
run: make

build-macos:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ macos-10.15, macos-11 ]
os: [ macos-12, macos-13 ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: "Install dependencies"
run: brew tap robotology/formulae && brew install qt5 protobuf robotology/formulae/ode
run: brew tap robotology/formulae && brew install cmake pkg-config qt@5
- name: "Build"
run: mkdir build && cd build && cmake .. && make
env:
Qt5_DIR: /usr/local/opt/qt5/lib/cmake/Qt5
# for some reason qt5 is not correctly in the path and this will break whenever the location of it changes
# 5.15.11 is for macos-12 and 5.15.12 is for macos-13
run: PATH=/usr/local/Cellar/qt@5/5.15.11/lib/cmake/Qt5:/usr/local/Cellar/qt@5/5.15.12/lib/cmake/Qt5:$PATH && make

build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: make build directory
run: mkdir '${{ github.workspace }}/build/'

- name: Install dependencies # saves / restores cache to avoid rebuilding dependencies
uses: lukka/run-vcpkg@v6
with:
setupOnly: false
vcpkgGitCommitId: 94ce0dab56f4d8ba6bd631ba59ed682b02d45c46
vcpkgDirectory: c:/vcpkg # folder must reside in c:\ otherwise qt wont install due to long path errors
vcpkgTriplet: x64-windows
vcpkgArguments: qt5 ode protobuf

- name: Run CMake and build
working-directory: ${{ github.workspace }}/build/
run: |
cmake -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake ..
cmake --build . --config Release
# Windows build does not work currently, see https://github.com/RoboCup-SSL/grSim/issues/183
# build-windows:
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v4
#
# - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies
# uses: lukka/run-vcpkg@v11
# with:
# vcpkgGitCommitId: 8eb57355a4ffb410a2e94c07b4dca2dffbee8e50
# vcpkgDirectory: c:/vcpkg # folder must reside in c:\ otherwise qt wont install due to long path errors
#
# - name: Run CMake and run vcpkg to build packages
# uses: lukka/run-cmake@v10
# with:
# # this preset is needed to actually install the vcpkg dependencies
# configurePreset: "ninja-multi-vcpkg"
# configPresetAdditionalArgs: "[-DVCPKG_TARGET_TRIPLET=x64-windows]"
# buildPreset: "ninja-multi-vcpkg"
# buildPresetAdditionalArgs: "['--config Release']"
# env:
# # [OPTIONAL] Define the vcpkg's triplet you want to enforce, otherwise the default one
# # for the hosting system will be automatically choosen (x64 is the default on all
# # platforms, e.g. `x64-osx`).
# VCPKG_DEFAULT_TRIPLET: "x64-windows"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ bin*/*
*.swp
Thumbs.db
.idea/*
*.iml
cmake-build-debug
cmake-build-release
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

67 changes: 54 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ include(${PROJECT_SOURCE_DIR}/cmake/Utils.cmake)
standard_config()
standard_paths(${PROJECT_SOURCE_DIR} bin lib)

# policy regarding how to handle generated stuff, OLD behavior would ignore generated files
# (which includes the generated protobuf cpp files)
if (POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()

# policy regarding when to rebuild stuff when external projects downloaded with URL changes
if (POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()

include(GNUInstallDirs)

set(app ${CMAKE_PROJECT_NAME})
# create the target before the sources list is known so that we can call
# add_dependencies(<target> external_proj)
Expand Down Expand Up @@ -69,20 +82,32 @@ find_package(Qt5 COMPONENTS Core Widgets OpenGL Network REQUIRED)
list(APPEND libs Qt5::Core Qt5::Widgets Qt5::OpenGL Qt5::Network)

# ODE
if(WIN32)
find_package(ODE CONFIG REQUIRED)
list(APPEND libs ODE::ODE)
if(BUILD_ODE)
include(BuildODE)
add_dependencies(${app} ode_external)
else()
find_package(ODE REQUIRED)
list(APPEND libs ode::ode)
if(WIN32)
find_package(ODE CONFIG)
set(ODE_LIB_NAME ODE::ODE)
else()
find_package(ODE)
set(ODE_LIB_NAME ode::ode)
endif()

if(ODE_FOUND)
list(APPEND libs ${ODE_LIB_NAME})
else()
# if ODE could not be found just build it
include(BuildODE)
add_dependencies(${app} ode_external)
endif()
endif()

# VarTypes
find_package(VarTypes)

if(NOT VARTYPES_FOUND)
include(ExternalProject)
set(VARTYPES_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/vartypes_install")

set(VARTYPES_CMAKE_ARGS "-DVARTYPES_BUILD_STATIC=ON;-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>")
if(NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
Expand All @@ -92,23 +117,39 @@ if(NOT VARTYPES_FOUND)
ExternalProject_Add(vartypes_external
GIT_REPOSITORY https://github.com/jpfeltracco/vartypes
GIT_TAG origin/jpfeltracco/build_static
INSTALL_DIR "${VARTYPES_INSTALL_DIR}"
CMAKE_ARGS "${VARTYPES_CMAKE_ARGS}"
STEP_TARGETS install
)
set(VARTYPES_LIB_SUBPATH "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}vartypes${CMAKE_STATIC_LIBRARY_SUFFIX}")

# the byproducts are available after the install step
ExternalProject_Add_Step(vartypes_external out
DEPENDEES install
BYPRODUCTS
"<INSTALL_DIR>/${VARTYPES_LIB_SUBPATH}"
)

add_dependencies(${app} vartypes_external)

ExternalProject_Get_Property(vartypes_external install_dir)
add_dependencies(${app} vartypes_external)

set(VARTYPES_INCLUDE_DIRS "${VARTYPES_INSTALL_DIR}/include")
set(VARTYPE_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}vartypes${CMAKE_STATIC_LIBRARY_SUFFIX})
set(VARTYPES_LIBRARIES "${VARTYPES_INSTALL_DIR}/lib/${VARTYPE_LIB_NAME}")
set(VARTYPES_INCLUDE_DIRS "${install_dir}/include")
set(VARTYPES_LIBRARIES "${install_dir}/${VARTYPES_LIB_SUBPATH}")
endif()

target_include_directories(${app} PRIVATE ${VARTYPES_INCLUDE_DIRS})
list(APPEND libs ${VARTYPES_LIBRARIES})

# Protobuf
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})
list(APPEND libs ${PROTOBUF_LIBRARIES})
include(FindOrBuildProtobuf)

if(TARGET protobuf_external)
add_dependencies(${app} protobuf_external)
endif()

include_directories(${Protobuf_INCLUDE_DIRS})
list(APPEND libs ${Protobuf_LIBRARIES})

set (Protobuf_IMPORT_DIRS ${Protobuf_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_CPP PROTO_H
Expand Down
45 changes: 45 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"version": 6,
"configurePresets": [
{
"name": "windows-default",
"displayName": "Windows x64 Release",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
}
},
{
"name": "ninja-multi-vcpkg",
"displayName": "Windows x64 Release vcpkg",
"generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"type": "FILEPATH",
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
},
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
}
}
],
"buildPresets": [
{
"name": "ninja-multi-vcpkg",
"configurePreset": "ninja-multi-vcpkg",
"displayName": "Build ninja-multi-vcpkg",
"description": "Build ninja-multi-vcpkg Configurations"
}
]
}
14 changes: 9 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ $ sudo pacman -S base-devel boost hicolor-icon-theme \
mesa ode protobuf qt5-base cmake git
```

#### Debian
#### Ubuntu / Debian

For Debian, or derivative
```
$ sudo apt install git build-essential cmake pkg-config qt5-default \
sudo apt install git build-essential cmake pkg-config qtbase5-dev \
libqt5opengl5-dev libgl1-mesa-dev libglu1-mesa-dev \
libprotobuf-dev protobuf-compiler libode-dev libboost-dev
```
Expand All @@ -79,8 +79,8 @@ brew install cmake
brew install pkg-config
brew tap robotology/formulae
brew install robotology/formulae/ode
brew install qt
brew install protobuf
brew install qt@5
brew install protobuf@21
```

If you run into build issues, you may need to run this first:
Expand Down Expand Up @@ -159,7 +159,11 @@ $ sudo make install
grSim will be — by default — installed on the `/usr/local` directory.


if you face any problem regarding of updating the grsim version, you can try removing the `grsim.xml`.
## Troubleshooting

If you face any problem regarding of updating the grsim version, you can try removing the `grsim.xml`.
If grSim crashes almost instantly with some ODE error the issue might by your ODE version.
Try adding -DBUILD_ODE=TRUE to build ODE from source instead of using the system dependency.

## Notes on the performance

Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ BUILDDIR=build
BUILDTYPE=Release
#BUILDTYPE=Debug

BUILD_ODE=OFF

.PHONY: all build mkbuilddir cmake dist package deb install clean clean-all

all: build
Expand All @@ -22,7 +24,7 @@ mkbuilddir:
[ -d $(BUILDDIR) ] || mkdir $(BUILDDIR)

cmake: CMakeLists.txt
cd $(BUILDDIR) && cmake -DCMAKE_BUILD_TYPE=$(BUILDTYPE) ..
cd $(BUILDDIR) && cmake -DCMAKE_BUILD_TYPE=$(BUILDTYPE) -DBUILD_ODE=$(BUILD_ODE) ..

dist: package

Expand Down
Loading

0 comments on commit 588c6c2

Please sign in to comment.