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

#125: Generate pre built binaries #140

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
7 changes: 6 additions & 1 deletion apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

macro(add_test_for_app_vt_tv test_name test_exec)
if(${test_name} STREQUAL "vt-tv:vt-tv_standalone")
if(${test_name} STREQUAL "vt-tv:vttv")
add_test(
NAME ${test_name}
COMMAND ${test_exec} -c tests/config/conf.yaml
Expand Down Expand Up @@ -57,4 +57,9 @@ foreach(APP_FULL ${PROJECT_APPS})
MODULES ${VTK_LIBRARIES}
)

install(
TARGETS ${APP}
DESTINATION bin
)

endforeach()
2 changes: 1 addition & 1 deletion apps/vt-tv_standalone.cc → apps/vttv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@HEADER
// *****************************************************************************
//
// example2.cc
// vttv.cc
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
Expand Down
10 changes: 7 additions & 3 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ file(
nanobind_build_library(nanobind SHARED)

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

# .. Link it to necessary libraries
target_link_libraries(vttv PUBLIC ${VT_TV_LIBRARY_NS} ${JSON_LIBRARY} ${FMT_LIBRARY})
target_link_libraries(pyvttv PUBLIC ${VT_TV_LIBRARY_NS} ${JSON_LIBRARY} ${FMT_LIBRARY})

vtk_module_autoinit(
TARGETS vttv
TARGETS pyvttv
MODULES ${VTK_LIBRARIES}
)
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ GCOV="${GCOV:-gcov}"
VT_TV_DIR="${VT_TV_DIR:-$CURRENT_DIR}"
VT_TV_BUILD_DIR="${VT_TV_BUILD_DIR:-$PARENT_DIR/vt-tv/build}"
VT_TV_OUTPUT_DIR="${VT_TV_OUTPUT_DIR:-$CURRENT_DIR/output}"
VT_TV_INSTALL="${VT_TV_INSTALL:-OFF}"
VT_TV_INSTALL_DIR="${VT_TV_INSTALL_DIR:-$VT_TV_BUILD_DIR/install}"
# >> Build settings
VT_TV_BUILD=$(on_off ${VT_TV_BUILD:-ON}) # option to turn off the build to only run tests
VT_TV_BUILD_TYPE=${VT_TV_BUILD_TYPE:-Release}
Expand Down Expand Up @@ -76,6 +78,8 @@ help() {

-b --build=[bool] Build vt-tv. Can be turned off for example to run tests without rebuilding. (VT_TV_BUILD=$VT_TV_BUILD)
-d --build-dir=[str] Build directory (VT_TV_BUILD_DIR=$VT_TV_BUILD_DIR)
-i --install Enable installation after build (VT_TV_INSTALL=$VT_TV_INSTALL)
-l --install-dir=[str] Installation directory (VT_TV_INSTALL_DIR=$VT_TV_INSTALL_DIR)
-m --build-type=[str] Set the CMAKE_BUILD_TYPE value (Debug|Release|...) (VT_TV_BUILD_TYPE=$VT_TV_BUILD_TYPE)
-y --clean=[bool] Clean the output directory and the CMake cache. (VT_TV_CLEAN=$VT_TV_CLEAN)
-p --bindings Build with Python bindings (VT_TV_PYTHON_BINDINGS_ENABLED=$VT_TV_PYTHON_BINDINGS_ENABLED)
Expand Down Expand Up @@ -124,6 +128,8 @@ while getopts btch-: OPT; do # allow -b -t -c -h, and --long_attr=value"
case "$OPT" in
b | build ) VT_TV_BUILD=$(on_off $OPTARG) ;;
d | build-dir ) VT_TV_BUILD_DIR=$(realpath "$OPTARG") ;;
i | install) VT_TV_INSTALL=$(on_off $OPTARG) ;;
l | install-dir) VT_TV_INSTALL_DIR=$(realpath "$OPTARG") ;;
m | build-type) VT_TV_BUILD_TYPE=$(on_off $OPTARG) ;;
p | bindings ) VT_TV_PYTHON_BINDINGS_ENABLED=$(on_off $OPTARG) ;;
c | cc) CC="$OPTARG" ;;
Expand Down Expand Up @@ -185,6 +191,7 @@ if [[ "${VT_TV_BUILD}" == "ON" ]]; then
\
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_INSTALL_PREFIX="${VT_TV_INSTALL_DIR}" \
\
-DVT_TV_WERROR_ENABLED="${VT_TV_WERROR_ENABLED}" \
\
Expand All @@ -201,6 +208,11 @@ if [[ "${VT_TV_BUILD}" == "ON" ]]; then

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

if [[ "$VT_TV_INSTALL" == "ON" ]]; then
echo "> Installing to ${VT_TV_INSTALL_DIR}..."
cmake --install . --prefix "${VT_TV_INSTALL_DIR}"
fi

popd

fi # End build
Expand Down
19 changes: 19 additions & 0 deletions cmake/load_vtk_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,22 @@ find_package(
message(STATUS "VTK version: ${VTK_VERSION}")

message(STATUS "VTK libraries: ${VTK_LIBRARIES}")

foreach(VTK_LIBRARY ${VTK_LIBRARIES})
get_target_property(VTK_RUNTIME_LIBRARY_DIR ${VTK_LIBRARY} LOCATION)

list(
APPEND
VTK_RUNTIME_LIBRARY_DIRS
"${VTK_RUNTIME_LIBRARY_DIR}"
)
endforeach()

if(NOT VTK_RUNTIME_LIBRARY_DIRS)
message(FATAL_ERROR "VTK runtime library paths could not be determined!")
endif()

install(
FILES ${VTK_RUNTIME_LIBRARY_DIRS}
DESTINATION lib
)
4 changes: 2 additions & 2 deletions tests/unit/render/test_standalone_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ TEST_P(StandaloneAppTest, test_run) {
fmt::format("{}/tests/config/{}", SRC_DIR, std::get<0>(GetParam()));
int expected_phases = std::get<1>(GetParam());

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

Expand Down
Loading