Skip to content
Permalink
Browse files

fix 7454d87

  • Loading branch information
jef-n committed Apr 13, 2016
1 parent 7454d87 commit cbf7b5c0df568fc8911f10cd50359cdb2daa97a3
Showing with 40 additions and 40 deletions.
  1. +38 −38 CMakeLists.txt
  2. +1 −1 cmake_templates/Doxyfile.in
  3. +1 −1 doc/CMakeLists.txt
@@ -16,44 +16,7 @@ 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}")

#############################################################
# 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})")
MESSAGE(STATUS "QGIS version: ${COMPLETE_VERSION} ${RELEASE_NAME} (${QGIS_VERSION_INT})")

#############################################################
# CMake settings
@@ -772,6 +735,43 @@ 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 ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.inc
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 for /f \"usebackq tokens=1\" %%a in "(`\"${GITCOMMAND}\" log -n1 --oneline`)" do echo PROJECT_NUMBER = \"${COMPLETE_VERSION}-${RELEASE_NAME} \(%%a\)\" >${CMAKE_CURRENT_BINARY_DIR}/qgsversion.inc
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 ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.inc
COMMAND ${GITCOMMAND} log -n1 --pretty=\#define\\ QGSVERSION\\ \\"%h\\" >${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h.temp
COMMAND ${GITCOMMAND} log -n1 --pretty='PROJECT_NUMBER = \"${COMPLETE_VERSION}-${RELEASE_NAME} \(%h\)\"' >${CMAKE_CURRENT_BINARY_DIR}/qgsversion.inc
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\"")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.inc "${COMPLETE_VERSION}-${RELEASE_NAME}")
ENDIF(GITCOMMAND)
ELSE (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
SET(REVISION "exported")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h "#define QGSVERSION \"exported\"")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.inc "${COMPLETE_VERSION}-${RELEASE_NAME}")
ENDIF (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)

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

#############################################################
@@ -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@ (@QGSVERSION@)"
@INCLUDE = "@CMAKE_BINARY_DIR@/qgsversion.inc"

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@@ -44,7 +44,7 @@ IF(WITH_APIDOC)
ADD_CUSTOM_TARGET(apidoc ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS qgis_core qgis_gui qgis_analysis
DEPENDS qgis_core qgis_gui qgis_analysis version
COMMENT "Generating API documentation" VERBATIM)
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api/html/ DESTINATION ${QGIS_DATA_DIR}/doc/api)
INSTALL(FILES ../images/icons/qgis-icon-60x60.png DESTINATION ${QGIS_DATA_DIR}/doc/api)

0 comments on commit cbf7b5c

Please sign in to comment.
You can’t perform that action at this time.