Skip to content

Commit bfd3751

Browse files
authored
Merge pull request #140 from DARMA-tasking/125-generate-pre-built-binaries-for-standalone-app
#125: Generate pre built binaries
2 parents 2d9dfc3 + 332290c commit bfd3751

File tree

10 files changed

+76
-9
lines changed

10 files changed

+76
-9
lines changed

.github/workflows/build-and-test-ubuntu.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,31 @@ jobs:
8686
VT_TV_COVERAGE_ENABLED=${{ env.VT_TV_COVERAGE_ENABLED }}
8787
outputs: type=local,dest=${{ env.OUTPUT_DIR }}
8888

89+
- name: Prepare Debian Package Structure
90+
run: |
91+
COMMIT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-7)
92+
mkdir -p pkg/DEBIAN
93+
mkdir -p pkg/usr/local/bin
94+
cp ${{ env.OUTPUT_DIR }}/tmp/pkg-artifacts/bin/vttv pkg/usr/local/bin/
95+
cat <<EOF > pkg/DEBIAN/control
96+
Package: vttv
97+
Version: 1.6.0-${COMMIT_HASH}
98+
Section: base
99+
Priority: optional
100+
Architecture: amd64
101+
Maintainer: Pierre Pébay <[email protected]>
102+
Depends: libx11-dev, libgl1-mesa-dev, libgomp1
103+
Description: DARMA vt task visualizer.
104+
EOF
105+
106+
- name: Build the Debian Package
107+
run: |
108+
COMMIT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-7)
109+
dpkg-deb --build pkg "${OUTPUT_DIR}/vttv-amd64-${COMMIT_HASH}.deb"
110+
111+
- name: Clean out pkg-artifacts
112+
run: rm -rf "${OUTPUT_DIR}/tmp/pkg-artifacts"
113+
89114
- name: Upload artifacts
90115
uses: actions/upload-artifact@v4
91116
if: always()

apps/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
macro(add_test_for_app_vt_tv test_name test_exec)
3-
if(${test_name} STREQUAL "vt-tv:vt-tv_standalone")
3+
if(${test_name} STREQUAL "vt-tv:vttv")
44
add_test(
55
NAME ${test_name}
66
COMMAND ${test_exec} -c tests/config/conf.yaml
@@ -59,4 +59,9 @@ foreach(APP_FULL ${PROJECT_APPS})
5959
MODULES ${VTK_LIBRARIES}
6060
)
6161

62+
install(
63+
TARGETS ${APP}
64+
DESTINATION bin
65+
)
66+
6267
endforeach()

apps/vt-tv_standalone.cc renamed to apps/vttv.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@HEADER
33
// *****************************************************************************
44
//
5-
// example2.cc
5+
// vttv.cc
66
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
77
//
88
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC

bindings/python/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ file(
1010
nanobind_build_library(nanobind SHARED)
1111

1212
# Create the Python bindings for the module
13-
nanobind_add_module(vttv ${PYTHON_BINDING_SRCS} tv.cc)
13+
# small workaround here, use pyvttv target name to avoid conflict with binary executable
14+
# target, called vttv as well; we want the python package to be called vttv too,
15+
# thus the set_target_properties on OUTPUT_NAME.
16+
nanobind_add_module(pyvttv ${PYTHON_BINDING_SRCS} tv.cc)
17+
set_target_properties(pyvttv PROPERTIES OUTPUT_NAME "vttv")
1418

1519
# .. Link it to necessary libraries
16-
target_link_libraries(vttv PUBLIC ${VT_TV_LIBRARY_NS} ${JSON_LIBRARY} ${FMT_LIBRARY})
17-
add_vttv_definitions(vttv)
20+
target_link_libraries(pyvttv PUBLIC ${VT_TV_LIBRARY_NS} ${JSON_LIBRARY} ${FMT_LIBRARY})
21+
add_vttv_definitions(pyvttv)
1822

1923
vtk_module_autoinit(
20-
TARGETS vttv
24+
TARGETS pyvttv
2125
MODULES ${VTK_LIBRARIES}
2226
)

build.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ GCOV="${GCOV:-gcov}"
4545
VT_TV_DIR="${VT_TV_DIR:-$CURRENT_DIR}"
4646
VT_TV_BUILD_DIR="${VT_TV_BUILD_DIR:-$PARENT_DIR/vt-tv/build}"
4747
VT_TV_OUTPUT_DIR="${VT_TV_OUTPUT_DIR:-$CURRENT_DIR/output}"
48+
VT_TV_INSTALL="${VT_TV_INSTALL:-OFF}"
49+
VT_TV_INSTALL_DIR="${VT_TV_INSTALL_DIR:-$VT_TV_BUILD_DIR/install}"
4850
# >> Build settings
4951
VT_TV_BUILD=$(on_off ${VT_TV_BUILD:-ON}) # option to turn off the build to only run tests
5052
VT_TV_BUILD_TYPE=${VT_TV_BUILD_TYPE:-Release}
@@ -76,6 +78,8 @@ help() {
7678
7779
-b --build=[bool] Build vt-tv. Can be turned off for example to run tests without rebuilding. (VT_TV_BUILD=$VT_TV_BUILD)
7880
-d --build-dir=[str] Build directory (VT_TV_BUILD_DIR=$VT_TV_BUILD_DIR)
81+
-i --install Enable installation after build (VT_TV_INSTALL=$VT_TV_INSTALL)
82+
-l --install-dir=[str] Installation directory (VT_TV_INSTALL_DIR=$VT_TV_INSTALL_DIR)
7983
-m --build-type=[str] Set the CMAKE_BUILD_TYPE value (Debug|Release|...) (VT_TV_BUILD_TYPE=$VT_TV_BUILD_TYPE)
8084
-y --clean=[bool] Clean the output directory and the CMake cache. (VT_TV_CLEAN=$VT_TV_CLEAN)
8185
-p --bindings Build with Python bindings (VT_TV_PYTHON_BINDINGS_ENABLED=$VT_TV_PYTHON_BINDINGS_ENABLED)
@@ -124,6 +128,8 @@ while getopts btch-: OPT; do # allow -b -t -c -h, and --long_attr=value"
124128
case "$OPT" in
125129
b | build ) VT_TV_BUILD=$(on_off $OPTARG) ;;
126130
d | build-dir ) VT_TV_BUILD_DIR=$(realpath "$OPTARG") ;;
131+
i | install) VT_TV_INSTALL=$(on_off $OPTARG) ;;
132+
l | install-dir) VT_TV_INSTALL_DIR=$(realpath "$OPTARG") ;;
127133
m | build-type) VT_TV_BUILD_TYPE=$(on_off $OPTARG) ;;
128134
p | bindings ) VT_TV_PYTHON_BINDINGS_ENABLED=$(on_off $OPTARG) ;;
129135
c | cc) CC="$OPTARG" ;;
@@ -185,6 +191,7 @@ if [[ "${VT_TV_BUILD}" == "ON" ]]; then
185191
\
186192
-DCMAKE_C_COMPILER="${CC}" \
187193
-DCMAKE_CXX_COMPILER="${CXX}" \
194+
-DCMAKE_INSTALL_PREFIX="${VT_TV_INSTALL_DIR}" \
188195
\
189196
-DVT_TV_WERROR_ENABLED="${VT_TV_WERROR_ENABLED}" \
190197
\
@@ -201,6 +208,11 @@ if [[ "${VT_TV_BUILD}" == "ON" ]]; then
201208

202209
time cmake --build . --parallel -j "${VT_TV_CMAKE_JOBS}"
203210

211+
if [[ "$VT_TV_INSTALL" == "ON" ]]; then
212+
echo "> Installing to ${VT_TV_INSTALL_DIR}..."
213+
cmake --install . --prefix "${VT_TV_INSTALL_DIR}"
214+
fi
215+
204216
popd
205217

206218
fi # End build

ci/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ bash -c "VT_TV_BUILD_DIR=/opt/build/vt-tv \
1111
VT_TV_TESTS_ENABLED=ON \
1212
VT_TV_COVERAGE_ENABLED=${VT_TV_COVERAGE_ENABLED:-OFF} \
1313
VT_TV_WERROR_ENABLED=ON \
14+
VT_TV_INSTALL=ON \
1415
/opt/src/vt-tv/build.sh"
1516

1617
echo "VT-TV build success"

ci/docker/build-and-test-ubuntu.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ RUN VTK_DIR=/opt/build/vtk bash /opt/src/vt-tv/ci/python_test.sh
4040
FROM scratch AS artifacts
4141
COPY --from=test-cpp /tmp/artifacts /tmp/artifacts
4242
COPY --from=test-python /opt/src/vt-tv/output/python_tests /tmp/python-artifacts
43+
COPY --from=build /opt/build/vt-tv/install /tmp/pkg-artifacts

ci/setup_vtk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pushd $VTK_DIR
1717
cmake \
1818
-DCMAKE_BUILD_TYPE:STRING=Release \
1919
-DBUILD_TESTING:BOOL=OFF \
20-
-DBUILD_SHARED_LIBS:BOOL=ON \
20+
-DBUILD_SHARED_LIBS:BOOL=OFF \
2121
-S "$VTK_SRC_DIR" -B "$VTK_DIR"
2222
cmake --build "$VTK_DIR" -j$(nproc)
2323

cmake/load_vtk_package.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,22 @@ find_package(
2020
message(STATUS "VTK version: ${VTK_VERSION}")
2121

2222
message(STATUS "VTK libraries: ${VTK_LIBRARIES}")
23+
24+
foreach(VTK_LIBRARY ${VTK_LIBRARIES})
25+
get_target_property(VTK_RUNTIME_LIBRARY_DIR ${VTK_LIBRARY} LOCATION)
26+
27+
list(
28+
APPEND
29+
VTK_RUNTIME_LIBRARY_DIRS
30+
"${VTK_RUNTIME_LIBRARY_DIR}"
31+
)
32+
endforeach()
33+
34+
if(NOT VTK_RUNTIME_LIBRARY_DIRS)
35+
message(FATAL_ERROR "VTK runtime library paths could not be determined!")
36+
endif()
37+
38+
install(
39+
FILES ${VTK_RUNTIME_LIBRARY_DIRS}
40+
DESTINATION lib
41+
)

tests/unit/render/test_standalone_app.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ TEST_P(StandaloneAppTest, test_run) {
7373
fmt::format("{}/tests/config/{}", SRC_DIR, std::get<0>(GetParam()));
7474
int expected_phases = std::get<1>(GetParam());
7575

76-
// Run vt-tv_standalone process
76+
// Run vttv process
7777
auto cmd =
78-
fmt::format("{}/apps/vt-tv_standalone --conf={}", BUILD_DIR, config_file);
78+
fmt::format("{}/apps/vttv --conf={}", BUILD_DIR, config_file);
7979
const auto [status, output] = Util::exec(cmd.c_str());
8080
fmt::print(output);
8181

0 commit comments

Comments
 (0)