Skip to content

Commit 1d1cd92

Browse files
authored
add back the configure script (#378)
* use c++17 * add configure script * configure
1 parent 8c39218 commit 1d1cd92

File tree

3 files changed

+86
-7
lines changed

3 files changed

+86
-7
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ debug.*
5959
!logo.png
6060
!docs/Makefile
6161
!docs/markdown/images/*
62+
63+
64+
/.build
65+

configure

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/sh
2+
set -e
3+
4+
BUILD_LIB=1
5+
BUILD_TESTS=0
6+
BUILD_FAKE=0
7+
BUILD_EXAMPLES=0
8+
BUILD_USER_CODES=0
9+
10+
if [ ! -e /dev/nvidia0 ]; then
11+
BUILD_FAKE=1
12+
echo "CUDA NOT Found, using BUILD_FAKE=$BUILD_FAKE"
13+
fi
14+
15+
parse_args() {
16+
for i in "$@"; do
17+
case $i in
18+
--prefix=*)
19+
PREFIX="${i#*=}"
20+
;;
21+
--examples)
22+
BUILD_EXAMPLES=1
23+
;;
24+
--tests)
25+
BUILD_TESTS=1
26+
;;
27+
--user-code)
28+
BUILD_USER_CODE=1
29+
;;
30+
--fake-cuda)
31+
BUILD_FAKE=1
32+
;;
33+
*)
34+
echo "unknown argument $i"
35+
exit 1
36+
;;
37+
esac
38+
done
39+
}
40+
41+
parse_args $@
42+
43+
cmake_flag() {
44+
echo "-D$1=$2"
45+
}
46+
47+
cmake_flags() {
48+
if [ ! -z "$PREFIX" ]; then
49+
cmake_flag CMAKE_INSTALL_PREFIX $PREFIX
50+
fi
51+
cmake_flag CMAKE_RUNTIME_OUTPUT_DIRECTORY $PWD/bin
52+
cmake_flag BUILD_TESTS $BUILD_TESTS
53+
cmake_flag BUILD_FAKE $BUILD_FAKE
54+
cmake_flag BUILD_EXAMPLES $BUILD_EXAMPLES
55+
cmake_flag BUILD_LIB $BUILD_LIB
56+
cmake_flag BUILD_USER_CODES $BUILD_USER_CODES
57+
}
58+
59+
cd $(dirname $0)
60+
W=$PWD
61+
62+
build='.build'
63+
64+
gen_make() {
65+
echo "build:"
66+
echo "\t\$(MAKE) -C $build"
67+
echo "install:"
68+
echo "\t\$(MAKE) -C $build install"
69+
echo "test:"
70+
echo "\t\$(MAKE) -C $build test"
71+
}
72+
73+
mkdir -p $build
74+
cd $build
75+
cmake $W $(cmake_flags)
76+
77+
gen_make >$W/Makefile

src/color.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1+
#include <array>
2+
13
#include <opencv2/opencv.hpp>
24

35
namespace hyperpose {
46

5-
using color_t = std::tuple<uint8_t, uint8_t, uint8_t>;
7+
using color_t = std::array<uint8_t, 3>;
68

79
inline cv::Scalar to_cv_scalar(const color_t& color)
810
{
9-
// const auto [r, g, b] = color;
10-
const auto r = std::get<0>(color);
11-
const auto g = std::get<1>(color);
12-
const auto b = std::get<2>(color);
13-
11+
const auto& [r, g, b] = color;
1412
return cv::Scalar(r, g, b);
1513
}
1614

@@ -49,4 +47,4 @@ std::vector<T> map(const F& f, const std::vector<S>& input)
4947

5048
const std::vector<cv::Scalar> coco_colors = map<cv::Scalar>(to_cv_scalar, coco_colors_rgb);
5149

52-
}
50+
}

0 commit comments

Comments
 (0)