CMakeLists.txt 2.2 KB
Newer Older
Z
zhangjinchao01 已提交
1 2 3 4 5 6
# paddle trainer package

set(TRAINER_SOURCES
        ParameterUpdater.cpp
        ParamUtil.cpp
        RemoteParameterUpdater.cpp
7
        NewRemoteParameterUpdater.cpp
Z
zhangjinchao01 已提交
8 9 10
        Tester.cpp
        Trainer.cpp
        TrainerInternal.cpp
11
        TrainerBenchmark.cpp
Z
zhangjinchao01 已提交
12 13 14 15 16 17 18 19
        ThreadParameterUpdater.cpp
        TrainerInternalConfig.cpp
        TrainerConfigHelper.cpp)

set(TRAINER_HEADERS
        ParameterUpdater.h
        ParamUtil.h
        RemoteParameterUpdater.h
20
        NewRemoteParameterUpdater.h
Z
zhangjinchao01 已提交
21 22 23 24 25 26 27 28
        Tester.h
        TesterConfig.h
        Trainer.h
        TrainerInternal.h
        TrainerInternalConfig.h
        ThreadParameterUpdater.h
        TrainerConfigHelper.h)

Q
qiaolongfei 已提交
29
if(NOT WITH_GOLANG)
30 31 32 33 34 35
  list(REMOVE_ITEM TRAINER_SOURCES
          NewRemoteParameterUpdater.cpp)
  list(REMOVE_ITEM TRAINER_HEADERS
          NewRemoteParameterUpdater.h)
endif()

Z
zhangjinchao01 已提交
36 37 38 39 40 41 42 43
add_library(paddle_trainer_lib STATIC
    ${TRAINER_SOURCES})

add_style_check_target(paddle_trainer_lib
    ${TRAINER_SOURCES})
add_style_check_target(paddle_trainer_lib
    ${TRAINER_HEADERS})
add_dependencies(paddle_trainer_lib
Y
Yu Yang 已提交
44 45
    paddle_proto
    ${external_project_dependencies})
Z
zhangjinchao01 已提交
46 47 48 49 50 51 52 53

macro(add_paddle_exe TARGET_NAME)
  add_executable(${TARGET_NAME} ${ARGN})
  add_style_check_target(${TARGET_NAME} ${ARGN})
  link_paddle_exe(${TARGET_NAME})
endmacro()

if(WITH_TESTING)
54
  add_subdirectory(tests)
Z
zhangjinchao01 已提交
55 56
endif()

57 58 59 60 61 62 63 64 65 66 67 68
if(NOT WITH_C_API)
  add_paddle_exe(paddle_trainer TrainerMain.cpp)
  add_paddle_exe(paddle_merge_model MergeModel.cpp)

  install(TARGETS paddle_trainer paddle_merge_model
          RUNTIME DESTINATION opt/paddle/bin
          PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
          GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ)

  set_target_properties(paddle_trainer PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
  set_target_properties(paddle_merge_model PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
69 70 71 72 73

if(APPLE)
  set(CMAKE_EXE_LINKER_FLAGS "-framework CoreFoundation -framework Security")
endif()

Q
qiaolongfei 已提交
74
if(WITH_GOLANG)
75
  add_dependencies(paddle_trainer_lib paddle_pserver_cclient)
H
Helin Wang 已提交
76
  target_link_libraries(paddle_trainer_lib paddle_pserver_cclient)
77 78 79
  if(NOT WITH_C_API)
    target_link_libraries(paddle_trainer paddle_pserver_cclient)
  endif()
Q
qiaolongfei 已提交
80
endif(WITH_GOLANG)