CMakeLists.txt 1.7 KB
Newer Older
Z
zhangjinchao01 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
# Gserver package contains:
#   * Layers
#   * Activations
#   * DataProviders
#   * Evaluators
#   * GradientMachines(NeuralNetwork)
file(GLOB_RECURSE GSERVER_HEADER RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
file(GLOB_RECURSE GSERVER_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.cpp")
set(GSERVER_SOURCES
    layers/LstmCompute.cu
    layers/GruCompute.cu
    ${GSERVER_SOURCES})

macro(filter_test VAR_NAME)
    set(tmp)
    foreach(p IN LISTS ${VAR_NAME})
        if(NOT ${p} MATCHES ".*tests/.*")
             set(tmp ${p} ${tmp})
        endif()
    endforeach()
    set(${VAR_NAME} ${tmp})
endmacro()

filter_test(GSERVER_HEADER)
filter_test(GSERVER_SOURCES)
if(NOT WITH_GPU)
    list(REMOVE_ITEM GSERVER_HEADER
W
wangyang59 已提交
28
        layers/CudnnConvBaseLayer.h
Z
zhangjinchao01 已提交
29
        layers/CudnnConvLayer.h
W
wangyang59 已提交
30
        layers/CudnnConvTransLayer.h
Z
zhangjinchao01 已提交
31
        layers/CudnnPoolLayer.h
H
hedaoyuan 已提交
32
        layers/CudnnBatchNormLayer.h)
Z
zhangjinchao01 已提交
33 34

    list(REMOVE_ITEM GSERVER_SOURCES
W
wangyang59 已提交
35
        layers/CudnnConvBaseLayer.cpp
Z
zhangjinchao01 已提交
36
        layers/CudnnConvLayer.cpp
W
wangyang59 已提交
37
        layers/CudnnConvTransLayer.cpp
Z
zhangjinchao01 已提交
38
        layers/CudnnPoolLayer.cpp
H
hedaoyuan 已提交
39
        layers/CudnnBatchNormLayer.cpp)
Z
zhangjinchao01 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52
    compile_cu_as_cpp(layers/LstmCompute.cu)
    compile_cu_as_cpp(layers/GruCompute.cu)
endif()

if(NOT WITH_PYTHON)
    list(REMOVE_ITEM GSERVER_SOURCES
            dataproviders/PyDataProvider.cpp)
    
    list(REMOVE_ITEM GSERVER_HEADER
            dataproviders/PyDataProvider.h)
endif()

if(WITH_GPU)
H
hedaoyuan 已提交
53
    cuda_add_library(paddle_gserver ${GSERVER_SOURCES})
Z
zhangjinchao01 已提交
54 55 56 57 58 59 60
else()
    add_library(paddle_gserver STATIC
        ${GSERVER_SOURCES})
endif()

add_style_check_target(paddle_gserver ${GSERVER_SOURCES})
add_style_check_target(paddle_gserver ${GSERVER_HEADER})
Y
Yu Yang 已提交
61
add_dependencies(paddle_gserver paddle_proto)
Z
zhangjinchao01 已提交
62 63 64
if(WITH_TESTING)
    add_subdirectory(tests)
endif()