Skip to content

Commit

Permalink
Modernise CMake ECFLOW-1972/1974
Browse files Browse the repository at this point in the history
- Prevent dev warning related to CMake Policy CMP0167
- Move finding Boost and Python into Dependencies.cmake
- Display relevant variables for all packages
- Deprecate support for Python2
- Modernise Qt package setup
- Remove unused QT-related CMake variables
  • Loading branch information
marcosbento authored Sep 16, 2024
2 parents 2c7d1bf + 18b9489 commit d7abfaf
Show file tree
Hide file tree
Showing 16 changed files with 446 additions and 694 deletions.
370 changes: 86 additions & 284 deletions CMakeLists.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Viewer/ecflowUI/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -786,11 +786,11 @@ if(ECFLOW_LOGVIEW)
LogLoadWidget.ui)
endif()

if(ECFLOW_QT6)
if(Qt6_FOUND)
qt6_wrap_cpp(VIEWER_MOC ${viewer_moc_files} TARGET ecflow_ui.x)
qt6_add_resources(VIEWER_RES viewer.qrc)
qt6_wrap_ui(VIEWER_FORMS_HEADERS ${viewer_wrap_ui_files})
elseif(ECFLOW_QT5)
elseif(Qt5_FOUND)
qt5_wrap_cpp(VIEWER_MOC ${viewer_moc_files} TARGET ecflow_ui.x)
qt5_add_resources(VIEWER_RES viewer.qrc)
qt5_wrap_ui(VIEWER_FORMS_HEADERS ${viewer_wrap_ui_files})
Expand Down
4 changes: 0 additions & 4 deletions Viewer/ecflowUI/src/ChangeNotify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
#include "VNodeList.hpp"
#include "VProperty.hpp"

// #ifdef ECFLOW_QT5
// #include <QSoundEffect>
// #endif

#include <map>

#include <QDebug>
Expand Down
11 changes: 0 additions & 11 deletions Viewer/ecflowUI/src/Sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
#include "VProperty.hpp"
#include "ecflow/core/Converter.hpp"

// #ifdef ECFLOW_QT5
// #include <QSoundEffect>
// #endif

#include <regex>

#include "ecflow/core/Str.hpp"
Expand All @@ -37,13 +33,6 @@ Sound* Sound::instance_ = nullptr;
if (system(soundCmd))
UiLog().dbg() << "ChangeNotify:add() could not play sound alert";
*/
// #ifdef ECFLOW_QT5
// QSoundEffect effect(dialog_);
// effect.setSource(QUrl::fromLocalFile("file:/usr/share/xemacs/xemacs-packages/etc/sounds/boing.wav"));
// effect.setLoopCount(1);
// effect.setVolume(0.25f);
// effect.play();
// #endif

Sound::Sound() {
sysDir_ = DirectoryHandler::concatenate(DirectoryHandler::etcDir(), "sounds");
Expand Down
4 changes: 2 additions & 2 deletions Viewer/libViewer/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ if(ECFLOW_LOGVIEW)
list(APPEND moc_files LogLoadData.hpp)
endif()

if(ECFLOW_QT6)
if(Qt6_FOUND)
qt6_wrap_cpp(LIBVIEWER_MOC ${moc_files} TARGET viewer)
qt6_wrap_ui(LIBVIEWER_FORMS_HEADERS ${wrap_ui_files})
elseif(ECFLOW_QT5)
elseif(Qt5_FOUND)
qt5_wrap_cpp(LIBVIEWER_MOC ${moc_files} TARGET viewer)
qt5_wrap_ui(LIBVIEWER_FORMS_HEADERS ${wrap_ui_files})
endif()
Expand Down
18 changes: 17 additions & 1 deletion cmake/CompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ ecbuild_info( "CMAKE_CXX_COMPILER_ID : ${CMAKE_CXX_COMPILER_ID}")
ecbuild_info( "CMAKE_CXX_COMPILER_VERSION : ${CMAKE_CXX_COMPILER_VERSION}")


ecbuild_info( "Selected built type: ${CMAKE_BUILD_TYPE}" )

if( CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]" )
# Tell C/C++ that we're doing a debug build
add_definitions( -DDEBUG )
endif()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
#
# In case of using Clang, we increase the template depth to avoid the following error:
# /usr/local/include/boost/type_traits/is_base_and_derived.hpp:226:42:
# fatal error: recursive template instantiation exceeded maximum depth of 256
#
ecbuild_add_cxx_flags("-ftemplate-depth=1024")
endif()

if (HAVE_WARNINGS)

ecbuild_add_c_flags(-Wall)
Expand Down Expand Up @@ -86,7 +102,7 @@ endif ()

if (HAVE_COLOURED_OUTPUT)
if ("${CMAKE_GENERATOR}" STREQUAL "Ninja" AND ENABLE_COLOURED_OUTPUT)
message(STATUS "Ninja generator detected! Ensuring GNU/Clang produce coloured output...")
ecbuild_info("Ninja generator detected! Ensuring GNU/Clang produce coloured output...")
add_compile_options(
$<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always>
$<$<CXX_COMPILER_ID:Clang>:-fdiagnostics-color>
Expand Down
Loading

0 comments on commit d7abfaf

Please sign in to comment.