mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
Avoid complete rebuild on cmake run with git info change
Before this commit, the following will trigger a complete rebuild: - create another git name (git checkout -b test) - run cmake again manually (cmake ..) - run ninja again The top-level CMakeLists.txt uses add_definitions() to add git information to all targets; if some git information changes, this will mark all command lines as dirty, triggering the build. There is an easy solution: instead of passing this information on the command line, pass it in a header. This commit uses configure_file() to generate a file oai_version.h in the build directory with the same information. Various sources files, e.g., main executables, use this to output the same information as before. It is then also not necessary to use header guards, as cmake takes care to create this file. If cmake is re-run, it will update the header, and trigger only files including this header will be rebuilt (which can be shown with the above stpes). The information passed is the same as before, and updates the information when the old method would have updated it.
This commit is contained in:
@@ -84,7 +84,6 @@ set (OPENAIR2_DIR ${OPENAIR_DIR}/openair2)
|
||||
set (OPENAIR3_DIR ${OPENAIR_DIR}/openair3)
|
||||
set (OPENAIR3_DIR ${OPENAIR_DIR}/openair3)
|
||||
set (OPENAIR_CMAKE ${OPENAIR_DIR}/cmake_targets)
|
||||
set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
|
||||
|
||||
project (OpenAirInterface)
|
||||
|
||||
@@ -254,9 +253,6 @@ if(GIT_FOUND)
|
||||
)
|
||||
endif()
|
||||
|
||||
add_definitions("-DFIRMWARE_VERSION=\"${GIT_COMMIT_HASH}\"")
|
||||
add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_COMMIT_HASH} Date: ${GIT_COMMIT_DATE}\"")
|
||||
|
||||
# Debug related options
|
||||
#########################################
|
||||
add_boolean_option(DEBUG_ASN1 False "Enable ASN1 debug logs" OFF)
|
||||
@@ -541,16 +537,8 @@ add_boolean_option(NAS_UE True "NAS UE INSTANCE (<> NAS_MME)"
|
||||
add_boolean_option(RRC_DEFAULT_RAB_IS_AM True "set the LTE RLC mode to AM for the default bearer, otherwise it is UM." ON)
|
||||
|
||||
# add the binary tree to the search path for include files
|
||||
#######################################################
|
||||
# We will find ConfigOAI.h after generation in target directory
|
||||
include_directories("${OPENAIR_BIN_DIR}")
|
||||
# add directories to find all include files
|
||||
# the internal rule is to use generic names such as defs.h
|
||||
# but to make it uniq name as adding the relative path in the include directtive
|
||||
# example: #include "RRC/LTE/rrc_defs.h"
|
||||
#find_path (include_dirs_all *.h ${OPENAIR_DIR})
|
||||
#find_path (include_dirs_all *.h PATHS /usr/include NO_CMAKE_PATH)
|
||||
#include_directories("${include_dirs_all}")
|
||||
# We will find common/oai_version.h after generation in target directory
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# Legacy exact order
|
||||
|
||||
|
||||
Reference in New Issue
Block a user