Skip to content

Commit

Permalink
Compile for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
talregev committed Sep 15, 2023
1 parent 87ac01b commit 05b2ff5
Show file tree
Hide file tree
Showing 28 changed files with 2,426 additions and 59 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/linux-config/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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', 'deps/vcpkg/manifest/vcpkg.json') }}

- 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 \
-DGZ_PROTOBUF_USE_CMAKE_CONFIG=ON \
-DCMAKE_INSTALL_PREFIX=$PWD/vcpkg/installed/x64-linux-release
59 changes: 0 additions & 59 deletions .github/workflows/linux.yml

This file was deleted.

83 changes: 83 additions & 0 deletions .github/workflows/linux_copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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:
config:
name: x64-config
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3

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

- name: Prepare logs on failure
if: failure()
shell: bash
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: 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: Config Gazebo
uses: ./.github/workflows/linux-config/

- name: Build Gazebo
shell: bash
run: |
export proc=$(nproc)
echo proc=$proc
cmake --build build --config Release -j $proc
- name: Install Gazebo
shell: bash
run: |
cmake --install build --config Release
- name: Tests suite compilation
shell: bash
run: |
echo compile and run tests here
- name: Prepare logs on failure
if: failure()
shell: bash
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: linux_logs_x64_${{github.event.pull_request.head.sha}}
path: logs.7z
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ test/plugins/rest-web/node_modules
build
build_*
build-*
vcpkg
Ogre.log
deps/vcpkg/cache
.DS_Store
Expand Down
8 changes: 8 additions & 0 deletions cmake/FindFreeimage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ include (${gazebo_cmake_dir}/GazeboUtils.cmake)
# Find packages
if (PKG_CONFIG_FOUND)
pkg_check_modules(freeimage freeimage>=${MIN_FREEIMAGE_VERSION})
if (NOT freeimage_FOUND)
unset(freeimage_FOUND CACHE)
find_package(freeimage CONFIG)
if (freeimage_FOUND)
set(freeimage_LIBRARIES freeimage::FreeImage)
message (STATUS "FreeImage found")
endif()
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
14 changes: 14 additions & 0 deletions cmake/SearchForStuff.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ if (PKG_CONFIG_FOUND)
if (USE_EXTERNAL_TINYXML)
message (STATUS "Using system tinyxml.")
pkg_check_modules(tinyxml tinyxml)
if (NOT tinyxml_FOUND)
unset(tinyxml_FOUND CACHE)
find_package(tinyxml CONFIG)
if (tinyxml_FOUND)
message (STATUS "tinyxml found via find_package")
endif()
endif()
if (NOT tinyxml_FOUND)
find_path (tinyxml_INCLUDE_DIRS tinyxml.h ${tinyxml_INCLUDE_DIRS} ENV CPATH)
find_library(tinyxml_LIBRARIES NAMES tinyxml)
Expand Down Expand Up @@ -592,6 +599,7 @@ if (PKG_CONFIG_FOUND)
pkg_check_modules(BULLET bullet2.82>=2.82)
endif()
if (NOT BULLET_FOUND)
unset(BULLET_FOUND CACHE)
find_package(BULLET CONFIG 2.82)
endif()
if (BULLET_FOUND)
Expand Down Expand Up @@ -690,12 +698,18 @@ endif ()
########################################
# Find gdal
include (FindGDAL)
if (NOT GDAL_FOUND)
message (STATUS "Looking for gdal in find_package")
unset(GDAL_FOUND CACHE)
find_package(GDAL CONFIG)
endif()
if (NOT GDAL_FOUND)
message (STATUS "Looking for libgdal - not found")
BUILD_WARNING ("GDAL not found, Digital elevation terrains support will be disabled.")
set (HAVE_GDAL OFF CACHE BOOL "HAVE GDAL" FORCE)
else ()
message (STATUS "Looking for libgdal - found")
message (STATUS "GDAL_LIBRARY: ${GDAL_LIBRARY}")
set (HAVE_GDAL ON CACHE BOOL "HAVE GDAL" FORCE)
endif ()

Expand Down
25 changes: 25 additions & 0 deletions deps/vcpkg/ports/ffmpeg/0001-create-lib-libraries.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/configure b/configure
index 34c2adb..1c8008a 100755
--- a/configure
+++ b/configure
@@ -5352,15 +5352,17 @@ case $target_os in
;;
win32|win64)
disable symver
- if enabled shared; then
+# if enabled shared; then
# Link to the import library instead of the normal static library
# for shared libs.
LD_LIB='%.lib'
# Cannot build both shared and static libs with MSVC or icl.
- disable static
- fi
+# disable static
+# fi
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
shlibdir_default="$bindir_default"
+ LIBPREF=""
+ LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
11 changes: 11 additions & 0 deletions deps/vcpkg/ports/ffmpeg/0002-fix-msvc-link.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -6162,6 +6162,7 @@ EOF
test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
case "$objformat" in
elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
+ win*) enabled debug && append X86ASMFLAGS "-g" ;;
esac

enabled avx512 && check_x86asm avx512_external "vmovdqa32 [eax]{k1}{z}, zmm0"
13 changes: 13 additions & 0 deletions deps/vcpkg/ports/ffmpeg/0003-fix-windowsinclude.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -51,6 +51,8 @@
#include "fopen_utf8.h"
#include "opt_common.h"
#ifdef _WIN32
+#define _WIN32_WINNT 0x0502
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "compat/w32dlfcn.h"
#endif

41 changes: 41 additions & 0 deletions deps/vcpkg/ports/ffmpeg/0004-fix-debug-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/configure b/configure
index bd2de34..fba948a 100755
--- a/configure
+++ b/configure
@@ -3993,6 +3993,9 @@ for opt do
--libfuzzer=*)
libfuzzer_path="$optval"
;;
+ --debug)
+ enable debug_configure
+ ;;
*)
optname="${opt%%=*}"
optname="${optname#--}"
@@ -6464,8 +6464,12 @@

enabled zlib && { check_pkg_config zlib zlib "zlib.h" zlibVersion ||
check_lib zlib zlib.h zlibVersion -lz; }
-enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
+if enabled debug_configure; then
+ enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2d
+else
+ enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
+fi
enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma

enabled zlib && test_exec $zlib_extralibs <<EOF && enable zlib_gzip
#include <zlib.h>
@@ -6350,7 +6350,11 @@ enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8
enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
-enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
+if enabled debug_configure; then
+ enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
+else
+ enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
+fi
enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
Loading

0 comments on commit 05b2ff5

Please sign in to comment.