diff --git a/Applications/ApplicationsLib/CMakeLists.txt b/Applications/ApplicationsLib/CMakeLists.txt index 70f117bb825eeb74b346da38591e1a5ed251adbd..cf01cfa4f56fe20645babead96c2a9ce06863367 100644 --- a/Applications/ApplicationsLib/CMakeLists.txt +++ b/Applications/ApplicationsLib/CMakeLists.txt @@ -11,3 +11,7 @@ target_link_libraries(ApplicationsLib ${CATALYST_LIBRARIES} ) ADD_CATALYST_DEPENDENCY(ApplicationsLib) + +if(OGS_BUILD_GUI) + target_link_libraries(ApplicationsLib Qt4::QtCore) +endif() diff --git a/Applications/CLI/CMakeLists.txt b/Applications/CLI/CMakeLists.txt index 203f3d522b3a2c8ed6659b52831e4d1452eb421d..49062be1e36de59e6bdb1125672845aee023fe85 100644 --- a/Applications/CLI/CMakeLists.txt +++ b/Applications/CLI/CMakeLists.txt @@ -12,11 +12,17 @@ target_link_libraries(ogs NumLib ${Boost_LIBRARIES} ${CATALYST_LIBRARIES} - + Threads::Threads ) if(OGS_BUILD_GUI) - target_link_libraries(ogs QtDataView VtkVis vtkInteractionStyle) + target_link_libraries(ogs QtDataView VtkVis vtkInteractionStyle Qt4::QtCore Qt4::QtGui Qt4::QtXml Qt4::QtNetwork) + if(CMAKE_CROSSCOMPILING) + target_link_libraries(ogs + ${QT_XML_DEPS_LIBRARIES} + ${QT_GUI_DEPS_LIBRARIES} + ${QT_NETWORK_DEPS_LIBRARIES}) + endif() endif() ADD_CATALYST_DEPENDENCY(ogs) diff --git a/Applications/DataExplorer/Base/CMakeLists.txt b/Applications/DataExplorer/Base/CMakeLists.txt index f64ff321f6d2b9094b5f55a1290d06ea664c71a1..a86ef47ce4da8ac0b64e5a0e0fd464b2ed020782 100644 --- a/Applications/DataExplorer/Base/CMakeLists.txt +++ b/Applications/DataExplorer/Base/CMakeLists.txt @@ -47,6 +47,6 @@ add_library(QtBase STATIC ${MOC_SOURCES} ) -target_link_libraries(QtBase ${QT_LIBRARIES}) +target_link_libraries(QtBase Qt4::QtGui) set_property(TARGET QtBase PROPERTY FOLDER "DataExplorer") diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake index b8c43398f0521f22eb975d1546b3d997b7426782..e4bd1530f3572ecd0bd08c7cf71c7a9e9667eb06 100644 --- a/Applications/DataExplorer/DataExplorer.cmake +++ b/Applications/DataExplorer/DataExplorer.cmake @@ -74,14 +74,16 @@ add_executable(DataExplorer MACOSX_BUNDLE ) target_link_libraries(DataExplorer - ${QT_LIBRARIES} + Qt4::QtCore + Qt4::QtGui + Qt4::QtXml + Qt4::QtNetwork ApplicationsLib BaseLib GeoLib FileIO InSituLib MeshLib - #MSHGEOTOOLS QtBase QtDataView QtStratView @@ -91,8 +93,17 @@ target_link_libraries(DataExplorer ${CATALYST_LIBRARIES} zlib shp + Threads::Threads ) +if(CMAKE_CROSSCOMPILING) + target_link_libraries(DataExplorer + ${QT_XML_DEPS_LIBRARIES} + ${QT_GUI_DEPS_LIBRARIES} + ${QT_NETWORK_DEPS_LIBRARIES} + ) +endif() + if(VTK_NETCDF_FOUND) target_link_libraries(DataExplorer vtkNetCDF vtkNetCDF_cxx ) else() diff --git a/Applications/DataExplorer/DataView/CMakeLists.txt b/Applications/DataExplorer/DataView/CMakeLists.txt index 8f38ba422e9563b48af910dbbc03e4e609b58d78..bfcb7a8da0f24cbbf31896d434620e95b1cd254e 100644 --- a/Applications/DataExplorer/DataView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/CMakeLists.txt @@ -176,7 +176,7 @@ add_library(QtDataView STATIC # Link Qt library target_link_libraries(QtDataView - ${QT_LIBRARIES} + Qt4::QtCore FileIO GeoLib MeshLib diff --git a/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt b/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt index a1aad85c51eb3527f35a84699f4dadbfbb2bd2e1..9df92e614c8725a7cfb2b5e7ae9c5fc44016afd6 100644 --- a/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt @@ -65,7 +65,7 @@ add_library(QtDiagramView STATIC # Link Qt library target_link_libraries(QtDiagramView - ${QT_LIBRARIES} + Qt4::QtGui GeoLib ) diff --git a/Applications/DataExplorer/DataView/StratView/CMakeLists.txt b/Applications/DataExplorer/DataView/StratView/CMakeLists.txt index 1f07213bcf1bd74e2c13602c0a605e22e2845b49..ee464388472bd9bde84fc1d8dab8ba2318842b80 100644 --- a/Applications/DataExplorer/DataView/StratView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/StratView/CMakeLists.txt @@ -57,7 +57,7 @@ add_library(QtStratView STATIC # Link Qt library target_link_libraries(QtStratView - ${QT_LIBRARIES} + Qt4::QtGui BaseLib GeoLib MathLib diff --git a/Applications/DataExplorer/VtkAct/CMakeLists.txt b/Applications/DataExplorer/VtkAct/CMakeLists.txt index 55a17f8932cac944af01b0ebf45690d81615fa0d..ed3648734475fc06e540a2c314ea936aa21c4541 100644 --- a/Applications/DataExplorer/VtkAct/CMakeLists.txt +++ b/Applications/DataExplorer/VtkAct/CMakeLists.txt @@ -39,6 +39,6 @@ add_library( VtkAct STATIC include(AddCatalystDependency) ADD_CATALYST_DEPENDENCY(VtkAct) -target_link_libraries( VtkAct ${QT_LIBRARIES} ) +target_link_libraries( VtkAct Qt4::QtGui ) set_property(TARGET VtkAct PROPERTY FOLDER "DataExplorer") diff --git a/Applications/DataExplorer/VtkVis/CMakeLists.txt b/Applications/DataExplorer/VtkVis/CMakeLists.txt index 82038dc9018b1d2a1d43b34c0a8e2b5a45515279..ad3a74b1173c658ff3da837cd514f0ac75dc6bc9 100644 --- a/Applications/DataExplorer/VtkVis/CMakeLists.txt +++ b/Applications/DataExplorer/VtkVis/CMakeLists.txt @@ -156,7 +156,7 @@ if(GEOTIFF_FOUND) target_link_libraries(VtkVis ${GEOTIFF_LIBRARIES}) endif() # GEOTIFF_FOUND -target_link_libraries(VtkVis ${QT_LIBRARIES}) +target_link_libraries(VtkVis Qt4::QtGui) add_dependencies(VtkVis QtDataView) diff --git a/Applications/DataExplorer/exe-icon.rc b/Applications/DataExplorer/exe-icon.rc index 1e5fc317137b5a9d2b7a172decece8dbf23ebce8..b6cc85448d6cd57b32d8fcbefcc967a0bb93674f 100644 --- a/Applications/DataExplorer/exe-icon.rc +++ b/Applications/DataExplorer/exe-icon.rc @@ -1 +1 @@ - IDI_ICON1 ICON DISCARDABLE "..\..\..\scripts\packaging\ogs-de-icon.ico" \ No newline at end of file + IDI_ICON1 ICON DISCARDABLE "../../../scripts/packaging/ogs-de-icon.ico" diff --git a/BaseLib/CMakeLists.txt b/BaseLib/CMakeLists.txt index f6feac94ef89dd7a95153345a4c1211dc73eda79..5d4571265c6a3a910534e67b3c3a4886601611f4 100644 --- a/BaseLib/CMakeLists.txt +++ b/BaseLib/CMakeLists.txt @@ -15,6 +15,6 @@ target_link_libraries(BaseLib ${Boost_LIBRARIES} ) -if(WIN32) - target_link_libraries(BaseLib WinMM) +if(TARGET Eigen) + add_dependencies(BaseLib Eigen) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index ddb1c3c4a9f8f1f0e6fb25254b744f2bf9619678..afefa80dd209d3a49a5a31a802615ea8488f0a83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,13 +3,11 @@ ##################### # Specify minimum CMake version -cmake_minimum_required(VERSION 2.8.8) +cmake_minimum_required(VERSION 3.1) # Set CMake policies cmake_policy(SET CMP0011 OLD) -if(CMAKE_VERSION VERSION_GREATER 3.0.2) - cmake_policy(SET CMP0054 NEW) -endif() +cmake_policy(SET CMP0054 NEW) # Project name project( OGS-6 ) diff --git a/FileIO/CMakeLists.txt b/FileIO/CMakeLists.txt index 96435c22b1f479a0205e762e270c63096da3b803..b5a08d1f30bdcf7fc71537a7e0693b470bdd42c9 100644 --- a/FileIO/CMakeLists.txt +++ b/FileIO/CMakeLists.txt @@ -59,6 +59,9 @@ target_link_libraries(FileIO zlib shp ) +if(QT4_FOUND) + target_link_libraries(FileIO Qt4::QtXml Qt4::QtXmlPatterns) +endif() ADD_CATALYST_DEPENDENCY(FileIO) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 4e62a27879f98049e69f9c2739d98d43e4775125..438296035dc00cff605c8fa53dad8dac661d3d64 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -41,9 +41,6 @@ include_directories( add_executable(testrunner testrunner.cpp ${TEST_SOURCES}) set_target_properties(testrunner PROPERTIES FOLDER Testing) -if(TARGET Eigen) - add_dependencies(testrunner Eigen) -endif() target_link_libraries(testrunner GTest @@ -81,7 +78,13 @@ if(OGS_BUILD_GUI) endif() if(QT4_FOUND) - target_link_libraries(testrunner ${QT_LIBRARIES}) + target_link_libraries(testrunner Qt4::QtCore Qt4::QtGui Qt4::QtXml Qt4::QtNetwork) + if(CMAKE_CROSSCOMPILING) + target_link_libraries(testrunner + ${QT_XML_DEPS_LIBRARIES} + ${QT_GUI_DEPS_LIBRARIES} + ${QT_NETWORK_DEPS_LIBRARIES}) + endif() endif() include(AddCatalystDependency) diff --git a/Tests/testrunner.cpp b/Tests/testrunner.cpp index 330baad5b046499942c5f1271f22b1fe55ffa7f3..27528a014377842faf2e556d9672f74b3d453775 100644 --- a/Tests/testrunner.cpp +++ b/Tests/testrunner.cpp @@ -32,7 +32,7 @@ #include "BaseLib/LogogCustomCout.h" #include "BaseLib/TemplateLogogFormatterSuppressedGCC.h" -#ifdef QT4_FOUND +#ifdef OGS_BUILD_GUI #include <QApplication> #endif @@ -40,7 +40,7 @@ int main(int argc, char* argv[]) { setlocale(LC_ALL, "C"); -#ifdef QT4_FOUND +#ifdef OGS_BUILD_GUI QApplication app(argc, argv, false); #endif int ret = 0; diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake index bc38d8fc396e1c66a14bcad9b0a9a492ff50f3c8..4b72f76fbe36244e4d6626fd6907725f217e942a 100644 --- a/scripts/cmake/CompilerSetup.cmake +++ b/scripts/cmake/CompilerSetup.cmake @@ -100,8 +100,11 @@ if (WIN32) DisableCompilerFlag(DEBUG /RTC1) # cygwin else() - message (STATUS "Might be GCC under cygwin.") - add_definitions( -DGCC ) + if(CMAKE_CROSSCOMPILING) + message(STATUS "Crosscompiling for Windows with MinGW.") + else() + message(STATUS "Might be GCC under cygwin.") + endif() endif() endif () diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake index d0269a98ded5e89a9297c8c40db06400d4bbd231..bd2dd5ed3ca3ca8db4ac212cfdf2092d997e07e9 100644 --- a/scripts/cmake/Find.cmake +++ b/scripts/cmake/Find.cmake @@ -71,33 +71,37 @@ if(OGS_NO_EXTERNAL_LIBS) return() endif() # OGS_NO_EXTERNAL_LIBS -find_package(OpenMP) +find_package(OpenMP QUIET) if(OPENMP_FOUND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + message(STATUS "OpenMP enabled.") endif() find_package(Metis QUIET) ## Qt4 library ## -if(NOT OGS_DONT_USE_QT) - find_package( Qt4 4.7) -endif() - -if(QT4_FOUND) - # Enable more modules - set(QT_USE_QTOPENGL TRUE) - set(QT_USE_QTSQL TRUE) - set(QT_USE_QTTEST TRUE) - set(QT_USE_QTXML TRUE) - set(QT_USE_QTXMLPATTERNS TRUE) - include( ${QT_USE_FILE} ) - add_definitions(${QT_DEFINITIONS} -DQT4_FOUND) +if(OGS_BUILD_GUI) + find_package( Qt4 4.7 REQUIRED QtGui QtXml QtXmlPatterns) + cmake_policy(SET CMP0020 NEW) + if(CMAKE_CROSSCOMPILING) + find_package(PkgConfig REQUIRED) + pkg_check_modules(QT_XML_DEPS REQUIRED QtXml) + list(REMOVE_ITEM QT_XML_DEPS_LIBRARIES QtXml QtCore) + pkg_check_modules(QT_GUI_DEPS REQUIRED QtGui) + list(REMOVE_ITEM QT_GUI_DEPS_LIBRARIES QtGui QtCore) + pkg_check_modules(QT_NETWORK_DEPS REQUIRED QtNetwork) + list(REMOVE_ITEM QT_NETWORK_DEPS_LIBRARIES QtNetwork QtCore) + endif() endif() ## pthread ## +if(CMAKE_CROSSCOMPILING) + set(THREADS_PTHREAD_ARG 0 CACHE STRING "Result from TRY_RUN" FORCE) +endif() set(CMAKE_THREAD_PREFER_PTHREAD ON) -find_package(Threads) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) if(CMAKE_USE_PTHREADS_INIT) set(HAVE_PTHREADS TRUE) add_definitions(-DHAVE_PTHREADS) diff --git a/scripts/cmake/packaging/PackagingWin.cmake b/scripts/cmake/packaging/PackagingWin.cmake index 26894f30b89745711772a27f5c063ab69518bedb..d92206d56b6bd1f3a24a7080c49b5c5646e3cf9f 100644 --- a/scripts/cmake/packaging/PackagingWin.cmake +++ b/scripts/cmake/packaging/PackagingWin.cmake @@ -1,6 +1,9 @@ set(CMAKE_INSTALL_OPENMP_LIBRARIES ON) include(InstallRequiredSystemLibraries) -set(CPACK_GENERATOR NSIS ZIP) +set(CPACK_GENERATOR ZIP) +if(NOT CMAKE_CROSSCOMPILING) + set(CPACK_GENERATOR NSIS ZIP) +endif() set(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/scripts/packaging/ogs-de-icon.ico) file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/Documentation/OpenGeoSys-Logo.bmp" BACKGROUND_IMAGE) set(CPACK_PACKAGE_ICON ${BACKGROUND_IMAGE})