Skip to content

Commit

Permalink
Compile for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
talregev committed Apr 29, 2023
1 parent 3ada487 commit 8802e46
Show file tree
Hide file tree
Showing 35 changed files with 2,789 additions and 60 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/conda-forge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
# Execute a "nightly" build at 2 AM UTC
- cron: '0 2 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: '[${{ matrix.os }}@${{ matrix.build_type }}@conda]'
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/linux-config/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: linux-config
description: configure linux

runs:
using: "composite"
steps:
- name: Cache dependencies
uses: actions/cache@v3
with:
path: deps/vcpkg/cache/linux
key: linux-x64-${{ hashFiles('.github/workflows/linux-config/action.yml') }}

- name: Install dependencies
shell: bash
run: |
# vcpkg
# qt5-base
# ffmpeg
# ogre
# libusb
sudo apt install -y \
ninja-build \
\
'^libxcb.*-dev' \
libx11-xcb-dev \
libglu1-mesa-dev \
libxrender-dev \
libxi-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
\
nasm \
\
libxaw7-dev \
libxrandr-dev \
\
libudev-dev \
autoconf
- name: Clone vcpkg
shell: bash
run: |
git clone https://github.com/microsoft/vcpkg/
- name: Configure Gazebo
shell: bash
run: |
export VCPKG_BINARY_SOURCES="clear;files,$PWD/deps/vcpkg/cache/linux,readwrite;"
cmake . -G Ninja -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_MANIFEST_DIR=deps/vcpkg/manifest \
-DVCPKG_OVERLAY_TRIPLETS=deps/vcpkg/triplets \
-DVCPKG_OVERLAY_PORTS=deps/vcpkg/ports \
-DVCPKG_INSTALLED_DIR=$PWD/vcpkg/installed \
-DVCPKG_TARGET_TRIPLET=x64-linux-release \
-DVCPKG_HOST_TRIPLET=x64-linux-release \
-DVCPKG_INSTALL_OPTIONS=--clean-after-build \
-DUSE_EXTERNAL_TINYXML=ON \
-DUSE_EXTERNAL_TINYXML2=ON \
-DUSE_EXTERNAL_TINY_PROCESS_LIBRARY=ON \
-DCMAKE_INSTALL_PREFIX=$PWD/vcpkg/installed/x64-linux-release
110 changes: 77 additions & 33 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,97 @@
name: Linux
name: 🐧 Linux
on:
push:
branches: [ gazebo11 ]
pull_request:
branches: [ gazebo11 ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: linux-build
config:
name: x64-config
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: actions/checkout@v3

- name: Install Required Dependencies
run: |
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget https://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update
wget https://raw.githubusercontent.com/ignition-tooling/release-tools/master/jenkins-scripts/lib/dependencies_archive.sh -O /tmp/dependencies.sh
GAZEBO_MAJOR_VERSION=11 ROS_DISTRO=dummy . /tmp/dependencies.sh
echo $BASE_DEPENDENCIES $GAZEBO_BASE_DEPENDENCIES | tr -d '\\' | xargs sudo apt-get -y install
- name: Optional Physics Engines
- name: Config Gazebo
uses: ./.github/workflows/linux-config/

- name: Prepare logs on failure
if: failure()
shell: bash
run: |
sudo apt-add-repository ppa:dartsim
sudo apt-get update
sudo apt-get install libdart6-dev
sudo apt-get install libdart6-utils-urdf-dev
7z a -t7z -r -mx=9 logs.7z \
vcpkg/buildtrees/*.log
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux_logs_x64_${{github.event.pull_request.head.sha}}
path: logs.7z

build:
name: x64-build
needs: config
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3

- name: Optional Dependencies
- name: Config Gazebo
uses: ./.github/workflows/linux-config/

- name: Build Gazebo
shell: bash
run: |
sudo apt-get install xsltproc
export proc=$(nproc)
echo proc=$proc
cmake --build build --config Release -j $proc
- name: Man Page Support
- name: Install Gazebo
shell: bash
run: |
sudo apt-get install ruby-ronn
cmake --install build --config Release
- name: Build Gazebo
- name: Tests suite compilation
shell: bash
run: |
mkdir build
cd build
cmake ../
make -j $(nproc --all)
- name: Optional tests suite compilation
echo compile and run tests here
- name: Prepare logs on failure
if: failure()
shell: bash
run: |
cd build
make tests
7z a -t7z -r -mx=9 logs.7z \
vcpkg/buildtrees/*.log \
build/.ninja_log \
build/build.ninja \
build/install_manifest.txt \
build/vcpkg-manifest-install.log
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux_logs_x64_${{github.event.pull_request.head.sha}}
path: logs.7z

- name: Prepare artifacts for deploy
if: success()
shell: bash
run: |
move vcpkg/installed/x64-linux-release vcpkg/installed/gazebo
7z a -t7z -r gazebo.7z ./vcpkg/installed/gazebo/
- name: Upload gazebo
if: success()
uses: actions/upload-artifact@v3
with:
name: gazebo_linux_x64_${{github.event.pull_request.head.sha}}
path: gazebo.7z
50 changes: 50 additions & 0 deletions .github/workflows/windows-config/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: windows-config
description: configure windows
inputs:
arch:
required: true
type: choice
options:
- x86
- x64

runs:
using: "composite"
steps:
- name: Cache dependencies
uses: actions/cache@v3
with:
path: deps\vcpkg\cache\windows
key: windows-${{ inputs.arch }}-${{ hashFiles('.github\workflows\windows-config\action.yml') }}

- name: Setup msbuild
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ inputs.arch }}

- name: Fix vcpkg
shell: cmd
run: vcpkg.exe integrate remove

- name: Clone vcpkg
shell: cmd
run: |
git clone https://github.com/microsoft/vcpkg/
- name: Configure Gazebo
shell: cmd
run: |
set VCPKG_BINARY_SOURCES=clear;files,%CD%\deps\vcpkg\cache\windows,readwrite;
cmake . -G Ninja -B build ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_TOOLCHAIN_FILE=vcpkg\scripts\buildsystems\vcpkg.cmake ^
-DVCPKG_MANIFEST_DIR=deps\vcpkg\manifest ^
-DVCPKG_OVERLAY_TRIPLETS=deps\vcpkg\triplets ^
-DVCPKG_INSTALLED_DIR=%CD%\vcpkg\installed ^
-DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-windows-release ^
-DVCPKG_HOST_TRIPLET=${{ inputs.arch }}-windows-release ^
-DVCPKG_INSTALL_OPTIONS=--clean-after-build ^
-DUSE_EXTERNAL_TINYXML=ON ^
-DUSE_EXTERNAL_TINYXML2=ON ^
-DUSE_EXTERNAL_TINY_PROCESS_LIBRARY=ON ^
-DCMAKE_INSTALL_PREFIX=%CD%\vcpkg\installed\${{ inputs.arch }}-windows-release
109 changes: 109 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: 🪟 Windows
on:
push:
branches: [ gazebo11 ]
pull_request:
branches: [ gazebo11 ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
config:
name: ${{ matrix.arch }}-config
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- arch: x64
- arch: x86
steps:
- uses: actions/checkout@v3

- name: Config Gazebo
uses: ./.github/workflows/windows-config/
with:
arch: ${{ matrix.arch }}

- name: Prepare logs on failure
if: failure()
shell: cmd
run: |
7z a -t7z -r -mx=9 logs.7z ^
vcpkg/buildtrees/*.log
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: windows_logs_${{matrix.arch}}_${{github.event.pull_request.head.sha}}
path: logs.7z

build:
name: ${{ matrix.arch }}-build
needs: config
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- arch: x64
- arch: x86
steps:
- uses: actions/checkout@v3

- name: Config Gazebo
uses: ./.github/workflows/windows-config/
with:
arch: ${{ matrix.arch }}

- name: Build Gazebo
shell: cmd
run: |
set /a proc=%NUMBER_OF_PROCESSORS%
echo proc=%proc%
cmake --build build --config Release -j %proc%
- name: Install Gazebo
shell: cmd
run: |
cmake --install build --config Release
- name: Tests suite compilation
shell: cmd
run: |
echo compile and run tests here
- name: Prepare logs on failure
if: failure()
shell: cmd
run: |
7z a -t7z -r -mx=9 logs.7z ^
vcpkg/buildtrees/*.log ^
build/.ninja_log ^
build/build.ninja ^
build/install_manifest.txt ^
build/vcpkg-manifest-install.log
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: windows_logs_${{matrix.arch}}_${{github.event.pull_request.head.sha}}
path: logs.7z

- name: Prepare artifacts for deploy
if: success()
shell: cmd
run: |
move vcpkg\installed\${{ matrix.arch }}-windows-release vcpkg\installed\gazebo
7z a -t7z -r gazebo.7z ./vcpkg/installed/gazebo/
- name: Upload gazebo
if: success()
uses: actions/upload-artifact@v3
with:
name: gazebo_windows_${{matrix.arch}}_${{github.event.pull_request.head.sha}}
path: gazebo.7z
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build
build_*
build-*
Ogre.log
deps/vcpkg/cache
.DS_Store
*.swp
*.orig
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ set(GAZEBO_MODEL_DATABASE_URI http://models.gazebosim.org)
set(OGRE_RESOURCE_PATH ${OGRE_PLUGINDIR})
# Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems when
# we pass it to the compiler later.
string(REPLACE "\n" "" OGRE_RESOURCE_PATH ${OGRE_RESOURCE_PATH})
string(REPLACE "\n" "" OGRE_RESOURCE_PATH "${OGRE_RESOURCE_PATH}")
FILE(TO_CMAKE_PATH "${OGRE_RESOURCE_PATH}" OGRE_RESOURCE_PATH)


Expand Down
9 changes: 8 additions & 1 deletion cmake/FindFreeimage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ include (${gazebo_cmake_dir}/GazeboUtils.cmake)
########################################
# Find packages
if (PKG_CONFIG_FOUND)
pkg_check_modules(freeimage freeimage>=${MIN_FREEIMAGE_VERSION})
find_package(freeimage CONFIG)
if (freeimage_FOUND)
set(freeimage_LIBRARIES freeimage::FreeImage)
message (STATUS "FreeImage found")
endif()
if (NOT freeimage_FOUND)
pkg_check_modules(freeimage freeimage>=${MIN_FREEIMAGE_VERSION})
endif()
if (NOT freeimage_FOUND)
message (STATUS " freeimage.pc not found, trying freeimage_include_dir and freeimage_library_dir flags.")
endif (NOT freeimage_FOUND)
Expand Down
Loading

0 comments on commit 8802e46

Please sign in to comment.