Pārlūkot izejas kodu

Merge branch 'superbuild_features'

Jean-Christophe Fillion-Robin 15 gadi atpakaļ
vecāks
revīzija
bf3d1c5dac

+ 11 - 8
CMake/ctkDashboardDriverScript.cmake

@@ -23,6 +23,7 @@
 # steps of the different CTK sub-project (library, application or plugins)
 #
 
+#-----------------------------------------------------------------------------
 # The following variable are expected to be define in the top-level script:
 set(expected_variables
   ADDITIONNAL_CMAKECACHE_OPTION
@@ -58,14 +59,16 @@ foreach(var ${expected_variables})
   endif()
 endforeach()
 
+set(git_repository http://github.com/commontk/CTK.git)
+
 # Should binary directory be cleaned?
 set(empty_binary_directory FALSE)
 
 # Attempt to build and test also if 'ctest_update' returned an error
 set(force_build FALSE)
 
+# Set model options
 set(model "")
-
 if (SCRIPT_MODE STREQUAL "experimental")
   set(empty_binary_directory FALSE)
   set(force_build TRUE)
@@ -95,7 +98,7 @@ if(empty_binary_directory)
 endif()
 
 if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
-  set(CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} clone http://github.com/commontk/CTK.git ${CTEST_SOURCE_DIRECTORY}")
+  set(CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} clone ${git_repository} ${CTEST_SOURCE_DIRECTORY}")
 endif()
 
 set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}")
@@ -137,7 +140,7 @@ ${ADDITIONNAL_CMAKECACHE_OPTION}
     ctest_submit(FILES "${CTEST_BINARY_DIRECTORY}/Project.xml")
 
     # Build top level
-    message("Build SuperBuild")
+    message("----------- [ Build SuperBuild ] -----------")
     ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
     ctest_submit(PARTS Build)
     
@@ -176,7 +179,7 @@ ${ADDITIONNAL_CMAKECACHE_OPTION}
      
      # Loop over kit suffixes and try to build the corresponding target
      foreach(kit_suffixe ${kit_suffixes})
-       message("Build ${subproject}${kit_suffixe}")
+       message("----------- [ Build ${subproject}${kit_suffixe} ] -----------")
        set(CTEST_BUILD_TARGET "${subproject}${kit_suffixe}")
        ctest_build(BUILD "${ctk_build_dir}" APPEND)
      endforeach()
@@ -191,7 +194,7 @@ ${ADDITIONNAL_CMAKECACHE_OPTION}
     foreach(subproject ${CTEST_PROJECT_SUBPROJECTS})
       set_property(GLOBAL PROPERTY SubProject ${subproject})
       set_property(GLOBAL PROPERTY Label ${subproject})
-      message("Test ${subproject}")
+      message("----------- [ Test ${subproject} ] -----------")
 
       ctest_test(
         BUILD "${ctk_build_dir}" 
@@ -203,7 +206,7 @@ ${ADDITIONNAL_CMAKECACHE_OPTION}
 
       # Coverage per sub-project (library, application or plugin)
       if (WITH_COVERAGE AND CTEST_COVERAGE_COMMAND)
-        message("Coverage ${subproject}")
+        message("----------- [ Coverage ${subproject} ] -----------")
         ctest_coverage(BUILD "${ctk_build_dir}" LABELS "${subproject}")
         ctest_submit(PARTS Coverage)
       endif ()
@@ -220,14 +223,14 @@ ${ADDITIONNAL_CMAKECACHE_OPTION}
     
     # Global coverage ... 
     if (WITH_COVERAGE AND CTEST_COVERAGE_COMMAND)
-      message("Global coverage")
+      message("----------- [ Global coverage ] -----------")
       ctest_coverage(BUILD "${ctk_build_dir}")
       ctest_submit(PARTS Coverage)
     endif ()
     
     # Global dynamic analysis ...
     if (WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND)
-        message("Global memcheck")
+        message("----------- [ Global memcheck ] -----------")
         ctest_memcheck(BUILD "${ctk_build_dir}")
         ctest_submit(PARTS MemCheck)
       endif ()

+ 1 - 1
CMake/ctkDashboardScript.EXAMPLE.cmake

@@ -55,7 +55,7 @@ set(SCRIPT_MODE "experimental") # "experimental", "continuous", "nightly"
 # Project specific properties
 #
 set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/CTK")
-set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/CTK-Superbuild-${SCRIPT_MODE}")
+set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/CTK-Superbuild-${CTEST_BUILD_CONFIGURATION}-${SCRIPT_MODE}")
 
 # Additionnal CMakeCache options - For example:
 # CTK_LIB_Widgets:BOOL=ON

+ 4 - 0
CMakeExternals/DCMTK.cmake

@@ -32,5 +32,9 @@ IF(${add_project})
       ALWAYS 1
       WORKING_DIRECTORY ${ep_build_dir}/${proj}
       )
+      
+    # Since DCMTK is statically build, there is not need to add its corresponding 
+    # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
+    
   ENDIF()
 ENDIF()

+ 3 - 0
CMakeExternals/KWStyle.cmake

@@ -21,5 +21,8 @@ IF(CTK_USE_KWSTYLE)
         ${ep_common_args}
       )
     SET(CTK_KWSTYLE_EXECUTABLE ${ep_install_dir}/bin/KWStyle)
+    
+    # Since KWStyle is an executable, there is not need to add its corresponding 
+    # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
   ENDIF()
 ENDIF()

+ 3 - 0
CMakeExternals/Log4Qt.cmake

@@ -24,6 +24,9 @@ IF(${add_project})
           -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
         )
     SET(Log4Qt_DIR ${ep_install_dir})
+    
+    # Since Log4Qt is statically build, there is not need to add its corresponding 
+    # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
       
   ENDIF()
 ENDIF()

+ 4 - 0
CMakeExternals/PythonQt.cmake

@@ -33,5 +33,9 @@ IF(${add_project})
         -DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
       )
     SET(PYTHONQT_INSTALL_DIR ${ep_install_dir})
+    
+    # Since the full path of PythonQt library is used, there is not need to add 
+    # its corresponding library output directory to CTK_EXTERNAL_LIBRARY_DIRS
+    
   ENDIF()
 ENDIF()

+ 3 - 0
CMakeExternals/QtMobility.cmake

@@ -64,5 +64,8 @@ IF(${add_project})
     INSTALL_COMMAND ${qtmobility_install_cmd}
     BUILD_IN_SOURCE 1
     )
+    
+  # Since the full path of QtMobility library is used, there is not need to add 
+  # its corresponding library output directory to CTK_EXTERNAL_LIBRARY_DIRS
 	
 ENDIF()

+ 5 - 0
CMakeExternals/VTK.cmake

@@ -31,5 +31,10 @@ IF(${add_project})
         -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
       )
     SET(VTK_DIR ${ep_build_dir}/${proj})
+    
+    # Since the link directories associated with VTK is used, it makes sens to 
+    # update CTK_EXTERNAL_LIBRARY_DIRS with its associated library output directory
+    LIST(APPEND CTK_EXTERNAL_LIBRARY_DIRS ${VTK_DIR}/bin)
+  
   ENDIF()
 ENDIF()

+ 8 - 2
CMakeLists.txt

@@ -240,6 +240,12 @@ ENDIF()
 SET(CTK_C_FLAGS "${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}")
 SET(CTK_CXX_FLAGS "${VISIBILITY_CXX_FLAGS} ${COVERAGE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}")
 
+IF(CMAKE_CXX_COMPILER_ID AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+  SET(cflags "-fdiagnostics-show-option -Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -fstack-protector-all -D_FORTIFY_SOURCE=2")
+  SET(CTK_C_FLAGS "${cflags} ${CTK_C_FLAGS}")
+  SET(CTK_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo ${CTK_CXX_FLAGS}")
+ENDIF()
+
 #-----------------------------------------------------------------------------
 # QT
 #
@@ -459,8 +465,8 @@ CONFIGURE_FILE(${CTK_SOURCE_DIR}/UseCTK.cmake.in
 #-----------------------------------------------------------------------------
 # Set C/CXX Flags
 #
-SET(CMAKE_CXX_FLAGS ${CTK_CXX_FLAGS})
-SET(CMAKE_C_FLAGS ${CTK_C_FLAGS})
+SET(CMAKE_CXX_FLAGS ${CTK_CXX_FLAGS} CACHE STRING "CMake C Flags" FORCE)
+SET(CMAKE_C_FLAGS ${CTK_C_FLAGS} CACHE STRING "CMake CXX Flags" FORCE)
 
 #-----------------------------------------------------------------------------
 # Add CTK library subdirectories

+ 13 - 1
CTKConfig.cmake.in

@@ -48,8 +48,20 @@ SET(CTK_LIBRARIES @CTK_LIBRARIES@)
 # The CTK include file directories.
 SET(CTK_INCLUDE_DIRS "@CTK_INCLUDE_DIRS_CONFIG@")
  
-# The CTK library directories.
+# The CTK library directories. Note that if
+# CTK_CONFIGURATION_TYPES is set (see below) then these directories
+# will be the parent directories under which there will be a directory
+# of runtime binaries for each configuration type.
 SET(CTK_LIBRARY_DIRS "@CTK_LIBRARY_DIRS_CONFIG@")
+
+# The CTK external project libraries.
+SET(CTK_EXTERNAL_LIBRARIES "@CTK_EXTERNAL_LIBRARIES_CONFIG@")
+
+# The CTK external project library directories. Note that if
+# CTK_CONFIGURATION_TYPES is set (see below) then these directories
+# will be the parent directories under which there will be a directory
+# of runtime binaries for each configuration type.
+SET(CTK_EXTERNAL_LIBRARY_DIRS "@CTK_EXTERNAL_LIBRARY_DIRS_CONFIG@")
  
 # The CTK binary executable directories. Note that if
 # CTK_CONFIGURATION_TYPES is set (see below) then these directories

+ 9 - 0
SuperBuild.cmake

@@ -29,6 +29,14 @@
 #
 
 #-----------------------------------------------------------------------------
+# Declare CTK_EXTERNAL_LIBRARY_DIRS variable - This variable stores
+# the library output directory associated with the different external project
+# It's then used in Utilities/LastConfigureStep/CTKGenerateCTKConfig.cmake to 
+# configure CTKConfig.cmake.in
+# This variable would then be exposed to project building against CTK
+SET(CTK_EXTERNAL_LIBRARY_DIRS)
+
+#-----------------------------------------------------------------------------
 # Make sure ${CTK_BINARY_DIR}/CTK-build/bin exists
 # May be used by some external project to install libs (e.g QtMobility)
 IF(NOT EXISTS ${CTK_BINARY_DIR}/CTK-build/bin)
@@ -207,6 +215,7 @@ ExternalProject_Add(${proj}
     -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
     -DCTK_CXX_FLAGS:STRING=${CTK_CXX_FLAGS}
     -DCTK_C_FLAGS:STRING=${CTK_C_FLAGS}
+    -DCTK_EXTERNAL_LIBRARY_DIRS:STRING=${CTK_EXTERNAL_LIBRARY_DIRS}
     -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
     -DCTKData_DIR:PATH=${CTKData_DIR}
 	  -DZMQ_DIR:PATH=${ZMQ_DIR}                     # FindVTK expects VTK_DIR variable to be defined

+ 36 - 0
Utilities/LastConfigureStep/CMakeLists.txt

@@ -43,6 +43,42 @@
 # end of CMakeLists processing, i.e. instead of waiting until some variables
 # are configured in SUBDIRS.
 
+
+SET(ctk_target_dependencies)
+
+# Loop over the list of CTK* targets and retrieve the associated dependencies
+FOREACH(ctk_target ${CTEST_PROJECT_SUBPROJECTS})
+  LIST(APPEND ctk_target_dependencies ${${ctk_target}_LIB_DEPENDS})
+ENDFOREACH()
+
+
+SET(CTK_EXTERNAL_LIBRARIES)
+
+# Loop over dependencies and append to CTK_EXTERNAL_LIBRARIES 
+# target dependency which are neither CTK or static library
+SET(link_type)
+FOREACH(ctk_target_dependency ${ctk_target_dependencies})
+  STRING(REGEX MATCH "(general|optimized|debug)" is_link_type ${ctk_target_dependency})
+  IF(is_link_type)
+    SET(link_type ${ctk_target_dependency})
+  ELSE()
+    # Sanity checks - link_type shouldn't be empty
+    IF(link_type STREQUAL "")
+      MESSAGE(SEND_ERROR "link_type shouldn't be empty")
+    ENDIF()
+    # Make sure ctk_target_dependency is not a CTK library
+    STRING(REGEX MATCH "(^(c|C)(t|T)(k|K)[a-zA-Z0-9]+$)" is_ctk_library ${ctk_target_dependency})
+    IF(NOT is_ctk_library)
+      # Make sure ctk_target_dependency is not a static library
+      GET_FILENAME_COMPONENT(ctk_target_dependency_ext ${ctk_target_dependency} EXT)
+      IF(NOT ctk_target_dependency_ext STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX)
+        LIST(APPEND CTK_EXTERNAL_LIBRARIES ${link_type} ${ctk_target_dependency})
+      ENDIF()
+      SET(link_type)
+    ENDIF()
+  ENDIF()
+ENDFOREACH()
+
 #-----------------------------------------------------------------------------
 # Create the CTKConfig.cmake file containing the CTK configuration.
 # Since it might generate configuration file depending

+ 13 - 7
Utilities/LastConfigureStep/CTKGenerateCTKConfig.cmake

@@ -64,9 +64,20 @@ SET(CTK_CONFIG_INSTALL_ONLY)
 # The "use" file.
 SET(CTK_USE_FILE ${CTK_SUPERBUILD_BINARY_DIR}/UseCTK.cmake)
 
+# Determine the include directories needed.
+SET(CTK_INCLUDE_DIRS_CONFIG
+  ${CTK_BASE_INCLUDE_DIRS}
+)
+
 # Library directory.
 SET(CTK_LIBRARY_DIRS_CONFIG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 
+# External project libraries.
+SET(CTK_EXTERNAL_LIBRARIES_CONFIG ${CTK_EXTERNAL_LIBRARIES})
+
+# External project library directory.
+SET(CTK_EXTERNAL_LIBRARY_DIRS_CONFIG ${CTK_EXTERNAL_LIBRARY_DIRS})
+
 # Runtime library directory.
 SET(CTK_RUNTIME_LIBRARY_DIRS_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
 
@@ -76,16 +87,11 @@ SET(CTK_EXECUTABLE_DIRS_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
 # QtDesigner plugins directory
 SET(CTK_QTDESIGNERPLUGINS_DIR_CONFIG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 
-# Determine the include directories needed.
-SET(CTK_INCLUDE_DIRS_CONFIG
-  ${CTK_BASE_INCLUDE_DIRS}
-)
-
 # Executable locations.
 
 # CMake extension module directory.
-SET(CTK_CMAKE_DIR_CONFIG "${CTK_CMAKE_DIR}")
-SET(CTK_CMAKE_UTILITIES_DIR_CONFIG "${CTK_CMAKE_UTILITIES_DIR}")
+SET(CTK_CMAKE_DIR_CONFIG ${CTK_CMAKE_DIR})
+SET(CTK_CMAKE_UTILITIES_DIR_CONFIG ${CTK_CMAKE_UTILITIES_DIR})
 
 # Build configuration information.
 SET(CTK_CONFIGURATION_TYPES_CONFIG ${CMAKE_CONFIGURATION_TYPES})