Skip to content

Commit 7cfc557

Browse files
Merge branch 'master' into temp_place_est_chan_util
2 parents a4e318e + a8e0002 commit 7cfc557

File tree

5 files changed

+398
-115
lines changed

5 files changed

+398
-115
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -611,19 +611,19 @@ jobs:
611611
fail-fast: false
612612
matrix:
613613
include:
614-
- { name: 'GCC 11 (Ubuntu Noble - 24.04)', eval: 'CC=gcc-11 && CXX=g++-11', key: 'gcc-11', }
615-
- { name: 'GCC 12 (Ubuntu Noble - 24.04)', eval: 'CC=gcc-12 && CXX=g++-12', key: 'gcc-12', }
616-
- { name: 'GCC 14 (Ubuntu Noble - 24.04)', eval: 'CC=gcc-14 && CXX=g++-14', key: 'gcc-14', }
617-
- { name: 'Clang 16 (Ubuntu Noble - 24.04)', eval: 'CC=clang-16 && CXX=clang++-16', key: 'clang-16', }
618-
- { name: 'Clang 17 (Ubuntu Noble - 24.04)', eval: 'CC=clang-17 && CXX=clang++-17', key: 'clang-17', }
619-
- { name: 'Clang 18 (Ubuntu Noble - 24.04)', eval: 'CC=clang-18 && CXX=clang++-18', key: 'clang-18', }
614+
- { name: 'GCC 12 (Ubuntu Noble - 24.04)', CC: 'gcc-12', CXX: 'g++-12', }
615+
- { name: 'GCC 14 (Ubuntu Noble - 24.04)', CC: 'gcc-14', CXX: 'g++-14', }
616+
- { name: 'Clang 16 (Ubuntu Noble - 24.04)', CC: 'clang-16', CXX: 'clang++-16', }
617+
- { name: 'Clang 17 (Ubuntu Noble - 24.04)', CC: 'clang-17', CXX: 'clang++-17', }
618+
- { name: 'Clang 18 (Ubuntu Noble - 24.04)', CC: 'clang-18', CXX: 'clang++-18', }
620619
# Note: We do not include GCC-13 since it is the default and is already tested.
620+
# We also do not include GCC-11 since it is tested in the JammyCompatibility test.
621621
name: 'B: ${{ matrix.name }}'
622+
env:
623+
CC: ${{ matrix.CC }}
624+
CXX: ${{ matrix.CXX }}
622625
steps:
623626

624-
- uses: actions/setup-python@v5
625-
with:
626-
python-version: 3.12.3
627627
- uses: actions/checkout@v4
628628
with:
629629
submodules: 'true'
@@ -637,27 +637,24 @@ jobs:
637637

638638
- uses: hendrikmuhs/[email protected]
639639
with:
640-
key: ${{ github.job }}-${{ matrix.key }}
640+
key: ${{ github.job }}-${{ matrix.CC }}
641641

642-
- name: Test
642+
- name: Build
643643
env:
644-
CMAKE_PARAMS: "-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DWITH_ODIN=on -DVTR_IPO_BUILD=off"
645-
MATRIX_EVAL: ${{ matrix.eval }}
646-
BUILD_TYPE: debug # Note: We use the debug build here to make the build time faster since we do not care about run time.
647-
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
644+
CMAKE_PARAMS: "-DVTR_ASSERT_LEVEL=3 -DVTR_IPO_BUILD=off"
645+
BUILD_TYPE: release # Note: Found that release build caches way better than debug build for this test.
648646
run: |
649647
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
650-
./.github/scripts/build.sh
648+
make -j${{ steps.cpu-cores.outputs.count}}
651649
652650
JammyCompatibility:
653651
name: 'Ubuntu Jammy - 22.04 Compatibility Test'
654652
runs-on: ubuntu-22.04
655653
needs: [BuildVTR]
654+
env:
655+
CC: gcc-11
656+
CXX: g++-11
656657
steps:
657-
- uses: actions/setup-python@v5
658-
with:
659-
python-version: 3.10.10
660-
661658
- uses: actions/checkout@v4
662659
with:
663660
submodules: 'true'
@@ -671,15 +668,13 @@ jobs:
671668

672669
- uses: hendrikmuhs/[email protected]
673670
with:
674-
key: ${{ github.job }}
671+
key: ${{ github.job }}-gcc-11
675672

676-
- name: Test
673+
- name: Build
677674
env:
678675
CMAKE_PARAMS: "-DVTR_ASSERT_LEVEL=3 -DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off"
679-
MATRIX_EVAL: 'CC=gcc-11 && CXX=g++-11'
680-
BUILD_TYPE: debug # Note: We use the debug build here to make the build time faster since we do not care about run time.
681-
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
676+
BUILD_TYPE: release # Note: Found that release build caches way better than debug build for this test.
682677
run: |
683678
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
684-
./.github/scripts/build.sh
679+
make -j${{ steps.cpu-cores.outputs.count}}
685680

libs/libvtrutil/CMakeLists.txt

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -50,35 +50,49 @@ if (VTR_ENABLE_DEBUG_LOGGING)
5050
set(VTR_BUILD_INFO "${VTR_BUILD_INFO} debug_logging")
5151
endif()
5252

53-
# We always update the vtr_version.cpp file every time the project is built,
54-
# to ensure the git revision and dirty status are up to date.
55-
#
56-
# We need to do this in two stages:
57-
#
58-
# 1) We a custom target 'version' (which is always out of date) so it will always be run.
59-
# It touches the unprocessed version input file so it too will always be out of date.
60-
#
61-
# 2) The custom command depends on the touched version input file and generates the processed
62-
# version file, with updated values. The custom command uses the configure_version.cmake
63-
# script to generate the up-to-date vtr_version.cpp
64-
add_custom_target(version ALL
65-
COMMAND ${CMAKE_COMMAND} -E touch ${VTR_VERSION_FILE_IN})
66-
67-
add_custom_command(OUTPUT ${VTR_VERSION_FILE_OUT}
68-
COMMAND ${CMAKE_COMMAND}
69-
-D IN_FILE=${VTR_VERSION_FILE_IN}
70-
-D OUT_FILE=${VTR_VERSION_FILE_OUT}
71-
-D VTR_VERSION_MAJOR=${VTR_VERSION_MAJOR}
72-
-D VTR_VERSION_MINOR=${VTR_VERSION_MINOR}
73-
-D VTR_VERSION_PATCH=${VTR_VERSION_PATCH}
74-
-D VTR_VERSION_PRERELEASE=${VTR_VERSION_PRERELEASE}
75-
-D VTR_COMPILER_INFO=${VTR_COMPILER_INFO}
76-
-D VTR_BUILD_INFO=${VTR_BUILD_INFO}
77-
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/configure_version.cmake
78-
MAIN_DEPENDENCY ${VTR_VERSION_FILE_IN}
79-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
80-
VERBATIM)
53+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
54+
include(GetGitRevisionDescription)
55+
56+
# Get the VCS revision.
57+
git_describe_working_tree(VTR_VCS_REVISION --tags --always --long)
58+
string(FIND ${VTR_VCS_REVISION} "NOTFOUND" GIT_DESCRIBE_VTR_REVISION_NOTFOUND)
59+
if (NOT ${GIT_DESCRIBE_VTR_REVISION_NOTFOUND} EQUAL -1)
60+
# Git describe failed, usually this means we
61+
# aren't in a git repo -- so don't set a VCS
62+
# revision
63+
set(VTR_VCS_REVISION "unknown")
64+
endif()
65+
66+
# Get the short VCS revision
67+
git_describe_working_tree(VTR_VCS_REVISION_SHORT --tags --always --long --exclude '*')
68+
string(FIND "${VTR_VCS_REVISION_SHORT}" "NOTFOUND" GIT_DESCRIBE_VTR_REVISION_SHORT_NOTFOUND)
69+
if (NOT ${GIT_DESCRIBE_VTR_REVISION_SHORT_NOTFOUND} EQUAL -1)
70+
# Git describe failed, usually this means we
71+
# aren't in a git repo -- so don't set a VCS
72+
# revision
73+
set(VTR_VCS_REVISION_SHORT "unknown")
74+
endif()
8175

76+
# Set the version according to semver.org
77+
set(VTR_VERSION "${VTR_VERSION_MAJOR}.${VTR_VERSION_MINOR}.${VTR_VERSION_PATCH}")
78+
if(VTR_VERSION_PRERELEASE)
79+
set(VTR_VERSION "${VTR_VERSION}-${VTR_VERSION_PRERELEASE}")
80+
endif()
81+
set(VTR_VERSION_SHORT ${VTR_VERSION})
82+
if(VTR_VCS_REVISION)
83+
set(VTR_VERSION "${VTR_VERSION}+${VTR_VCS_REVISION_SHORT}")
84+
endif()
85+
86+
# Other build meta-data
87+
string(TIMESTAMP VTR_BUILD_TIMESTAMP)
88+
set(VTR_BUILD_TIMESTAMP "${VTR_BUILD_TIMESTAMP}")
89+
set(VTR_BUILD_INFO "${VTR_BUILD_INFO}")
90+
91+
message(STATUS "VTR Version: ${VTR_VERSION}")
92+
message(STATUS "VTR Revision: ${VTR_VCS_REVISION}")
93+
message(STATUS "VTR Short Revision: ${VTR_VCS_REVISION_SHORT}")
94+
95+
configure_file(${VTR_VERSION_FILE_IN} ${VTR_VERSION_FILE_OUT})
8296

8397
#
8498
# Source files and library
@@ -97,9 +111,6 @@ add_library(libvtrutil STATIC
97111
target_include_directories(libvtrutil PUBLIC ${LIB_INCLUDE_DIRS})
98112
set_target_properties(libvtrutil PROPERTIES PREFIX "") #Avoid extra 'lib' prefix
99113

100-
#Ensure version is always up to date by requiring version to be run first
101-
add_dependencies(libvtrutil version)
102-
103114
#Specify link-time dependencies
104115
target_link_libraries(libvtrutil
105116
liblog)

0 commit comments

Comments
 (0)