Skip to content

Commit 3007a9c

Browse files
authored
Merge pull request #28 from JustusBraun/develop
Automatic builds for ubuntu-20, ubuntu-22, ubuntu-24 and ubuntu-latest and fixes for target based linking
2 parents 3b9b3ca + e447432 commit 3007a9c

File tree

4 files changed

+85
-2
lines changed

4 files changed

+85
-2
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# 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.
2+
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3+
name: CMake on multiple platforms
4+
5+
on:
6+
push:
7+
branches: [ "develop" ]
8+
pull_request:
9+
branches: [ "develop" ]
10+
workflow_dispatch:
11+
branches:
12+
- '*'
13+
14+
jobs:
15+
build:
16+
runs-on: ${{ matrix.os }}
17+
18+
strategy:
19+
# 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.
20+
fail-fast: false
21+
22+
# Set up a matrix to run the following 3 linux versions:
23+
matrix:
24+
os: [ubuntu-latest, ubuntu-24.04, ubuntu-22.04, ubuntu-20.04]
25+
build_type: [Release]
26+
c_compiler: [gcc]
27+
include:
28+
- os: ubuntu-latest
29+
c_compiler: gcc
30+
cpp_compiler: g++
31+
32+
- os: ubuntu-24.04
33+
c_compiler: gcc
34+
cpp_compiler: g++
35+
36+
- os: ubuntu-22.04
37+
c_compiler: gcc
38+
cpp_compiler: g++
39+
40+
- os: ubuntu-20.04
41+
c_compiler: gcc
42+
cpp_compiler: g++
43+
44+
steps:
45+
- uses: actions/checkout@v4
46+
with:
47+
submodules: recursive
48+
49+
- name: Install dependencies
50+
run: >
51+
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
52+
53+
- name: Set reusable strings
54+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
55+
id: strings
56+
shell: bash
57+
run: |
58+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
59+
60+
- name: Configure CMake
61+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
62+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
63+
run: >
64+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
65+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
66+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
67+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
68+
-S ${{ github.workspace }}
69+
70+
- name: Build
71+
# 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).
72+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ option(BUILD_TOOLS_EXPERIMENTAL "Build experimental tools" OFF)
99
option(WITH_DRACO "Build libraries with draco enabled" OFF)
1010

1111
## Compile as C++17
12-
add_compile_options(-std=c++17)
1312
set(CMAKE_CXX_STANDARD 17)
13+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1414

1515
# DEFAULT RELEASE
1616
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
@@ -583,6 +583,7 @@ endif()
583583
###############################################################################
584584

585585
set(LVR2_LIB_DEPENDENCIES
586+
${Boost_LIBRARIES}
586587
${Boost_PROGRAM_OPTIONS_LIBRARY}
587588
${Boost_SYSTEM_LIBRARY}
588589
${Boost_THREAD_LIBRARY}

LVR2Config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ if(@CGAL_FOUND@)
7171
list(APPEND LVR2_INCLUDE_DIRS ${CGAL_INCLUDE_DIRS})
7272
endif()
7373

74-
find_package(Boost REQUIRED)
74+
find_package(Boost COMPONENTS @Boost_COMPONENTS@ REQUIRED)
7575
list(APPEND LVR2_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
7676
list(APPEND LVR2_DEFINITIONS ${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
7777

src/liblvr2/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ target_link_libraries(
165165
lvr2_static
166166
${LVR2_INTERNAL_DEPENDENCIES_STATIC}
167167
${LVR2_LIB_DEPENDENCIES})
168+
target_compile_definitions(
169+
lvr2_static
170+
PUBLIC
171+
${LVR2_DEFINITIONS}
172+
)
168173

169174

170175
#####################################################################################
@@ -178,6 +183,11 @@ if( NOT MSVC )
178183
lvr2
179184
${LVR2_INTERNAL_DEPENDENCIES_SHARED}
180185
${LVR2_LIB_DEPENDENCIES})
186+
target_compile_definitions(
187+
lvr2
188+
PUBLIC
189+
${LVR2_DEFINITIONS}
190+
)
181191

182192
install(TARGETS lvr2_static lvr2
183193
EXPORT lvr2Targets

0 commit comments

Comments
 (0)