Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: export -DGDAL_DEBUG as PUBLIC for debug builds #11314

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions autotest/postinstall/test_cpp/test_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@
#endif
#include <cpl_vsi_virtual.h>
#include <ogr_geometry.h>
#include <ogr_spatialref.h>

int main(int argc, char **argv)
{
OGRGeometry *poGeom = nullptr;
OGRGeometryFactory::createFromWkt("POINT(1 2)", nullptr, &poGeom);
OGRGeometryFactory::destroyGeometry(poGeom);
std::cout << GDALVersionInfo("RELEASE_NAME") << std::endl;

// Check fix for https://github.com/OSGeo/gdal/issues/11311
OGRSpatialReference oSRS;
int nEntries = 0;
int *panMatchCondidence = nullptr;
oSRS.FindMatches(nullptr, &nEntries, &panMatchCondidence);
CPLFree(panMatchCondidence);

return (0);
}
4 changes: 4 additions & 0 deletions gdal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ if (MINGW AND BUILD_SHARED_LIBS)
set_target_properties(${GDAL_LIB_TARGET_NAME} PROPERTIES SUFFIX "-${GDAL_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif ()

# Some of the types in our public headers are dependent on whether GDAL_DEBUG
# is defined or not
target_compile_definitions(${GDAL_LIB_TARGET_NAME} PUBLIC $<$<CONFIG:DEBUG>:GDAL_DEBUG>)

# Install properties
if (GDAL_ENABLE_MACOSX_FRAMEWORK)
set(FRAMEWORK_VERSION ${GDAL_VERSION_MAJOR}.${GDAL_VERSION_MINOR})
Expand Down
10 changes: 5 additions & 5 deletions ogr/ogr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool CPL_DLL OGRGetGEOSVersion(int *pnMajor, int *pnMinor, int *pnPatch);
/*! @cond Doxygen_Suppress */
#define DEFINEH_OGRGeometryH
/*! @endcond */
#ifdef DEBUG
#if defined(DEBUG) || defined(GDAL_DEBUG)
typedef struct OGRGeometryHS *OGRGeometryH;
#else
/** Opaque type for a geometry */
Expand All @@ -57,7 +57,7 @@ typedef void *OGRGeometryH;
/*! @endcond */

#ifndef DOXYGEN_XML
#ifdef DEBUG
#if defined(DEBUG) || defined(GDAL_DEBUG)
typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH;
typedef struct OGRCoordinateTransformationHS *OGRCoordinateTransformationH;
#else
Expand Down Expand Up @@ -396,7 +396,7 @@ int CPL_DLL OGRPreparedGeometryContains(OGRPreparedGeometryH hPreparedGeom,
/*! @cond Doxygen_Suppress */
#define DEFINE_OGRFeatureH
/*! @endcond */
#ifdef DEBUG
#if defined(DEBUG) || defined(GDAL_DEBUG)
typedef struct OGRFieldDefnHS *OGRFieldDefnH;
typedef struct OGRFeatureDefnHS *OGRFeatureDefnH;
typedef struct OGRFeatureHS *OGRFeatureH;
Expand Down Expand Up @@ -667,7 +667,7 @@ const char CPL_DLL *OGR_GlobFldDomain_GetGlob(OGRFieldDomainH);
/* ogrsf_frmts.h */
/* -------------------------------------------------------------------- */

#ifdef DEBUG
#if defined(DEBUG) || defined(GDAL_DEBUG)
typedef struct OGRLayerHS *OGRLayerH;
typedef struct OGRDataSourceHS *OGRDataSourceH;
typedef struct OGRDriverHS *OGRSFDriverH;
Expand Down Expand Up @@ -949,7 +949,7 @@ void CPL_DLL OGRCleanupAll(void);
/* ogrsf_featurestyle.h */
/* -------------------------------------------------------------------- */

#ifdef DEBUG
#if defined(DEBUG) || defined(GDAL_DEBUG)
typedef struct OGRStyleMgrHS *OGRStyleMgrH;
typedef struct OGRStyleToolHS *OGRStyleToolH;
#else
Expand Down
2 changes: 1 addition & 1 deletion ogr/ogr_feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/*! @cond Doxygen_Suppress */
#define DEFINE_OGRFeatureH
/*! @endcond */
#ifdef DEBUG
#if defined(DEBUG) || defined(GDAL_DEBUG)
typedef struct OGRFieldDefnHS *OGRFieldDefnH;
typedef struct OGRFeatureDefnHS *OGRFeatureDefnH;
typedef struct OGRFeatureHS *OGRFeatureH;
Expand Down
2 changes: 1 addition & 1 deletion ogr/ogr_geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/*! @cond Doxygen_Suppress */
#ifndef DEFINEH_OGRGeometryH
#define DEFINEH_OGRGeometryH
#ifdef DEBUG
#if defined(DEBUG) || defined(GDAL_DEBUG)
typedef struct OGRGeometryHS *OGRGeometryH;
#else
typedef void *OGRGeometryH;
Expand Down
2 changes: 1 addition & 1 deletion ogr/ogr_srs_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ const char CPL_DLL *OSRAxisEnumToName(OGRAxisOrientation eOrientation);
#define DEFINED_OGRSpatialReferenceH
/*! @endcond */

#ifdef DEBUG
#if defined(DEBUG) || defined(GDAL_DEBUG)
typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH;
typedef struct OGRCoordinateTransformationHS *OGRCoordinateTransformationH;
#else
Expand Down
2 changes: 1 addition & 1 deletion ogr/ograpispy.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* @since GDAL 2.0
*/

#ifdef DEBUG
#if defined(DEBUG) || defined(GDAL_DEBUG)
#define OGRAPISPY_ENABLED
#endif

Expand Down
2 changes: 1 addition & 1 deletion port/cpl_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void CPL_DLL CPLDebugProgress(const char *, CPL_FORMAT_STRING(const char *),
...) CPL_PRINT_FUNC_FORMAT(2, 3);
#endif

#ifdef DEBUG
#if defined(DEBUG) || defined(GDAL_DEBUG)
/** Same as CPLDebug(), but expands to nothing for non-DEBUG builds.
* @since GDAL 3.1
*/
Expand Down
Loading