b0noI commented on a change in pull request #9832: Ability to not build 
examples during the build of the cpp package.
URL: https://github.com/apache/incubator-mxnet/pull/9832#discussion_r169427978
 
 

 ##########
 File path: cpp-package/CMakeLists.txt
 ##########
 @@ -1,21 +1,23 @@
 if(USE_CPP_PACKAGE)
 
-set(CPP_PACKAGE_OP_H_HEADER ${CMAKE_CURRENT_LIST_DIR}/include/mxnet-cpp/op.h)
+  set(CPP_PACKAGE_OP_H_HEADER ${CMAKE_CURRENT_LIST_DIR}/include/mxnet-cpp/op.h)
 
-if(MSVC)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
-endif(MSVC)
+  if(MSVC)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
+  endif(MSVC)
 
-add_custom_target(
-  cpp_package_op_h ALL
-  BYPRODUCTS ${CPP_PACKAGE_OP_H_HEADER}
-  MAIN_DEPENDENCY mxnet
-  DEPENDS mxnet ${CMAKE_CURRENT_SOURCE_DIR}/scripts/OpWrapperGenerator.py
-  COMMAND echo "Running: OpWrapperGenerator.py"
-  COMMAND python OpWrapperGenerator.py $<TARGET_FILE:mxnet>
-  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/scripts
-)
+  add_custom_target(
+    cpp_package_op_h ALL
+    BYPRODUCTS ${CPP_PACKAGE_OP_H_HEADER}
+    MAIN_DEPENDENCY mxnet
+    DEPENDS mxnet ${CMAKE_CURRENT_SOURCE_DIR}/scripts/OpWrapperGenerator.py
+    COMMAND echo "Running: OpWrapperGenerator.py"
+    COMMAND python OpWrapperGenerator.py $<TARGET_FILE:mxnet>
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/scripts
+  )
 
-add_subdirectory(example)
+  if(NOT DO_NOT_BUILD_EXAMPLES)
 
 Review comment:
   @cjolivier01 yep, I kept the name generic deliberately, since if you do not 
need examples, probably you do not need them in all targets, so I hope the flag 
will be adopted as needed in other places. But if you think we need to make it 
more concrete, I'm okay with it.
   
    > what current use cases don?t build?
   
   Examples can consume several Gb after building. And also they consumes time 
to build. It make sense not to build them if there no explicit need.
   
   > for test target probably they should build?
   
   Yes, you are right, I do need to refactor ```IF``` statement to reflect this.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to