Skip to content

Commit

Permalink
Fix Windows Debug Build
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Jan 23, 2025
1 parent dd73a6b commit 48ad866
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 28 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.22.1)
cmake_minimum_required(VERSION 3.25)

list(APPEND CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake
Expand Down Expand Up @@ -117,6 +117,8 @@ if(CMAKE_CROSSCOMPILING AND ANDROID)
endif()

set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")

# https://cmake.org/cmake/help/latest/policy/CMP0168.html#policy:CMP0168
if(POLICY CMP0168)
Expand Down Expand Up @@ -288,6 +290,11 @@ endif()

cmake_dependent_option(QGC_BUILD_DEPENDENCIES "Force Building of Dependencies." OFF "NOT CMAKE_CROSSCOMPILING;NOT MACOS_UNIVERSAL_BUILD" ON)

include(CPM)
if(CMAKE_CROSSCOMPILING OR ANDROID OR MACOS_UNIVERSAL_BUILD)
set(CPM_DOWNLOAD_ALL ON CACHE BOOL "Download all Dependencies" FORCE)
endif()

#######################################################
# Custom Build Configuration
#######################################################
Expand Down
6 changes: 3 additions & 3 deletions cmake/find-modules/FindShapelib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ mark_as_advanced(Shapelib_INCLUDE_DIR Shapelib_LIBRARY)
if(Shapelib_FOUND)
set(Shapelib_INCLUDE_DIRS "${Shapelib_INCLUDE_DIR}")
set(Shapelib_LIBRARIES "${Shapelib_LIBRARY}")
if(NOT TARGET SHAPELIB::shp)
add_library(SHAPELIB::shp UNKNOWN IMPORTED)
set_target_properties(SHAPELIB::shp PROPERTIES
if(NOT TARGET shapelib::shp)
add_library(shapelib::shp UNKNOWN IMPORTED)
set_target_properties(shapelib::shp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Shapelib_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES C
IMPORTED_LOCATION "${Shapelib_LIBRARY}")
Expand Down
46 changes: 32 additions & 14 deletions src/AnalyzeView/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,39 @@ endif()

#===========================================================================#

include(CPM)
set(EXIV2_VERSION 0.28.3)

if(NOT QGC_BUILD_DEPENDENCIES)
if(MSVC)
set(EXIV2_RELEASE_URL "https://github.com/Exiv2/exiv2/releases/download/v${EXIV2_VERSION}/exiv2-${EXIV2_VERSION}-2019msvc64.zip")
elseif(LINUX)
set(EXIV2_RELEASE_URL "https://github.com/Exiv2/exiv2/releases/download/v${EXIV2_VERSION}/exiv2-${EXIV2_VERSION}-Linux64.tar.gz")
elseif(MACOS)
set(EXIV2_RELEASE_URL "https://github.com/Exiv2/exiv2/releases/download/v${EXIV2_VERSION}/exiv2-${EXIV2_VERSION}-Darwin.tar.gz")
endif()
endif()

if(EXIV2_RELEASE_URL)
include(CPM)
CPMAddPackage(
NAME exiv2
URL ${EXIV2_RELEASE_URL}
VERSION ${EXIV2_VERSION}
DOWNLOAD_ONLY
)

if(exiv2_ADDED)
target_include_directories(AnalyzeView PRIVATE ${exiv2_SOURCE_DIR}/include)
target_link_directories(AnalyzeView PUBLIC ${exiv2_SOURCE_DIR}/lib)
target_link_libraries(AnalyzeView PRIVATE exiv2)
return()
endif()
endif()

# https://github.com/libexpat/libexpat/releases/download/R_2_6_4/expat-win32bin-2.6.4.zip

CPMFindPackage(
NAME expat
NAME EXPAT
VERSION 2.2.6
GITHUB_REPOSITORY libexpat/libexpat
GIT_TAG "R_2_6_4"
Expand All @@ -123,25 +150,16 @@ CPMFindPackage(
"EXPAT_SHARED_LIBS OFF"
)

# if(MSVC)
# set(EXIV2_URL "https://github.com/Exiv2/exiv2/releases/download/v${EXIV2_VERSION}/exiv2-${EXIV2_VERSION}-2019msvc64.zip")
# elseif(LINUX)
# set(EXIV2_URL "https://github.com/Exiv2/exiv2/releases/download/v${EXIV2_VERSION}/exiv2-${EXIV2_VERSION}-Linux64.tar.gz")
# elseif(MACOS)
# set(EXIV2_URL "https://github.com/Exiv2/exiv2/releases/download/v${EXIV2_VERSION}/exiv2-${EXIV2_VERSION}-Darwin.tar.gz")
# endif()

if(TARGET EXPAT::EXPAT)
set(_EXIV2_ENABLE_XMP ON)
else()
set(_EXIV2_ENABLE_XMP OFF)
endif()

CPMAddPackage(
CPMFindPackage(
NAME exiv2
VERSION 0.28
VERSION ${EXIV2_VERSION}
GITHUB_REPOSITORY Exiv2/exiv2
GIT_TAG v0.28.3
OPTIONS
"EXIV2_ENABLE_XMP ${_EXIV2_ENABLE_XMP}"
"EXIV2_ENABLE_EXTERNAL_XMP OFF"
Expand All @@ -161,7 +179,7 @@ CPMAddPackage(
"EXIV2_BUILD_UNIT_TESTS OFF"
"EXIV2_BUILD_FUZZ_TESTS OFF"
"EXIV2_BUILD_DOC OFF"
"BUILD_WITH_CCACHE ON"
"BUILD_WITH_CCACHE OFF"
)

if(TARGET Exiv2::exiv2lib)
Expand Down
14 changes: 12 additions & 2 deletions src/Geo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ if(LINUX AND EXISTS "/usr/share/cmake/geographiclib")
endif()

include(CPM)
CPMAddPackage(
# CPMAddPackage(
# NAME geographiclib
# VERSION 2.5
# URL https://sourceforge.net/projects/geographiclib/files/distrib-C%2B%2B/GeographicLib-2.5.tar.gz/download
# DOWNLOAD_ONLY
# SOURCE_SUBDIR src
# )

CPMFindPackage(
NAME geographiclib
VERSION 2.3
VERSION 2.5
GITHUB_REPOSITORY geographiclib/geographiclib
GIT_TAG r2.5
OPTIONS
Expand All @@ -43,6 +51,8 @@ CPMAddPackage(
"PKGDIR OFF"
"DOCDIR OFF"
"EXAMPLEDIR OFF"
EXCLUDE_FROM_ALL
SYSTEM
)

if(TARGET GeographicLib::GeographicLib)
Expand Down
4 changes: 3 additions & 1 deletion src/Joystick/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if(WIN32)
endif()

CPMFindPackage(
NAME sdl2
NAME SDL2
VERSION 2.0.20
GITHUB_REPOSITORY libsdl-org/SDL
GIT_TAG release-2.30.11
Expand Down Expand Up @@ -118,4 +118,6 @@ CPMFindPackage(

if(TARGET SDL2::SDL2-static)
target_link_libraries(Joystick PRIVATE SDL2::SDL2-static)
elseif(TARGET SDL2::SDL2)
target_link_libraries(Joystick PRIVATE SDL2::SDL2)
endif()
15 changes: 10 additions & 5 deletions src/Utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,20 @@ endif()
#===========================================================================#

include(CPM)
CPMFindPackage(
NAME shapelib
VERSION 1.6.0
CPMAddPackage(
NAME Shapelib
VERSION 1.6.1
GITHUB_REPOSITORY OSGeo/shapelib
GIT_TAG v1.6.1
OPTIONS
"BUILD_SHAPELIB_CONTRIB OFF"
"BUILD_APPS OFF"
"BUILD_TESTING OFF"
)

target_link_libraries(Utilities PRIVATE shp)
if(Shapelib_ADDED)
if(TARGET shp)
target_link_libraries(Utilities PRIVATE shp)
elseif(TARGET shapelib::shp)
target_link_libraries(Utilities PRIVATE shapelib::shp)
endif()
endif()
9 changes: 7 additions & 2 deletions src/Utilities/Compression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ target_include_directories(Compression PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

include(CPM)
CPMFindPackage(
NAME zlib
NAME ZLIB
VERSION 1.3.1
GITHUB_REPOSITORY madler/zlib
OPTIONS
Expand All @@ -35,7 +35,12 @@ CPMFindPackage(
"ZLIB_USE_STATIC_LIBS ON"
)

target_link_libraries(Compression PRIVATE zlibstatic)
if(ZLIB_ADDED)
target_link_libraries(Compression PRIVATE zlibstatic)
else()
find_package(Qt6ZlibPrivate REQUIRED)
target_link_libraries(Compression PRIVATE Qt6::ZlibPrivate)
endif()

#===========================================================================#

Expand Down

0 comments on commit 48ad866

Please sign in to comment.