From 7311b3eed209de4e2f60524706fdfc8b6519aec1 Mon Sep 17 00:00:00 2001 From: Mooiman Date: Mon, 23 Sep 2024 15:13:26 +0200 Subject: [PATCH] Update CMAKE files --- CMakeLists.txt | 56 +++++++++++++++++++++++---- packages/CMakeLists.txt | 84 +++++++++++++++++++++-------------------- 2 files changed, 91 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87aba48..2012f8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,49 @@ -cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.30.0) -set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) +# set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) project(qgis_umesh VERSION 0.15.0 LANGUAGES CXX) -set(CMAKE_PREFIX_PATH "c:/OSGeo4W/apps/Qt5/") -find_package(Qt5 COMPONENTS Widgets REQUIRED) -find_package(Boost 1.77.0 COMPONENTS REQUIRED) - set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if (MSVC) + message("*** MSVC ") + set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/../bin/x64) + set(CMAKE_CXX_COMPILER cl) + set(CMAKE_BUILD_TYPE Release) +endif() + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_PREFIX_PATH "c:/OSGeo4W/apps/Qt5/") +find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport) +if (Qt5_FOUND) + message("*** Qt5 found") +else() + message("*** Qt5 not found") +endif() + +# set(CMAKE_PREFIX_PATH "c:/boost/boost_1_85_0/") +find_package(Boost 1.85.0 REQUIRED COMPONENTS + date_time filesystem iostreams) +if(Boost_FOUND) + message("*** Boost found") +else() + message("*** Boost not found") +endif() + +find_package(netCDF 4.9.2 REQUIRED) +if(netCDF_FOUND) + message("*** netCDF found") +else() + message("*** netCDF not found") +endif() + set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) +# set(CMAKE_AUTORCC ON) # set(CMAKE_AUTOUIC ON) ################################################################################ @@ -35,7 +66,7 @@ set(CMAKE_CONFIGURATION_TYPES "Release" CACHE STRING "" FORCE ) - +# message("*** 1 ") ################################################################################ # Global compiler options ################################################################################ @@ -45,6 +76,7 @@ if(MSVC) set(CMAKE_CXX_FLAGS_DEBUG "") set(CMAKE_CXX_FLAGS_RELEASE "") endif() +# message("*** 2 ") ################################################################################ # Global linker options @@ -64,6 +96,8 @@ if(MSVC) set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}") set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}") endif() +# message("*** 3 ") + ################################################################################ # Nuget packages function stub. @@ -73,24 +107,30 @@ function(use_package TARGET PACKAGE VERSION) "Package \"${PACKAGE}\" with version \"${VERSION}\" " "for target \"${TARGET}\" is ignored!") endfunction() +# message("*** 4 ") ################################################################################ # Common utils ################################################################################ include(CMake/Utils.cmake) +# message("*** 5 ") ################################################################################ # Additional Global Settings(add specific info there) ################################################################################ include(CMake/GlobalSettingsInclude.cmake OPTIONAL) +# message("*** 6 ") ################################################################################ # Use solution folders feature ################################################################################ set_property(GLOBAL PROPERTY USE_FOLDERS ON) +# message("*** 7 ") ################################################################################ # Sub-projects ################################################################################ add_subdirectory(packages) +# message("*** 8 ") + diff --git a/packages/CMakeLists.txt b/packages/CMakeLists.txt index 3253eab..7dec43a 100644 --- a/packages/CMakeLists.txt +++ b/packages/CMakeLists.txt @@ -1,3 +1,8 @@ +message("*** Enter packages directory") + +set(CMAKE_AUTOMOC ON) +set(AUTOMOC_EXECUTABLE "c:/OSGeo4W/apps/Qt5/bin/moc.exe") + set(PROJECT_NAME qgis_umesh) ################################################################################ @@ -8,18 +13,6 @@ set(no_group_source_files ) source_group("" FILES ${no_group_source_files}) -#set(Generated_Files -# "generated/moc_add_current_view_window.cpp" -# "generated/moc_edit_observation_points_window.cpp" -# "generated/moc_map_property.cpp" -# "generated/moc_map_property_window.cpp" -# "generated/moc_map_time_manager_window.cpp" -# "generated/moc_MyDrawingCanvas.cpp" -# "generated/moc_MyEditTool.cpp" -# "generated/moc_my_date_time_edit.cpp" -# "generated/moc_QColorRampEditor.cpp" -# "generated/moc_qgis_umesh.cpp" -#) source_group("Generated Files" FILES ${Generated_Files}) set(Header_Files @@ -27,7 +20,7 @@ set(Header_Files "include/AbstractCanvasListener.h" "include/add_current_view_window.h" "include/data_struct.h" - "include/edit_observation_points_window.h" + "include/handle_vector_layers.h" "include/his_cf.h" "include/json_reader.h" "include/map_property.h" @@ -35,7 +28,7 @@ set(Header_Files "include/map_time_manager_window.h" "include/my_date_time_edit.h" "include/MyDrawingCanvas.h" - "include/MyEditTool.h" +# "include/MyEditTool.h" "include/netcdf.h" # "include/pattern.xpm" "include/perf_timer.h" @@ -54,14 +47,14 @@ source_group("Header Files" FILES ${Header_Files}) set(Source_Files "src/add_current_view_window.cpp" - "src/edit_observation_points_window.cpp" + "src/handle_vector_layers.cpp" "src/his_cf.cpp" "src/map_property.cpp" "src/map_property_window.cpp" "src/map_time_manager_window.cpp" "src/my_date_time_edit.cpp" "src/MyDrawingCanvas.cpp" - "src/MyEditTool.cpp" +# "src/MyEditTool.cpp" "src/perf_timer.cpp" "src/QColorRampEditor.cpp" "src/qgis_umesh.cpp" @@ -121,21 +114,28 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUN ################################################################################ # Include directories ################################################################################ -target_include_directories(${PROJECT_NAME} PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/.;" - "${CMAKE_CURRENT_SOURCE_DIR}/include;" - "c:/OSGeo4W/include;" - "c:/OSGeo4W/apps/qgis/include;" - "$ENV{QT5DIR64OSGEO}/include;" - "$ENV{QT5DIR64OSGEO}/include/ActiveQt;" - "$ENV{QT5DIR64OSGEO}/include/Qt;" - "$ENV{QT5DIR64OSGEO}/include/QtCore;" - "$ENV{QT5DIR64OSGEO}/include/QtGui;" - "$ENV{QT5DIR64OSGEO}/include/QtSvg;" - "$ENV{QT5DIR64OSGEO}/include/QtWidgets;" - "$ENV{QT5DIR64OSGEO}/include/QtXml;" - "$ENV{BOOST_INCLUDEDIR}" -) +if (MSVC) + message("*** MSVC ") + target_include_directories(${PROJECT_NAME} PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/.;" + "${CMAKE_CURRENT_SOURCE_DIR}/include;" + "c:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/include/" + "c:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt/" + "c:/OSGeo4W/include;" + "c:/OSGeo4W/apps/qgis/include;" + "$ENV{QT5DIROSGEO}/include;" + "$ENV{QT5DIROSGEO}/include/ActiveQt;" + "$ENV{QT5DIROSGEO}/include/Qt;" + "$ENV{QT5DIROSGEO}/include/QtCore;" + "$ENV{QT5DIROSGEO}/include/QtGui;" + "$ENV{QT5DIROSGEO}/include/QtSvg;" + "$ENV{QT5DIROSGEO}/include/QtWidgets;" + "$ENV{QT5DIROSGEO}/include/QtXml;" + "c:/boost/boost_1_85_0/" + ) +else() + message("*** not supported, ex. UCRT64 ") +endif() ################################################################################ # Compile definitions @@ -208,20 +208,20 @@ add_custom_command_if( ################################################################################ set(ADDITIONAL_LIBRARY_DEPENDENCIES "$<$:" - "qtmaind;" - "Qt5Cored;" - "Qt5Guid;" - "Qt5Widgetsd;" - "Qt5PrintSupportd" + "qtmain" + "Qt5Core" + "Qt5Gui" + "Qt5Widgets" + "Qt5PrintSupport" "qgis_analysis" "qgis_core" "qgis_gui" ">" "$<$:" - "qtmain;" - "Qt5Core;" - "Qt5Gui;" - "Qt5Widgets;" + "qtmain" + "Qt5Core" + "Qt5Gui" + "Qt5Widgets" "Qt5PrintSupport" "qgis_analysis" "qgis_core" @@ -232,8 +232,10 @@ set(ADDITIONAL_LIBRARY_DEPENDENCIES target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}") target_link_directories(${PROJECT_NAME} PRIVATE - "$ENV{QT5DIR64OSGEO}/lib;" + "$ENV{QT5DIROSGEO}/lib;" "c:/OSGeoW/apps/qgis/lib" "${CMAKE_CURRENT_SOURCE_DIR}/../lib/${CMAKE_VS_PLATFORM_NAME}/$" ) +message("*** Exiting packages directory") +