Skip to content
Snippets Groups Projects
Commit 032f27aa authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

Simplify CMake code to generate viewer_version.txt and summary.json.

The quoting used for the cygwin printf command didn't work for 'cmake -E
echo'. The whole content was enclosed in single quotes, with individual
string elements enclosed in double quotes. But we ended up with a summary.json
containing (e.g.):
'{Type:viewer,Version:3.7.26.33262}'
instead of the desired:
{"Type":"viewer","Version":"3.7.26.33262"}
HOWEVER: I see no compelling reason why either of these files must be deferred
to build time. It's simpler and more robust to generate them both directly
from CMake at configure time.
parent 611913f5
No related branches found
No related tags found
No related merge requests found
...@@ -1307,18 +1307,14 @@ source_group("CMake Rules" FILES ViewerInstall.cmake) ...@@ -1307,18 +1307,14 @@ source_group("CMake Rules" FILES ViewerInstall.cmake)
# the viewer_version.txt file created here is for passing to viewer_manifest and autobuild # the viewer_version.txt file created here is for passing to viewer_manifest and autobuild
# the summary.json file is created for the benefit of the TeamCity builds, where # the summary.json file is created for the benefit of the TeamCity builds, where
# it is used to provide descriptive information to the build results page # it is used to provide descriptive information to the build results page
add_custom_target(generate_viewer_version ALL file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt"
COMMENT Generating '${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt' for manifest processing "${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}\n")
COMMAND ${CMAKE_COMMAND} -E echo '${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}' > ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt file(WRITE "${CMAKE_BINARY_DIR}/summary.json"
"{\"Type\":\"viewer\",\"Version\":\"${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}\"}\n")
COMMENT Generating '${CMAKE_BINARY_DIR}/summary.json' for TeamCity builds
COMMAND ${CMAKE_COMMAND} -E echo '{"Type":"viewer","Version":"${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}"}' > ${CMAKE_BINARY_DIR}/summary.json
)
set_source_files_properties( set_source_files_properties(
llversioninfo.cpp tests/llversioninfo_test.cpp llversioninfo.cpp tests/llversioninfo_test.cpp
PROPERTIES PROPERTIES
DEPENDS generate_viewer_version # dummy dependency to force recompile every time
COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}" # see BuildVersion.cmake COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}" # see BuildVersion.cmake
) )
...@@ -1676,8 +1672,6 @@ if (WINDOWS) ...@@ -1676,8 +1672,6 @@ if (WINDOWS)
LINK_FLAGS_RELEASE "/FORCE:MULTIPLE /MAP\"secondlife-bin.MAP\" /OPT:REF /LARGEADDRESSAWARE" LINK_FLAGS_RELEASE "/FORCE:MULTIPLE /MAP\"secondlife-bin.MAP\" /OPT:REF /LARGEADDRESSAWARE"
) )
add_dependencies(${VIEWER_BINARY_NAME} generate_viewer_version)
if(USE_PRECOMPILED_HEADERS) if(USE_PRECOMPILED_HEADERS)
set_target_properties( set_target_properties(
${VIEWER_BINARY_NAME} ${VIEWER_BINARY_NAME}
...@@ -2002,8 +1996,6 @@ if (LINUX) ...@@ -2002,8 +1996,6 @@ if (LINUX)
llcommon llcommon
) )
add_dependencies(${VIEWER_BINARY_NAME} generate_viewer_version)
add_custom_command( add_custom_command(
OUTPUT ${product}.tar.bz2 OUTPUT ${product}.tar.bz2
COMMAND ${PYTHON_EXECUTABLE} COMMAND ${PYTHON_EXECUTABLE}
...@@ -2087,8 +2079,6 @@ if (DARWIN) ...@@ -2087,8 +2079,6 @@ if (DARWIN)
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app/Contents/Info.plist" "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app/Contents/Info.plist"
) )
add_dependencies(${VIEWER_BINARY_NAME} generate_viewer_version)
add_custom_command( add_custom_command(
TARGET ${VIEWER_BINARY_NAME} POST_BUILD TARGET ${VIEWER_BINARY_NAME} POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} COMMAND ${PYTHON_EXECUTABLE}
...@@ -2121,7 +2111,6 @@ if (DARWIN) ...@@ -2121,7 +2111,6 @@ if (DARWIN)
if (PACKAGE) if (PACKAGE)
add_custom_target(llpackage ALL DEPENDS ${VIEWER_BINARY_NAME}) add_custom_target(llpackage ALL DEPENDS ${VIEWER_BINARY_NAME})
add_dependencies(llpackage generate_viewer_version)
add_custom_command( add_custom_command(
TARGET llpackage POST_BUILD TARGET llpackage POST_BUILD
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment