diff --git a/cmake/FindPDAL.cmake b/cmake/FindPDAL.cmake index 34a4ae5d756a..1899d26de5ff 100644 --- a/cmake/FindPDAL.cmake +++ b/cmake/FindPDAL.cmake @@ -26,7 +26,7 @@ FIND_PATH(PDAL_INCLUDE_DIR pdal/pdal.hpp ) FIND_PATH(PDAL_INCLUDE_DIR pdal/pdal.hpp) -FIND_LIBRARY(PDAL_CPP_LIBRARY NAMES pdalccpp libpdalcpp PATHS +FIND_LIBRARY(PDAL_CPP_LIBRARY NAMES pdalcpp libpdalcpp PATHS "$ENV{LIB_DIR}/lib" c:/msys/local/lib NO_DEFAULT_PATH diff --git a/cmake/PyQtMacros.cmake b/cmake/PyQtMacros.cmake index 8458f496eac6..95188b631cb8 100644 --- a/cmake/PyQtMacros.cmake +++ b/cmake/PyQtMacros.cmake @@ -9,15 +9,7 @@ SET(PYUIC_PROG_NAMES pyuic5) SET(PYRCC_PROG_NAME pyrcc5) IF(NOT PYUIC_PROGRAM) - IF (MSVC) - FIND_PROGRAM(PYUIC_PROGRAM - NAMES ${PYUIC_PROG_NAME}.bat - PATHS $ENV{LIB_DIR}/bin - ) - ELSE(MSVC) - FIND_PROGRAM(PYUIC_PROGRAM NAMES ${PYUIC_PROG_NAMES} PATHS $ENV{LIB_DIR}/bin) - ENDIF (MSVC) - + FIND_PROGRAM(PYUIC_PROGRAM NAMES ${PYUIC_PROG_NAMES} PATHS $ENV{LIB_DIR}/bin) IF (NOT PYUIC_PROGRAM) MESSAGE(FATAL_ERROR "pyuic5 not found - aborting") ENDIF (NOT PYUIC_PROGRAM) @@ -53,15 +45,7 @@ MACRO(PYQT_WRAP_UI outfiles ) ENDMACRO(PYQT_WRAP_UI) IF(NOT PYRCC_PROGRAM) - IF (MSVC) - FIND_PROGRAM(PYRCC_PROGRAM - NAMES ${PYRCC_PROG_NAME}.bat - PATHS $ENV{LIB_DIR}/bin - ) - ELSE(MSVC) - FIND_PROGRAM(PYRCC_PROGRAM ${PYRCC_PROG_NAME} PATHS $ENV{LIB_DIR}/bin) - ENDIF (MSVC) - + FIND_PROGRAM(PYRCC_PROGRAM NAMES ${PYRCC_PROG_NAME} PATHS $ENV{LIB_DIR}/bin) IF (NOT PYRCC_PROGRAM) MESSAGE(FATAL_ERROR "pyrcc5 not found - aborting") ENDIF (NOT PYRCC_PROGRAM) diff --git a/external/untwine/epf/FileProcessor.cpp b/external/untwine/epf/FileProcessor.cpp index 07e498bd910f..eae209fe9ad9 100644 --- a/external/untwine/epf/FileProcessor.cpp +++ b/external/untwine/epf/FileProcessor.cpp @@ -50,7 +50,11 @@ void FileProcessor::run() // This is some random cell that ultimately won't get used, but it contains a buffer // into which we can write data. Cell *cell = m_cellMgr.get(VoxelKey()); +#ifdef _MSC_VER + f.setCallback([this, &CountIncrement, &count, &limit, &cell](pdal::PointRef& point) +#else f.setCallback([this, &count, &limit, &cell](pdal::PointRef& point) +#endif { // Write the data into the point buffer in the cell. This is the *last* // cell buffer that we used. We're hoping that it's the right one. diff --git a/external/untwine/untwine/MapFile.cpp b/external/untwine/untwine/MapFile.cpp index ba205b38ad79..9d520a8826b5 100644 --- a/external/untwine/untwine/MapFile.cpp +++ b/external/untwine/untwine/MapFile.cpp @@ -30,6 +30,11 @@ #include "MapFile.hpp" +#ifdef _MSC_VER +#include +#include +#endif + namespace untwine { diff --git a/python/__init__.py b/python/__init__.py index 0eb585123acf..53627fb8fe1a 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -66,6 +66,10 @@ def setupenv(): # any of the QGIS modules or else it will error. setupenv() + if sys.version_info[0] > 3 or (sys.version_info[0] == 3 and sys.version_info[1] >= 9): + for p in os.getenv("PATH").split(";"): + if os.path.exists(p): + os.add_dll_directory(p) from qgis.PyQt import QtCore diff --git a/src/analysis/CMakeLists.txt b/src/analysis/CMakeLists.txt index 6951a5ecca11..ce2fd0a9b368 100644 --- a/src/analysis/CMakeLists.txt +++ b/src/analysis/CMakeLists.txt @@ -452,6 +452,9 @@ target_compile_features(qgis_analysis PRIVATE cxx_std_17) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_definitions(qgis_analysis PUBLIC _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) endif() +if (MSVC) + target_compile_definitions(qgis_analysis PUBLIC _HAS_AUTO_PTR_ETC=1) +endif() target_include_directories(qgis_analysis PUBLIC ${CMAKE_SOURCE_DIR}/src/analysis diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 8bed5854d72f..c99d6de3dd7a 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -420,9 +420,10 @@ if(HAVE_OPENCL) endif() if (HAVE_PDAL) - include_directories(SYSTEM - ${PDAL_INCLUDE_DIR} - ) + include_directories(SYSTEM ${PDAL_INCLUDE_DIR}) + if(MSVC) + add_definitions(-DWIN32_LEAN_AND_MEAN) + endif() endif() if(ENABLE_MODELTEST) @@ -603,9 +604,7 @@ if (POSTGRES_FOUND) endif() if (HAVE_PDAL) - target_link_libraries(qgis_app - ${PDAL_LIBRARIES} - ) + target_link_libraries(qgis_app ${PDAL_LIBRARIES}) endif() if(MSVC) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 16dcc2942258..9cd66ae9cb56 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -484,7 +484,7 @@ extern "C" #ifndef Q_OS_WIN #include #else -#include +#include #include #endif diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 8b3c33cc91d6..342b2c768081 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1644,9 +1644,7 @@ endif() protobuf_generate_cpp(VECTOR_TILE_PROTO_SRCS VECTOR_TILE_PROTO_HDRS vectortile/vector_tile.proto) set(QGIS_CORE_SRCS ${QGIS_CORE_SRCS} ${VECTOR_TILE_PROTO_SRCS}) set(QGIS_CORE_HDRS ${QGIS_CORE_HDRS} ${VECTOR_TILE_PROTO_HDRS}) -if (MSVC) - set_source_files_properties(${VECTOR_TILE_PROTO_SRCS} vectortile/qgsvectortilemvtdecoder.cpp vectortile/qgsvectortilemvtencoder.cpp vectortile/qgsvectortilewriter.cpp PROPERTIES COMPILE_DEFINITIONS PROTOBUF_USE_DLLS) -else() +if (NOT MSVC) # automatically generated file produces warnings (unused-parameter, unused-variable, misleading-indentation) set_source_files_properties(${VECTOR_TILE_PROTO_SRCS} PROPERTIES COMPILE_FLAGS -w) endif() diff --git a/src/core/auth/qgsauthmanager.h b/src/core/auth/qgsauthmanager.h index 0de97ed10ab2..31854a252675 100644 --- a/src/core/auth/qgsauthmanager.h +++ b/src/core/auth/qgsauthmanager.h @@ -757,7 +757,7 @@ class CORE_EXPORT QgsAuthManager : public QObject static QgsAuthManager *instance() SIP_SKIP; -#ifdef __MINGW32__ +#ifdef Q_OS_WIN public: explicit QgsAuthManager() SIP_SKIP; #else diff --git a/src/core/qgscoordinatereferencesystem.h b/src/core/qgscoordinatereferencesystem.h index ce7b2f376fb6..13d185b7944b 100644 --- a/src/core/qgscoordinatereferencesystem.h +++ b/src/core/qgscoordinatereferencesystem.h @@ -983,10 +983,10 @@ class CORE_EXPORT QgsCoordinateReferenceSystem friend class TestQgsCoordinateReferenceSystem; friend class QgsPostgresProvider; friend class QgsCoordinateReferenceSystemRegistry; - friend bool operator> ( const QgsCoordinateReferenceSystem &c1, const QgsCoordinateReferenceSystem &c2 ); - friend bool operator< ( const QgsCoordinateReferenceSystem &c1, const QgsCoordinateReferenceSystem &c2 ); - friend bool operator>= ( const QgsCoordinateReferenceSystem &c1, const QgsCoordinateReferenceSystem &c2 ); - friend bool operator<= ( const QgsCoordinateReferenceSystem &c1, const QgsCoordinateReferenceSystem &c2 ); + friend bool CORE_EXPORT operator> ( const QgsCoordinateReferenceSystem &c1, const QgsCoordinateReferenceSystem &c2 ); + friend bool CORE_EXPORT operator< ( const QgsCoordinateReferenceSystem &c1, const QgsCoordinateReferenceSystem &c2 ); + friend bool CORE_EXPORT operator>= ( const QgsCoordinateReferenceSystem &c1, const QgsCoordinateReferenceSystem &c2 ); + friend bool CORE_EXPORT operator<= ( const QgsCoordinateReferenceSystem &c1, const QgsCoordinateReferenceSystem &c2 ); bool createFromPostgisSrid( const long id ); }; diff --git a/src/providers/pdal/CMakeLists.txt b/src/providers/pdal/CMakeLists.txt index 6a928f1a9958..2f577ca32f15 100644 --- a/src/providers/pdal/CMakeLists.txt +++ b/src/providers/pdal/CMakeLists.txt @@ -1,6 +1,9 @@ ######################################################## # Files +if(MSVC) + add_definitions(-DWIN32_LEAN_AND_MEAN) +endif(MSVC) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED)