parent
6cd1441df6
commit
8742441fc0
@ -0,0 +1,21 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
|
||||
get_filename_component(PARENT_DIR ${PARENT_DIR} DIRECTORY)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PARENT_DIR}/cmake")
|
||||
|
||||
project(cxx_go C Go)
|
||||
|
||||
include(golang)
|
||||
include(flags)
|
||||
|
||||
set(MASTER_LIB_NAME "paddle_master")
|
||||
go_library(${MASTER_LIB_NAME} SHARED)
|
||||
|
||||
if(PROJ_ROOT)
|
||||
add_custom_command(OUTPUT ${PROJ_ROOT}/python/paddle/v2/master/lib${MASTER_LIB_NAME}.so
|
||||
COMMAND rm ${CMAKE_CURRENT_BINARY_DIR}/lib${MASTER_LIB_NAME}.h
|
||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/lib${MASTER_LIB_NAME}.so ${PROJ_ROOT}/python/paddle/v2/master/
|
||||
DEPENDS ${MASTER_LIB_NAME})
|
||||
add_custom_target(paddle_master_shared ALL DEPENDS ${PROJ_ROOT}/python/paddle/v2/master/lib${MASTER_LIB_NAME}.so)
|
||||
endif(PROJ_ROOT)
|
@ -1 +0,0 @@
|
||||
*.whl
|
@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
go build -buildmode=c-shared ../c && rm c.h && mv c paddle_master/libmaster.so
|
||||
pip wheel .
|
@ -1,19 +0,0 @@
|
||||
from setuptools import setup, Distribution
|
||||
|
||||
|
||||
class BinaryDistribution(Distribution):
|
||||
def has_ext_modules(foo):
|
||||
return True
|
||||
|
||||
|
||||
setup(
|
||||
name='paddle_master',
|
||||
version='0.1',
|
||||
description='The client of the master server of PaddlePaddle.',
|
||||
url='https://github.com/PaddlePaddle/Paddle/go/master/python',
|
||||
author='PaddlePaddle Authors',
|
||||
author_email='paddle-dev@baidu.com',
|
||||
license='Apache 2.0',
|
||||
packages=['paddle_master'],
|
||||
package_data={'master': ['libmaster.so'], },
|
||||
distclass=BinaryDistribution)
|
@ -1,2 +1,3 @@
|
||||
*.whl
|
||||
*.so
|
||||
*.pyc
|
@ -1,7 +1,7 @@
|
||||
import ctypes
|
||||
import os
|
||||
|
||||
path = os.path.join(os.path.dirname(__file__), "libmaster.so")
|
||||
path = os.path.join(os.path.dirname(__file__), "libpaddle_master.so")
|
||||
lib = ctypes.cdll.LoadLibrary(path)
|
||||
|
||||
|
Loading…
Reference in new issue