|
|
|
@ -26,27 +26,23 @@ function(GO_LIBRARY NAME BUILD_TYPE)
|
|
|
|
|
|
|
|
|
|
|
|
# automatically get all dependencies specified in the source code
|
|
|
|
# automatically get all dependencies specified in the source code
|
|
|
|
# for given target.
|
|
|
|
# for given target.
|
|
|
|
add_custom_target(goGet env GOPATH=${GOPATH} ${CMAKE_Go_COMPILER} get -d ${rel}/...)
|
|
|
|
add_custom_target(${NAME}_goGet env GOPATH=${GOPATH} ${CMAKE_Go_COMPILER} get -d ${rel}/...)
|
|
|
|
|
|
|
|
|
|
|
|
# make a symlink that references Paddle inside $GOPATH, so go get
|
|
|
|
# make a symlink that references Paddle inside $GOPATH, so go get
|
|
|
|
# will use the local changes in Paddle rather than checkout Paddle
|
|
|
|
# will use the local changes in Paddle rather than checkout Paddle
|
|
|
|
# in github.
|
|
|
|
# in github.
|
|
|
|
add_custom_target(copyPaddle
|
|
|
|
add_custom_target(${NAME}_copyPaddle
|
|
|
|
COMMAND rm -rf ${PADDLE_IN_GOPATH}/Paddle
|
|
|
|
COMMAND rm -rf ${PADDLE_IN_GOPATH}/Paddle
|
|
|
|
COMMAND ln -sf ${PADDLE_DIR} ${PADDLE_IN_GOPATH}/Paddle)
|
|
|
|
COMMAND ln -sf ${PADDLE_DIR} ${PADDLE_IN_GOPATH}/Paddle)
|
|
|
|
add_dependencies(goGet copyPaddle)
|
|
|
|
add_dependencies(${NAME}_goGet ${NAME}_copyPaddle)
|
|
|
|
|
|
|
|
|
|
|
|
add_custom_command(OUTPUT ${OUTPUT_DIR}/.timestamp
|
|
|
|
add_custom_command(OUTPUT ${OUTPUT_DIR}/.timestamp
|
|
|
|
COMMAND env GOPATH=${GOPATH} ${CMAKE_Go_COMPILER} build ${BUILD_MODE}
|
|
|
|
COMMAND env GOPATH=${GOPATH} ${CMAKE_Go_COMPILER} build ${BUILD_MODE}
|
|
|
|
-gcflags=-shared -asmflags=-shared -installsuffix=_shared -a
|
|
|
|
|
|
|
|
-o "${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}"
|
|
|
|
-o "${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}"
|
|
|
|
${CMAKE_GO_FLAGS} ${GO_SOURCE}
|
|
|
|
${CMAKE_GO_FLAGS} ${GO_SOURCE}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
|
|
|
|
|
|
|
add_custom_target(${NAME} ALL DEPENDS ${OUTPUT_DIR}/.timestamp ${ARGN})
|
|
|
|
add_custom_target(${NAME} ALL DEPENDS ${OUTPUT_DIR}/.timestamp ${ARGN})
|
|
|
|
add_dependencies(${NAME} goGet)
|
|
|
|
add_dependencies(${NAME} ${NAME}_goGet)
|
|
|
|
|
|
|
|
|
|
|
|
if(NOT BUILD_TYPE STREQUAL "STATIC")
|
|
|
|
|
|
|
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} DESTINATION bin)
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endfunction(GO_LIBRARY)
|
|
|
|
endfunction(GO_LIBRARY)
|
|
|
|
|