qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [20/38] qpid-proton git commit: NO-JIRA: go binding build results in binary dir, not source dir
Date Thu, 23 Feb 2017 22:51:27 GMT
NO-JIRA: go binding build results in binary dir, not source dir

Avoid polluting source directory and avoid races when multiple builds are done
in parallel from the same source.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/9bd99ebf
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/9bd99ebf
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/9bd99ebf

Branch: refs/heads/go1
Commit: 9bd99ebf096ed83bd23ae05fe9cc0e6f65d9ac2e
Parents: ce6626b
Author: Alan Conway <aconway@redhat.com>
Authored: Thu Feb 16 00:44:52 2017 -0500
Committer: Alan Conway <aconway@redhat.com>
Committed: Thu Feb 16 16:52:44 2017 -0500

----------------------------------------------------------------------
 .gitignore                          |  7 -------
 examples/go/CMakeLists.txt          |  8 +++-----
 proton-c/bindings/go/CMakeLists.txt | 17 ++++++++---------
 3 files changed, 11 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9bd99ebf/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index aa9bc36..b769990 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,16 +31,9 @@ eclipse-classes
 # The usual location for proton-c build files
 proton-c/build
 
-# Executables built by go binding tests
-proton-c/bindings/go/bin
-
 # Testresults from the jenkins build script
 testresults
 
-# Go binding build output
-/proton-c/bindings/go/pkg
-/proton-c/bindings/go/bin
-
 # Python TOX test build output
 /proton-c/bindings/python/MANIFEST
 /proton-c/bindings/python/build

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9bd99ebf/examples/go/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/go/CMakeLists.txt b/examples/go/CMakeLists.txt
index c9aba01..861cdd8 100644
--- a/examples/go/CMakeLists.txt
+++ b/examples/go/CMakeLists.txt
@@ -20,12 +20,11 @@
 if(BUILD_GO)
 
   set(examples electron/broker electron/receive electron/send proton/broker)
-  file(GLOB_RECURSE example_source FOLLOW_SYMLINKS ${CMAKE_CURRENT_SOURCE_DIR}/*.go)
 
   # Build example exes
   foreach(example ${examples})
-    string(REPLACE / _ target ${example})
-    set(target "go_example_${target}")
+    string(REPLACE / - target ${example})
+    set(target "go-example-${target}")
     set(output ${CMAKE_CURRENT_BINARY_DIR}/${example})
     # Always run go_build, it will do nothing if there is nothing to do.
     # Otherwise it's too hard to get the dependencies right.
@@ -33,12 +32,11 @@ if(BUILD_GO)
       COMMAND ${GO_BUILD} ${GO_EXAMPLE_FLAGS} -o ${output} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.go
       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
       DEPENDS go-build)
-    list(APPEND example_targets ${target})
   endforeach()
 
   # Build test driver exe
   set(test_exe ${CMAKE_CURRENT_BINARY_DIR}/example_test)
-  add_custom_target(go_example_test ALL
+  add_custom_target(go-example-test ALL
     COMMAND ${GO_TEST} -c -o ${test_exe} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.go
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9bd99ebf/proton-c/bindings/go/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/CMakeLists.txt b/proton-c/bindings/go/CMakeLists.txt
index d0ffe9b..1cb9d6c 100644
--- a/proton-c/bindings/go/CMakeLists.txt
+++ b/proton-c/bindings/go/CMakeLists.txt
@@ -26,7 +26,6 @@ set(GO_TEST_FLAGS "-v" CACHE STRING "Flags for 'go test'")
 
 # Flags that differ for golang go and gcc go.
 if (go_ver MATCHES "gccgo")
-  # TODO aconway 2015-10-08: import cycles with -race under gccgo, investigate.
   set(GO_RPATH_FLAGS -gccgoflags "-Wl,-rpath=${CMAKE_BINARY_DIR}/proton-c")
 else()
   set(GO_RPATH_FLAGS -ldflags "-r ${CMAKE_BINARY_DIR}/proton-c")
@@ -37,7 +36,7 @@ separate_arguments(GO_TEST_FLAGS)
 
 # Following are CACHE INTERNAL so examples/CMakeLists.txt can see them.
 set(GO_ENV ${env_py} --
-  "GOPATH=${CMAKE_CURRENT_SOURCE_DIR}"
+  "GOPATH=${CMAKE_CURRENT_BINARY_DIR}"
   "CGO_CFLAGS=-I${CMAKE_SOURCE_DIR}/proton-c/include -I${CMAKE_BINARY_DIR}/proton-c/include"
   "CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/proton-c"
   "PN_INTEROP_DIR=${CMAKE_SOURCE_DIR}/tests/interop"
@@ -47,15 +46,15 @@ set(GO ${GO_ENV} ${GO_EXE} CACHE INTERNAL "Run go with environment set")
 
 set(GO_BUILD ${GO} build ${GO_BUILD_FLAGS} ${GO_RPATH_FLAGS} CACHE INTERNAL "Run go build")
 set(GO_INSTALL ${GO} install ${GO_BUILD_FLAGS} CACHE INTERNAL "Run go install" )
-set(GO_TEST ${GO} test ${GO_BUILD_FLAGS} ${GO_RPATH_FLAGS} ${GO_TEST_FLAGS} CACHE INTERNAL
"Run go test")
+set(GO_TEST ${GO} test ${GO_TEST_FLAGS} ${GO_RPATH_FLAGS} CACHE INTERNAL "Run go test")
 
-# Go tools insist on standard Go layout which puts compiled code in the source tree :(
-# Build output is all under git-ignored pkg or bin subdirectories, they are removed by make
clean.
-
-# The go build tools handle dependency checks and incremental builds better than
-# CMake so just run them every time, they do nothing if nothing needs to be
-# done.
+# The go build tools handle dependency checks and incremental builds better than CMake so
+# just run them every time, they do nothing if nothing needs to be done.
+#
+# The Go sources are copied to the binary directory so we can respect the standard Go tree
+# layout without polluting the source tree.
 add_custom_target(go-build ALL
+  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
   COMMAND ${GO_INSTALL} qpid.apache.org/...
   DEPENDS qpid-proton-core
   WORKING_DIRECTORY $ENV{PWD})


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message