build: Do not recreate header symlinks during CMake refreshes
This commit is contained in:
@@ -567,5 +567,14 @@ function(write_module_header name header_files)
|
||||
list(APPEND contents "
|
||||
#endif "
|
||||
)
|
||||
if(EXISTS ${CMAKE_HEADER_OUTPUT_DIRECTORY}/${name}-module.h)
|
||||
file(READ ${CMAKE_HEADER_OUTPUT_DIRECTORY}/${name}-module.h oldcontents)
|
||||
string(REPLACE ";" "" contents "${contents}")
|
||||
# If the header-module.h already exists and is the exact same, do not
|
||||
# overwrite it to preserve timestamps
|
||||
if("${contents}" STREQUAL "${oldcontents}")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
file(WRITE ${CMAKE_HEADER_OUTPUT_DIRECTORY}/${name}-module.h ${contents})
|
||||
endfunction()
|
||||
|
||||
@@ -295,22 +295,6 @@ endfunction()
|
||||
macro(process_options)
|
||||
clear_global_cached_variables()
|
||||
|
||||
# check if the include directory exists in the output directory
|
||||
if((EXISTS ${CMAKE_OUTPUT_DIRECTORY}) AND (EXISTS
|
||||
${CMAKE_OUTPUT_DIRECTORY}/include)
|
||||
)
|
||||
# if it does, delete it to make sure we only have relevant header stubs
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
|
||||
set(delete_directory_cmd rm -R) # introduced in CMake 3.17
|
||||
else()
|
||||
set(delete_directory_cmd remove_directory) # deprecated in CMake 3.17
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E ${delete_directory_cmd}
|
||||
${CMAKE_OUTPUT_DIRECTORY}/include
|
||||
)
|
||||
endif()
|
||||
|
||||
# make sure to default to RelWithDebInfo if no build type is specified
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "default" CACHE STRING "Choose the type of build."
|
||||
@@ -797,7 +781,8 @@ macro(process_options)
|
||||
endif()
|
||||
|
||||
# Disable the below warning from bindings built in debug mode with clang++:
|
||||
# "expression with side effects will be evaluated despite being used as an operand to 'typeid'"
|
||||
# "expression with side effects will be evaluated despite being used as an
|
||||
# operand to 'typeid'"
|
||||
if(${ENABLE_PYTHON_BINDINGS} AND ${CLANG})
|
||||
add_compile_options(-Wno-potentially-evaluated-expression)
|
||||
endif()
|
||||
@@ -1392,6 +1377,12 @@ function(copy_headers_before_building_lib libname outputdir headers visibility)
|
||||
get_filename_component(
|
||||
header_name ${CMAKE_CURRENT_SOURCE_DIR}/${header} NAME
|
||||
)
|
||||
|
||||
# If header already exists, skip symlinking/stub header creation
|
||||
if(EXISTS ${outputdir}/${header_name})
|
||||
continue()
|
||||
endif()
|
||||
|
||||
# CMake 3.13 cannot create symlinks on Windows, so we use stub headers as a
|
||||
# fallback
|
||||
if(WIN32 AND (${CMAKE_VERSION} VERSION_LESS "3.13.0"))
|
||||
|
||||
@@ -838,6 +838,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase):
|
||||
Test passing 'show version' argument to ns3 to get the build version
|
||||
@return None
|
||||
"""
|
||||
if shutil.which("git") is None:
|
||||
self.skipTest("git is not available")
|
||||
|
||||
return_code, _, _ = run_ns3("configure -G \"Unix Makefiles\" --enable-build-version")
|
||||
self.assertEqual(return_code, 0)
|
||||
|
||||
@@ -924,7 +927,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase):
|
||||
"""
|
||||
# Skip test if mpi is not installed
|
||||
if shutil.which("mpiexec") is None:
|
||||
return
|
||||
self.skipTest("Mpi is not available")
|
||||
|
||||
# Ensure sample simulator was built
|
||||
return_code, stdout, stderr = run_ns3("build sample-simulator")
|
||||
|
||||
Reference in New Issue
Block a user