include_directories(${LightGBM_HEADER_DIR})

if(USE_MPI)
  include_directories(${MPI_CXX_INCLUDE_PATH})
endif()

AUX_SOURCE_DIRECTORY(./application/ APPLICATION_SRC) 
AUX_SOURCE_DIRECTORY(./boosting/ BOOSTING_SRC) 
AUX_SOURCE_DIRECTORY(./io/ IO_SRC) 
AUX_SOURCE_DIRECTORY(./metric/ METRIC_SRC) 
AUX_SOURCE_DIRECTORY(./objective/ OBJECTIVE_SRC) 
AUX_SOURCE_DIRECTORY(./network/ NETWORK_SRC) 
AUX_SOURCE_DIRECTORY(./treelearner/ TREELEARNER_SRC) 

add_executable(lightgbm main.cpp ${APPLICATION_SRC} ${BOOSTING_SRC} ${IO_SRC} ${METRIC_SRC} ${OBJECTIVE_SRC} ${NETWORK_SRC} ${TREELEARNER_SRC})

add_library(_lightgbm SHARED c_api.cpp ${APPLICATION_SRC} ${BOOSTING_SRC} ${IO_SRC} ${METRIC_SRC} ${OBJECTIVE_SRC} ${NETWORK_SRC} ${TREELEARNER_SRC})

if(USE_MPI)
  TARGET_LINK_LIBRARIES(lightgbm ${MPI_CXX_LIBRARIES})
endif(USE_MPI)

