qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject qpid-proton git commit: NO-JIRA: Small improvements to CMake files - Tidy up build type message to take account of builds where there is no single build type - Use generators expressions to construct tests paths (this makes Windows build/testing more
Date Thu, 30 Apr 2015 20:10:44 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master aad0884c9 -> 62ee7b4af


NO-JIRA: Small improvements to CMake files
- Tidy up build type message to take account of
  builds where there is no single build type
- Use generators expressions to construct tests paths
  (this makes Windows build/testing more robust)


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

Branch: refs/heads/master
Commit: 62ee7b4af7067e0424ff52fa79a6360b5bce58cd
Parents: aad0884
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Wed Apr 29 14:15:47 2015 -0400
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Thu Apr 30 16:00:13 2015 -0400

----------------------------------------------------------------------
 CMakeLists.txt          | 49 +++++++++++++------------
 proton-c/CMakeLists.txt | 86 +++++++++++++++++++-------------------------
 2 files changed, 61 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/62ee7b4a/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5667cc..2df2dfb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,14 +18,6 @@
 #
 cmake_minimum_required (VERSION 2.6)
 
-# Set default build type. Must come before project() which sets default to ""
-set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE string
-  "Build type: Debug, Release, RelWithDebInfo or MinSizeRel (default RelWithDebInfo)")
-if (CMAKE_BUILD_TYPE MATCHES "Deb")
-  set (has_debug_symbols " (has debug symbols)")
-endif (CMAKE_BUILD_TYPE MATCHES "Deb")
-message(STATUS "Build type is \"${CMAKE_BUILD_TYPE}\"${has_debug_symbols}")
-
 project (Proton C)
 
 if (MSVC)
@@ -34,6 +26,27 @@ if (MSVC)
 endif (MSVC)
 option(BUILD_WITH_CXX "Compile Proton using C++" ${DEFAULT_BUILD_WITH_CXX})
 
+if (BUILD_WITH_CXX)
+  project (Proton C CXX)
+endif (BUILD_WITH_CXX)
+
+if (CMAKE_CONFIGURATION_TYPES)
+  # There is no single "build type"...
+  message(STATUS "Build types are ${CMAKE_CONFIGURATION_TYPES}")
+else (CMAKE_CONFIGURATION_TYPES)
+  # There is a single build configuration
+  # If the build type is not set then set the default
+  if (NOT CMAKE_BUILD_TYPE)
+  set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE string
+       "Build type: Debug, Release, RelWithDebInfo or MinSizeRel (default RelWithDebInfo)"
FORCE)
+  endif ()
+
+  if (CMAKE_BUILD_TYPE MATCHES "Deb")
+    set (has_debug_symbols " (has debug symbols)")
+  endif (CMAKE_BUILD_TYPE MATCHES "Deb")
+  message(STATUS "Build type is \"${CMAKE_BUILD_TYPE}\"${has_debug_symbols}")
+endif (CMAKE_CONFIGURATION_TYPES)
+
 if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   # Default to universal binary on Mac OS X unless user has overriden
   if (NOT DEFINED CMAKE_OSX_ARCHITECTURES OR "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
@@ -41,10 +54,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   endif ()
 endif ()
 
-if (BUILD_WITH_CXX)
-  project (Proton C CXX)
-endif (BUILD_WITH_CXX)
-
 file(READ version.txt PN_VERSION_FILE)
 string(STRIP ${PN_VERSION_FILE} PN_VERSION_LINE)
 string(REPLACE "-" ";" PN_VERSION_SPLIT "${PN_VERSION_LINE}")
@@ -124,18 +133,8 @@ set (PROTON_SHARE ${SHARE_INSTALL_DIR}/proton-${PN_VERSION})
 # Pull in local cmake modules
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/Modules/")
 
-if (NOBUILD_JAVA)
-  set (DEFAULT_JAVA OFF)
-else()
-  find_package(Java)
-  if (JAVA_FOUND)
-    set (DEFAULT_JAVA ON)
-  else()
-    set (DEFAULT_JAVA OFF)
-  endif()
-endif()
-
-option (BUILD_JAVA "Build proton-j." ${DEFAULT_JAVA})
+find_package(Java)
+option (BUILD_JAVA "Build proton-j." ${JAVA_FOUND})
 
 if (BUILD_JAVA)
   add_subdirectory(proton-j)
@@ -153,7 +152,7 @@ install (DIRECTORY examples
 find_program (MAVEN_EXE mvn DOC "Location of the maven program")
 mark_as_advanced (MAVEN_EXE)
 if (JAVA_FOUND AND MAVEN_EXE)
-  add_test (proton-java mvn test --file ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml)
+  add_test (proton-java ${MAVEN_EXE} test --file ${Proton_SOURCE_DIR}/pom.xml)
 else (JAVA_FOUND AND MAVEN_EXE)
   message (STATUS "Cannot find both Java and Maven: testing disabled for Proton-J")
 endif (JAVA_FOUND AND MAVEN_EXE)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/62ee7b4a/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index b97bee7..4670a06 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -465,36 +465,6 @@ install (FILES
 
 # CTest
 
-  # suffix for Visual Studio targets.  Only support RelWithDebInfo for now.
-if (MSVC)
-  set (bld_suffix "/RelWithDebInfo")
-endif(MSVC)
-
-if (CMAKE_SYSTEM_NAME STREQUAL Windows)
-
-  # Substitute windows separators in path and remove empty entries.
-  # Replace necessary colons after windows drive letters.
-  function(set_path result path)
-    string (REGEX REPLACE ":" ";" path "${path}")
-    string (REGEX REPLACE ";;" ";" path "${path}")
-    string (REGEX REPLACE "^;" "" path "${path}")
-    string (REGEX REPLACE "\\\\" "/" path "${path}")
-    string (REGEX REPLACE ";([a-zA-Z]);" ";\\1:" path "${path}")
-    string (REGEX REPLACE "^([a-zA-Z]);" "\\1:" path "${path}")
-    set (${result} ${path} PARENT_SCOPE)
-  endfunction()
-
-else (CMAKE_SYSTEM_NAME STREQUAL Windows)
-
-  # Set variable result to path, with empty entries removed
-  function(set_path result path)
-    string (REGEX REPLACE "^:" "" path "${path}")
-    string (REGEX REPLACE "::" ":" path "${path}")
-    set (${result} ${path} PARENT_SCOPE)
-  endfunction()
-
-endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
-
 find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program")
 option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
 if (ENABLE_VALGRIND)
@@ -511,20 +481,35 @@ mark_as_advanced (VALGRIND_EXE)
 
 add_subdirectory(src/tests)
 
+if (CMAKE_SYSTEM_NAME STREQUAL Windows)
+  # No change needed for windows already use correct separator
+  function(to_native_path path result)
+    file (TO_NATIVE_PATH "${path}" path)
+    set (${result} ${path} PARENT_SCOPE)
+  endfunction()
+else (CMAKE_SYSTEM_NAME STREQUAL Windows)
+  # Just change ';'->':'
+  function(to_native_path path result)
+    file (TO_NATIVE_PATH "${path}" path)
+    string (REGEX REPLACE ";" ":" path "${path}")
+    set (${result} ${path} PARENT_SCOPE)
+  endfunction()
+endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
+
 # python test: tests/python/proton-test
 if (BUILD_PYTHON)
   set (py_root "${pn_test_root}/python")
   set (py_src "${CMAKE_CURRENT_SOURCE_DIR}/bindings/python")
   set (py_bin "${CMAKE_CURRENT_BINARY_DIR}/bindings/python")
-  set (py_bld "${CMAKE_CURRENT_BINARY_DIR}${bld_suffix}") # For windows
-  set (app_path "${pn_test_bin}/tools/apps/c${bld_suffix}")
-  set (app_path "${app_path}:${pn_test_root}/tools/apps/python")
-  set_path (py_path "${py_bin}:${py_bld}:${app_path}:$ENV{PATH}")
-  set_path (py_pythonpath "${py_root}:${py_src}:${py_bin}:${py_bld}|$ENV{PYTHONPATH}")
-  if (CMAKE_SYSTEM_NAME STREQUAL Windows)
-    set_path (py_pythonpath "${py_bin}${bld_suffix}:${py_pythonpath}")
-  endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
-  add_test (python-test ${env_py}
+  set (py_dll "$<TARGET_FILE_DIR:_cproton>")
+  set (py_bld "$<TARGET_FILE_DIR:qpid-proton>") # For windows
+  set (app_path $<TARGET_FILE_DIR:msgr-send> "${pn_test_root}/tools/apps/python")
+  set (py_path ${py_bld} ${app_path} $ENV{PATH})
+  set (py_pythonpath ${py_root} ${py_src} ${py_bin} ${py_dll} $ENV{PYTHONPATH})
+  to_native_path ("${py_path}" py_path)
+  to_native_path ("${py_pythonpath}" py_pythonpath)
+  add_test (NAME python-test
+            COMMAND ${env_py}
             "PATH=${py_path}" "PYTHONPATH=${py_pythonpath}" ${VALGRIND_ENV}
             ${PYTHON_EXECUTABLE} "${py_root}/proton-test")
   set_tests_properties(python-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
@@ -532,19 +517,22 @@ endif (BUILD_PYTHON)
 
 find_program(RUBY_EXE "ruby")
 if (RUBY_EXE)
-  set (rb_root "${pn_test_root}/ruby")
-  set (rb_src "${CMAKE_CURRENT_SOURCE_DIR}/bindings/ruby")
-  set (rb_lib "${CMAKE_CURRENT_SOURCE_DIR}/bindings/ruby/lib")
-  set (rb_bin "${CMAKE_CURRENT_BINARY_DIR}/bindings/ruby")
-  set (rb_bld "${CMAKE_CURRENT_BINARY_DIR}${bld_suffix}")
-  set (rb_path "$ENV{PATH}:${rb_bin}:${rb_bld}")
-  set (rb_rubylib "${rb_root}:${rb_src}:${rb_bin}:${rb_bld}:${rb_lib}")
-
   # ruby unit tests:  tests/ruby/proton-test
   # only enable the tests if the Ruby gem dependencies were found
   if (DEFAULT_RUBY_TESTING)
-    add_test (ruby-unit-test ${env_py} "PATH=${rb_path}" "RUBYLIB=${rb_rubylib}"
-      "${rb_root}/proton-test")
+    set (rb_root "${pn_test_root}/ruby")
+    set (rb_src "${CMAKE_CURRENT_SOURCE_DIR}/bindings/ruby")
+    set (rb_lib "${CMAKE_CURRENT_SOURCE_DIR}/bindings/ruby/lib")
+    set (rb_bin "${CMAKE_CURRENT_BINARY_DIR}/bindings/ruby")
+    set (rb_bld "$<TARGET_FILE_DIR:qpid-proton>")
+    set (rb_path $ENV{PATH} ${rb_bin} ${rb_bld})
+    set (rb_rubylib ${rb_root} ${rb_src} ${rb_bin} ${rb_bld} ${rb_lib})
+    to_native_path("${rb_path}" rb_path)
+    to_native_path("${rb_rubylib}" rb_rubylib)
+
+    add_test (NAME ruby-unit-test
+              COMMAND ${env_py} "PATH=${rb_path}" "RUBYLIB=${rb_rubylib}"
+                      "${rb_root}/proton-test")
 
     # ruby spec tests
     find_program(RSPEC_EXE rspec)


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


Mime
View raw message