Skip to content

Commit

Permalink
Merge pull request #28 from JustusBraun/develop
Browse files Browse the repository at this point in the history
Automatic builds for ubuntu-20, ubuntu-22, ubuntu-24 and ubuntu-latest and fixes for target based linking
  • Loading branch information
amock authored Nov 8, 2024
2 parents 3b9b3ca + e447432 commit 3007a9c
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 2 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/cmake-multi-platform-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
workflow_dispatch:
branches:
- '*'

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following 3 linux versions:
matrix:
os: [ubuntu-latest, ubuntu-24.04, ubuntu-22.04, ubuntu-20.04]
build_type: [Release]
c_compiler: [gcc]
include:
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++

- os: ubuntu-24.04
c_compiler: gcc
cpp_compiler: g++

- os: ubuntu-22.04
c_compiler: gcc
cpp_compiler: g++

- os: ubuntu-20.04
c_compiler: gcc
cpp_compiler: g++

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies
run: >
sudo apt update && sudo apt install -y libboost-all-dev build-essential cmake cmake-curses-gui libflann-dev libgsl-dev libeigen3-dev libopenmpi-dev openmpi-bin opencl-c-headers ocl-icd-opencl-dev freeglut3-dev libhdf5-dev liblz4-dev libopencv-dev libyaml-cpp-dev libcgal-dev libgdal-dev
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ option(BUILD_TOOLS_EXPERIMENTAL "Build experimental tools" OFF)
option(WITH_DRACO "Build libraries with draco enabled" OFF)

## Compile as C++17
add_compile_options(-std=c++17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# DEFAULT RELEASE
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
Expand Down Expand Up @@ -583,6 +583,7 @@ endif()
###############################################################################

set(LVR2_LIB_DEPENDENCIES
${Boost_LIBRARIES}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
Expand Down
2 changes: 1 addition & 1 deletion LVR2Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if(@CGAL_FOUND@)
list(APPEND LVR2_INCLUDE_DIRS ${CGAL_INCLUDE_DIRS})
endif()

find_package(Boost REQUIRED)
find_package(Boost COMPONENTS @Boost_COMPONENTS@ REQUIRED)
list(APPEND LVR2_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
list(APPEND LVR2_DEFINITIONS ${Boost_LIB_DIAGNOSTIC_DEFINITIONS})

Expand Down
10 changes: 10 additions & 0 deletions src/liblvr2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ target_link_libraries(
lvr2_static
${LVR2_INTERNAL_DEPENDENCIES_STATIC}
${LVR2_LIB_DEPENDENCIES})
target_compile_definitions(
lvr2_static
PUBLIC
${LVR2_DEFINITIONS}
)


#####################################################################################
Expand All @@ -178,6 +183,11 @@ if( NOT MSVC )
lvr2
${LVR2_INTERNAL_DEPENDENCIES_SHARED}
${LVR2_LIB_DEPENDENCIES})
target_compile_definitions(
lvr2
PUBLIC
${LVR2_DEFINITIONS}
)

install(TARGETS lvr2_static lvr2
EXPORT lvr2Targets
Expand Down

0 comments on commit 3007a9c

Please sign in to comment.