Skip to content

Commit

Permalink
Updates to compile cleanly on ROS 2 Rolling on Ubuntu 24.04 (#415)
Browse files Browse the repository at this point in the history
* Update minimum to CMake 3.5.

Newer CMake complains about anything older than that,
and CMake 3.5 was released in 2016.

Signed-off-by: Chris Lalancette <[email protected]>

* Cleanup stderr output from CMake.

Calling message("mystring") in CMake, by default,
outputs to stderr.  Since these are generally informational
messages, change this to message(STATUS "mystring"), which
prints to stdout instead.  This should quite down warnings
when building with colcon (and on the ROS 2 buildfarm).

Signed-off-by: Chris Lalancette <[email protected]>

* Add in a variable to control how OpenGL is found.

Newer versions of CMake have changed how finding OpenGL
works.  If you don't specify anything at all, they will
complain that you haven't told them how to find OpenGL.

Work around this by explicitly setting OpenGL_GL_PREFERENCE
to LEGACY, which tells CMake how you want to find OpenGL.
This quiets the warning.

Signed-off-by: Chris Lalancette <[email protected]>

* Switch away from 0 for Qt::WindowFlags.

Apparently modern Qt has deprecated using an integer
to initialize Qt::Flags objects.  Instead, use the
default constructor which should do the same thing.

Signed-off-by: Chris Lalancette <[email protected]>

---------

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Mar 17, 2024
1 parent af240da commit e5227fd
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions dynamicEDT3D/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT(dynamicEDT3D)

include(CTest)
Expand Down Expand Up @@ -170,7 +170,7 @@ ENDIF(DOXYGEN_FOUND)
INCLUDE(CPackSettings)

# Finished:
MESSAGE ("\n")
MESSAGE (STATUS "\n")
MESSAGE (STATUS "Compile dynamicEDT3D using: make")
MESSAGE (STATUS "Install dynamicEDT3D using: make install")
MESSAGE (STATUS " (be sure to set the correct CMAKE_INSTALL_PREFIX before)")
Expand Down
6 changes: 3 additions & 3 deletions dynamicEDT3D/CMakeModules/CompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)

MESSAGE ("\n")
MESSAGE (STATUS "\n")
MESSAGE (STATUS "${PROJECT_NAME} building as ${CMAKE_BUILD_TYPE}")

# OCTOMAP_OMP = enable OpenMP
# SET(OCTOMAP_OMP 1 CACHE BOOL "Enable/disable OpenMP")
# IF($ENV{OCTOMAP_OMP})
# SET(OCTOMAP_OMP $ENV{OCTOMAP_OMP})
# SET(OCTOMAP_OMP $ENV{OCTOMAP_OMP})
# MESSAGE(STATUS "Found OCTOMAP_OMP=${OCTOMAP_OMP}")
# ENDIF($ENV{OCTOMAP_OMP})

Expand All @@ -21,7 +21,7 @@ IF (CMAKE_COMPILER_IS_GNUCC)
SET (CMAKE_CXX_FLAGS_RELEASE "-O3 -funroll-loops -DNDEBUG")
SET (CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
# Shared object compilation under 64bit (vtable)
ADD_DEFINITIONS(-fPIC)
ADD_DEFINITIONS(-fPIC)
# IF(OCTOMAP_OMP)
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
# SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -fopenmp")
Expand Down
4 changes: 2 additions & 2 deletions octomap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT( octomap )

include(CTest)
Expand Down Expand Up @@ -173,7 +173,7 @@ ENDIF(DOXYGEN_FOUND)
INCLUDE(CPackSettings)

# Finished:
MESSAGE ("\n")
MESSAGE (STATUS "\n")
MESSAGE (STATUS "Compile octomap using: make")
MESSAGE (STATUS "Install octomap using: make install")
MESSAGE (STATUS " (be sure to set the correct CMAKE_INSTALL_PREFIX before)")
Expand Down
2 changes: 1 addition & 1 deletion octomap/CMakeModules/CompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)

MESSAGE ("\n")
MESSAGE (STATUS "\n")
MESSAGE (STATUS "${PROJECT_NAME} building as ${CMAKE_BUILD_TYPE}")

# COMPILER FLAGS
Expand Down
3 changes: 2 additions & 1 deletion octovis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT( octovis )

include(CTest)
Expand Down Expand Up @@ -68,6 +68,7 @@ SET( BUILD_VIEWER 0)
option(OCTOVIS_QT5 "Link Octovis against Qt5?" ON)

# Look for required libraries:
set(OpenGL_GL_PREFERENCE LEGACY)
FIND_PACKAGE(OpenGL)
if(NOT OCTOVIS_QT5)
FIND_PACKAGE(Qt4)
Expand Down
4 changes: 2 additions & 2 deletions octovis/CMakeModules/CompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)

MESSAGE ("\n")
MESSAGE (STATUS "\n")
MESSAGE (STATUS "${PROJECT_NAME} building as ${CMAKE_BUILD_TYPE}")

# OCTOMAP_OMP = enable OpenMP
# SET(OCTOMAP_OMP 1 CACHE BOOL "Enable/disable OpenMP")
# IF($ENV{OCTOMAP_OMP})
# SET(OCTOMAP_OMP $ENV{OCTOMAP_OMP})
# SET(OCTOMAP_OMP $ENV{OCTOMAP_OMP})
# MESSAGE(STATUS "Found OCTOMAP_OMP=${OCTOMAP_OMP}")
# ENDIF($ENV{OCTOMAP_OMP})

Expand Down
6 changes: 3 additions & 3 deletions octovis/src/extern/QGLViewer/qglviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class QGLVIEWER_EXPORT QGLViewer : public QGLWidget

#else

explicit QGLViewer(QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=0);
explicit QGLViewer(QGLContext *context, QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=0);
explicit QGLViewer(const QGLFormat& format, QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=0);
explicit QGLViewer(QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=Qt::WindowFlags());
explicit QGLViewer(QGLContext *context, QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=Qt::WindowFlags());
explicit QGLViewer(const QGLFormat& format, QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=Qt::WindowFlags());
#endif

virtual ~QGLViewer();
Expand Down

0 comments on commit e5227fd

Please sign in to comment.