Skip to content

Commit

Permalink
Update CMAKE files
Browse files Browse the repository at this point in the history
  • Loading branch information
mooiman committed Sep 23, 2024
1 parent c9a77d4 commit 7311b3e
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 49 deletions.
56 changes: 48 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

################################################################################
Expand All @@ -35,7 +66,7 @@ set(CMAKE_CONFIGURATION_TYPES
"Release"
CACHE STRING "" FORCE
)

# message("*** 1 ")
################################################################################
# Global compiler options
################################################################################
Expand All @@ -45,6 +76,7 @@ if(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
endif()
# message("*** 2 ")

################################################################################
# Global linker options
Expand All @@ -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.
Expand All @@ -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 ")


84 changes: 43 additions & 41 deletions packages/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

################################################################################
Expand All @@ -8,34 +13,22 @@ 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
"include/AbstractCanvas.h"
"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"
"include/map_property_window.h"
"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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -208,20 +208,20 @@ add_custom_command_if(
################################################################################
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"$<$<CONFIG:Debug>:"
"qtmaind;"
"Qt5Cored;"
"Qt5Guid;"
"Qt5Widgetsd;"
"Qt5PrintSupportd"
"qtmain"
"Qt5Core"
"Qt5Gui"
"Qt5Widgets"
"Qt5PrintSupport"
"qgis_analysis"
"qgis_core"
"qgis_gui"
">"
"$<$<CONFIG:Release>:"
"qtmain;"
"Qt5Core;"
"Qt5Gui;"
"Qt5Widgets;"
"qtmain"
"Qt5Core"
"Qt5Gui"
"Qt5Widgets"
"Qt5PrintSupport"
"qgis_analysis"
"qgis_core"
Expand All @@ -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}/$<CONFIG>"
)

message("*** Exiting packages directory")

0 comments on commit 7311b3e

Please sign in to comment.