CMakeLists.txt 1.5 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
# paddle trainer package

set(TRAINER_SOURCES
        ParameterUpdater.cpp
        ParamUtil.cpp
        RemoteParameterUpdater.cpp
        Tester.cpp
        Trainer.cpp
        TrainerInternal.cpp
        ThreadParameterUpdater.cpp
        TrainerInternalConfig.cpp
        TrainerConfigHelper.cpp)

set(TRAINER_HEADERS
        ParameterUpdater.h
        ParamUtil.h
        RemoteParameterUpdater.h
        Tester.h
        TesterConfig.h
        Trainer.h
        TrainerInternal.h
        TrainerInternalConfig.h
        ThreadParameterUpdater.h
        TrainerConfigHelper.h)

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
    gen_proto_cpp)

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

add_paddle_exe(paddle_trainer
    TrainerMain.cpp)

add_paddle_exe(paddle_merge_model
    MergeModel.cpp)

if(WITH_TESTING)
    add_subdirectory(tests)
endif()
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)