Skip to content

Commit

Permalink
Merge pull request apache#1641 from yajiedesign/addcmake
Browse files Browse the repository at this point in the history
add EXTRA_OPERATORS with cmake
  • Loading branch information
tqchen committed Mar 30, 2016
2 parents 68890c2 + 026432e commit ce89474
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mxnet_option(USE_CUDNN "Build with cudnn support" ON) # one could set CUDNN_R
mxnet_option(USE_CUDA "Build with CUDA support" ON)
mxnet_option(USE_DIST_KVSTORE "Build with DIST_KVSTORE support" OFF)

SET(EXTRA_OPERATORS "" CACHE PATH "EXTRA OPERATORS PATH")


include(mshadow/cmake/mshadow.cmake)
Expand Down Expand Up @@ -83,6 +84,14 @@ mxnet_source_group("Source\\Cuda" GLOB_RECURSE "src/*.cu")
FILE(GLOB_RECURSE SOURCE "src/*.cc")
FILE(GLOB_RECURSE cuda "src/*.cu")

if (NOT (EXTRA_OPERATORS STREQUAL ""))
mxnet_source_group("Extra" GLOB_RECURSE "${EXTRA_OPERATORS}/*.cc")
mxnet_source_group("Extra\\Cuda" GLOB_RECURSE "${EXTRA_OPERATORS}/*.cu")
FILE(GLOB_RECURSE EXTRA_SRC "${EXTRA_OPERATORS}/*.cc")
FILE(GLOB_RECURSE EXTRA_CUSRC "${EXTRA_OPERATORS}/*.cu")
list(APPEND SOURCE ${EXTRA_SRC} ${EXTRA_CUSRC})
endif()

if(MSVC)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
Expand Down Expand Up @@ -114,6 +123,8 @@ if(NOT MSVC)
add_definitions(-DMSHADOW_IN_CXX11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
endif()

add_library(mxnet SHARED ${SOURCE})
Expand Down

0 comments on commit ce89474

Please sign in to comment.