From 07f3170034d371af463200502226c607f4739778 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Wed, 14 Aug 2019 11:32:30 +0200 Subject: [PATCH] [cmake] format Applications/ --- Applications/ApplicationsLib/CMakeLists.txt | 16 ++-- Applications/CLI/CMakeLists.txt | 81 ++++++++++--------- Applications/DataExplorer/Base/CMakeLists.txt | 11 +-- Applications/DataExplorer/CMakeLists.txt | 8 +- Applications/DataExplorer/DataExplorer.cmake | 4 +- .../DataExplorer/DataView/CMakeLists.txt | 63 ++++++++------- .../DataView/DiagramView/CMakeLists.txt | 34 ++++---- .../DataView/StratView/CMakeLists.txt | 39 +++------ .../DataExplorer/NetCdfDialog/CMakeLists.txt | 12 ++- .../DataExplorer/VtkVis/CMakeLists.txt | 46 +++++------ Applications/DataHolderLib/CMakeLists.txt | 7 +- Applications/FileIO/CMakeLists.txt | 48 ++++++----- Applications/FileIO/GocadIO/CMakeLists.txt | 8 +- Applications/InSituLib/CMakeLists.txt | 2 +- .../Utils/FileConverter/CMakeLists.txt | 70 ++++++++-------- Applications/Utils/GeoTools/CMakeLists.txt | 5 +- Applications/Utils/MeshEdit/CMakeLists.txt | 9 ++- .../Utils/MeshGeoTools/CMakeLists.txt | 7 +- .../Utils/ModelPreparation/CMakeLists.txt | 8 +- .../Utils/OGSFileConverter/CMakeLists.txt | 27 +++---- .../Utils/PostProcessing/CMakeLists.txt | 1 - .../Utils/SWMMConverter/CMakeLists.txt | 11 ++- .../Utils/SimpleMeshCreation/CMakeLists.txt | 18 ++--- 23 files changed, 244 insertions(+), 291 deletions(-) diff --git a/Applications/ApplicationsLib/CMakeLists.txt b/Applications/ApplicationsLib/CMakeLists.txt index 1987e809d21..4d00c3f2ef8 100644 --- a/Applications/ApplicationsLib/CMakeLists.txt +++ b/Applications/ApplicationsLib/CMakeLists.txt @@ -1,5 +1,5 @@ # Source files -GET_SOURCE_FILES(SOURCES_APPLICATIONSLIB) +get_source_files(SOURCES_APPLICATIONSLIB) set(LIB_SOURCES ${SOURCES_APPLICATIONSLIB}) # Library @@ -9,16 +9,20 @@ if(BUILD_SHARED_LIBS) endif() target_link_libraries(ApplicationsLib - PUBLIC BaseLib GeoLib Processes logog - PRIVATE MathLib MeshLib MeshGeoToolsLib NumLib ParameterLib -) + PUBLIC BaseLib GeoLib Processes logog + PRIVATE MathLib + MeshLib + MeshGeoToolsLib + NumLib + ParameterLib) # Set cpp definitions if the cmake option is enabled for the given process. foreach(process ${ProcessesList}) if(OGS_BUILD_PROCESS_${process}) string(TOUPPER "OGS_BUILD_PROCESS_${process}" EnableProcess) - set_property(SOURCE ProjectData.cpp APPEND PROPERTY COMPILE_DEFINITIONS - ${EnableProcess}) + set_property(SOURCE ProjectData.cpp + APPEND + PROPERTY COMPILE_DEFINITIONS ${EnableProcess}) endif() endforeach() diff --git a/Applications/CLI/CMakeLists.txt b/Applications/CLI/CMakeLists.txt index 30a38e1caa0..bb8917b3288 100644 --- a/Applications/CLI/CMakeLists.txt +++ b/Applications/CLI/CMakeLists.txt @@ -1,27 +1,27 @@ - add_executable(ogs ogs.cpp) -target_link_libraries(ogs - PRIVATE BaseLib ApplicationsLib -) +target_link_libraries(ogs PRIVATE BaseLib ApplicationsLib) if(OGS_USE_PYTHON) - # Troubleshooting: - # If you get linker errors, such as ogs.cpp:(.text+0xb4): undefined reference to `_Py_ZeroStruct' - # it could be that OGS is compiled with the wrong Python version. - # I (Ch. Leh.) observed the following: The symbol _Py_ZeroStruct could not be found in /usr/lib/libpython3.6m.so (I intended to compile OGS with Python3). - # It's apparently a Python2 symbol (present in /usr/lib/libpython2.7.so) - # The compiler command-line was the following: + # Troubleshooting: If you get linker errors, such as ogs.cpp:(.text+0xb4): + # undefined reference to `_Py_ZeroStruct' it could be that OGS is compiled + # with the wrong Python version. I (Ch. Leh.) observed the following: The + # symbol _Py_ZeroStruct could not be found in /usr/lib/libpython3.6m.so (I + # intended to compile OGS with Python3). It's apparently a Python2 symbol + # (present in /usr/lib/libpython2.7.so) The compiler command-line was the + # following: + # ~~~ # /usr/bin/g++ ... -DvtkRenderingVolume_AUTOINIT="1(vtkRenderingVolumeOpenGL2)" \ # -I/usr/include/vtk -I/usr/include/python2.7 -I/usr/include/freetype2 \ # -I/usr/include/libxml2 ... -I/.../BaseLib ... \ # -isystem /usr/include/python3.6m ... -o CMakeFiles/ogs.dir/ogs.cpp.o \ # -c /.../Applications/CLI/ogs.cpp - # In particular, the Python2 include path comes before the Python3 include path. - # Compiling OGS with Python2 solved the issue. - # I assume (this is only a guess!) that VTK pulls in Python2 dependencies (on my system). - # I assume that this is related to https://github.com/ufz/ogs/pull/2158. - # Workaround: Always make sure that OGS is compiled with the same Python version as VTK. + # ~~~ + # In particular, the Python2 include path comes before the Python3 include + # path. Compiling OGS with Python2 solved the issue. I assume (this is only + # a guess!) that VTK pulls in Python2 dependencies (on my system). I assume + # that this is related to https://github.com/ufz/ogs/pull/2158. Workaround: + # Always make sure that OGS is compiled with the same Python version as VTK. # The error described above should be detected automatically by cmake and an # appropriate message should be presented. The note is kept for the case # that the automatic detection does not work due to whatever reason. @@ -29,25 +29,29 @@ if(OGS_USE_PYTHON) add_library(ogs_embedded_python ogs_embedded_python.cpp) # Performance warning from - # https://github.com/pybind/pybind11/blob/master/docs/compiling.rst: - # Since pybind11 is a metatemplate library, it is crucial that certain compiler - # flags are provided to ensure high quality code generation. In contrast to the - # pybind11_add_module() command, the CMake interface library only provides the - # minimal set of parameters to ensure that the code using pybind11 compiles, but - # it does not pass these extra compiler flags (i.e. this is up to you). - # TODO: Enable further compiler/linker flags. + # https://github.com/pybind/pybind11/blob/master/docs/compiling.rst: Since + # pybind11 is a metatemplate library, it is crucial that certain compiler + # flags are provided to ensure high quality code generation. In contrast to + # the pybind11_add_module() command, the CMake interface library only + # provides the minimal set of parameters to ensure that the code using + # pybind11 compiles, but it does not pass these extra compiler flags (i.e. + # this is up to you). TODO: Enable further compiler/linker flags. target_link_libraries(ogs_embedded_python PUBLIC pybind11::embed) target_compile_definitions(ogs_embedded_python PUBLIC OGS_USE_PYTHON) - target_link_libraries(ogs_embedded_python PRIVATE - ProcessLibBoundaryConditionPythonModule ProcessLibSourceTermPythonModule) + target_link_libraries(ogs_embedded_python + PRIVATE ProcessLibBoundaryConditionPythonModule + ProcessLibSourceTermPythonModule) target_link_libraries(ogs PRIVATE ogs_embedded_python) if(BUILD_SHARED_LIBS) - # Add macro definition, because static libs make special handling necessary - # s.t. the embedded OpenGeoSys Python module won't be removed by the linker. - target_compile_definitions(ogs_embedded_python PRIVATE OGS_BUILD_SHARED_LIBS) - install(TARGETS ogs_embedded_python LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + # Add macro definition, because static libs make special handling + # necessary s.t. the embedded OpenGeoSys Python module won't be removed + # by the linker. + target_compile_definitions(ogs_embedded_python PRIVATE + OGS_BUILD_SHARED_LIBS) + install(TARGETS ogs_embedded_python + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() endif() @@ -64,20 +68,19 @@ if(OGS_USE_PCH) cotire(ogs) endif() -#################### -### Tests ########## -#################### +# ---- Tests ---- add_test(NAME ogs_no_args COMMAND ogs) set_tests_properties(ogs_no_args PROPERTIES WILL_FAIL TRUE) -#################### -### Installation ### -#################### +# ---- Installation ---- install(TARGETS ogs RUNTIME DESTINATION bin COMPONENT ogs_cli) -set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "ogs" "OGS Simulator") +set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "ogs" + "OGS Simulator") cpack_add_component(ogs_cli - DISPLAY_NAME "OGS THMC Simulator" - DESCRIPTION "The command line interface for OpenGeoSys." - GROUP Applications -) + DISPLAY_NAME + "OGS THMC Simulator" + DESCRIPTION + "The command line interface for OpenGeoSys." + GROUP + Applications) diff --git a/Applications/DataExplorer/Base/CMakeLists.txt b/Applications/DataExplorer/Base/CMakeLists.txt index c8f22d0819c..112e81c89b6 100644 --- a/Applications/DataExplorer/Base/CMakeLists.txt +++ b/Applications/DataExplorer/Base/CMakeLists.txt @@ -8,8 +8,7 @@ set(SOURCES ColorPickerPushButton.cpp TreeModelIterator.cpp CheckboxDelegate.cpp - QValueTooltipSlider.cpp -) + QValueTooltipSlider.cpp) # Header files set(HEADERS @@ -23,18 +22,14 @@ set(HEADERS TreeModel.h ColorPickerPushButton.h CheckboxDelegate.h - QValueTooltipSlider.h -) + QValueTooltipSlider.h) # Put moc files in a project folder source_group("UI Files" REGULAR_EXPRESSION "\\w*\\.ui") source_group("Moc Files" REGULAR_EXPRESSION "moc_.*") # Create the library -add_library(QtBase - ${SOURCES} - ${HEADERS} -) +add_library(QtBase ${SOURCES} ${HEADERS}) if(BUILD_SHARED_LIBS) install(TARGETS QtBase LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() diff --git a/Applications/DataExplorer/CMakeLists.txt b/Applications/DataExplorer/CMakeLists.txt index 005036f32b1..2e991908d77 100644 --- a/Applications/DataExplorer/CMakeLists.txt +++ b/Applications/DataExplorer/CMakeLists.txt @@ -1,6 +1,6 @@ set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}") -# Always built Data Explorer statically as there are cyclic dependencies -# between QtDataView and VtkVis +# Always built Data Explorer statically as there are cyclic dependencies between +# QtDataView and VtkVis set(BUILD_SHARED_LIBS OFF) if(MSVC) @@ -11,9 +11,7 @@ if(VTKFBXCONVERTER_FOUND) add_definitions(-DVTKFBXCONVERTER_FOUND) endif() -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} -) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_AUTOMOC TRUE) set(CMAKE_AUTOUIC TRUE) diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake index 6efad206252..96264714217 100644 --- a/Applications/DataExplorer/DataExplorer.cmake +++ b/Applications/DataExplorer/DataExplorer.cmake @@ -91,9 +91,7 @@ if(OGS_USE_PCH) cotire(DataExplorer) endif() -#################### -### Installation ### -#################### +# ---- Installation ---- install(TARGETS DataExplorer RUNTIME DESTINATION bin COMPONENT ogs_gui) cpack_add_component(ogs_gui diff --git a/Applications/DataExplorer/DataView/CMakeLists.txt b/Applications/DataExplorer/DataView/CMakeLists.txt index 06a747961a4..216248285f4 100644 --- a/Applications/DataExplorer/DataView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/CMakeLists.txt @@ -41,8 +41,7 @@ set(SOURCES StationTabWidget.cpp StationTreeModel.cpp StationTreeView.cpp - SurfaceExtractionDialog.cpp -) + SurfaceExtractionDialog.cpp) set(HEADERS AddLayerToMeshDialog.h @@ -92,56 +91,60 @@ set(HEADERS StationTabWidget.h StationTreeModel.h StationTreeView.h - SurfaceExtractionDialog.h -) + SurfaceExtractionDialog.h) # Visual Studio folder source_group("Dialog Header Files" REGULAR_EXPRESSION "[.]*Dialog.h") source_group("Dialog Source Files" REGULAR_EXPRESSION "[.]*Dialog.cpp") -source_group("Data Model Header Files" REGULAR_EXPRESSION "[.]*Item.h|[.]*Model.h|[.]*View.h") -source_group("Data Model Source Files" REGULAR_EXPRESSION "[.]*Item.cpp|[.]*Model.cpp|[.]*View.cpp") +source_group("Data Model Header Files" REGULAR_EXPRESSION + "[.]*Item.h|[.]*Model.h|[.]*View.h") +source_group("Data Model Source Files" REGULAR_EXPRESSION + "[.]*Item.cpp|[.]*Model.cpp|[.]*View.cpp") file(GLOB UIS CONFIGURE_DEPENDS *.ui) source_group("UI Files" FILES ${UIS}) set(SOURCE_DIR_REL ${CMAKE_CURRENT_SOURCE_DIR}/../../..) set(GUI_SOURCE_DIR_REL ${CMAKE_CURRENT_SOURCE_DIR}/..) -include_directories( - ${SOURCE_DIR_REL}/Applications/FileIO - ${SOURCE_DIR_REL}/BaseLib - ${SOURCE_DIR_REL}/MathLib - ${SOURCE_DIR_REL}/GeoLib - ${SOURCE_DIR_REL}/MeshGeoToolsLib - ${SOURCE_DIR_REL}/MeshLib - ${GUI_SOURCE_DIR_REL}/Base - ${GUI_SOURCE_DIR_REL}/VtkVis - - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/DiagramView - ${CMAKE_CURRENT_SOURCE_DIR}/StratView -) +include_directories(${SOURCE_DIR_REL}/Applications/FileIO + ${SOURCE_DIR_REL}/BaseLib + ${SOURCE_DIR_REL}/MathLib + ${SOURCE_DIR_REL}/GeoLib + ${SOURCE_DIR_REL}/MeshGeoToolsLib + ${SOURCE_DIR_REL}/MeshLib + ${GUI_SOURCE_DIR_REL}/Base + ${GUI_SOURCE_DIR_REL}/VtkVis + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/DiagramView + ${CMAKE_CURRENT_SOURCE_DIR}/StratView) if(GEOTIFF_FOUND) include_directories(${GEOTIFF_INCLUDE_DIRS}) endif() # GEOTIFF_FOUND -add_library(QtDataView - ${SOURCES} - ${HEADERS} - ${UIS} -) +add_library(QtDataView ${SOURCES} ${HEADERS} ${UIS}) if(BUILD_SHARED_LIBS) install(TARGETS QtDataView LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() target_link_libraries(QtDataView - PUBLIC GeoLib MeshGeoToolsLib MeshLib QtBase VtkVis - PRIVATE BaseLib MathLib ApplicationsFileIO QtDiagramView QtStratView - DataHolderLib logog Qt5::Core Qt5::Gui -) + PUBLIC GeoLib + MeshGeoToolsLib + MeshLib + QtBase + VtkVis + PRIVATE BaseLib + MathLib + ApplicationsFileIO + QtDiagramView + QtStratView + DataHolderLib + logog + Qt5::Core + Qt5::Gui) if(GEOTIFF_FOUND) target_link_libraries(QtDataView PRIVATE ${GEOTIFF_LIBRARIES}) -endif () # GEOTIFF_FOUND +endif() # GEOTIFF_FOUND add_autogen_include(QtDataView) diff --git a/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt b/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt index c9503d12f2e..3da36416dcf 100644 --- a/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt @@ -5,8 +5,7 @@ set(SOURCES DiagramScene.cpp DiagramView.cpp QArrow.cpp - QGraphicsGrid.cpp -) + QGraphicsGrid.cpp) set(HEADERS DiagramList.h @@ -16,35 +15,32 @@ set(HEADERS DiagramScene.h DetailWindow.h DiagramPrefsDialog.h - DiagramView.h -) + DiagramView.h) set(SOURCE_DIR_REL ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) set(GUI_SOURCE_DIR_REL ${CMAKE_CURRENT_SOURCE_DIR}/../..) -include_directories( - ${SOURCE_DIR_REL}/BaseLib - ${SOURCE_DIR_REL}/GeoLib - ${SOURCE_DIR_REL}/MathLib - ${CMAKE_CURRENT_SOURCE_DIR} - ${GUI_SOURCE_DIR_REL}/Base - ${GUI_SOURCE_DIR_REL}/DataView -) +include_directories(${SOURCE_DIR_REL}/BaseLib + ${SOURCE_DIR_REL}/GeoLib + ${SOURCE_DIR_REL}/MathLib + ${CMAKE_CURRENT_SOURCE_DIR} + ${GUI_SOURCE_DIR_REL}/Base + ${GUI_SOURCE_DIR_REL}/DataView) file(GLOB_RECURSE UIS CONFIGURE_DEPENDS *.ui) source_group("UI Files" FILES ${UIS}) -add_library(QtDiagramView - ${SOURCES} - ${HEADERS} - ${UIS} -) +add_library(QtDiagramView ${SOURCES} ${HEADERS} ${UIS}) if(BUILD_SHARED_LIBS) install(TARGETS QtDiagramView LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() target_link_libraries(QtDiagramView - PRIVATE BaseLib GeoLib QtBase DataHolderLib Qt5::Gui logog -) + PRIVATE BaseLib + GeoLib + QtBase + DataHolderLib + Qt5::Gui + logog) add_autogen_include(QtDiagramView) diff --git a/Applications/DataExplorer/DataView/StratView/CMakeLists.txt b/Applications/DataExplorer/DataView/StratView/CMakeLists.txt index b17d9286bc7..e88986209ca 100644 --- a/Applications/DataExplorer/DataView/StratView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/StratView/CMakeLists.txt @@ -1,42 +1,29 @@ -set(SOURCES - StratBar.cpp - StratScene.cpp - StratView.cpp - StratWindow.cpp -) +set(SOURCES StratBar.cpp StratScene.cpp StratView.cpp StratWindow.cpp) -set(HEADERS - StratBar.h - StratScene.h - StratView.h - StratWindow.h -) +set(HEADERS StratBar.h StratScene.h StratView.h StratWindow.h) set(SOURCE_DIR_REL ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) set(GUI_SOURCE_DIR_REL ${CMAKE_CURRENT_SOURCE_DIR}/../..) -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${SOURCE_DIR_REL}/BaseLib - ${SOURCE_DIR_REL}/GeoLib - ${SOURCE_DIR_REL}/MathLib - ${GUI_SOURCE_DIR_REL}/Base -) +include_directories(${CMAKE_CURRENT_SOURCE_DIR} + ${SOURCE_DIR_REL}/BaseLib + ${SOURCE_DIR_REL}/GeoLib + ${SOURCE_DIR_REL}/MathLib + ${GUI_SOURCE_DIR_REL}/Base) file(GLOB_RECURSE UI_FILES CONFIGURE_DEPENDS *.ui) source_group("UI Files" FILES ${UI_FILES}) -add_library(QtStratView - ${SOURCES} - ${HEADERS} - ${UIS} -) +add_library(QtStratView ${SOURCES} ${HEADERS} ${UIS}) if(BUILD_SHARED_LIBS) install(TARGETS QtStratView LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() target_link_libraries(QtStratView - PRIVATE BaseLib GeoLib DataHolderLib QtBase Qt5::Gui -) + PRIVATE BaseLib + GeoLib + DataHolderLib + QtBase + Qt5::Gui) add_autogen_include(QtStratView) set_property(TARGET QtStratView PROPERTY FOLDER "DataExplorer") diff --git a/Applications/DataExplorer/NetCdfDialog/CMakeLists.txt b/Applications/DataExplorer/NetCdfDialog/CMakeLists.txt index 0d74f1e40cb..68c16fb9c32 100644 --- a/Applications/DataExplorer/NetCdfDialog/CMakeLists.txt +++ b/Applications/DataExplorer/NetCdfDialog/CMakeLists.txt @@ -1,14 +1,18 @@ add_library(NetCdfDialogLib NetCdfConfigureDialog.cpp NetCdfConfigureDialog.h) if(BUILD_SHARED_LIBS) - install(TARGETS NetCdfConfigureDialog LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS NetCdfConfigureDialog + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -target_link_libraries(NetCdfDialogLib PUBLIC Qt5::Widgets PRIVATE MathLib vtknetcdfcpp) +target_link_libraries(NetCdfDialogLib + PUBLIC Qt5::Widgets + PRIVATE MathLib vtknetcdfcpp) set_property(TARGET NetCdfDialogLib PROPERTY FOLDER "DataExplorer") # Workaround for system installed VTK (tested on arch) if(NOT OGS_USE_CONAN) - target_include_directories(NetCdfDialogLib SYSTEM + target_include_directories( + NetCdfDialogLib SYSTEM PUBLIC ${VTK_INSTALL_PREFIX}/include/vtk/vtknetcdfcpp) endif() -add_autogen_include(NetCdfDialogLib) \ No newline at end of file +add_autogen_include(NetCdfDialogLib) diff --git a/Applications/DataExplorer/VtkVis/CMakeLists.txt b/Applications/DataExplorer/VtkVis/CMakeLists.txt index d8bb0b9b8e3..cb0841b1950 100644 --- a/Applications/DataExplorer/VtkVis/CMakeLists.txt +++ b/Applications/DataExplorer/VtkVis/CMakeLists.txt @@ -46,8 +46,7 @@ set(SOURCES VtkVisPipelineItem.cpp VtkVisPipelineView.cpp VtkVisPointSetItem.cpp - VtkVisTabWidget.cpp -) + VtkVisTabWidget.cpp) set(HEADERS MeshFromRasterDialog.h @@ -97,8 +96,7 @@ set(HEADERS VtkVisPipelineItem.h VtkVisPipelineView.h VtkVisPointSetItem.h - VtkVisTabWidget.h -) + VtkVisTabWidget.h) # Visual Studio folder source_group("Filter Header Files" REGULAR_EXPRESSION "[.]*Filter.h") @@ -110,24 +108,18 @@ source_group("UI Files" FILES ${UIS}) set(SOURCE_DIR_REL ${CMAKE_CURRENT_SOURCE_DIR}/../../..) set(GUI_SOURCE_DIR_REL ${CMAKE_CURRENT_SOURCE_DIR}/..) -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${SOURCE_DIR_REL}/Applications/FileIO - ${SOURCE_DIR_REL}/BaseLib - ${SOURCE_DIR_REL}/GeoLib - ${SOURCE_DIR_REL}/MathLib - ${SOURCE_DIR_REL}/MeshLib - ${GUI_SOURCE_DIR_REL}/Base - ${GUI_SOURCE_DIR_REL}/DataView - ${GUI_SOURCE_DIR_REL}/VtkModules/Qt -) +include_directories(${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${SOURCE_DIR_REL}/Applications/FileIO + ${SOURCE_DIR_REL}/BaseLib + ${SOURCE_DIR_REL}/GeoLib + ${SOURCE_DIR_REL}/MathLib + ${SOURCE_DIR_REL}/MeshLib + ${GUI_SOURCE_DIR_REL}/Base + ${GUI_SOURCE_DIR_REL}/DataView + ${GUI_SOURCE_DIR_REL}/VtkModules/Qt) -add_library(VtkVis - ${SOURCES} - ${HEADERS} - ${UIS} -) +add_library(VtkVis ${SOURCES} ${HEADERS} ${UIS}) if(BUILD_SHARED_LIBS) install(TARGETS VtkVis LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() @@ -138,11 +130,15 @@ if(GEOTIFF_FOUND) endif() # GEOTIFF_FOUND target_link_libraries(VtkVis - PUBLIC BaseLib GeoLib MeshLib DataHolderLib QtBase vtkIOImage - PRIVATE MathLib ApplicationsFileIO Qt5::Gui logog -) + PUBLIC BaseLib + GeoLib + MeshLib + DataHolderLib + QtBase + vtkIOImage + PRIVATE MathLib ApplicationsFileIO Qt5::Gui logog) -if (OGS_USE_NETCDF) +if(OGS_USE_NETCDF) target_link_libraries(VtkVis PRIVATE NetCdfDialogLib) endif() diff --git a/Applications/DataHolderLib/CMakeLists.txt b/Applications/DataHolderLib/CMakeLists.txt index 7f23991438f..40e7e38bd43 100644 --- a/Applications/DataHolderLib/CMakeLists.txt +++ b/Applications/DataHolderLib/CMakeLists.txt @@ -1,5 +1,5 @@ # Source files -GET_SOURCE_FILES(SOURCES_DataHolderLib) +get_source_files(SOURCES_DataHolderLib) # Library add_library(DataHolderLib ${SOURCES_DataHolderLib}) @@ -7,10 +7,7 @@ if(BUILD_SHARED_LIBS) install(TARGETS DataHolderLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -target_link_libraries(DataHolderLib - PUBLIC GeoLib MeshLib - PRIVATE BaseLib logog -) +target_link_libraries(DataHolderLib PUBLIC GeoLib MeshLib PRIVATE BaseLib logog) if(OGS_USE_PCH) cotire(DataHolderLib) diff --git a/Applications/FileIO/CMakeLists.txt b/Applications/FileIO/CMakeLists.txt index eaaed88a542..95d05766e94 100644 --- a/Applications/FileIO/CMakeLists.txt +++ b/Applications/FileIO/CMakeLists.txt @@ -1,23 +1,23 @@ -GET_SOURCE_FILES(SOURCES) -APPEND_SOURCE_FILES(SOURCES Gmsh) -APPEND_SOURCE_FILES(SOURCES Legacy) +get_source_files(SOURCES) +append_source_files(SOURCES Gmsh) +append_source_files(SOURCES Legacy) if(NOT Shapelib_FOUND) list(REMOVE_ITEM SOURCES SHPInterface.h SHPInterface.cpp) endif() # GO2OGS -GET_SOURCE_FILES(SOURCES_GO2OGS GocadIO) +get_source_files(SOURCES_GO2OGS GocadIO) set(SOURCES ${SOURCES} ${SOURCES_GO2OGS}) if(OGS_BUILD_GUI) - APPEND_SOURCE_FILES(SOURCES XmlIO/Qt) - APPEND_SOURCE_FILES(SOURCES FEFLOW) + append_source_files(SOURCES XmlIO/Qt) + append_source_files(SOURCES FEFLOW) endif() if(OGS_BUILD_SWMM) - GET_SOURCE_FILES(SOURCES_SWMM SWMM) - SET(SOURCES ${SOURCES} ${SOURCES_SWMM}) + get_source_files(SOURCES_SWMM SWMM) + set(SOURCES ${SOURCES} ${SOURCES_SWMM}) endif() include(${PROJECT_SOURCE_DIR}/scripts/cmake/OGSEnabledElements.cmake) @@ -25,12 +25,16 @@ include(${PROJECT_SOURCE_DIR}/scripts/cmake/OGSEnabledElements.cmake) # Create the library add_library(ApplicationsFileIO ${SOURCES}) if(BUILD_SHARED_LIBS) - install(TARGETS ApplicationsFileIO LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS ApplicationsFileIO + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() target_link_libraries(ApplicationsFileIO - PUBLIC BaseLib DataHolderLib GeoLib MathLib logog - PRIVATE MeshLib -) + PUBLIC BaseLib + DataHolderLib + GeoLib + MathLib + logog + PRIVATE MeshLib) if(OGS_BUILD_GUI) # Needed for the XmlPrjInterface, which links the DE/Base/OGSError.h. @@ -49,13 +53,13 @@ if(OGS_USE_PCH) cotire(ApplicationsFileIO) endif() - -configure_file(XmlIO/OpenGeoSysCND.xsd ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/OpenGeoSysCND.xsd COPYONLY) -configure_file(XmlIO/OpenGeoSysNum.xsd ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/OpenGeoSysNum.xsd COPYONLY) -configure_file(XmlIO/OpenGeoSysProject.xsd ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/OpenGeoSysProject.xsd COPYONLY) -install(FILES - XmlIO/OpenGeoSysCND.xsd - XmlIO/OpenGeoSysNum.xsd - XmlIO/OpenGeoSysProject.xsd - DESTINATION bin COMPONENT ogs_cli -) +configure_file(XmlIO/OpenGeoSysCND.xsd + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/OpenGeoSysCND.xsd COPYONLY) +configure_file(XmlIO/OpenGeoSysNum.xsd + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/OpenGeoSysNum.xsd COPYONLY) +configure_file(XmlIO/OpenGeoSysProject.xsd + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/OpenGeoSysProject.xsd COPYONLY) +install(FILES XmlIO/OpenGeoSysCND.xsd XmlIO/OpenGeoSysNum.xsd + XmlIO/OpenGeoSysProject.xsd + DESTINATION bin + COMPONENT ogs_cli) diff --git a/Applications/FileIO/GocadIO/CMakeLists.txt b/Applications/FileIO/GocadIO/CMakeLists.txt index 7ca90dceddc..a5d9d3df2e5 100644 --- a/Applications/FileIO/GocadIO/CMakeLists.txt +++ b/Applications/FileIO/GocadIO/CMakeLists.txt @@ -1,6 +1,2 @@ -include_directories( - ${CMAKE_SOURCE_DIR}/BaseLib - ${CMAKE_SOURCE_DIR}/FileIO - ${CMAKE_SOURCE_DIR}/GeoLib - ${CMAKE_SOURCE_DIR}/MeshLib -) +include_directories(${CMAKE_SOURCE_DIR}/BaseLib ${CMAKE_SOURCE_DIR}/FileIO + ${CMAKE_SOURCE_DIR}/GeoLib ${CMAKE_SOURCE_DIR}/MeshLib) diff --git a/Applications/InSituLib/CMakeLists.txt b/Applications/InSituLib/CMakeLists.txt index 486ef6cba61..3103fa1a1c2 100644 --- a/Applications/InSituLib/CMakeLists.txt +++ b/Applications/InSituLib/CMakeLists.txt @@ -1,5 +1,5 @@ # Source files -GET_SOURCE_FILES(SOURCES) +get_source_files(SOURCES) # Library add_library(InSituLib ${SOURCES}) diff --git a/Applications/Utils/FileConverter/CMakeLists.txt b/Applications/Utils/FileConverter/CMakeLists.txt index d280d8c5558..aac2917cb5c 100644 --- a/Applications/Utils/FileConverter/CMakeLists.txt +++ b/Applications/Utils/FileConverter/CMakeLists.txt @@ -1,23 +1,23 @@ -if (OGS_BUILD_GUI) - if (Shapelib_FOUND) +if(OGS_BUILD_GUI) + if(Shapelib_FOUND) add_executable(ConvertSHPToGLI ConvertSHPToGLI.cpp) set_target_properties(ConvertSHPToGLI PROPERTIES FOLDER Utilities) - target_link_libraries(ConvertSHPToGLI GeoLib Qt5::Xml ${Shapelib_LIBRARIES}) + target_link_libraries(ConvertSHPToGLI GeoLib Qt5::Xml + ${Shapelib_LIBRARIES}) endif() add_executable(FEFLOW2OGS FEFLOW2OGS.cpp) set_target_properties(FEFLOW2OGS PROPERTIES FOLDER Utilities) target_link_libraries(FEFLOW2OGS ApplicationsFileIO) -endif () +endif() add_executable(convertGEO convertGEO.cpp) set_target_properties(convertGEO PROPERTIES FOLDER Utilities) target_link_libraries(convertGEO GeoLib ApplicationsFileIO) -add_executable(generateMatPropsFromMatID generateMatPropsFromMatID.cpp ) +add_executable(generateMatPropsFromMatID generateMatPropsFromMatID.cpp) target_link_libraries(generateMatPropsFromMatID MeshLib) -set_target_properties(generateMatPropsFromMatID - PROPERTIES FOLDER Utilities) +set_target_properties(generateMatPropsFromMatID PROPERTIES FOLDER Utilities) add_executable(GMSH2OGS GMSH2OGS.cpp) set_target_properties(GMSH2OGS PROPERTIES FOLDER Utilities) @@ -46,50 +46,44 @@ target_link_libraries(TecPlotTools GeoLib MeshLib) add_executable(GocadSGridReader GocadSGridReaderMain.cpp) set_target_properties(GocadSGridReader PROPERTIES FOLDER Utilities) target_link_libraries(GocadSGridReader - GeoLib - MeshLib - ApplicationsFileIO - ${Boost_LIBRARIES} -) + GeoLib + MeshLib + ApplicationsFileIO + ${Boost_LIBRARIES}) add_executable(GocadTSurfaceReader GocadTSurfaceReader.cpp) set_target_properties(GocadTSurfaceReader PROPERTIES FOLDER Utilities) -target_link_libraries(GocadTSurfaceReader - MeshLib - ApplicationsFileIO - ${Boost_LIBRARIES} -) +target_link_libraries(GocadTSurfaceReader MeshLib ApplicationsFileIO + ${Boost_LIBRARIES}) add_executable(Mesh2Raster MeshToRaster.cpp) set_target_properties(Mesh2Raster PROPERTIES FOLDER Utilities) target_link_libraries(Mesh2Raster MeshLib) - -#################### -### Installation ### -#################### -install(TARGETS - generateMatPropsFromMatID - GMSH2OGS - OGS2VTK - VTK2OGS - VTK2TIN - TecPlotTools - GocadSGridReader - Mesh2Raster - RUNTIME DESTINATION bin COMPONENT ogs_converter) +# ---- Installation ---- +install(TARGETS generateMatPropsFromMatID + GMSH2OGS + OGS2VTK + VTK2OGS + VTK2TIN + TecPlotTools + GocadSGridReader + Mesh2Raster + RUNTIME DESTINATION bin COMPONENT ogs_converter) if(OGS_BUILD_GUI) if(Shapelib_FOUND) install(TARGETS ConvertSHPToGLI - RUNTIME DESTINATION bin COMPONENT ogs_converter) + RUNTIME DESTINATION bin COMPONENT ogs_converter) endif() - install(TARGETS FEFLOW2OGS convertGEO - RUNTIME DESTINATION bin COMPONENT ogs_converter) + install(TARGETS FEFLOW2OGS convertGEO + RUNTIME DESTINATION bin COMPONENT ogs_converter) endif() cpack_add_component(ogs_converter - DISPLAY_NAME "File converter" - DESCRIPTION "File converter." - GROUP Utilities -) + DISPLAY_NAME + "File converter" + DESCRIPTION + "File converter." + GROUP + Utilities) diff --git a/Applications/Utils/GeoTools/CMakeLists.txt b/Applications/Utils/GeoTools/CMakeLists.txt index e65cb74e20e..a721629a0e4 100644 --- a/Applications/Utils/GeoTools/CMakeLists.txt +++ b/Applications/Utils/GeoTools/CMakeLists.txt @@ -2,10 +2,7 @@ if(NOT OGS_BUILD_GUI) return() endif() -set(TOOLS - MoveGeometry - TriangulatePolyline -) +set(TOOLS MoveGeometry TriangulatePolyline) foreach(TOOL ${TOOLS}) add_executable(${TOOL} ${TOOL}.cpp) target_link_libraries(${TOOL} GeoLib ApplicationsFileIO Qt5::Core) diff --git a/Applications/Utils/MeshEdit/CMakeLists.txt b/Applications/Utils/MeshEdit/CMakeLists.txt index 680fe9173ff..780ee023752 100644 --- a/Applications/Utils/MeshEdit/CMakeLists.txt +++ b/Applications/Utils/MeshEdit/CMakeLists.txt @@ -17,8 +17,7 @@ set(TOOLS ResetPropertiesInPolygonalRegion reviseMesh swapNodeCoordinateAxes - UnityPreprocessing -) + UnityPreprocessing) foreach(TOOL ${TOOLS}) add_executable(${TOOL} ${TOOL}.cpp) target_link_libraries(${TOOL} MeshLib) @@ -26,8 +25,10 @@ endforeach() set_target_properties(${TOOLS} PROPERTIES FOLDER Utilities) install(TARGETS ${TOOLS} RUNTIME DESTINATION bin COMPONENT Utilities) -target_link_libraries(appendLinesAlongPolyline MeshGeoToolsLib ApplicationsFileIO) -target_link_libraries(CreateBoundaryConditionsAlongPolylines MeshGeoToolsLib ApplicationsFileIO) +target_link_libraries(appendLinesAlongPolyline MeshGeoToolsLib + ApplicationsFileIO) +target_link_libraries(CreateBoundaryConditionsAlongPolylines MeshGeoToolsLib + ApplicationsFileIO) target_link_libraries(createLayeredMeshFromRasters ApplicationsFileIO) target_link_libraries(MapGeometryToMeshSurface MeshGeoToolsLib) target_link_libraries(ResetPropertiesInPolygonalRegion ApplicationsFileIO) diff --git a/Applications/Utils/MeshGeoTools/CMakeLists.txt b/Applications/Utils/MeshGeoTools/CMakeLists.txt index 240aff55f60..c5b69d1e445 100644 --- a/Applications/Utils/MeshGeoTools/CMakeLists.txt +++ b/Applications/Utils/MeshGeoTools/CMakeLists.txt @@ -1,8 +1,5 @@ -set(TOOLS - computeSurfaceNodeIDsInPolygonalRegion - constructMeshesFromGeometry - identifySubdomains -) +set(TOOLS computeSurfaceNodeIDsInPolygonalRegion constructMeshesFromGeometry + identifySubdomains) foreach(TOOL ${TOOLS}) add_executable(${TOOL} ${TOOL}.cpp) target_link_libraries(${TOOL} MeshLib ApplicationsFileIO MeshGeoToolsLib) diff --git a/Applications/Utils/ModelPreparation/CMakeLists.txt b/Applications/Utils/ModelPreparation/CMakeLists.txt index 54bf77437d5..2433d9ab5f6 100644 --- a/Applications/Utils/ModelPreparation/CMakeLists.txt +++ b/Applications/Utils/ModelPreparation/CMakeLists.txt @@ -1,9 +1,5 @@ -set(TOOLS - ComputeNodeAreasFromSurfaceMesh - convertVtkDataArrayToVtkDataArray - createNeumannBc - scaleProperty -) +set(TOOLS ComputeNodeAreasFromSurfaceMesh convertVtkDataArrayToVtkDataArray + createNeumannBc scaleProperty) foreach(TOOL ${TOOLS}) add_executable(${TOOL} ${TOOL}.cpp) target_link_libraries(${TOOL} MeshLib) diff --git a/Applications/Utils/OGSFileConverter/CMakeLists.txt b/Applications/Utils/OGSFileConverter/CMakeLists.txt index 54361c9e056..ec758b6a05f 100644 --- a/Applications/Utils/OGSFileConverter/CMakeLists.txt +++ b/Applications/Utils/OGSFileConverter/CMakeLists.txt @@ -1,33 +1,24 @@ -add_library(OGSFileConverterLib - FileListDialog.h - OGSFileConverter.h - FileListDialog.cpp - OGSFileConverter.cpp -) +add_library(OGSFileConverterLib FileListDialog.h OGSFileConverter.h + FileListDialog.cpp OGSFileConverter.cpp) target_link_libraries(OGSFileConverterLib - PUBLIC ApplicationsFileIO MathLib QtBase ${VTK_LIBRARIES} - INTERFACE MeshLib -) + PUBLIC ApplicationsFileIO MathLib QtBase ${VTK_LIBRARIES} + INTERFACE MeshLib) if(BUILD_SHARED_LIBS) - install(TARGETS OGSFileConverterLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS OGSFileConverterLib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_target_properties(OGSFileConverterLib PROPERTIES - AUTOMOC TRUE - AUTOUIC TRUE -) +set_target_properties(OGSFileConverterLib PROPERTIES AUTOMOC TRUE AUTOUIC TRUE) add_executable(OGSFileConverter main.cpp) target_link_libraries(OGSFileConverter - PUBLIC OGSFileConverterLib ApplicationsFileIO -) + PUBLIC OGSFileConverterLib ApplicationsFileIO) add_autogen_include(OGSFileConverterLib) set_target_properties(OGSFileConverter OGSFileConverterLib - PROPERTIES FOLDER "Utilities" -) + PROPERTIES FOLDER "Utilities") if(OGS_USE_PCH) cotire(OGSFileConverterLib) diff --git a/Applications/Utils/PostProcessing/CMakeLists.txt b/Applications/Utils/PostProcessing/CMakeLists.txt index 06016e3a38b..52469fed16d 100644 --- a/Applications/Utils/PostProcessing/CMakeLists.txt +++ b/Applications/Utils/PostProcessing/CMakeLists.txt @@ -1,4 +1,3 @@ - if(OGS_BUILD_PROCESS_LIE) add_executable(postLIE postLIE.cpp) target_link_libraries(postLIE LIECommon) diff --git a/Applications/Utils/SWMMConverter/CMakeLists.txt b/Applications/Utils/SWMMConverter/CMakeLists.txt index 59b62127999..1b78a128bc8 100644 --- a/Applications/Utils/SWMMConverter/CMakeLists.txt +++ b/Applications/Utils/SWMMConverter/CMakeLists.txt @@ -1,10 +1,9 @@ add_executable(SWMMConverter SWMMConverter.cpp) target_link_libraries(SWMMConverter - ApplicationsFileIO - GeoLib - MeshLib - SwmmInterface -) -include_directories( ${PROJECT_SOURCE_DIR}/Applications/FileIO ) + ApplicationsFileIO + GeoLib + MeshLib + SwmmInterface) +include_directories(${PROJECT_SOURCE_DIR}/Applications/FileIO) set_target_properties(SWMMConverter PROPERTIES FOLDER Utilities) install(TARGETS SWMMConverter RUNTIME DESTINATION bin COMPONENT Utilities) diff --git a/Applications/Utils/SimpleMeshCreation/CMakeLists.txt b/Applications/Utils/SimpleMeshCreation/CMakeLists.txt index 98767fae4f4..91562281a1b 100644 --- a/Applications/Utils/SimpleMeshCreation/CMakeLists.txt +++ b/Applications/Utils/SimpleMeshCreation/CMakeLists.txt @@ -1,21 +1,19 @@ - if(OGS_BUILD_GUI) - add_executable(createMeshElemPropertiesFromASCRaster createMeshElemPropertiesFromASCRaster.cpp) - set_target_properties(createMeshElemPropertiesFromASCRaster PROPERTIES FOLDER Utilities) + add_executable(createMeshElemPropertiesFromASCRaster + createMeshElemPropertiesFromASCRaster.cpp) + set_target_properties(createMeshElemPropertiesFromASCRaster + PROPERTIES FOLDER Utilities) target_link_libraries(createMeshElemPropertiesFromASCRaster - ApplicationsFileIO - MeshLib - ) + ApplicationsFileIO MeshLib) endif() add_executable(generateStructuredMesh generateStructuredMesh.cpp) target_link_libraries(generateStructuredMesh MeshLib) set_target_properties(generateStructuredMesh PROPERTIES FOLDER Utilities) -install(TARGETS generateStructuredMesh RUNTIME DESTINATION bin - COMPONENT Utilities) +install(TARGETS generateStructuredMesh + RUNTIME DESTINATION bin COMPONENT Utilities) if(OGS_BUILD_GUI) install(TARGETS createMeshElemPropertiesFromASCRaster - RUNTIME DESTINATION bin - COMPONENT Utilities) + RUNTIME DESTINATION bin COMPONENT Utilities) endif() -- GitLab