|
1 |
| -if(NOT MSVC) |
2 |
| - set(UNITTEST_STATIC_LINK ON) |
3 |
| -endif() |
4 |
| - |
5 |
| -set(CPP_EXAMPLE_LIBS |
6 |
| - ${BEGIN_WHOLE_ARCHIVE} mxnet_static ${END_WHOLE_ARCHIVE} |
7 |
| - ${BEGIN_WHOLE_ARCHIVE} dmlc ${END_WHOLE_ARCHIVE} |
8 |
| - ${mxnet_LINKER_LIBS} |
9 |
| - ) |
10 |
| - |
11 |
| -set(CPP_PACKAGE_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../include/mxnet-cpp/) |
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
12 | 17 |
|
13 |
| -set(CPPEX_DEPS cpp_package_op_h) |
| 18 | +# Explicitly set GENERATED property https://gitlab.kitware.com/cmake/cmake/issues/18399 |
| 19 | +set_property(SOURCE ${CMAKE_CURRENT_LIST_DIR}/../include/mxnet-cpp/op.h PROPERTY GENERATED 1) |
14 | 20 |
|
15 |
| -file(GLOB_RECURSE CPP_PACKAGE_HEADERS |
16 |
| - "${CPP_PACKAGE_INCLUDE_DIR}/*.h" |
17 |
| - "${CPP_PACKAGE_INCLUDE_DIR}/*.hpp" |
18 |
| - ) |
| 21 | +add_executable(test_regress_label test_regress_label.cpp) |
| 22 | +target_link_libraries(test_regress_label mxnet_cpp) |
19 | 23 |
|
20 |
| -if (MSVC) |
21 |
| - add_custom_target( |
22 |
| - cpp_package_deploy_library ALL |
23 |
| - DEPENDS mxnet |
24 |
| - COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:mxnet> $<TARGET_FILE_DIR:mlp> |
25 |
| - ) |
26 |
| -endif() |
27 |
| - |
28 |
| -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include) |
| 24 | +add_executable(lenet lenet.cpp) |
| 25 | +target_link_libraries(lenet mxnet_cpp) |
29 | 26 |
|
30 |
| -add_executable(test_regress_label test_regress_label.cpp ${CPP_PACKAGE_HAEDERS}) |
31 |
| -target_link_libraries(test_regress_label ${CPP_EXAMPLE_LIBS}) |
32 |
| -add_dependencies(test_regress_label ${CPPEX_DEPS}) |
| 27 | +add_executable(lenet_with_mxdataiter lenet_with_mxdataiter.cpp) |
| 28 | +target_link_libraries(lenet_with_mxdataiter mxnet_cpp) |
33 | 29 |
|
34 |
| -add_executable(lenet lenet.cpp ${CPP_PACKAGE_HEADERS}) |
35 |
| -target_link_libraries(lenet ${CPP_EXAMPLE_LIBS}) |
36 |
| -add_dependencies(lenet ${CPPEX_DEPS}) |
| 30 | +add_executable(alexnet alexnet.cpp) |
| 31 | +target_link_libraries(alexnet mxnet_cpp) |
37 | 32 |
|
38 |
| -add_executable(lenet_with_mxdataiter lenet_with_mxdataiter.cpp ${CPP_PACKAGE_HEADERS}) |
39 |
| -target_link_libraries(lenet_with_mxdataiter ${CPP_EXAMPLE_LIBS}) |
40 |
| -add_dependencies(lenet_with_mxdataiter ${CPPEX_DEPS}) |
| 33 | +add_executable(charRNN charRNN.cpp) |
| 34 | +target_link_libraries(charRNN mxnet_cpp) |
41 | 35 |
|
42 |
| -add_executable(alexnet alexnet.cpp ${CPP_PACKAGE_HEADERS}) |
43 |
| -target_link_libraries(alexnet ${CPP_EXAMPLE_LIBS}) |
44 |
| -add_dependencies(alexnet ${CPPEX_DEPS}) |
| 36 | +add_executable(googlenet googlenet.cpp) |
| 37 | +target_link_libraries(googlenet mxnet_cpp) |
45 | 38 |
|
46 |
| -add_executable(charRNN charRNN.cpp ${CPP_PACKAGE_HEADERS}) |
47 |
| -target_link_libraries(charRNN ${CPP_EXAMPLE_LIBS}) |
48 |
| -add_dependencies(charRNN ${CPPEX_DEPS}) |
| 39 | +add_executable(inception_bn inception_bn.cpp) |
| 40 | +target_link_libraries(inception_bn mxnet_cpp) |
49 | 41 |
|
50 |
| -add_executable(googlenet googlenet.cpp ${CPP_PACKAGE_HEADERS}) |
51 |
| -target_link_libraries(googlenet ${CPP_EXAMPLE_LIBS}) |
52 |
| -add_dependencies(googlenet ${CPPEX_DEPS}) |
| 42 | +add_executable(mlp mlp.cpp) |
| 43 | +target_link_libraries(mlp mxnet_cpp) |
53 | 44 |
|
54 |
| -add_executable(inception_bn inception_bn.cpp ${CPP_PACKAGE_HEADERS}) |
55 |
| -target_link_libraries(inception_bn ${CPP_EXAMPLE_LIBS}) |
56 |
| -add_dependencies(inception_bn ${CPPEX_DEPS}) |
| 45 | +add_executable(mlp_cpu mlp_cpu.cpp) |
| 46 | +target_link_libraries(mlp_cpu mxnet_cpp) |
57 | 47 |
|
58 |
| -add_executable(mlp mlp.cpp ${CPP_PACKAGE_HEADERS}) |
59 |
| -target_link_libraries(mlp ${CPP_EXAMPLE_LIBS}) |
60 |
| -add_dependencies(mlp ${CPPEX_DEPS}) |
| 48 | +add_executable(mlp_gpu mlp_gpu.cpp) |
| 49 | +target_link_libraries(mlp_gpu mxnet_cpp) |
61 | 50 |
|
62 |
| -add_executable(mlp_cpu mlp_cpu.cpp ${CPP_PACKAGE_HEADERS}) |
63 |
| -target_link_libraries(mlp_cpu ${CPP_EXAMPLE_LIBS}) |
64 |
| -add_dependencies(mlp_cpu ${CPPEX_DEPS}) |
| 51 | +add_executable(resnet resnet.cpp) |
| 52 | +target_link_libraries(resnet mxnet_cpp) |
65 | 53 |
|
66 |
| -add_executable(mlp_gpu mlp_gpu.cpp ${CPP_PACKAGE_HEADERS}) |
67 |
| -target_link_libraries(mlp_gpu ${CPP_EXAMPLE_LIBS}) |
68 |
| -add_dependencies(mlp_gpu ${CPPEX_DEPS}) |
69 | 54 |
|
70 |
| -add_executable(resnet resnet.cpp ${CPP_PACKAGE_HEADERS}) |
71 |
| -target_link_libraries(resnet ${CPP_EXAMPLE_LIBS}) |
72 |
| -add_dependencies(resnet ${CPPEX_DEPS}) |
| 55 | +if(MSVC) |
| 56 | + add_custom_target(cpp_package_deploy_library ALL |
| 57 | + DEPENDS mxnet |
| 58 | + COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:mxnet> $<TARGET_FILE_DIR:mlp>) |
| 59 | +endif() |
0 commit comments