Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cmake timestamp and git csv retrieval to avoid useless rebuild #1260

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1262,16 +1262,7 @@ vp_system_information(NUMBER_OF_LOGICAL_CORES NUMBER_OF_PHYSICAL_CORES TOTAL_PHY
find_host_package(Git QUIET)

if(NOT DEFINED VISP_VCSVERSION AND GIT_FOUND)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "v[0-9].[0-9].[0-9]*"
WORKING_DIRECTORY "${VISP_SOURCE_DIR}"
OUTPUT_VARIABLE VISP_VCSVERSION
RESULT_VARIABLE GIT_RESULT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_RESULT EQUAL 0)
set(VISP_VCSVERSION "unknown")
endif()
vp_git_describe(VISP_VCSVERSION "${VISP_SOURCE_DIR}")
elseif(NOT DEFINED VISP_VCSVERSION)
# We don't have git:
set(VISP_VCSVERSION "unknown")
Expand Down Expand Up @@ -1322,11 +1313,12 @@ endif()
# ========================== build platform ==========================
status("")
status(" Platform:")
if(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
string(TIMESTAMP TIMESTAMP "" UTC)
if(TIMESTAMP)
status(" Timestamp:" ${TIMESTAMP})
endif()
if(NOT DEFINED VISP_TIMESTAMP AND NOT BUILD_INFO_SKIP_TIMESTAMP)
string(TIMESTAMP VISP_TIMESTAMP "" UTC)
set(VISP_TIMESTAMP "${VISP_TIMESTAMP}" CACHE STRING "Timestamp of ViSP build configuration" FORCE)
endif()
if(VISP_TIMESTAMP)
status(" Timestamp:" ${VISP_TIMESTAMP})
endif()
status(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
if(CMAKE_CROSSCOMPILING)
Expand Down
10 changes: 0 additions & 10 deletions cmake/VISPModule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,6 @@ macro(vp_target_include_modules target)
if(d MATCHES "^visp_" AND HAVE_${d})
if (EXISTS "${VISP_MODULE_${d}_LOCATION}/include")
vp_target_include_directories(${target} "${VISP_MODULE_${d}_LOCATION}/include")
# Work around to be able to build the modules without INTERFACE_INCLUDE_DIRECTORIES
# that was only introduces since CMake 2.8.12
if (CMAKE_VERSION VERSION_LESS 2.8.12)
vp_target_include_directories(${target} "${VISP_MODULE_${d}_INC_DEPS}")
endif()
endif()
elseif(EXISTS "${d}")
# FS keep external deps inc
Expand Down Expand Up @@ -992,11 +987,6 @@ macro(vp_add_tests)
foreach(d ${VISP_TEST_${the_module}_DEPS})
list(APPEND test_deps ${d})
list(APPEND test_deps ${VISP_MODULE_${d}_DEPS})
# Work around to be able to build the modules without INTERFACE_INCLUDE_DIRECTORIES
# that was only introduces since CMake 2.8.12
if(CMAKE_VERSION VERSION_LESS 2.8.12)
list(APPEND test_deps "${VISP_MODULE_${__m}_INC_DEPS}")
endif()
endforeach()

vp_check_dependencies(${test_deps})
Expand Down
35 changes: 27 additions & 8 deletions cmake/VISPUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,11 @@ function(vp_target_include_directories target)
endif()
endforeach()
if(__params)
if(CMAKE_VERSION VERSION_LESS 2.8.11)
include_directories(${__params})
if(TARGET ${target})
target_include_directories(${target} PRIVATE ${__params})
else()
if(TARGET ${target})
target_include_directories(${target} PRIVATE ${__params})
else()
set(__new_inc "${VP_TARGET_INCLUDE_DIRS_${target}};${__params}")
set(VP_TARGET_INCLUDE_DIRS_${target} "${__new_inc}" CACHE INTERNAL "")
endif()
set(__new_inc "${VP_TARGET_INCLUDE_DIRS_${target}};${__params}")
set(VP_TARGET_INCLUDE_DIRS_${target} "${__new_inc}" CACHE INTERNAL "")
endif()
endif()
endfunction()
Expand Down Expand Up @@ -1969,3 +1965,26 @@ macro(vp_list_replace_string list_in list_out regular_expression replacement_exp
endforeach()
set(${list_out} ${__list_out})
endmacro()

macro(vp_git_describe var_name path)
if(GIT_FOUND)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --exact-match --dirty
WORKING_DIRECTORY "${path}"
OUTPUT_VARIABLE ${var_name}
RESULT_VARIABLE GIT_RESULT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_RESULT EQUAL 0)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*"
WORKING_DIRECTORY "${path}"
OUTPUT_VARIABLE ${var_name}
RESULT_VARIABLE GIT_RESULT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
else()
set(${var_name} "unknown")
endif()
endmacro()
3 changes: 0 additions & 3 deletions platforms/android/android.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1156,9 +1156,6 @@ if( NOT CMAKE_C_COMPILER )
endif()

set( _CMAKE_TOOLCHAIN_PREFIX "${ANDROID_TOOLCHAIN_MACHINE_NAME}-" )
if( CMAKE_VERSION VERSION_LESS 2.8.5 )
set( CMAKE_ASM_COMPILER_ARG1 "-c" )
endif()
if( APPLE )
find_program( CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool )
if( NOT CMAKE_INSTALL_NAME_TOOL )
Expand Down
Loading