Skip to content
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
40 changes: 31 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ install(EXPORT retinifyTargets
FILE retinifyTargets.cmake
NAMESPACE retinify::
DESTINATION lib/cmake/retinify
COMPONENT dev
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
Expand All @@ -43,6 +44,7 @@ configure_package_config_file(
)
install(FILES "${CMAKE_BINARY_DIR}/retinifyConfig.cmake"
DESTINATION "lib/cmake/retinify"
COMPONENT dev
)

# ALL IN ONE HEADER
Expand All @@ -55,6 +57,14 @@ configure_file(
install(
FILES "${CMAKE_BINARY_DIR}/include/retinify/retinify.hpp"
DESTINATION include/retinify
COMPONENT dev
)
install(
FILES
"${CMAKE_BINARY_DIR}/include/retinify/retinifyVersion.hpp"
"${CMAKE_BINARY_DIR}/include/retinify/retinifyModels.hpp"
DESTINATION include/retinify
COMPONENT dev
)

# DOWNLOAD MODELS
Expand Down Expand Up @@ -97,15 +107,20 @@ if(BUILD_SAMPLES)
endif(BUILD_SAMPLES)

# SHARE
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION share/retinify)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/NOTICE.md DESTINATION share/retinify)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/VERSION DESTINATION share/retinify)
install(FILES ${DOWNLOADED_MODEL_ASSETS} DESTINATION share/retinify/weights/${PROJECT_VERSION})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION share/retinify COMPONENT runtime)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/NOTICE.md DESTINATION share/retinify COMPONENT runtime)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/VERSION DESTINATION share/retinify COMPONENT runtime)
install(FILES ${DOWNLOADED_MODEL_ASSETS} DESTINATION share/retinify/weights/${PROJECT_VERSION} COMPONENT runtime)

# CPACK
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_NAME "libretinify-dev")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_ALL runtime dev)
set(CPACK_COMPONENT_RUNTIME_DESCRIPTION "Runtime library for retinify")
set(CPACK_COMPONENT_DEV_DESCRIPTION "Development files for retinify")
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
set(CPACK_COMPONENT_DEV_DEPENDS runtime)

if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64)$")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64)
Expand Down Expand Up @@ -152,13 +167,20 @@ if(BUILD_WITH_TENSORRT)
set(_retinify_pkg_tag "cuda${_retinify_cuda_major}-tensorrt${_retinify_tensorrt_major}")
endif()

set(CPACK_DEBIAN_FILE_NAME
"${CPACK_PACKAGE_NAME}-${_retinify_pkg_tag}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb"
)
get_target_property(RETINIFY_SOVERSION retinify SOVERSION)
if(NOT RETINIFY_SOVERSION)
set(RETINIFY_SOVERSION "${PROJECT_VERSION_MAJOR}")
endif()

set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME "libretinify${RETINIFY_SOVERSION}")
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "libretinify-dev")
set(CPACK_DEBIAN_RUNTIME_FILE_NAME "${CPACK_DEBIAN_RUNTIME_PACKAGE_NAME}-${_retinify_pkg_tag}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
set(CPACK_DEBIAN_DEV_FILE_NAME "${CPACK_DEBIAN_DEV_PACKAGE_NAME}-${_retinify_pkg_tag}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")

set(CPACK_DEBIAN_RUNTIME_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_DEV_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Sensui Yagi <contact@retinify.ai>")
set(CPACK_PACKAGE_CONTACT "contact@retinify.ai")
set(CPACK_PACKAGE_DESCRIPTION "Real-Time AI Stereo Vision Library")
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://retinify.ai")
Expand Down
33 changes: 26 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ BUILD_WITH_TENSORRT=ON
BUILD_SAMPLES=OFF
BUILD_TESTS=OFF
DO_INSTALL=0
DEV_MODE=0

# ARGUMENTS
for arg in "$@"; do
case "$arg" in
--dev)
DEV_MODE=1
;;
--install)
DO_INSTALL=1
;;
Expand All @@ -21,13 +25,15 @@ for arg in "$@"; do
--cpu)
BUILD_WITH_TENSORRT=OFF
;;
--dev)
BUILD_SAMPLES=ON
--tests)
BUILD_TESTS=ON
;;
--samples)
BUILD_SAMPLES=ON
;;
*)
echo "Unknown option: $arg"
echo "Usage: $0 [--install] [--tensorrt|--cpu] [--dev]"
echo "Usage: $0 [--dev] [--install] [--tensorrt|--cpu] [--tests] [--samples]"
exit 1
;;
esac
Expand Down Expand Up @@ -57,17 +63,30 @@ cpack -G DEB
if [[ "${DO_INSTALL}" -eq 1 ]]; then
echo -e "\033[1;32m[RETINIFY] INSTALLING DEBIAN PACKAGE\033[0m"

DEB_PACKAGE=$(ls -t libretinify-*.deb 2>/dev/null | head -n 1)
RUNTIME_DEB=$(ls -t libretinify[0-9]*-*.deb 2>/dev/null | head -n 1)
if [[ -z "${RUNTIME_DEB}" ]]; then
RUNTIME_DEB=$(ls -t libretinify-*.deb 2>/dev/null | grep -v "libretinify-dev" | head -n 1)
fi
DEV_DEB=$(ls -t libretinify-dev-*.deb 2>/dev/null | head -n 1)

if [[ -z "${DEB_PACKAGE}" ]]; then
if [[ -z "${RUNTIME_DEB}" ]]; then
echo -e "\033[1;31m[RETINIFY] ERROR: RETINIFY DEBIAN PACKAGE NOT FOUND.\033[0m"
exit 1
fi

INSTALL_PKGS=("${RUNTIME_DEB}")
if [[ "${DEV_MODE}" -eq 1 ]]; then
if [[ -z "${DEV_DEB}" ]]; then
echo -e "\033[1;31m[RETINIFY] ERROR: RETINIFY DEV PACKAGE NOT FOUND.\033[0m"
exit 1
fi
INSTALL_PKGS+=("${DEV_DEB}")
fi

if [[ $EUID -eq 0 ]]; then
dpkg -i "${DEB_PACKAGE}"
dpkg -i "${INSTALL_PKGS[@]}"
else
sudo dpkg -i "${DEB_PACKAGE}"
sudo dpkg -i "${INSTALL_PKGS[@]}"
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion docs/content/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cd retinify
## Install retinify
Build retinify and install its Debian package.
```bash
./build.sh --install --tensorrt
./build.sh --install --dev
```

## Verify Installation
Expand Down
7 changes: 4 additions & 3 deletions retinify/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ endif()
# INSTALL
install(TARGETS retinify
EXPORT retinifyTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib COMPONENT runtime NAMELINK_COMPONENT dev
ARCHIVE DESTINATION lib COMPONENT dev
RUNTIME DESTINATION bin COMPONENT runtime
)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
DESTINATION include
COMPONENT dev
FILES_MATCHING PATTERN "*.hpp"
)

Expand Down
5 changes: 0 additions & 5 deletions retinify/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,3 @@ target_include_directories(retinify-tests
PRIVATE
../src # retinify source
)

# INSTALL
install(TARGETS retinify-tests
RUNTIME DESTINATION bin
)