mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Cmake build: Moved creation of variable LYX_GIT_COMMIT_HASH to development/cmake/scripts/LyXGetVersion.cmake.
1.) The only file which needs this define is src/version.cpp. Our use in config.h resulted in recompiling most of our sources. With this change, only version.cpp needs to be recompiled. 2.) Without reconfiguring, the old commit hash was still valid. Now the detection of commit hash is done at compile time.
This commit is contained in:
parent
61f0634abf
commit
81afd10fc7
@ -316,7 +316,6 @@ endforeach(_c_l)
|
||||
|
||||
FIND_PROGRAM(LYX_GITVERSION git)
|
||||
#message(STATUS "gitversion = ${LYX_GITVERSION}")
|
||||
set(LYX_GIT_COMMIT_HASH "none")
|
||||
set(LYX_REVISION_VERSION ${LYX_PATCH_VERSION})
|
||||
if(LYX_GITVERSION)
|
||||
if (LYX_LOCALVERSIONING)
|
||||
@ -332,13 +331,7 @@ if(LYX_GITVERSION)
|
||||
set(ENABLE_DIST ON)
|
||||
endif()
|
||||
endif()
|
||||
EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} log -1 "--pretty=format:%H"
|
||||
WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE lyxgitcommit OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if (lyxgitcommit MATCHES "^[0-9a-f]+$")
|
||||
set(LYX_GIT_COMMIT_HASH ${lyxgitcommit})
|
||||
endif()
|
||||
endif()
|
||||
#message(STATUS "LYX_GIT_COMMIT_HASH = ${LYX_GIT_COMMIT_HASH}")
|
||||
|
||||
# Set the programs (lyx, tex2lyx, etc.) suffix
|
||||
# When building an OS X bundle, we will append
|
||||
@ -677,7 +670,7 @@ endif()
|
||||
# Compute qt4-version from ${QTVERSION}
|
||||
|
||||
message(STATUS "")
|
||||
foreach(_v PACKAGE PACKAGE_VERSION LYX_GIT_COMMIT_HASH
|
||||
foreach(_v PACKAGE PACKAGE_VERSION
|
||||
PROGRAM_SUFFIX LYX_DATE LYX_DIR_VER LYX_USERDIR_VER
|
||||
LYX_ABS_TOP_SRCDIR
|
||||
LYX_ABS_INSTALLED_DATADIR LYX_ABS_INSTALLED_LOCALEDIR LYX_INSTALL_SUFFIX)
|
||||
|
@ -39,7 +39,6 @@
|
||||
#cmakedefine LYX_USERDIR_VER "${LYX_USERDIR_VER}"
|
||||
#define LYX_MAJOR_VERSION ${LYX_MAJOR_VERSION}
|
||||
#define LYX_MINOR_VERSION ${LYX_MINOR_VERSION}
|
||||
#define LYX_GIT_COMMIT_HASH "${LYX_GIT_COMMIT_HASH}"
|
||||
|
||||
#define PROGRAM_SUFFIX "${PROGRAM_SUFFIX}"
|
||||
#define LYX_ABS_INSTALLED_DATADIR "${LYX_ABS_INSTALLED_DATADIR}"
|
||||
|
18
development/cmake/lyx_commit_hash.h.cmake
Normal file
18
development/cmake/lyx_commit_hash.h.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* \file lyx_commit_hash.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* This is the compilation configuration file for LyX.
|
||||
* It was generated by cmake.
|
||||
* You might want to change some of the defaults if something goes wrong
|
||||
* during the compilation.
|
||||
*/
|
||||
|
||||
#ifndef _LYX_COMMIT_HASH_H
|
||||
#define _LYX_COMMIT_HASH_H
|
||||
|
||||
#define LYX_GIT_COMMIT_HASH "${LYX_GIT_COMMIT_HASH}"
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2012, Kornel Benko, <kornel@lyx.org>
|
||||
# Copyright (c) 2012-2014, Kornel Benko, <kornel@lyx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
@ -32,6 +32,8 @@
|
||||
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
|
||||
set(LYX_GIT_COMMIT_HASH "none")
|
||||
|
||||
FIND_PROGRAM(LYX_GITVERSION git)
|
||||
if(LYX_GITVERSION)
|
||||
# Override the value from configure.ac, if possible
|
||||
@ -44,16 +46,22 @@ if(LYX_GITVERSION)
|
||||
set(LYX_DATE ${CMAKE_MATCH_2})
|
||||
message(STATUS "Git-hash = ${LYX_GITHASH}")
|
||||
endif()
|
||||
EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} log -1 "--pretty=format:%H"
|
||||
WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE lyxgitcommit OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if (lyxgitcommit MATCHES "^[0-9a-f]+$")
|
||||
set(LYX_GIT_COMMIT_HASH ${lyxgitcommit})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${TOP_BINARY_DIR}/lyx_date.h)
|
||||
configure_file(${TOP_CMAKE_PATH}/lyx_date.h.cmake ${TOP_BINARY_DIR}/lyx_date.h)
|
||||
else()
|
||||
configure_file(${TOP_CMAKE_PATH}/lyx_date.h.cmake ${TOP_BINARY_DIR}/lyx_date.tmp)
|
||||
message(STATUS "Created ${TOP_BINARY_DIR}/lyx_date.tmp")
|
||||
foreach(_hf lyx_date lyx_commit_hash)
|
||||
if(NOT EXISTS ${TOP_BINARY_DIR}/${_hf}.h)
|
||||
configure_file(${TOP_CMAKE_PATH}/${_hf}.h.cmake ${TOP_BINARY_DIR}/${_hf}.h)
|
||||
else()
|
||||
configure_file(${TOP_CMAKE_PATH}/${_hf}.h.cmake ${TOP_BINARY_DIR}/${_hf}.tmp)
|
||||
message(STATUS "Created ${TOP_BINARY_DIR}/${_hf}.tmp")
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${TOP_BINARY_DIR}/lyx_date.tmp ${TOP_BINARY_DIR}/lyx_date.h
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${TOP_BINARY_DIR}/${_hf}.tmp ${TOP_BINARY_DIR}/${_hf}.h
|
||||
ERROR_VARIABLE copy_err
|
||||
)
|
||||
|
||||
@ -62,8 +70,8 @@ else()
|
||||
endif()
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TOP_BINARY_DIR}/lyx_date.tmp
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TOP_BINARY_DIR}/${_hf}.tmp
|
||||
)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user