This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  6ff8890fbd07e4aa93a2d232fec5d28321192672 (commit)
       via  9af8f411fa6df6268597a0ab744048a5e6bae341 (commit)
      from  1835942c915892d6a27a869f49f5583de0b34284 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6ff8890fbd07e4aa93a2d232fec5d28321192672
commit 6ff8890fbd07e4aa93a2d232fec5d28321192672
Merge: 1835942 9af8f41
Author:     Chuck Atkins <chuck.atk...@kitware.com>
AuthorDate: Wed Nov 18 11:51:18 2015 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Wed Nov 18 11:51:18 2015 -0500

    Merge topic 'add-cray-linux-platform' into next
    
    9af8f411 Cray: Fix static / dynamic detection logic and parse more driver 
flags


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9af8f411fa6df6268597a0ab744048a5e6bae341
commit 9af8f411fa6df6268597a0ab744048a5e6bae341
Author:     Chuck Atkins <chuck.atk...@kitware.com>
AuthorDate: Wed Nov 18 10:24:56 2015 -0600
Commit:     Chuck Atkins <chuck.atk...@kitware.com>
CommitDate: Wed Nov 18 10:24:56 2015 -0600

    Cray: Fix static / dynamic detection logic and parse more driver flags

diff --git a/Modules/Platform/CrayPrgEnv.cmake 
b/Modules/Platform/CrayPrgEnv.cmake
index a78846d..1652420 100644
--- a/Modules/Platform/CrayPrgEnv.cmake
+++ b/Modules/Platform/CrayPrgEnv.cmake
@@ -26,73 +26,53 @@ foreach(__lang C CXX Fortran)
 endforeach()
 
 # If the link type is not explicitly specified in the environment then
-# the Cray wrappers assume that the code will be built staticly
-if(NOT ((CMAKE_C_FLAGS MATCHES "(^| )-dynamic($| )") OR
-        (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )") OR
-        ("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic")))
+# the Cray wrappers assume that the code will be built staticly so
+# we check the following condition(s) are NOT met
+#  Compiler flags are explicitly dynamic
+#  Env var is dynamic and compiler flags are not explicitly static
+if(NOT (((CMAKE_C_FLAGS MATCHES "(^| )-dynamic($| )") OR
+         (CMAKE_CXX_FLAGS MATCHES "(^| )-dynamic($| )") OR
+         (CMAKE_Fortran_FLAGS MATCHES "(^| )-dynamic($| )") OR
+         (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )"))
+        OR
+       (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND
+         NOT ((CMAKE_C_FLAGS MATCHES "(^| )-static($| )") OR
+              (CMAKE_CXX_FLAGS MATCHES "(^| )-static($| )") OR
+              (CMAKE_Fortran_FLAGS MATCHES "(^| )-static($| )") OR
+              (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )")))))
   set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
   set(BUILD_SHARED_LIBS FALSE CACHE BOOL "")
   set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
   set(CMAKE_LINK_SEARCH_START_STATIC TRUE)
 endif()
 
-# Parse the implicit directories used by the wrappers
-get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES)
-foreach(__lang IN LISTS __langs)
-  if(__lang STREQUAL "C")
-    set(__empty_fname empty.c)
-  elseif(__lang STREQUAL CXX)
-    set(__empty_fname empty.cxx)
-  elseif(__lang STREQUAL Fortran)
-    set(__empty_fname empty.f90)
-  else()
-    continue()
-  endif()
-
-  execute_process(
-    COMMAND ${CMAKE_${__lang}_COMPILER} ${__verbose_flag} ${__empty_fname}
-    OUTPUT_VARIABLE __cray_output
-    ERROR_QUIET
-  )
-  string(REGEX MATCH "(^|\n)[^\n]*${__empty_fname}[^\n]*" __cray_driver_cmd 
"${__cray_output}")
-
-  # Parse include paths
-  string(REGEX MATCHALL " -I([^ ]+)" __cray_include_flags 
"${__cray_driver_cmd}")
-  foreach(_flag IN LISTS __cray_include_flags)
-    string(REGEX REPLACE "^ -I([^ ]+)" "\\1" _dir "${_flag}")
-    list(APPEND CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES ${_dir})
-  endforeach()
-  if(CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES)
-    list(REMOVE_DUPLICATES CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES)
-  endif()
-
-  # Parse library paths
-  string(REGEX MATCHALL " -L([^ ]+)" __cray_library_dir_flags 
"${__cray_driver_cmd}")
-  foreach(_flag IN LISTS __cray_library_dir_flags)
-    string(REGEX REPLACE "^ -L([^ ]+)" "\\1" _dir "${_flag}")
-    list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES ${_dir})
+function(__cray_parse_flags_with_sep OUTPUT FLAG_TAG SEP INPUT)
+  string(REGEX MATCHALL "${SEP}${FLAG_TAG}([^${SEP}]+)" FLAG_ARGS "${INPUT}")
+  foreach(FLAG_ARG IN LISTS FLAG_ARGS)
+    string(REGEX REPLACE
+      "^${SEP}${FLAG_TAG}([^${SEP}]+)" "\\1" FLAG_VALUE
+      "${FLAG_ARG}")
+    list(APPEND ${OUTPUT} ${FLAG_VALUE})
   endforeach()
-  if(CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
-    list(REMOVE_DUPLICATES CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
-  endif()
+  set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE)
+endfunction()
+macro(__cray_parse_flags OUTPUT FLAG_TAG INPUT)
+  __cray_parse_flags_with_sep(${OUTPUT} ${FLAG_TAG} " " "${INPUT}")
+endmacro()
 
-  # Parse library paths
-  string(REGEX MATCHALL " -l([^ ]+)" __cray_library_flags 
"${__cray_driver_cmd}")
-  foreach(_flag IN LISTS __cray_library_flags)
-    string(REGEX REPLACE "^ -l([^ ]+)" "\\1" _dir "${_flag}")
-    list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES ${_dir})
-  endforeach()
-  if(CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
-    list(REMOVE_DUPLICATES CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES)
+# Remove duplicates in a list
+macro(__cray_list_remove_duplicates VAR)
+  if(${VAR})
+    list(REMOVE_DUPLICATES ${VAR})
   endif()
-endforeach()
+endmacro()
 
 # Compute the intersection of several lists
-macro(__list_intersection L_OUT L0)
+function(__cray_list_intersect OUTPUT INPUT0)
   if(ARGC EQUAL 2)
-    list(APPEND ${L_OUT} ${${L0}})
+    list(APPEND ${OUTPUT} ${${INPUT0}})
   else()
-    foreach(I IN LISTS ${L0})
+    foreach(I IN LISTS ${INPUT0})
       set(__is_common 1)
       foreach(L IN LISTS ARGN)
         list(FIND ${L} "${I}" __idx)
@@ -102,26 +82,79 @@ macro(__list_intersection L_OUT L0)
         endif()
       endforeach()
       if(__is_common)
-        list(APPEND ${L_OUT}  "${I}")
+        list(APPEND ${OUTPUT}  "${I}")
       endif()
     endforeach()
   endif()
-  if(${L_OUT})
-    list(REMOVE_DUPLICATES ${L_OUT})
-  endif()
+  set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE)
+endfunction()
+
+macro(__cray_debug_print_list VAR)
+  message("${VAR}:")
+  foreach(I IN LISTS ${VAR})
+    message("  ${I}")
+  endforeach()
 endmacro()
 
+# Parse the implicit directories used by the wrappers
+get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES)
+foreach(__lang IN LISTS __langs)
+  if(__lang STREQUAL "C")
+    set(__empty empty.c)
+  elseif(__lang STREQUAL CXX)
+    set(__empty empty.cxx)
+  elseif(__lang STREQUAL Fortran)
+    set(__empty empty.f90)
+  else()
+    continue()
+  endif()
+
+  execute_process(
+    COMMAND ${CMAKE_${__lang}_COMPILER} ${__verbose_flag} ${__empty}
+    OUTPUT_VARIABLE __cmd_out
+    ERROR_QUIET
+  )
+  string(REGEX MATCH "(^|\n)[^\n]*${__empty}[^\n]*" __driver "${__cmd_out}")
+
+  # Parse include paths
+  set(__cray_flag_args)
+  __cray_parse_flags(__cray_flag_args "-I" "${__driver}")
+  __cray_parse_flags(__cray_flag_args "-isystem " "${__driver}")
+  list(APPEND CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES ${__cray_flag_args})
+  __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES)
+
+  # Parse library paths
+  set(__cray_flag_args)
+  __cray_parse_flags(__cray_flag_args "-L" "${__driver}")
+  list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES ${__cray_flag_args})
+  __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
+
+  # Parse libraries
+  set(__cray_flag_args)
+  __cray_parse_flags(__cray_flag_args "-l" "${__driver}")
+  __cray_parse_flags(__cray_linker_flags "-Wl" "${__driver}")
+  foreach(F IN LISTS __cray_linker_flags)
+    __cray_parse_flags_with_sep(__cray_flag_args "-l" "," "${F}")
+  endforeach()
+  list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES ${__cray_flag_args})
+  __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES)
+
+  __cray_debug_print_list(CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES)
+  __cray_debug_print_list(CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
+  __cray_debug_print_list(CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES)
+endforeach()
+
 # Determine the common directories between all languages and add them
 # as system search paths
-set(__cray_include_path_vars)
-set(__cray_library_path_vars)
+set(__cray_inc_path_vars)
+set(__cray_lib_path_vars)
 foreach(__lang IN LISTS __langs)
-  list(APPEND __cray_include_path_vars 
CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES)
-  list(APPEND __cray_library_path_vars 
CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
+  list(APPEND __cray_inc_path_vars 
CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES)
+  list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
 endforeach()
-if(__cray_include_path_vars)
-  __list_intersection(CMAKE_SYSTEM_INCLUDE_PATH ${__cray_include_path_vars})
+if(__cray_inc_path_vars)
+  __cray_list_intersect(CMAKE_SYSTEM_INCLUDE_PATH ${__cray_inc_path_vars})
 endif()
-if(__cray_library_path_vars)
-  __list_intersection(CMAKE_SYSTEM_LIBRARY_PATH ${__cray_library_path_vars})
+if(__cray_lib_path_vars)
+  __cray_list_intersect(CMAKE_SYSTEM_LIBRARY_PATH ${__cray_lib_path_vars})
 endif()

-----------------------------------------------------------------------

Summary of changes:
 Modules/Platform/CrayPrgEnv.cmake |  165 ++++++++++++++++++++++---------------
 1 file changed, 99 insertions(+), 66 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to