Skip to content

Commit 471a060

Browse files
committed
Add example for CMake building.
1 parent b5060e9 commit 471a060

5 files changed

Lines changed: 27 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,4 @@ add_custom_command(
292292

293293
# ./vgg images/frog.jpg
294294

295+
add_subdirectory(examples)

examples/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
3+
add_subdirectory(my_example)

examples/my_example/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
3+
4+
5+
6+
add_executable(MyExample
7+
${PROJECT_ROOT_DIR}/examples/my_example/my_example.chpl
8+
${CHAI_LIB_FILES}
9+
)
10+
add_dependencies(MyExample bridge)
11+
add_dependencies(MyExample ChAI)
12+
target_link_options(MyExample
13+
PRIVATE
14+
${CHAI_LINKER_ARGS}
15+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use Tensor;
2+
3+
4+
proc main() {
5+
var a = ndarray.arange(1, 10);
6+
writeln("a: ", a);
7+
}

examples/vgg/test.chpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ proc main(args: [] string) {
9898
// writeln("b sum: ", b.sum());
9999

100100
// return;
101-
101+
;
102102
runX(args[1]);
103103
return;
104104

0 commit comments

Comments
 (0)