Skip to content

Commit 77b2b73

Browse files
committed
tmplr: Update tmplr to v1.4
Signed-off-by: Diogo Behrens <[email protected]>
1 parent 2bff2f9 commit 77b2b73

File tree

22 files changed

+362
-934
lines changed

22 files changed

+362
-934
lines changed

.github/workflows/actions.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ jobs:
123123
run: cmake -S . -Bbuild
124124
-DCMAKE_TOOLCHAIN_FILE=".github/toolchains/${{ matrix.toolchain }}.cmake"
125125
-DCMAKE_C_FLAGS="-${{ matrix.optimization_level }} ${{ matrix.flags }}"
126+
-DVATOMIC_DEV=OFF
126127
- name: Build
127128
run: cmake --build build
128129
- name: Test
@@ -145,6 +146,7 @@ jobs:
145146
run: cmake -S . -Bbuild
146147
-DCMAKE_TOOLCHAIN_FILE=".github/toolchains/${{ matrix.toolchain }}.cmake"
147148
-DCMAKE_C_FLAGS="-${{ matrix.optimization_level }} ${{ matrix.flags }}"
149+
-DVATOMIC_DEV=OFF
148150
- name: Build
149151
run: cmake --build build
150152
- name: Test
@@ -172,12 +174,13 @@ jobs:
172174
run: cmake -S . -Bbuild
173175
-DCMAKE_TOOLCHAIN_FILE=".github/toolchains/${{ matrix.options.toolchain }}.cmake"
174176
-DCMAKE_C_FLAGS="-${{ matrix.optimization_level }} ${{ matrix.options.flags }}"
177+
-DVATOMIC_DEV=OFF
175178
- name: Build
176179
run: cmake --build build
177180
- name: Test
178181
run: ctest --test-dir build --output-on-failure
179182

180-
boogie-verification-rust-armv8:
183+
verify-armv8:
181184
strategy:
182185
matrix:
183186
target: [ builtin, llsc, lse, lxe ]
@@ -190,13 +193,13 @@ jobs:
190193
with:
191194
fetch-depth: 0
192195
- name: Configure
193-
run: cmake -S. -Bbuild
196+
run: cmake -S. -Bbuild -DVATOMIC_DEV=OFF
194197
- name: Build
195198
run: cmake --build build --target build_boogie_armv8_${{ matrix.target }}_${{ matrix.group }}
196199
- name: Verify
197200
run: ctest -j 4 -L armv8_${{ matrix.target }}_${{ matrix.group }} --test-dir build/verify
198201

199-
boogie-verification-rust-riscv:
202+
verify-riscv:
200203
strategy:
201204
matrix:
202205
group: [ vatomic8, vatomic16, vatomic32, vatomic64, vatomicsz, vatomicptr, vatomic_fence ]
@@ -208,7 +211,7 @@ jobs:
208211
with:
209212
fetch-depth: 0
210213
- name: Configure
211-
run: cmake -S. -Bbuild
214+
run: cmake -S. -Bbuild -DVATOMIC_DEV=OFF
212215
- name: Build
213216
run: cmake --build build --target build_boogie_riscv_builtin_${{ matrix.group }}
214217
- name: Verify

CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,31 @@ install(DIRECTORY include/vsync DESTINATION include)
2323
install(FILES vmm.cat DESTINATION share/vsync/)
2424
install(TARGETS vatomic EXPORT ${PROJECT_TARGETS})
2525

26-
# Enable development targets only if this is the top level project
26+
# Enable development and test targets only if this is the top level project
2727
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
2828
set(VATOMIC_DEV_DEFAULT ON)
29+
set(VATOMIC_TESTS_DEFAULT ON)
2930
else()
3031
set(VATOMIC_DEV_DEFAULT OFF)
32+
set(VATOMIC_TESTS_DEFAULT OFF)
3133
endif()
3234

33-
option(VATOMIC_DEV "Enable development targets" ${VATOMIC_DEV_DEFAULT})
35+
option(VATOMIC_DEV
36+
"Enable generating vatomic headers from templates with tmplr"
37+
${VATOMIC_DEV_DEFAULT})
38+
option(VATOMIC_TESTS "Enable test and verification targets"
39+
${VATOMIC_TESTS_DEFAULT})
3440

3541
if(VATOMIC_DEV)
3642
# Atomic templating
43+
include(cmake/tmplr.cmake)
44+
set(TMPLR_PROGRAM ${TMPLR_PROGRAM} -P_tmpl -b 1000)
3745
add_subdirectory(template)
38-
add_subdirectory(tmplr)
46+
47+
# Documentation generation
3948
include(cmake/doc.cmake)
4049
add_doc_targets()
50+
4151
# Basic format sanitization
4252
add_custom_target(
4353
sanitize-vatomic
@@ -62,7 +72,9 @@ if(VATOMIC_DEV)
6272

6373
# General diff check for pipeline
6474
add_custom_target(diff-check COMMAND git --no-pager diff --exit-code)
75+
endif()
6576

77+
if(VATOMIC_TESTS)
6678
include(CTest)
6779
include(ProcessorCount)
6880
include(cmake/v_add_test.cmake)

cmake/tmplr.cmake

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (C) Huawei Technologies Co., Ltd. 2025. All rights reserved.
2+
# SPDX-License-Identifier: MIT
3+
4+
set(OPENS4C_URL "https://github.com/open-s4c")
5+
set(TMPLR_VERSION "1.4")
6+
set(TMPLR_URL "${OPENS4C_URL}/tmplr/archive/refs/tags/v${TMPLR_VERSION}.tar.gz")
7+
set(TMPLR_SHA256
8+
"ab6b67cd9894afbd8f262a7739598902c873c89007bcddb818afe65b405294ea")
9+
10+
if(DEFINED TMPLR_PROGRAM AND EXISTS "${TMPLR_PROGRAM}")
11+
# Cached values are valid; nothing further needed.
12+
return()
13+
endif()
14+
15+
execute_process(
16+
COMMAND
17+
"${CMAKE_SOURCE_DIR}/scripts/ensure-cmd.sh" -q #
18+
--workdir "${CMAKE_BINARY_DIR}" #
19+
--url "${TMPLR_URL}" #
20+
--sha256 "${TMPLR_SHA256}" #
21+
"tmplr" "${TMPLR_VERSION}"
22+
OUTPUT_VARIABLE TMPLR_PROGRAM
23+
OUTPUT_STRIP_TRAILING_WHITESPACE
24+
RESULT_VARIABLE ENSURE_TMPLR_RC)
25+
if(NOT ENSURE_TMPLR_RC EQUAL 0)
26+
message(FATAL_ERROR "Failed to ensure tmplr ${TMPLR_VERSION} is available")
27+
endif()
28+
message(STATUS "tmplr v${TMPLR_VERSION}: ${TMPLR_PROGRAM}")

0 commit comments

Comments
 (0)