Skip to content

Commit

Permalink
doxygen: include sha in PROJECT_NUMBER
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Apr 13, 2016
1 parent e023363 commit 7454d87
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 55 deletions.
72 changes: 38 additions & 34 deletions CMakeLists.txt
Expand Up @@ -16,7 +16,44 @@ ENDIF (APPLE)

# Note the version no is Mmmpp for Major/minor/patch, 0-padded, thus '10100' for 1.1.0
MATH(EXPR QGIS_VERSION_INT "${CPACK_PACKAGE_VERSION_MAJOR}*10000+${CPACK_PACKAGE_VERSION_MINOR}*100+${CPACK_PACKAGE_VERSION_PATCH}")
MESSAGE(STATUS "QGIS version: ${COMPLETE_VERSION} ${RELEASE_NAME} (${QGIS_VERSION_INT})")

#############################################################
# create qgsversion.h
IF (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
FIND_PROGRAM(GITCOMMAND git PATHS c:/cygwin/bin)
IF(GITCOMMAND)
IF(WIN32)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h
COMMAND for /f \"usebackq tokens=1\" %%a in "(`\"${GITCOMMAND}\" log -n1 --oneline`)" do echo \#define QGSVERSION \"%%a\" >${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp -DDST=${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/.git/index
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
ELSE(WIN32)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h
COMMAND ${GITCOMMAND} log -n1 --pretty=\#define\\ QGSVERSION\\ \\"%h\\" >${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp
COMMAND ${GITCOMMAND} config remote.$$\(${GITCOMMAND} config branch.$$\(${GITCOMMAND} name-rev --name-only HEAD\).remote\).url | sed -e 's/^/\#define QGS_GIT_REMOTE_URL \"/' -e 's/$$/\"/' >>${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp -DDST=${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/.git/index
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
ENDIF(WIN32)
ELSE(GITCOMMAND)
MESSAGE(STATUS "git marker, but no git found - version will be unknown")
SET(REVISION "unknown")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h "#define QGSVERSION \"unknown\"")
ENDIF(GITCOMMAND)
ELSE (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
SET(REVISION "exported")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h "#define QGSVERSION \"exported\"")
ENDIF (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)

FILE(READ ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h VERSIONFILE)
STRING(REGEX REPLACE "^.*#define QGSVERSION \"([^\"]+)\".*$" "\\1" QGSVERSION "${VERSIONFILE}")

MESSAGE(STATUS "QGIS version: ${COMPLETE_VERSION} ${RELEASE_NAME} (${QGIS_VERSION_INT} / ${QGSVERSION})")

#############################################################
# CMake settings
Expand Down Expand Up @@ -735,39 +772,6 @@ INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
# that may be in the same install prefix
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src/core ${CMAKE_BINARY_DIR}/src/gui)

#############################################################
# create qgsversion.h
IF (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
FIND_PROGRAM(GITCOMMAND git PATHS c:/cygwin/bin)
IF(GITCOMMAND)
IF(WIN32)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h
COMMAND for /f \"usebackq tokens=1\" %%a in "(`\"${GITCOMMAND}\" log -n1 --oneline`)" do echo \#define QGSVERSION \"%%a\" >${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp -DDST=${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/.git/index
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
ELSE(WIN32)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h
COMMAND ${GITCOMMAND} log -n1 --pretty=\#define\\ QGSVERSION\\ \\"%h\\" >${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp
COMMAND ${GITCOMMAND} config remote.$$\(${GITCOMMAND} config branch.$$\(${GITCOMMAND} name-rev --name-only HEAD\).remote\).url | sed -e 's/^/\#define QGS_GIT_REMOTE_URL \"/' -e 's/$$/\"/' >>${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp -DDST=${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/.git/index
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
ENDIF(WIN32)
ELSE(GITCOMMAND)
MESSAGE(STATUS "git marker, but no git found - version will be unknown")
SET(REVISION "unknown")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h "#define QGSVERSION \"unknown\"")
ENDIF(GITCOMMAND)
ELSE (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
SET(REVISION "exported")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h "#define QGSVERSION \"exported\"")
ENDIF (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)

ADD_CUSTOM_TARGET(version ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h)

#############################################################
Expand Down
2 changes: 1 addition & 1 deletion cmake_templates/Doxyfile.in
Expand Up @@ -31,7 +31,7 @@ PROJECT_NAME = "QGIS API Documentation"
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = "@COMPLETE_VERSION@-@RELEASE_NAME@"
PROJECT_NUMBER = "@COMPLETE_VERSION@-@RELEASE_NAME@ (@QGSVERSION@)"

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
Expand Down
18 changes: 17 additions & 1 deletion python/core/dxf/qgsdxfexport.sip
Expand Up @@ -117,7 +117,7 @@ class QgsDxfExport
* Get DXF palette index of nearest entry for given color
* @param color
*/
static int closestColorMatch( QRgb pixel );
static int closestColorMatch( QRgb color );

/**
* Get layer name for feature
Expand Down Expand Up @@ -270,4 +270,20 @@ class QgsDxfExport
//! return list of available DXF encodings
static QStringList encodings();

/** Output the label
* @param layerId id of the layer
* @param context render context
* @param label position of label
* @param settings label settings
* @note not available in Python bindings
*/
// void drawLabel( QString layerId, QgsRenderContext& context, pal::LabelPosition* label, const QgsPalLayerSettings &settings );

/** Register name of layer for feature
* @param layerId id of layer
* @param fid id of feature
* @param layer dxf layer of feature
*/
void registerDxfLayer( QString layerId, QgsFeatureId fid, QString layer );

};
14 changes: 12 additions & 2 deletions src/core/dxf/qgsdxfexport.h
Expand Up @@ -290,10 +290,20 @@ class CORE_EXPORT QgsDxfExport
//! return list of available DXF encodings
static QStringList encodings();

//! output the label
/** Output the label
* @param layerId id of the layer
* @param context render context
* @param label position of label
* @param settings label settings
* @note not available in Python bindings
*/
void drawLabel( QString layerId, QgsRenderContext& context, pal::LabelPosition* label, const QgsPalLayerSettings &settings );

//! register name of layer for feature
/** Register name of layer for feature
* @param layerId id of layer
* @param fid id of feature
* @param layer dxf layer of feature
*/
void registerDxfLayer( QString layerId, QgsFeatureId fid, QString layer );

private:
Expand Down
37 changes: 21 additions & 16 deletions src/core/dxf/qgsdxfpallabeling.h
Expand Up @@ -39,15 +39,17 @@ class QgsDxfLabelProvider : public QgsVectorLayerLabelProvider
//! construct the provider
explicit QgsDxfLabelProvider( QgsVectorLayer* layer, QgsDxfExport* dxf, const QgsPalLayerSettings *settings );

//! re-implementation that writes to DXF file instead of drawing with QPainter
// @param context render context
// @param label label
/** Re-implementation that writes to DXF file instead of drawing with QPainter
* @param context render context
* @param label label
*/
void drawLabel( QgsRenderContext& context, pal::LabelPosition* label ) const override;

//! registration method that keeps track of DXF layer names of individual features
// @param feature feature
// @param context render context
// @param dxfLayerName name of dxf layer
/** Registration method that keeps track of DXF layer names of individual features
* @param feature feature
* @param context render context
* @param dxfLayerName name of dxf layer
*/
void registerDxfFeature( QgsFeature& feature, QgsRenderContext &context, const QString& dxfLayerName );

protected:
Expand All @@ -67,19 +69,22 @@ class QgsDxfRuleBasedLabelProvider : public QgsRuleBasedLabelProvider
//! construct the provider
explicit QgsDxfRuleBasedLabelProvider( const QgsRuleBasedLabeling &rules, QgsVectorLayer* layer, QgsDxfExport* dxf );

//! reinitialize the subproviders with QgsDxfLabelProviders
//@param layer layer
/** Reinitialize the subproviders with QgsDxfLabelProviders
* @param layer layer
*/
void reinit( QgsVectorLayer* layer );

//! re-implementation that writes to DXF file instead of drawing with QPainter
// @param context render context
// @param label label
/** Re-implementation that writes to DXF file instead of drawing with QPainter
* @param context render context
* @param label label
*/
void drawLabel( QgsRenderContext &context, pal::LabelPosition *label ) const override;

//! registration method that keeps track of DXF layer names of individual features
// @param feature feature
// @param context render context
// @param dxfLayerName name of dxf layer
/** Registration method that keeps track of DXF layer names of individual features
* @param feature feature
* @param context render context
* @param dxfLayerName name of dxf layer
*/
void registerDxfFeature( QgsFeature& feature, QgsRenderContext &context, const QString& dxfLayerName );

//! create QgsDxfLabelProvider
Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsrulebasedlabeling.h
Expand Up @@ -310,9 +310,10 @@ class CORE_EXPORT QgsRuleBasedLabelProvider : public QgsVectorLayerLabelProvider

virtual void registerFeature( QgsFeature& feature, QgsRenderContext& context, QgsGeometry* obstacleGeometry = nullptr ) override;

// new methods
//! create a label provider
virtual QgsVectorLayerLabelProvider *createProvider( QgsVectorLayer *layer, bool withFeatureLoop, const QgsPalLayerSettings *settings );

//! return subproviders
virtual QList<QgsAbstractLabelProvider*> subProviders() override;

protected:
Expand Down

0 comments on commit 7454d87

Please sign in to comment.