Skip to content

Commit 29efd69

Browse files
peng.li24claude
andcommitted
feat: include README and example code in DEB package
Install README.md and example/{CMakeLists.txt,main.cpp} to /usr/share/numpycpp/ so users can copy and build after dpkg -i. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 223e544 commit 29efd69

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ install(FILES
4444
DESTINATION lib/cmake/numpycpp
4545
)
4646

47+
# ---- Docs & examples -------------------------------------------------------
48+
install(FILES README.md
49+
DESTINATION share/numpycpp
50+
)
51+
install(DIRECTORY example/
52+
DESTINATION share/numpycpp/example
53+
)
54+
4755
# ---- CPack DEB packaging ----------------------------------------------------
4856
set(CPACK_PACKAGE_NAME "numpycpp-dev")
4957
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})

example/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
project(numpycpp_example LANGUAGES CXX)
3+
4+
find_package(numpycpp REQUIRED)
5+
6+
add_executable(example main.cpp)
7+
target_link_libraries(example PRIVATE numpycpp::numpycpp)

example/main.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <numpy/core.h>
2+
#include <iostream>
3+
#include <vector>
4+
5+
int main() {
6+
double data[] = {1.0, 2.0, 3.0, 4.0, 5.0};
7+
8+
std::cout << "sum: " << numpy::sum(data, 5) << std::endl;
9+
std::cout << "mean: " << numpy::mean(data, 5) << std::endl;
10+
std::cout << "max: " << numpy::max(data, 5) << std::endl;
11+
std::cout << "min: " << numpy::min(data, 5) << std::endl;
12+
13+
double sq[5];
14+
numpy::sqrt(data, sq, 5);
15+
std::cout << "sqrt:";
16+
for (int i = 0; i < 5; ++i) std::cout << " " << sq[i];
17+
std::cout << std::endl;
18+
19+
return 0;
20+
}

0 commit comments

Comments
 (0)