Skip to content

Commit

Permalink
avoid core relinking on cmake changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Dec 19, 2015
1 parent 60f246a commit 89583b7
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 27 deletions.
2 changes: 0 additions & 2 deletions resources/CMakeLists.txt
Expand Up @@ -2,5 +2,3 @@ INSTALL(FILES srs.db qgis.db symbology-ng-style.db spatialite.db customization.x
DESTINATION ${QGIS_DATA_DIR}/resources)
INSTALL(DIRECTORY cpt-city-qgis-min DESTINATION ${QGIS_DATA_DIR}/resources)
INSTALL(DIRECTORY themes DESTINATION ${QGIS_DATA_DIR}/resources)

ADD_SUBDIRECTORY(context_help)
20 changes: 0 additions & 20 deletions resources/context_help/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion resources/context_help/QgsIdentifyResultsDialog
@@ -1,6 +1,6 @@
<h3>Identify Features</h3>
<p>
The results dialog shows all the features identified within the search tolerance. To see the results details, expand the feature information on the left of each feature.
The result dialog shows all the features identified within the search tolerance. To see the results details, expand the feature information on the left of each feature.
</p>
<p>
The search radius can be set in the options dialog <label>Settings > Options > Map tools</label>, Identify section, as a percentage of map width. In this section you may also set identify mode to <label>Current layer</label>, <label>Top down, stop at first</label>, <label>Top down</label>. <br>
Expand Down
24 changes: 24 additions & 0 deletions scripts/process_contexthelp.py
@@ -0,0 +1,24 @@
import os
import glob
import sys

cpp = open(sys.argv[1], "w")
cpp.write(
"#include \"qgscontexthelp.h\"\n"
"#include <QCoreApplication>\n\n"
"QHash<QString, QString> QgsContextHelp::gContextHelpTexts;\n"
"\n"
"void QgsContextHelp::init()\n"
"{\n"
" if( !gContextHelpTexts.isEmpty() )\n"
" return;\n"
)

for f in sorted(glob.glob('resources/context_help/*')):
n = os.path.basename(f)
with open(f) as content:
cpp.write("\n gContextHelpTexts.insert( \"{0}\", QCoreApplication::translate( \"context_help\", \"{1}\") );".format(
n, content.read().replace("\\", "&#92;").replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n"\n\"')))

cpp.write("\n}\n")
cpp.close()
16 changes: 12 additions & 4 deletions src/core/CMakeLists.txt
Expand Up @@ -336,10 +336,18 @@ STRING(REPLACE "$" "$$" JSON_HELP_FILES "${JSON_HELP_FILES}")
STRING(REPLACE "\(" "\\(" JSON_HELP_FILES "${JSON_HELP_FILES}")
STRING(REPLACE "\)" "\\)" JSON_HELP_FILES "${JSON_HELP_FILES}")
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/qgsexpression_texts.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/process_function_template.py ${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp.temp
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp.temp -DDST=${CMAKE_CURRENT_SOURCE_DIR}/qgsexpression_texts.cpp -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
DEPENDS ${JSON_HELP_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/process_function_template.py ${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp.temp
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp.temp -DDST=${CMAKE_CURRENT_SOURCE_DIR}/qgsexpression_texts.cpp -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
DEPENDS ${JSON_HELP_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

FILE(GLOB CONTEXT_HELP_FILES "${CMAKE_SOURCE_DIR}/resources/context_help/*")
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/qgscontexthelp_texts.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/process_contexthelp.py ${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp.temp
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp.temp -DDST=${CMAKE_CURRENT_SOURCE_DIR}/qgscontexthelp_texts.cpp -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
DEPENDS ${CONTEXT_HELP_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

IF(ENABLE_MODELTEST)
Expand Down

1 comment on commit 89583b7

@m-kuhn
Copy link
Member

@m-kuhn m-kuhn commented on 89583b7 Dec 19, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 great!!

Please sign in to comment.