diff options
91 files changed, 4256 insertions, 295 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a586764..5705e6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,6 +214,12 @@ ENDMACRO(CMAKE_SET_TARGET_FOLDER) #----------------------------------------------------------------------- MACRO (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- + # Create the KWIML library for CMake. + SET(KWIML cmIML) + SET(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities) + ADD_SUBDIRECTORY(Utilities/KWIML) + + #--------------------------------------------------------------------- # Create the kwsys library for CMake. SET(KWSYS_NAMESPACE cmsys) SET(KWSYS_USE_SystemTools 1) diff --git a/Copyright.txt b/Copyright.txt index 35f7e4b..83a2482 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -1,5 +1,5 @@ CMake - Cross Platform Makefile Generator -Copyright 2000-2009 Kitware, Inc., Insight Software Consortium +Copyright 2000-2011 Kitware, Inc., Insight Software Consortium All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Modules/AutomocInfo.cmake.in b/Modules/AutomocInfo.cmake.in index 2dc3aa2..8542ff6 100644 --- a/Modules/AutomocInfo.cmake.in +++ b/Modules/AutomocInfo.cmake.in @@ -3,6 +3,7 @@ set(AM_HEADERS "@_moc_headers@" ) set(AM_MOC_COMPILE_DEFINITIONS "@_moc_compile_defs@") set(AM_MOC_DEFINITIONS "@_moc_defs@") set(AM_MOC_INCLUDES "@_moc_incs@") +set(AM_MOC_OPTIONS "@_moc_options@") set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@") set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/") set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/") @@ -10,4 +11,5 @@ set(AM_QT_MOC_EXECUTABLE "@QT_MOC_EXECUTABLE@") set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/") set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/") set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" ) +set(AM_Qt5SrcTools_VERSION_MAJOR "@Qt5SrcTools_VERSION_MAJOR@" ) set(AM_TARGET_NAME "@_moc_target_name@") diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 51c8eac..bb1021b 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -4,7 +4,12 @@ # used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration # # However CPackRPM has specific features which are controlled by -# the specifics CPACK_RPM_XXX variables. +# the specifics CPACK_RPM_XXX variables. CPackRPM is a component aware +# generator so when CPACK_RPM_COMPONENT_INSTALL is ON some more +# CPACK_RPM_<ComponentName>_XXXX variables may be used in order +# to have component specific values. Note however that <componentName> +# refers to the **grouping name**. This may be either a component name +# or a component GROUP name. # Usually those vars correspond to RPM spec file entities, one may find # information about spec files here http://www.rpm.org/wiki/Docs. # You'll find a detailed usage of CPackRPM on the wiki: @@ -98,9 +103,11 @@ # If CPACK_SET_DESTDIR is set then you will get a warning message # but if there is file installed with absolute path you'll get # unexpected behavior. -# CPACK_RPM_SPEC_INSTALL_POST +# CPACK_RPM_SPEC_INSTALL_POST [deprecated] # Mandatory : NO # Default : - +# This way of specifying post-install script is deprecated use +# CPACK_RPM_POST_INSTALL_SCRIPT_FILE # May be used to set an RPM post-install command inside the spec file. # For example setting it to "/bin/true" may be used to prevent # rpmbuild to strip binaries. @@ -158,7 +165,7 @@ # Mandatory : NO # Default : - # May be used to embed a changelog in the spec file. -# The refered file will be read and directly put after the %changelog +# The refered file will be read and directly put after the %changelog # section. #============================================================================= @@ -388,9 +395,33 @@ if(CPACK_RPM_PACKAGE_RELOCATABLE) endif(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) endif(CPACK_RPM_PACKAGE_RELOCATABLE) -# check if additional fields for RPM spec header are given +# Check if additional fields for RPM spec header are given +# There may be some COMPONENT specific variables as well FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV) - IF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) + IF(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}) + IF(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}}) + else() + IF(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER} not defined") + message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + endif() + else() + IF(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + endif() + + IF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) STRING(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH) MATH(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1") STRING(SUBSTRING ${_RPM_SPEC_HEADER} 1 ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL) @@ -398,10 +429,10 @@ FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLIC STRING(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) SET(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}") + MESSAGE("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") ENDIF(CPACK_RPM_PACKAGE_DEBUG) - SET(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}") - ENDIF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) + SET(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") +ENDIF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) ENDFOREACH(_RPM_SPEC_HEADER) # CPACK_RPM_SPEC_INSTALL_POST @@ -435,20 +466,31 @@ else(CPACK_RPM_PACKAGE_COMPONENT) set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) endif(CPACK_RPM_PACKAGE_COMPONENT) + +# Handle post-install file if it has been specified if(CPACK_RPM_POST_INSTALL_READ_FILE) if(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) file(READ ${CPACK_RPM_POST_INSTALL_READ_FILE} CPACK_RPM_SPEC_POSTINSTALL) else(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring") endif(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) +else(CPACK_RPM_POST_INSTALL_READ_FILE) + # reset SPEC var value if no post install file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_POSTINSTALL "") endif(CPACK_RPM_POST_INSTALL_READ_FILE) +# Handle post-uninstall file if it has been specified if(CPACK_RPM_POST_UNINSTALL_READ_FILE) if(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) file(READ ${CPACK_RPM_POST_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_POSTUNINSTALL) else(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring") endif(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) +else(CPACK_RPM_POST_UNINSTALL_READ_FILE) + # reset SPEC var value if no post uninstall file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_POSTUNINSTALL "") endif(CPACK_RPM_POST_UNINSTALL_READ_FILE) # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE) @@ -471,20 +513,31 @@ else(CPACK_RPM_PACKAGE_COMPONENT) set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) endif(CPACK_RPM_PACKAGE_COMPONENT) + +# Handle pre-install file if it has been specified if(CPACK_RPM_PRE_INSTALL_READ_FILE) if(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) file(READ ${CPACK_RPM_PRE_INSTALL_READ_FILE} CPACK_RPM_SPEC_PREINSTALL) else(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring") endif(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) +else(CPACK_RPM_PRE_INSTALL_READ_FILE) + # reset SPEC var value if no pre-install file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_PREINSTALL "") endif(CPACK_RPM_PRE_INSTALL_READ_FILE) +# Handle pre-uninstall file if it has been specified if(CPACK_RPM_PRE_UNINSTALL_READ_FILE) if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) file(READ ${CPACK_RPM_PRE_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_PREUNINSTALL) else(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring") endif(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) +else(CPACK_RPM_PRE_UNINSTALL_READ_FILE) + # reset SPEC var value if no pre-uninstall file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_PREUNINSTALL "") endif(CPACK_RPM_PRE_UNINSTALL_READ_FILE) # CPACK_RPM_CHANGELOG_FILE diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 5ccbd6b..ea60354 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -65,7 +65,7 @@ # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, # 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0, # 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0, -# 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1 +# 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1, 1.47, 1.47.0, 1.48, 1.48.0 # # NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should # add both 1.x and 1.x.0 as shown above. Official Boost include directories @@ -449,7 +449,7 @@ else(Boost_FIND_VERSION_EXACT) # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.46.1" + "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" @@ -750,10 +750,12 @@ else(_boost_IN_CACHE) else() set (_boost_COMPILER "-il") endif() - elseif (MSVC90) - set(_boost_COMPILER "-vc90") + elseif (MSVC11) + set(_boost_COMPILER "-vc110") elseif (MSVC10) set(_boost_COMPILER "-vc100") + elseif (MSVC90) + set(_boost_COMPILER "-vc90") elseif (MSVC80) set(_boost_COMPILER "-vc80") elseif (MSVC71) diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index 462835a..1f49c3b 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -5,6 +5,9 @@ # LIBXSLT_INCLUDE_DIR - the LibXslt include directory # LIBXSLT_LIBRARIES - Link these to LibXslt # LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt +# Additionally, the following two variables are set (but not required for using xslt): +# LIBXSLT_EXSLT_LIBRARIES - Link to these if you need to link against the exslt library +# LIBXSLT_XSLTPROC_EXECUTABLE - Contains the full path to the xsltproc executable if found #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -23,7 +26,7 @@ # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls FIND_PACKAGE(PkgConfig) -PKG_CHECK_MODULES(PC_LIBXSLT libxslt) +PKG_CHECK_MODULES(PC_LIBXSLT QUIET libxslt) SET(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER}) FIND_PATH(LIBXSLT_INCLUDE_DIR NAMES libxslt/xslt.h @@ -38,10 +41,22 @@ FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt ${PC_LIBXSLT_LIBRARY_DIRS} ) -# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if +FIND_LIBRARY(LIBXSLT_EXSLT_LIBRARY NAMES exslt libexslt + HINTS + ${PC_LIBXSLT_LIBDIR} + ${PC_LIBXSLT_LIBRARY_DIRS} + ) + +SET(LIBXSLT_EXSLT_LIBRARIES ${LIBXSLT_EXSLT_LIBRARY} ) + +FIND_PROGRAM(LIBXSLT_XSLTPROC_EXECUTABLE xsltproc) + +# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt DEFAULT_MSG LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR) -MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES) - +MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR + LIBXSLT_LIBRARIES + LIBXSLT_EXSLT_LIBRARY + LIBXSLT_XSLTPROC_EXECUTABLE) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 9df3f01..04646c0 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -108,6 +108,7 @@ IF (UNIX) FIND_PATH(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_XRes_INCLUDE_PATH X11/extensions/XRes.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH}) @@ -136,6 +137,7 @@ IF (UNIX) FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH}) + FIND_LIBRARY(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH}) @@ -250,6 +252,11 @@ IF (UNIX) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH}) ENDIF (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) + IF (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB) + SET(X11_XRes_FOUND TRUE) + SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XRes_INCLUDE_PATH}) + ENDIF (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB) + IF (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB) SET(X11_Xrandr_FOUND TRUE) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH}) @@ -424,6 +431,8 @@ IF (UNIX) X11_Xdamage_INCLUDE_PATH X11_Xrender_LIB X11_Xrender_INCLUDE_PATH + X11_XRes_LIB + X11_XRes_INCLUDE_PATH X11_Xxf86misc_LIB X11_xf86misc_INCLUDE_PATH X11_xf86vmode_INCLUDE_PATH diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index b6735c1..65d254a 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -141,36 +141,46 @@ IF(MSVC) ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) ENDIF(MSVC90) - IF(MSVC10) + MACRO(MSVCRT_FILES_FOR_VERSION version) + SET(v "${version}") + # Find the runtime library redistribution directory. GET_FILENAME_COMPONENT(msvc_install_dir - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]" ABSOLUTE) - FIND_PATH(MSVC10_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${v}.0;InstallDir]" ABSOLUTE) + FIND_PATH(MSVC${v}_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT PATHS "${msvc_install_dir}/../../VC/redist" "${base_dir}/VC/redist" - "$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/VC/redist" - "$ENV{ProgramFiles(x86)}/Microsoft Visual Studio 10.0/VC/redist" + "$ENV{ProgramFiles}/Microsoft Visual Studio ${v}.0/VC/redist" + "$ENV{ProgramFiles(x86)}/Microsoft Visual Studio ${v}.0/VC/redist" ) - MARK_AS_ADVANCED(MSVC10_REDIST_DIR) - SET(MSVC10_CRT_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT") + MARK_AS_ADVANCED(MSVC${v}_REDIST_DIR) + SET(MSVC${v}_CRT_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT") IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) SET(__install__libs - "${MSVC10_CRT_DIR}/msvcp100.dll" - "${MSVC10_CRT_DIR}/msvcr100.dll" + "${MSVC${v}_CRT_DIR}/msvcp${v}0.dll" + "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll" ) ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) IF(CMAKE_INSTALL_DEBUG_LIBRARIES) - SET(MSVC10_CRT_DIR - "${MSVC10_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC100.DebugCRT") + SET(MSVC${v}_CRT_DIR + "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugCRT") SET(__install__libs ${__install__libs} - "${MSVC10_CRT_DIR}/msvcp100d.dll" - "${MSVC10_CRT_DIR}/msvcr100d.dll" + "${MSVC${v}_CRT_DIR}/msvcp${v}0d.dll" + "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll" ) ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) - ENDIF(MSVC10) + ENDMACRO() + + IF(MSVC10) + MSVCRT_FILES_FOR_VERSION(10) + ENDIF() + + IF(MSVC11) + MSVCRT_FILES_FOR_VERSION(11) + ENDIF() IF(CMAKE_INSTALL_MFC_LIBRARIES) IF(MSVC70) @@ -273,42 +283,52 @@ IF(MSVC) ) ENDIF(MSVC90) - IF(MSVC10) + MACRO(MFC_FILES_FOR_VERSION version) + SET(v "${version}") + IF(CMAKE_INSTALL_DEBUG_LIBRARIES) - SET(MSVC10_MFC_DIR - "${MSVC10_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC100.DebugMFC") + SET(MSVC${v}_MFC_DIR + "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugMFC") SET(__install__libs ${__install__libs} - "${MSVC10_MFC_DIR}/mfc100d.dll" - "${MSVC10_MFC_DIR}/mfc100ud.dll" - "${MSVC10_MFC_DIR}/mfcm100d.dll" - "${MSVC10_MFC_DIR}/mfcm100ud.dll" + "${MSVC${v}_MFC_DIR}/mfc${v}0d.dll" + "${MSVC${v}_MFC_DIR}/mfc${v}0ud.dll" + "${MSVC${v}_MFC_DIR}/mfcm${v}0d.dll" + "${MSVC${v}_MFC_DIR}/mfcm${v}0ud.dll" ) ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) - SET(MSVC10_MFC_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.MFC") + SET(MSVC${v}_MFC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFC") IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) SET(__install__libs ${__install__libs} - "${MSVC10_MFC_DIR}/mfc100.dll" - "${MSVC10_MFC_DIR}/mfc100u.dll" - "${MSVC10_MFC_DIR}/mfcm100.dll" - "${MSVC10_MFC_DIR}/mfcm100u.dll" + "${MSVC${v}_MFC_DIR}/mfc${v}0.dll" + "${MSVC${v}_MFC_DIR}/mfc${v}0u.dll" + "${MSVC${v}_MFC_DIR}/mfcm${v}0.dll" + "${MSVC${v}_MFC_DIR}/mfcm${v}0u.dll" ) ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) - # include the language dll's for vs10 as well as the actuall dll's - SET(MSVC10_MFCLOC_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.MFCLOC") + # include the language dll's as well as the actuall dll's + SET(MSVC${v}_MFCLOC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFCLOC") SET(__install__libs ${__install__libs} - "${MSVC10_MFCLOC_DIR}/mfc100chs.dll" - "${MSVC10_MFCLOC_DIR}/mfc100cht.dll" - "${MSVC10_MFCLOC_DIR}/mfc100enu.dll" - "${MSVC10_MFCLOC_DIR}/mfc100esp.dll" - "${MSVC10_MFCLOC_DIR}/mfc100deu.dll" - "${MSVC10_MFCLOC_DIR}/mfc100fra.dll" - "${MSVC10_MFCLOC_DIR}/mfc100ita.dll" - "${MSVC10_MFCLOC_DIR}/mfc100jpn.dll" - "${MSVC10_MFCLOC_DIR}/mfc100kor.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0chs.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0cht.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0enu.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0esp.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0deu.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0fra.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0ita.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0jpn.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0kor.dll" ) - ENDIF(MSVC10) + ENDMACRO() + + IF(MSVC10) + MFC_FILES_FOR_VERSION(10) + ENDIF() + + IF(MSVC11) + MFC_FILES_FOR_VERSION(11) + ENDIF() ENDIF(CMAKE_INSTALL_MFC_LIBRARIES) FOREACH(lib diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 702ba10..7bb8b27 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -655,10 +655,26 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) } cmMakefile* mf = command->GetMakefile(); - std::string fname = src_dir; - fname += "/CTestConfig.cmake"; - cmSystemTools::ConvertToUnixSlashes(fname); - if ( cmSystemTools::FileExists(fname.c_str()) ) + std::string fname; + + std::string src_dir_fname = src_dir; + src_dir_fname += "/CTestConfig.cmake"; + cmSystemTools::ConvertToUnixSlashes(src_dir_fname); + + std::string bld_dir_fname = bld_dir; + bld_dir_fname += "/CTestConfig.cmake"; + cmSystemTools::ConvertToUnixSlashes(bld_dir_fname); + + if ( cmSystemTools::FileExists(bld_dir_fname.c_str()) ) + { + fname = bld_dir_fname; + } + else if ( cmSystemTools::FileExists(src_dir_fname.c_str()) ) + { + fname = src_dir_fname; + } + + if ( !fname.empty() ) { cmCTestLog(this, OUTPUT, " Reading ctest configuration file: " << fname.c_str() << std::endl); @@ -674,8 +690,12 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) } else { - cmCTestLog(this, WARNING, "Cannot locate CTest configuration: " - << fname.c_str() << std::endl); + cmCTestLog(this, WARNING, + "Cannot locate CTest configuration: in BuildDirectory: " + << bld_dir_fname.c_str() << std::endl); + cmCTestLog(this, WARNING, + "Cannot locate CTest configuration: in SourceDirectory: " + << src_dir_fname.c_str() << std::endl); } this->SetCTestConfigurationFromCMakeVariable(mf, "NightlyStartTime", @@ -2526,6 +2546,8 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def, cmSystemTools::ExpandListArgument(dval, slist); std::vector<std::string>::iterator it; + vec.clear(); + for ( it = slist.begin(); it != slist.end(); ++it ) { cmCTestLog(this, DEBUG, " -- " << it->c_str() << std::endl); @@ -2801,7 +2823,7 @@ bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "SetCTestConfigurationFromCMakeVariable:" - << dconfig << ":" << cmake_var); + << dconfig << ":" << cmake_var << std::endl); this->SetCTestConfiguration(dconfig, ctvar); return true; } diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index c87b64d..f8ab686 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1318,8 +1318,9 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) this->AddFrameworkPath(this->SplitFramework.match(1)); // Add the item using the -framework option. - std::string fw = "-framework "; - fw += this->SplitFramework.match(2); + this->Items.push_back(Item("-framework", false)); + std::string fw = this->SplitFramework.match(2); + fw = this->LocalGenerator->EscapeForShell(fw.c_str()); this->Items.push_back(Item(fw, false)); } diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index f4d4e7c..ed303c9 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -126,7 +126,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "This variable is set to the program that will be" " needed to build the output of CMake. If the " "generator selected was Visual Studio 6, the " - "CMAKE_MAKE_PROGRAM will be set to msdev, for " + "CMAKE_BUILD_TOOL will be set to msdev, for " "Unix makefiles it will be set to make or gmake, " "and for Visual Studio 7 it set to devenv. For " "Nmake Makefiles the value is nmake. This can be " @@ -1103,6 +1103,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables that Control the Build"); cm->DefineProperty + ("CMAKE_AUTOMOC_MOC_OPTIONS", cmProperty::VARIABLE, + "Additional options for moc when using automoc (see CMAKE_AUTOMOC).", + "This variable is used to initialize the " + "AUTOMOC_MOC_OPTIONS property on all the targets. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); + + cm->DefineProperty ("CMAKE_DEBUG_POSTFIX", cmProperty::VARIABLE, "See variable CMAKE_<CONFIG>_POSTFIX.", "This variable is a special case of the more-general " diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 785e85a..248a30a 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -87,6 +87,16 @@ void cmExtraEclipseCDT4Generator::Generate() this->GenerateSourceProject = (this->IsOutOfSourceBuild && mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT")); + if (cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(), + this->HomeDirectory.c_str())) + { + mf->IssueMessage(cmake::WARNING, "The build directory is a subdirectory " + "of the source directory.\n" + "This is not supported well by Eclipse. It is strongly " + "recommended to use a build directory which is a " + "sibling of the source directory."); + } + // NOTE: This is not good, since it pollutes the source tree. However, // Eclipse doesn't allow CVS/SVN to work when the .project is not in // the cvs/svn root directory. Hence, this is provided as an option. @@ -998,7 +1008,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::string virtDir = "[Targets]/"; virtDir += prefix; virtDir += ti->first; - this->AppendTarget(fout, "Build", make, makeArgs, virtDir, "", + std::string buildArgs = "-C \""; + buildArgs += makefile->GetHomeOutputDirectory(); + buildArgs += "\" "; + buildArgs += makeArgs; + this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "", ti->first.c_str()); std::string cleanArgs = "-E chdir \""; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index ec8f4a5..22ead10 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -43,7 +43,8 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator() { - cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator; + cmLocalVisualStudio10Generator* lg = + new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10); lg->SetPlatformName(this->GetPlatformName()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 97308bb..be7fd55 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -10,6 +10,7 @@ See the License for more information. ============================================================================*/ #include "cmGlobalVisualStudio11Generator.h" +#include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" //---------------------------------------------------------------------------- @@ -36,6 +37,16 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) } //---------------------------------------------------------------------------- +cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio10Generator* lg = + new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11); + lg->SetPlatformName(this->GetPlatformName()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudio11Generator ::GetDocumentation(cmDocumentationEntry& entry) const { diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 14019a7..7e8f6aa 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -35,6 +35,9 @@ public: /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + /** TODO: VS 11 user macro support. */ virtual std::string GetUserMacrosDirectory() { return ""; } protected: diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index adb5f2f..a5feaca 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -26,8 +26,8 @@ cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator() ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio71Generator::CreateLocalGenerator() { - cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; - lg->SetVersion71(); + cmLocalVisualStudio7Generator *lg = + new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 84e7f1b..a68e6d8 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -133,7 +133,8 @@ std::string cmGlobalVisualStudio7Generator ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator() { - cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + cmLocalVisualStudio7Generator *lg = + new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index ef723b7..a723109 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -28,8 +28,8 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator() ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator() { - cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; - lg->SetVersion8(); + cmLocalVisualStudio7Generator *lg = + new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8); lg->SetPlatformName(this->GetPlatformName()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); diff --git a/Source/cmGlobalVisualStudio8Win64Generator.cxx b/Source/cmGlobalVisualStudio8Win64Generator.cxx index 3469b17..60e45b8 100644 --- a/Source/cmGlobalVisualStudio8Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio8Win64Generator.cxx @@ -25,8 +25,8 @@ cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator() ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio8Win64Generator::CreateLocalGenerator() { - cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; - lg->SetVersion8(); + cmLocalVisualStudio7Generator *lg + = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8); lg->SetPlatformName(this->GetPlatformName()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index f8ceea0..f082675 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -40,8 +40,8 @@ void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout) ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator() { - cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; - lg->SetVersion9(); + cmLocalVisualStudio7Generator *lg + = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); lg->SetPlatformName(this->GetPlatformName()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); diff --git a/Source/cmGlobalVisualStudio9IA64Generator.cxx b/Source/cmGlobalVisualStudio9IA64Generator.cxx index d49739b..993340a 100644 --- a/Source/cmGlobalVisualStudio9IA64Generator.cxx +++ b/Source/cmGlobalVisualStudio9IA64Generator.cxx @@ -22,8 +22,8 @@ cmGlobalVisualStudio9IA64Generator::cmGlobalVisualStudio9IA64Generator() ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio9IA64Generator::CreateLocalGenerator() { - cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; - lg->SetVersion9(); + cmLocalVisualStudio7Generator *lg = + new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); lg->SetPlatformName(this->GetPlatformName()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); diff --git a/Source/cmGlobalVisualStudio9Win64Generator.cxx b/Source/cmGlobalVisualStudio9Win64Generator.cxx index ff4fd4f..08f537d 100644 --- a/Source/cmGlobalVisualStudio9Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio9Win64Generator.cxx @@ -22,8 +22,8 @@ cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator() ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio9Win64Generator::CreateLocalGenerator() { - cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; - lg->SetVersion9(); + cmLocalVisualStudio7Generator *lg = + new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); lg->SetPlatformName(this->GetPlatformName()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index e5ff4f0..aa13589 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -65,7 +65,12 @@ public: "For historical reasons, relative paths given to this command are " "passed to the linker unchanged " "(unlike many CMake commands which interpret them relative to the " - "current source directory)." + "current source directory).\n" + "Note that this command is rarely necessary. Library locations " + "returned by find_package() and find_library() are absolute paths. " + "Pass these absolute library file paths directly to the " + "target_link_libraries() command. CMake will ensure the linker finds " + "them." ; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index da6a1c6..4e4f1d9 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -608,6 +608,27 @@ cmLocalUnixMakefileGenerator3 } //---------------------------------------------------------------------------- +std::string +cmLocalUnixMakefileGenerator3 +::ConvertShellCommand(std::string const& cmd, RelativeRoot root) +{ + if(this->WatcomWMake && + cmSystemTools::FileIsFullPath(cmd.c_str()) && + cmd.find_first_of("( )") != cmd.npos) + { + // On Watcom WMake use the windows short path for the command + // name. This is needed to avoid funny quoting problems on + // lines with shell redirection operators. + std::string scmd; + if(cmSystemTools::GetShortPath(cmd.c_str(), scmd)) + { + return this->Convert(scmd.c_str(), NONE, SHELL); + } + } + return this->Convert(cmd.c_str(), root, SHELL); +} + +//---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 ::WriteMakeVariables(std::ostream& makefileStream) @@ -646,13 +667,13 @@ cmLocalUnixMakefileGenerator3 makefileStream << "# The CMake executable.\n" << "CMAKE_COMMAND = " - << this->Convert(cmakecommand.c_str(), FULL, SHELL).c_str() + << this->ConvertShellCommand(cmakecommand, FULL) << "\n" << "\n"; makefileStream << "# The command to remove a file.\n" << "RM = " - << this->Convert(cmakecommand.c_str(),FULL,SHELL).c_str() + << this->ConvertShellCommand(cmakecommand, FULL) << " -E remove -f\n" << "\n"; @@ -662,7 +683,7 @@ cmLocalUnixMakefileGenerator3 makefileStream << "# The program to use to edit the cache.\n" << "CMAKE_EDIT_COMMAND = " - << this->Convert(edit_cmd,FULL,SHELL) << "\n" + << this->ConvertShellCommand(edit_cmd, FULL) << "\n" << "\n"; } @@ -697,7 +718,7 @@ cmLocalUnixMakefileGenerator3 // This should be the first target except for the default_target in // the interface Makefile. this->WriteMakeRule( - makefileStream, "Disable implicit rules so canoncical targets will work.", + makefileStream, "Disable implicit rules so canonical targets will work.", ".SUFFIXES", no_depends, no_commands, false); if(!this->NMake && !this->WatcomWMake && !this->BorlandMakeCurlyHack) @@ -1019,22 +1040,9 @@ cmLocalUnixMakefileGenerator3 // without the current directory being in the search path. cmd = "./" + cmd; } - if(this->WatcomWMake && - cmSystemTools::FileIsFullPath(cmd.c_str()) && - cmd.find(" ") != cmd.npos) - { - // On Watcom WMake use the windows short path for the command - // name. This is needed to avoid funny quoting problems on - // lines with shell redirection operators. - std::string scmd; - if(cmSystemTools::GetShortPath(cmd.c_str(), scmd)) - { - cmd = scmd; - } - } std::string launcher = this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT); - cmd = launcher + this->Convert(cmd.c_str(),NONE,SHELL); + cmd = launcher + this->ConvertShellCommand(cmd, NONE); ccg.AppendArguments(c, cmd); if(content) diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index fab98da..45ac21d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -340,6 +340,7 @@ protected: void CheckMultipleOutputs(bool verbose); private: + std::string ConvertShellCommand(std::string const& cmd, RelativeRoot root); std::string MakeLauncher(const cmCustomCommand& cc, cmTarget* target, RelativeRoot relative); diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index ef378f9..8b22705 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -61,7 +61,8 @@ class cmVS10XMLParser : public cmXMLParser //---------------------------------------------------------------------------- -cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator() +cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator(VSVersion v): + cmLocalVisualStudio7Generator(v) { } diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index 0fccdb0..699de4c 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -25,7 +25,7 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio10Generator(); + cmLocalVisualStudio10Generator(VSVersion v); virtual ~cmLocalVisualStudio10Generator(); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 095e1a7..1dfcbea 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -21,7 +21,8 @@ #include <cmsys/RegularExpression.hxx> -cmLocalVisualStudio6Generator::cmLocalVisualStudio6Generator() +cmLocalVisualStudio6Generator::cmLocalVisualStudio6Generator(): + cmLocalVisualStudioGenerator(VS6) { } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index d9b2772..8185b95 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -45,9 +45,9 @@ private: extern cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[]; //---------------------------------------------------------------------------- -cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator() +cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator(VSVersion v): + cmLocalVisualStudioGenerator(v) { - this->Version = 7; this->PlatformName = "Win32"; this->ExtraFlagTable = 0; this->Internal = new cmLocalVisualStudio7GeneratorInternals(this); @@ -719,7 +719,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, t = Options::FortranCompiler; table = cmLocalVisualStudio7GeneratorFortranFlagTable; } - Options targetOptions(this, this->Version, t, + Options targetOptions(this, t, table, this->ExtraFlagTable); targetOptions.FixExceptionHandlingDefault(); @@ -888,7 +888,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // end of <Tool Name=VCMIDLTool // Check if we need the FAT32 workaround. - if(targetBuilds && this->Version >= 8) + if(targetBuilds && this->Version >= VS8) { // Check the filesystem type where the target will be written. if(cmLVS6G_IsFAT(target.GetDirectory(configName).c_str())) @@ -975,7 +975,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, extraLinkOptions += " "; extraLinkOptions += targetLinkFlags; } - Options linkOptions(this, this->Version, Options::Linker, + Options linkOptions(this, Options::Linker, cmLocalVisualStudio7GeneratorLinkFlagTable); linkOptions.Parse(extraLinkOptions.c_str()); if(!this->ModuleDefinitionFile.empty()) @@ -1604,7 +1604,7 @@ void cmLocalVisualStudio7Generator tool = Options::FortranCompiler; table = cmLocalVisualStudio7GeneratorFortranFlagTable; } - Options fileOptions(this, this->Version, tool, table, + Options fileOptions(this, tool, table, this->ExtraFlagTable); fileOptions.Parse(fc.CompileFlags.c_str()); fileOptions.AddDefines(fc.CompileDefs.c_str()); @@ -1811,11 +1811,18 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout, const char* vsProjectname = target.GetProperty("VS_SCC_PROJECTNAME"); const char* vsLocalpath = target.GetProperty("VS_SCC_LOCALPATH"); const char* vsProvider = target.GetProperty("VS_SCC_PROVIDER"); + if(vsProvider && vsLocalpath && vsProjectname) { fout << "\tSccProjectName=\"" << vsProjectname << "\"\n" << "\tSccLocalPath=\"" << vsLocalpath << "\"\n" << "\tSccProvider=\"" << vsProvider << "\"\n"; + + const char* vsAuxPath = target.GetProperty("VS_SCC_AUXPATH"); + if(vsAuxPath) + { + fout << "\tSccAuxPath=\"" << vsAuxPath << "\"\n"; + } } } @@ -1913,13 +1920,13 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n" << "<VisualStudioProject\n" << "\tProjectType=\"Visual C++\"\n"; - if(this->Version == 71) + if(this->Version == VS71) { fout << "\tVersion=\"7.10\"\n"; } else { - fout << "\tVersion=\"" << this->Version << ".00\"\n"; + fout << "\tVersion=\"" << (this->Version/10) << ".00\"\n"; } const char* projLabel = target.GetProperty("PROJECT_LABEL"); if(!projLabel) @@ -1934,7 +1941,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, cmGlobalVisualStudio7Generator* gg = static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); fout << "\tName=\"" << projLabel << "\"\n"; - if(this->Version >= 8) + if(this->Version >= VS8) { fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n"; } diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index cdd714e..5b634b8 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -35,7 +35,7 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio7Generator(); + cmLocalVisualStudio7Generator(VSVersion v); virtual ~cmLocalVisualStudio7Generator(); @@ -53,9 +53,6 @@ public: */ void SetBuildType(BuildType,const char *name); - void SetVersion71() {this->Version = 71;} - void SetVersion8() {this->Version = 8;} - void SetVersion9() {this->Version = 9;} void SetPlatformName(const char* n) { this->PlatformName = n;} void GetTargetObjectFileDirectories(cmTarget* target, std::vector<std::string>& @@ -130,7 +127,6 @@ private: cmVS7FlagTable const* ExtraFlagTable; std::string ModuleDefinitionFile; - int Version; bool FortranProject; std::string PlatformName; // Win32 or x64 cmLocalVisualStudio7GeneratorInternals* Internal; diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 4390a08..4d16409 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -18,10 +18,11 @@ #include "windows.h" //---------------------------------------------------------------------------- -cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator() +cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator(VSVersion v) { this->WindowsShell = true; this->WindowsVSIDE = true; + this->Version = v; } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index a38bc30..fcf1f21 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -29,7 +29,19 @@ class cmCustomCommand; class cmLocalVisualStudioGenerator : public cmLocalGenerator { public: - cmLocalVisualStudioGenerator(); + /** Known versions of Visual Studio. */ + enum VSVersion + { + VS6 = 60, + VS7 = 70, + VS71 = 71, + VS8 = 80, + VS9 = 90, + VS10 = 100, + VS11 = 110 + }; + + cmLocalVisualStudioGenerator(VSVersion v); virtual ~cmLocalVisualStudioGenerator(); /** Construct a script from the given list of command lines. */ @@ -41,6 +53,9 @@ public: sequence of custom commands. */ const char* GetReportErrorLabel() const; + /** Version of Visual Studio. */ + VSVersion GetVersion() const { return this->Version; } + protected: virtual const char* ReportErrorLabel() const; virtual bool CustomCommandUseLocal() const { return false; } @@ -58,6 +73,8 @@ protected: std::map<cmStdString, int>& count); std::set<const cmSourceFile*> NeedObjectName; friend class cmVisualStudio10TargetGenerator; + + VSVersion Version; }; #endif diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index a839489..7a80f28 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -49,9 +49,13 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) { cmMakefile* makefile = target->GetMakefile(); const char* targetName = target->GetName(); - // don't do anything if there is no Qt4: + // don't do anything if there is no Qt4 or Qt5SrcTools (which contains moc): std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR"); - if (qtMajorVersion != "4") + if (qtMajorVersion == "") + { + qtMajorVersion = makefile->GetSafeDefinition("Qt5SrcTools_VERSION_MAJOR"); + } + if (qtMajorVersion != "4" && qtMajorVersion != "5") { return; } @@ -67,7 +71,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) targetDir += ".dir/"; cmCustomCommandLine currentLine; - currentLine.push_back(makefile->GetCMakeInstance()->GetCMakeCommand()); + currentLine.push_back(makefile->GetSafeDefinition("CMAKE_COMMAND")); currentLine.push_back("-E"); currentLine.push_back("cmake_automoc"); currentLine.push_back(targetDir); @@ -124,9 +128,15 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) } } - std::string _moc_incs = makefile->GetProperty("INCLUDE_DIRECTORIES"); - std::string _moc_defs = makefile->GetProperty("DEFINITIONS"); - std::string _moc_compile_defs = makefile->GetProperty("COMPILE_DEFINITIONS"); + const char* tmp = makefile->GetProperty("INCLUDE_DIRECTORIES"); + std::string _moc_incs = (tmp!=0 ? tmp : ""); + tmp = makefile->GetProperty("DEFINITIONS"); + std::string _moc_defs = (tmp!=0 ? tmp : ""); + tmp = makefile->GetProperty("COMPILE_DEFINITIONS"); + std::string _moc_compile_defs = (tmp!=0 ? tmp : ""); + tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); + std::string _moc_options = (tmp!=0 ? tmp : ""); + // forget the variables added here afterwards again: cmMakefile::ScopePushPop varScope(makefile); static_cast<void>(varScope); @@ -135,10 +145,11 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) makefile->AddDefinition("_moc_incs", _moc_incs.c_str()); makefile->AddDefinition("_moc_defs", _moc_defs.c_str()); makefile->AddDefinition("_moc_compile_defs", _moc_compile_defs.c_str()); + makefile->AddDefinition("_moc_options", _moc_options.c_str()); makefile->AddDefinition("_moc_files", _moc_files.c_str()); makefile->AddDefinition("_moc_headers", _moc_headers.c_str()); - const char* cmakeRoot = makefile->GetDefinition("CMAKE_ROOT"); + const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT"); std::string inputFile = cmakeRoot; inputFile += "/Modules/AutomocInfo.cmake.in"; std::string outputFile = targetDir; @@ -170,9 +181,9 @@ bool cmQtAutomoc::Run(const char* targetDirectory) this->Init(); - if (this->QtMajorVersion == "4") + if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5") { - this->RunAutomocQt4(); + this->RunAutomoc(); } this->WriteOldMocDefinitionsFile(targetDirectory); @@ -215,6 +226,11 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile, } this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR"); + if (this->QtMajorVersion == "") + { + this->QtMajorVersion = makefile->GetSafeDefinition( + "AM_Qt5SrcTools_VERSION_MAJOR"); + } this->Sources = makefile->GetSafeDefinition("AM_SOURCES"); this->Headers = makefile->GetSafeDefinition("AM_HEADERS"); this->IncludeProjectDirsBefore = makefile->IsOn( @@ -226,6 +242,7 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile, "AM_MOC_COMPILE_DEFINITIONS"); this->MocDefinitionsStr = makefile->GetSafeDefinition("AM_MOC_DEFINITIONS"); this->MocIncludesStr = makefile->GetSafeDefinition("AM_MOC_INCLUDES"); + this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS"); this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR"); this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR"); this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME"); @@ -302,6 +319,8 @@ void cmQtAutomoc::Init() } } + cmSystemTools::ExpandListArgument(this->MocOptionsStr, this->MocOptions); + std::vector<std::string> incPaths; cmSystemTools::ExpandListArgument(this->MocIncludesStr, incPaths); @@ -372,7 +391,7 @@ void cmQtAutomoc::Init() } -bool cmQtAutomoc::RunAutomocQt4() +bool cmQtAutomoc::RunAutomoc() { if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str()) || (this->OldMocDefinitionsStr != this->Join(this->MocDefinitions, ' '))) @@ -711,6 +730,12 @@ bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile, { command.push_back(*it); } + for(std::vector<std::string>::const_iterator it=this->MocOptions.begin(); + it != this->MocOptions.end(); + ++it) + { + command.push_back(*it); + } #ifdef _WIN32 command.push_back("-DWIN32"); #endif diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h index c3550a4..f6355de 100644 --- a/Source/cmQtAutomoc.h +++ b/Source/cmQtAutomoc.h @@ -35,7 +35,7 @@ private: const char* targetDirectory); void WriteOldMocDefinitionsFile(const char* targetDirectory); - bool RunAutomocQt4(); + bool RunAutomoc(); bool GenerateMoc(const std::string& sourceFile, const std::string& mocFileName); void ParseCppFile(const std::string& absFilename, @@ -62,6 +62,7 @@ private: std::string MocCompileDefinitionsStr; std::string MocDefinitionsStr; std::string MocIncludesStr; + std::string MocOptionsStr; std::string ProjectBinaryDir; std::string ProjectSourceDir; std::string TargetName; @@ -71,6 +72,7 @@ private: std::string OutMocCppFilename; std::list<std::string> MocIncludes; std::list<std::string> MocDefinitions; + std::vector<std::string> MocOptions; bool Verbose; bool ColorOutput; diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 320378d..f001a11 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -140,7 +140,8 @@ public: "the target in an IDE like visual studio. VS_KEYWORD can be set " "to change the visual studio keyword, for example QT integration " "works better if this is set to Qt4VSv1.0.\n" - "VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER can be set " + "VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and " + "VS_SCC_AUXPATH can be set " "to add support for source control bindings in a Visual Studio " "project file.\n" "VS_GLOBAL_<variable> can be set to add a Visual Studio " diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f7d3ba9..dad0353 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -157,7 +157,20 @@ void cmTarget::DefineProperties(cmake *cm) "files are included in a generated <targetname>_automoc.cpp file, " "which is compiled as part of the target." "This property is initialized by the value of the variable " - "CMAKE_AUTOMOC if it is set when a target is created."); + "CMAKE_AUTOMOC if it is set when a target is created.\n" + "Additional command line options for moc can be set via the " + "AUTOMOC_MOC_OPTIONS property." + ); + + cm->DefineProperty + ("AUTOMOC_MOC_OPTIONS", cmProperty::TARGET, + "Additional options for moc when using automoc (see the AUTOMOC property)", + "This property is only used if the AUTOMOC property is set to TRUE for " + "this target. In this case, it holds additional command line options " + "which will be used when moc is executed during the build, i.e. it is " + "equivalent to the optional OPTIONS argument of the qt4_wrap_cpp() " + "macro.\n" + "By default it is empty."); cm->DefineProperty ("BUILD_WITH_INSTALL_RPATH", cmProperty::TARGET, @@ -1011,7 +1024,7 @@ void cmTarget::DefineProperties(cmake *cm) "provider property."); cm->DefineProperty ("VS_SCC_LOCALPATH", cmProperty::TARGET, - "Visual Studio Source Code Control Provider.", + "Visual Studio Source Code Control Local Path.", "Can be set to change the visual studio source code control " "local path property."); cm->DefineProperty @@ -1020,6 +1033,11 @@ void cmTarget::DefineProperties(cmake *cm) "Can be set to change the visual studio source code control " "project name property."); cm->DefineProperty + ("VS_SCC_AUXPATH", cmProperty::TARGET, + "Visual Studio Source Code Control Aux Path.", + "Can be set to change the visual studio source code control " + "auxpath property."); + cm->DefineProperty ("VS_GLOBAL_<variable>", cmProperty::TARGET, "Visual Studio project-specific global variable.", "Tell the Visual Studio generator to set the global variable " @@ -1179,6 +1197,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0); this->SetPropertyDefault("OSX_ARCHITECTURES", 0); this->SetPropertyDefault("AUTOMOC", 0); + this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0); this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0); // Collect the set of configuration types. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 551b0ad..fcb668a 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -182,7 +182,7 @@ void cmVisualStudio10TargetGenerator::Generate() const char* vsLocalPath = this->Target->GetProperty("VS_SCC_LOCALPATH"); const char* vsProvider = this->Target->GetProperty("VS_SCC_PROVIDER"); - if ( vsProjectName && vsLocalPath && vsProvider) + if( vsProjectName && vsLocalPath && vsProvider ) { this->WriteString("<SccProjectName>", 2); (*this->BuildFileStream) << cmVS10EscapeXML(vsProjectName) << @@ -193,6 +193,14 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteString("<SccProvider>", 2); (*this->BuildFileStream) << cmVS10EscapeXML(vsProvider) << "</SccProvider>\n"; + + const char* vsAuxPath = this->Target->GetProperty("VS_SCC_AUXPATH"); + if( vsAuxPath ) + { + this->WriteString("<SccAuxPath>", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(vsAuxPath) << + "</SccAuxPath>\n"; + } } this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2); @@ -290,16 +298,24 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() } configType += "</ConfigurationType>\n"; this->WriteString(configType.c_str(), 2); + const char* mfcFlag = this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG"); - if(mfcFlag) + std::string mfcFlagValue = mfcFlag ? mfcFlag : "0"; + + std::string useOfMfcValue = "false"; + if(mfcFlagValue == "1") { - this->WriteString("<UseOfMfc>true</UseOfMfc>\n", 2); + useOfMfcValue = "Static"; } - else + else if(mfcFlagValue == "2") { - this->WriteString("<UseOfMfc>false</UseOfMfc>\n", 2); + useOfMfcValue = "Dynamic"; } + std::string mfcLine = "<UseOfMfc>"; + mfcLine += useOfMfcValue + "</UseOfMfc>\n"; + this->WriteString(mfcLine.c_str(), 2); + if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY && this->ClOptions[*i]->UsingUnicode()) { @@ -897,7 +913,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( hasFlags = true; cmVisualStudioGeneratorOptions clOptions(this->LocalGenerator, - 10, cmVisualStudioGeneratorOptions::Compiler, + cmVisualStudioGeneratorOptions::Compiler, cmVS10CLFlagTable, 0, this); clOptions.Parse(flags.c_str()); clOptions.AddDefines(configDefines.c_str()); @@ -1082,7 +1098,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( // TODO: Integrate code below with cmLocalVisualStudio7Generator. cmsys::auto_ptr<Options> pOptions( - new Options(this->LocalGenerator, 10, Options::Compiler, + new Options(this->LocalGenerator, Options::Compiler, cmVS10CLFlagTable)); Options& clOptions = *pOptions; @@ -1237,7 +1253,7 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) { this->WriteString("<Lib>\n", 2); cmVisualStudioGeneratorOptions - libOptions(this->LocalGenerator, 10, + libOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker, cmVS10LibFlagTable, 0, this); libOptions.Parse(libflags?libflags:""); @@ -1317,7 +1333,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& flags += flagsConfig; } cmVisualStudioGeneratorOptions - linkOptions(this->LocalGenerator, 10, + linkOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker, cmVS10LinkFlagTable, 0, this); if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 4edeedc..41230e7 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -25,14 +25,13 @@ inline std::string cmVisualStudioGeneratorOptionsEscapeForXML(const char* s) //---------------------------------------------------------------------------- cmVisualStudioGeneratorOptions -::cmVisualStudioGeneratorOptions(cmLocalGenerator* lg, - int version, +::cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool, cmVS7FlagTable const* table, cmVS7FlagTable const* extraTable, cmVisualStudio10TargetGenerator* g): cmIDEOptions(), - LocalGenerator(lg), Version(version), CurrentTool(tool), + LocalGenerator(lg), Version(lg->GetVersion()), CurrentTool(tool), TargetGenerator(g) { // Store the given flag tables. @@ -61,11 +60,12 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() // remove the flag we need to override the IDE default of on. switch (this->Version) { - case 7: - case 71: + case cmLocalVisualStudioGenerator::VS7: + case cmLocalVisualStudioGenerator::VS71: this->FlagMap["ExceptionHandling"] = "FALSE"; break; - case 10: + case cmLocalVisualStudioGenerator::VS10: + case cmLocalVisualStudioGenerator::VS11: // by default VS puts <ExceptionHandling></ExceptionHandling> empty // for a project, to make our projects look the same put a new line // and space over for the closing </ExceptionHandling> as the default @@ -93,7 +93,8 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose) if(verbose && this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end()) { - this->FlagMap["SuppressStartupBanner"] = this->Version < 10 ? "FALSE" : ""; + this->FlagMap["SuppressStartupBanner"] = + this->Version < cmLocalVisualStudioGenerator::VS10 ? "FALSE" : ""; } } @@ -211,7 +212,7 @@ cmVisualStudioGeneratorOptions { return; } - if(this->Version == 10) + if(this->Version >= cmLocalVisualStudioGenerator::VS10) { // if there are configuration specifc flags, then // use the configuration specific tag for PreprocessorDefinitions @@ -239,7 +240,7 @@ cmVisualStudioGeneratorOptions { // Escape the definition for the compiler. std::string define; - if(this->Version != 10) + if(this->Version < cmLocalVisualStudioGenerator::VS10) { define = this->LocalGenerator->EscapeForShell(di->c_str(), true); @@ -249,7 +250,7 @@ cmVisualStudioGeneratorOptions define = *di; } // Escape this flag for the IDE. - if(this->Version == 10) + if(this->Version >= cmLocalVisualStudioGenerator::VS10) { define = cmVisualStudio10GeneratorOptionsEscapeForXML(define.c_str()); @@ -266,7 +267,7 @@ cmVisualStudioGeneratorOptions fout << sep << define; sep = ";"; } - if(this->Version == 10) + if(this->Version >= cmLocalVisualStudioGenerator::VS10) { fout << ";%(PreprocessorDefinitions)</PreprocessorDefinitions>" << suffix; } @@ -281,7 +282,7 @@ void cmVisualStudioGeneratorOptions ::OutputFlagMap(std::ostream& fout, const char* indent) { - if(this->Version == 10) + if(this->Version >= cmLocalVisualStudioGenerator::VS10) { for(std::map<cmStdString, cmStdString>::iterator m = this->FlagMap.begin(); m != this->FlagMap.end(); ++m) @@ -326,7 +327,7 @@ cmVisualStudioGeneratorOptions { if(!this->FlagString.empty()) { - if(this->Version == 10) + if(this->Version >= cmLocalVisualStudioGenerator::VS10) { fout << prefix; if(this->Configuration.size()) diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index fadc4b5..51a1362 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -12,7 +12,7 @@ #ifndef cmVisualStudioGeneratorOptions_h #define cmVisualStudioGeneratorOptions_h -#include "cmLocalGenerator.h" +#include "cmLocalVisualStudioGenerator.h" #include "cmIDEOptions.h" typedef cmIDEFlagTable cmVS7FlagTable; @@ -30,8 +30,7 @@ public: Linker, FortranCompiler }; - cmVisualStudioGeneratorOptions(cmLocalGenerator* lg, - int version, + cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool, cmVS7FlagTable const* table, cmVS7FlagTable const* extraTable = 0, @@ -62,8 +61,8 @@ public: const char* suffix); void SetConfiguration(const char* config); private: - cmLocalGenerator* LocalGenerator; - int Version; + cmLocalVisualStudioGenerator* LocalGenerator; + cmLocalVisualStudioGenerator::VSVersion Version; std::string Configuration; Tool CurrentTool; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 1bf19c0..ed7f62c 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -128,7 +128,7 @@ public: #include <io.h> #include <direct.h> #define _unlink unlink -#endif +#endif /* The maximum length of a file name. */ #if defined(PATH_MAX) @@ -168,9 +168,9 @@ static inline char *realpath(const char *path, char *resolved_path) snprintf(resolved_path, maxlen, "%s", path); BPath normalized(resolved_path, NULL, true); const char *resolved = normalized.Path(); - if (resolved != NULL) // NULL == No such file. + if (resolved != NULL) // NULL == No such file. { - if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen) + if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen) { return resolved_path; } @@ -179,7 +179,7 @@ static inline char *realpath(const char *path, char *resolved_path) } #endif -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) inline int Mkdir(const char* dir) { return _mkdir(dir); @@ -300,7 +300,7 @@ double SystemTools::GetTime(void) #endif } -class SystemToolsTranslationMap : +class SystemToolsTranslationMap : public kwsys_stl::map<kwsys_stl::string,kwsys_stl::string> { }; @@ -371,7 +371,7 @@ bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result) } } -#ifdef INTEL_COMPILER +#ifdef __INTEL_COMPILER #pragma warning disable 444 #endif @@ -392,7 +392,7 @@ kwsysDeletingCharVector::~kwsysDeletingCharVector() #endif } bool SystemTools::PutEnv(const char* value) -{ +{ static kwsysDeletingCharVector localEnvironment; char* envVar = new char[strlen(value)+1]; strcpy(envVar, value); @@ -403,18 +403,13 @@ bool SystemTools::PutEnv(const char* value) return ret == 0; } -#ifdef INTEL_COMPILER -#pragma warning restore 444 -#endif - - const char* SystemTools::GetExecutableExtension() { #if defined(_WIN32) || defined(__CYGWIN__) || defined(__VMS) return ".exe"; #else return ""; -#endif +#endif } @@ -482,7 +477,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, { const char *src = source.c_str(); char *searchPos = const_cast<char *>(strstr(src,replace)); - + // get out quick if string is not found if (!searchPos) { @@ -499,7 +494,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, char *orig = strdup(src); char *currentPos = orig; searchPos = searchPos - src + orig; - + // initialize the result source.erase(source.begin(),source.end()); do @@ -551,7 +546,7 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode, #endif // Read a registry value. -// Example : +// Example : // HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath // => will return the data of the "default" value of the key // HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root @@ -580,7 +575,7 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value, second = primary.substr(start+1, valuenamepos-start-1); primary = primary.substr(0, start); - + HKEY primaryKey = HKEY_CURRENT_USER; if (primary == "HKEY_CURRENT_USER") { @@ -602,11 +597,11 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value, { primaryKey = HKEY_USERS; } - + HKEY hKey; - if(RegOpenKeyEx(primaryKey, - second.c_str(), - 0, + if(RegOpenKeyEx(primaryKey, + second.c_str(), + 0, SystemToolsMakeRegistryMode(KEY_READ, view), &hKey) != ERROR_SUCCESS) { @@ -617,11 +612,11 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value, DWORD dwType, dwSize; dwSize = 1023; char data[1024]; - if(RegQueryValueEx(hKey, - (LPTSTR)valuename.c_str(), - NULL, - &dwType, - (BYTE *)data, + if(RegQueryValueEx(hKey, + (LPTSTR)valuename.c_str(), + NULL, + &dwType, + (BYTE *)data, &dwSize) == ERROR_SUCCESS) { if (dwType == REG_SZ) @@ -656,7 +651,7 @@ bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &, // Write a registry value. -// Example : +// Example : // HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath // => will set the data of the "default" value of the key // HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root @@ -669,7 +664,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value, kwsys_stl::string primary = key; kwsys_stl::string second; kwsys_stl::string valuename; - + size_t start = primary.find("\\"); if (start == kwsys_stl::string::npos) { @@ -684,7 +679,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value, second = primary.substr(start+1, valuenamepos-start-1); primary = primary.substr(0, start); - + HKEY primaryKey = HKEY_CURRENT_USER; if (primary == "HKEY_CURRENT_USER") { @@ -706,13 +701,13 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value, { primaryKey = HKEY_USERS; } - + HKEY hKey; DWORD dwDummy; char lpClass[] = ""; - if(RegCreateKeyEx(primaryKey, - second.c_str(), - 0, + if(RegCreateKeyEx(primaryKey, + second.c_str(), + 0, lpClass, REG_OPTION_NON_VOLATILE, SystemToolsMakeRegistryMode(KEY_WRITE, view), @@ -723,11 +718,11 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value, return false; } - if(RegSetValueEx(hKey, - (LPTSTR)valuename.c_str(), - 0, - REG_SZ, - (CONST BYTE *)value, + if(RegSetValueEx(hKey, + (LPTSTR)valuename.c_str(), + 0, + REG_SZ, + (CONST BYTE *)value, (DWORD)(strlen(value) + 1)) == ERROR_SUCCESS) { return true; @@ -742,7 +737,7 @@ bool SystemTools::WriteRegistryValue(const char *, const char *, KeyWOW64) #endif // Delete a registry value. -// Example : +// Example : // HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath // => will delete the data of the "default" value of the key // HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root @@ -754,7 +749,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) kwsys_stl::string primary = key; kwsys_stl::string second; kwsys_stl::string valuename; - + size_t start = primary.find("\\"); if (start == kwsys_stl::string::npos) { @@ -769,7 +764,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) second = primary.substr(start+1, valuenamepos-start-1); primary = primary.substr(0, start); - + HKEY primaryKey = HKEY_CURRENT_USER; if (primary == "HKEY_CURRENT_USER") { @@ -791,11 +786,11 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) { primaryKey = HKEY_USERS; } - + HKEY hKey; - if(RegOpenKeyEx(primaryKey, - second.c_str(), - 0, + if(RegOpenKeyEx(primaryKey, + second.c_str(), + 0, SystemToolsMakeRegistryMode(KEY_WRITE, view), &hKey) != ERROR_SUCCESS) { @@ -803,7 +798,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) } else { - if(RegDeleteValue(hKey, + if(RegDeleteValue(hKey, (LPTSTR)valuename.c_str()) == ERROR_SUCCESS) { RegCloseKey(hKey); @@ -824,17 +819,17 @@ bool SystemTools::SameFile(const char* file1, const char* file2) #ifdef _WIN32 HANDLE hFile1, hFile2; - hFile1 = CreateFile( file1, - GENERIC_READ, + hFile1 = CreateFile( file1, + GENERIC_READ, FILE_SHARE_READ , NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL ); - hFile2 = CreateFile( file2, - GENERIC_READ, - FILE_SHARE_READ, + hFile2 = CreateFile( file2, + GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, @@ -868,10 +863,10 @@ bool SystemTools::SameFile(const char* file1, const char* file2) { // see if the files are the same file // check the device inode and size - if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 && + if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 && memcmp(&fileStat2.st_ino, &fileStat1.st_ino, sizeof(fileStat1.st_ino)) == 0 && - fileStat2.st_size == fileStat1.st_size - ) + fileStat2.st_size == fileStat1.st_size + ) { return true; } @@ -1068,11 +1063,11 @@ kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s) #if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG) // MS has an assert that will fail if s[i] < 0; setting // LC_CTYPE using setlocale() does *not* help. Painful. - if ((int)s[i] >= 0 && isalpha(s[i]) && + if ((int)s[i] >= 0 && isalpha(s[i]) && (i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1])))) #else if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1]))) -#endif +#endif { n[i] = static_cast<kwsys_stl::string::value_type>(toupper(s[i])); } @@ -1089,11 +1084,11 @@ kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s) #if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG) // MS has an assert that will fail if s[i] < 0; setting // LC_CTYPE using setlocale() does *not* help. Painful. - if ((int)s[i] >= 0 && isalpha(s[i]) && + if ((int)s[i] >= 0 && isalpha(s[i]) && (i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1])))) #else if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1]))) -#endif +#endif { n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i])); } @@ -1171,7 +1166,7 @@ char* SystemTools::AppendStrings( return newstr; } -// Return a lower case string +// Return a lower case string kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s) { kwsys_stl::string n; @@ -1183,7 +1178,7 @@ kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s) return n; } -// Return a lower case string +// Return a lower case string kwsys_stl::string SystemTools::UpperCase(const kwsys_stl::string& s) { kwsys_stl::string n; @@ -1313,7 +1308,7 @@ const char* SystemTools::FindLastString(const char* str1, const char* str2) { return NULL; } - + size_t len1 = strlen(str1), len2 = strlen(str2); if (len1 >= len2) { @@ -1341,8 +1336,8 @@ char* SystemTools::DuplicateString(const char* str) return NULL; } -// Return a cropped string -kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s, +// Return a cropped string +kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s, size_t max_len) { if (!s.size() || max_len == 0 || max_len >= s.size()) @@ -1386,7 +1381,7 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se if(isPath && path[0] == '/') { path.erase(path.begin()); - paths.push_back("/"); + paths.push_back("/"); } kwsys_stl::string::size_type pos1 = 0; kwsys_stl::string::size_type pos2 = path.find(sep, pos1+1); @@ -1395,9 +1390,9 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se paths.push_back(path.substr(pos1, pos2-pos1)); pos1 = pos2+1; pos2 = path.find(sep, pos1+1); - } + } paths.push_back(path.substr(pos1, pos2-pos1)); - + return paths; } @@ -1411,11 +1406,11 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap) // Quick-hack attempt at estimating the length of the string. // Should never under-estimate. - + // Start with the length of the format string itself. size_t length = strlen(format); - + // Increase the length for every argument in the format. const char* cur = format; @@ -1447,7 +1442,7 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap) { // Assume the argument contributes no more than 64 characters. length += 64; - + // Eat the argument. static_cast<void>(va_arg(ap, double)); } break; @@ -1455,24 +1450,24 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap) { // Assume the argument contributes no more than 64 characters. length += 64; - + // Eat the argument. static_cast<void>(va_arg(ap, int)); } break; } } - + // Move past the characters just tested. ++cur; } } - + return static_cast<int>(length); } kwsys_stl::string SystemTools::EscapeChars( - const char *str, - const char *chars_to_escape, + const char *str, + const char *chars_to_escape, char escape_char) { kwsys_stl::string n; @@ -1529,7 +1524,7 @@ static void ConvertVMSToUnix(kwsys_stl::string& path) } #endif -// convert windows slashes to unix slashes +// convert windows slashes to unix slashes void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) { const char* pathCString = path.c_str(); @@ -1596,7 +1591,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) } } #endif - // remove trailing slash if the path is more than + // remove trailing slash if the path is more than // a single / pathCString = path.c_str(); if(path.size() > 1 && *(pathCString+(path.size()-1)) == '/') @@ -1614,7 +1609,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path) { kwsys_stl::string ret = path; - + // remove // except at the beginning might be a cygwin drive kwsys_stl::string::size_type pos=1; while((pos = ret.find("//", pos)) != kwsys_stl::string::npos) @@ -1652,7 +1647,7 @@ kwsys_stl::string SystemTools::ConvertToOutputPath(const char* path) // remove double slashes not at the start kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path) -{ +{ kwsys_stl::string ret; // make it big enough for all of path and double quotes ret.reserve(strlen(path)+3); @@ -1738,13 +1733,13 @@ bool SystemTools::FilesDiffer(const char* source, const char* destination) { struct stat statSource; - if (stat(source, &statSource) != 0) + if (stat(source, &statSource) != 0) { return true; } struct stat statDestination; - if (stat(destination, &statDestination) != 0) + if (stat(destination, &statDestination) != 0) { return true; } @@ -1790,7 +1785,7 @@ bool SystemTools::FilesDiffer(const char* source, { return true; } - + // If this block differs the file differs. if(memcmp(static_cast<const void*>(source_buf), static_cast<const void*>(dest_buf), @@ -1849,7 +1844,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination) // Open files #if defined(_WIN32) || defined(__CYGWIN__) - kwsys_ios::ifstream fin(source, + kwsys_ios::ifstream fin(source, kwsys_ios::ios::binary | kwsys_ios::ios::in); #else kwsys_ios::ifstream fin(source); @@ -1858,7 +1853,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination) { return false; } - + // try and remove the destination file so that read only destination files // can be written to. // If the remove fails continue so that files in read only directories @@ -1866,17 +1861,17 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination) SystemTools::RemoveFile(destination); #if defined(_WIN32) || defined(__CYGWIN__) - kwsys_ios::ofstream fout(destination, + kwsys_ios::ofstream fout(destination, kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc); #else - kwsys_ios::ofstream fout(destination, + kwsys_ios::ofstream fout(destination, kwsys_ios::ios::out | kwsys_ios::ios::trunc); #endif if(!fout) { return false; } - + // This copy loop is very sensitive on certain platforms with // slightly broken stream libraries (like HPUX). Normally, it is // incorrect to not check the error condition on the fin.read() @@ -1890,12 +1885,12 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination) fout.write(buffer, fin.gcount()); } } - + // Make sure the operating system has finished writing the file // before closing it. This will ensure the file is finished before // the check below. fout.flush(); - + fin.close(); fout.close(); @@ -1979,7 +1974,7 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination, unsigned long SystemTools::FileLength(const char* filename) { struct stat fs; - if (stat(filename, &fs) != 0) + if (stat(filename, &fs) != 0) { return 0; } @@ -2225,7 +2220,7 @@ kwsys_stl::string SystemTools { // Add the system search path to our path first kwsys_stl::vector<kwsys_stl::string> path; - if (!no_system_path) + if (!no_system_path) { SystemTools::GetPath(path, "CMAKE_FILE_PATH"); SystemTools::GetPath(path); @@ -2340,7 +2335,7 @@ kwsys_stl::string SystemTools::FindProgram( // first try with extensions if the os supports them if(extensions.size()) { - for(kwsys_stl::vector<kwsys_stl::string>::iterator i = + for(kwsys_stl::vector<kwsys_stl::string>::iterator i = extensions.begin(); i != extensions.end(); ++i) { tryPath = name; @@ -2368,7 +2363,7 @@ kwsys_stl::string SystemTools::FindProgram( } // now add the additional paths { - for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = + for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin(); i != userPaths.end(); ++i) { path.push_back(*i); @@ -2397,7 +2392,7 @@ kwsys_stl::string SystemTools::FindProgram( // first try with extensions if(extensions.size()) { - for(kwsys_stl::vector<kwsys_stl::string>::iterator ext + for(kwsys_stl::vector<kwsys_stl::string>::iterator ext = extensions.begin(); ext != extensions.end(); ++ext) { tryPath = *p; @@ -2962,7 +2957,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot } // split up both paths into arrays of strings using / as a separator - kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true); + kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true); kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(remote, '/', true); kwsys_stl::vector<kwsys::String> commonPath; // store shared parts of path in this array kwsys_stl::vector<kwsys::String> finalPath; // store the final relative path here @@ -3019,7 +3014,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot } } kwsys_stl::string relativePath; // result string - // now turn the array of directories into a unix path by puttint / + // now turn the array of directories into a unix path by puttint / // between each entry that does not already have one for(kwsys_stl::vector<String>::iterator vit1 = finalPath.begin(); vit1 != finalPath.end(); ++vit1) @@ -3396,7 +3391,7 @@ kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename { kwsys_stl::string fn = filename; SystemTools::ConvertToUnixSlashes(fn); - + kwsys_stl::string::size_type slash_pos = fn.rfind("/"); if(slash_pos != kwsys_stl::string::npos) { @@ -3515,7 +3510,7 @@ SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename) } bool SystemTools::FileHasSignature(const char *filename, - const char *signature, + const char *signature, long offset) { if (!filename || !signature) @@ -3547,9 +3542,9 @@ bool SystemTools::FileHasSignature(const char *filename, return res; } -SystemTools::FileTypeEnum +SystemTools::FileTypeEnum SystemTools::DetectFileType(const char *filename, - unsigned long length, + unsigned long length, double percent_bin) { if (!filename || percent_bin < 0) @@ -3577,13 +3572,13 @@ SystemTools::DetectFileType(const char *filename, // Loop over contents and count size_t text_count = 0; - + const unsigned char *ptr = buffer; const unsigned char *buffer_end = buffer + read_length; while (ptr != buffer_end) { - if ((*ptr >= 0x20 && *ptr <= 0x7F) || + if ((*ptr >= 0x20 && *ptr <= 0x7F) || *ptr == '\n' || *ptr == '\r' || *ptr == '\t') @@ -3595,7 +3590,7 @@ SystemTools::DetectFileType(const char *filename, delete [] buffer; - double current_percent_bin = + double current_percent_bin = (static_cast<double>(read_length - text_count) / static_cast<double>(read_length)); @@ -3607,8 +3602,8 @@ SystemTools::DetectFileType(const char *filename, return SystemTools::FileTypeText; } -bool SystemTools::LocateFileInDir(const char *filename, - const char *dir, +bool SystemTools::LocateFileInDir(const char *filename, + const char *dir, kwsys_stl::string& filename_found, int try_filename_dirs) { @@ -3621,7 +3616,7 @@ bool SystemTools::LocateFileInDir(const char *filename, kwsys_stl::string filename_base = SystemTools::GetFilenameName(filename); - // Check if 'dir' is really a directory + // Check if 'dir' is really a directory // If win32 and matches something like C:, accept it as a dir kwsys_stl::string real_dir; @@ -3645,7 +3640,7 @@ bool SystemTools::LocateFileInDir(const char *filename, if (filename_base.size() && dir) { size_t dir_len = strlen(dir); - int need_slash = + int need_slash = (dir_len && dir[dir_len - 1] != '/' && dir[dir_len - 1] != '\\'); kwsys_stl::string temp = dir; @@ -3676,7 +3671,7 @@ bool SystemTools::LocateFileInDir(const char *filename, filename_dir = SystemTools::GetFilenamePath(filename_dir); filename_dir_base = SystemTools::GetFilenameName(filename_dir); #if defined( _WIN32 ) - if (!filename_dir_base.size() || + if (!filename_dir_base.size() || filename_dir_base[filename_dir_base.size() - 1] == ':') #else if (!filename_dir_base.size()) @@ -3700,7 +3695,7 @@ bool SystemTools::LocateFileInDir(const char *filename, } while (!res && filename_dir_base.size()); } } - + return res; } @@ -3746,12 +3741,12 @@ bool SystemTools::FileIsFullPath(const char* in_name) bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath) { -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(WIN32) && !defined(__CYGWIN__) const int size = int(strlen(path)) +1; // size of return char *buffer = new char[size]; // create a buffer char *tempPath = new char[size]; // create a buffer int ret; - + // if the path passed in has quotes around it, first remove the quotes if (path[0] == '"' && path[strlen(path)-1] == '"') { @@ -3762,7 +3757,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath) { strcpy(tempPath,path); } - + buffer[0] = 0; ret = GetShortPathName(tempPath, buffer, size); @@ -3785,7 +3780,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath) #endif } -void SystemTools::SplitProgramFromArgs(const char* path, +void SystemTools::SplitProgramFromArgs(const char* path, kwsys_stl::string& program, kwsys_stl::string& args) { // see if this is a full path to a program @@ -3797,7 +3792,7 @@ void SystemTools::SplitProgramFromArgs(const char* path, return; } // Try to find the program in the path, note the program - // may have spaces in its name so we have to look for it + // may have spaces in its name so we have to look for it kwsys_stl::vector<kwsys_stl::string> e; kwsys_stl::string findProg = SystemTools::FindProgram(path, e); if(findProg.size()) @@ -3828,7 +3823,7 @@ void SystemTools::SplitProgramFromArgs(const char* path, args = dir.substr(spacePos, dir.size()-spacePos); return; } - // Now try and find the the program in the path + // Now try and find the the program in the path findProg = SystemTools::FindProgram(tryProg.c_str(), e); if(findProg.size()) { @@ -4203,23 +4198,23 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() if (!bOsVersionInfoEx) { osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx((OSVERSIONINFO *)&osvi)) + if (!GetVersionEx((OSVERSIONINFO *)&osvi)) { return 0; } } - + switch (osvi.dwPlatformId) { // Test for the Windows NT product family. case VER_PLATFORM_WIN32_NT: - + // Test for the specific product family. if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0) { -#if (_MSC_VER >= 1300) +#if (_MSC_VER >= 1300) if (osvi.wProductType == VER_NT_WORKSTATION) { res += "Microsoft Windows Vista"; @@ -4259,7 +4254,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() { // Test for the workstation type. -#if (_MSC_VER >= 1300) +#if (_MSC_VER >= 1300) if (osvi.wProductType == VER_NT_WORKSTATION) { if (osvi.dwMajorVersion == 4) @@ -4278,7 +4273,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() } } } - + // Test for the server type. else if (osvi.wProductType == VER_NT_SERVER) @@ -4302,7 +4297,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() res += " Standard Edition"; } } - + else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) { if (osvi.wSuiteMask & VER_SUITE_DATACENTER) @@ -4319,7 +4314,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() } } - else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0 + else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0 { if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) { @@ -4336,7 +4331,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() // Test for specific product on Windows NT 4.0 SP5 and earlier - else + else { HKEY hKey; #define BUFSIZE 80 @@ -4386,7 +4381,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() // Display service pack (if any) and build number. - if (osvi.dwMajorVersion == 4 && + if (osvi.dwMajorVersion == 4 && lstrcmpi(osvi.szCSDVersion, "Service Pack 6") == 0) { HKEY hKey; @@ -4415,7 +4410,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() res += buffer; res += ")"; } - + RegCloseKey(hKey); } else // Windows NT 3.51 and earlier or Windows 2000 and later @@ -4455,11 +4450,11 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) { res += "Microsoft Windows Millennium Edition"; - } + } break; case VER_PLATFORM_WIN32s: - + res += "Microsoft Win32s"; break; } @@ -4469,7 +4464,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() } // ---------------------------------------------------------------------- -bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL, +bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL, kwsys_stl::string& protocol, kwsys_stl::string& dataglom ) { @@ -4487,12 +4482,12 @@ bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL, } // ---------------------------------------------------------------------- -bool SystemTools::ParseURL( const kwsys_stl::string& URL, +bool SystemTools::ParseURL( const kwsys_stl::string& URL, kwsys_stl::string& protocol, - kwsys_stl::string& username, - kwsys_stl::string& password, - kwsys_stl::string& hostname, - kwsys_stl::string& dataport, + kwsys_stl::string& username, + kwsys_stl::string& password, + kwsys_stl::string& hostname, + kwsys_stl::string& dataport, kwsys_stl::string& database ) { kwsys::RegularExpression urlRe( VTK_URL_REGEX ); @@ -4515,7 +4510,7 @@ bool SystemTools::ParseURL( const kwsys_stl::string& URL, hostname = urlRe.match( 6 ); dataport = urlRe.match( 8 ); database = urlRe.match( 9 ); - + return true; } diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 7ed0700..9e6a6d8 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2011) SET(KWSYS_DATE_STAMP_MONTH 11) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 01) +SET(KWSYS_DATE_STAMP_DAY 14) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 78db39d..28c6261 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1206,6 +1206,61 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean") ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile") + if(NOT DEFINED CTEST_RUN_MFC) + set(CTEST_RUN_MFC OFF) + + if(MSVC) + set(CTEST_RUN_MFC ON) + + # Look for evidence that this is a VCExpress build. If so, avoid + # the MFC test by default. + string(TOLOWER "${CMAKE_TEST_MAKEPROGRAM}" mkprog) + if(mkprog MATCHES "vcexpress") + message(STATUS + "CMAKE_TEST_MAKEPROGRAM indicates vcexpress, avoiding MFC test") + set(CTEST_RUN_MFC OFF) + endif() + + # Since MSBuild might also be the "makeprogram" for a VCExpress + # build tree, use one more heuristic, too. The string representing + # the .vcproj file type contains "VCExpress" on machines where an + # express edition of VS was installed last: + if(CTEST_RUN_MFC) + execute_process(COMMAND cmd /c assoc .vcproj + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE ov) + if(ov MATCHES "VCExpress") + message(STATUS + ".vcproj file association indicates VCExpress, avoiding MFC test") + set(CTEST_RUN_MFC OFF) + endif() + endif() + + # For the Watcom WMake generator, avoid the MFC test by default. + if(CTEST_RUN_MFC) + if("${CMAKE_TEST_GENERATOR}" MATCHES "WMake") + message(STATUS + "using the Watcom WMake generator, avoiding MFC test") + set(CTEST_RUN_MFC OFF) + endif() + endif() + endif() + endif() + + if(CTEST_RUN_MFC) + add_test(MFC ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/MFC" + "${CMake_BINARY_DIR}/Tests/MFC" + --build-two-config + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project mfc_driver + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --test-command ${CMAKE_CTEST_COMMAND} + -C \${CTEST_CONFIGURATION_TYPE} -VV) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC") + endif() + IF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio") ADD_TEST(VSExternalInclude ${CMAKE_CTEST_COMMAND} --build-and-test @@ -1531,6 +1586,35 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ SET_TESTS_PROPERTIES(CTestTestUpload PROPERTIES PASS_REGULAR_EXPRESSION "Upload\\.xml") + CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" + @ONLY ESCAPE_QUOTES) + ADD_TEST(CTestTestConfigFileInBuildDir1 ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/testOut1.log" + ) + SET_TESTS_PROPERTIES(CTestTestConfigFileInBuildDir1 PROPERTIES DEPENDS CTestTestNoBuild + PASS_REGULAR_EXPRESSION + "Reading ctest configuration file: ${CMake_SOURCE_DIR}.Tests.CTestTestConfigFileInBuildDir.CTestConfig.cmake") + + CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/test2.cmake" + @ONLY ESCAPE_QUOTES) + CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake" + "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/CTestConfig.cmake" + @ONLY ESCAPE_QUOTES COPYONLY) + ADD_TEST(CTestTestConfigFileInBuildDir2 ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/test2.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/testOut2.log" + ) + SET_TESTS_PROPERTIES(CTestTestConfigFileInBuildDir2 PROPERTIES DEPENDS CTestTestNoBuild + REQUIRED_FILES ${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/CTestConfig.cmake + PASS_REGULAR_EXPRESSION + "Reading ctest configuration file: ${CMake_BINARY_DIR}.Tests.CTestTestConfigFileInBuildDir2.CTestConfig.cmake") + # Use macro, not function so that build can still be driven by CMake 2.4. # After 2.6 is required, this could be a function without the extra 'set' # calls. diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index d82943f..9444a14 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -7,6 +7,7 @@ endif(CPACK_GENERATOR MATCHES "ZIP") if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") + set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") endif(CPACK_GENERATOR MATCHES "RPM") if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in index 1e1a410..2d251b3 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in @@ -7,6 +7,7 @@ endif(CPACK_GENERATOR MATCHES "ZIP") if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") + set(CPACK_RPM_Development_PACKAGE_REQUIRES "mylib-Runtime") endif(CPACK_GENERATOR MATCHES "RPM") if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CTestTestConfigFileInBuildDir/CMakeLists.txt b/Tests/CTestTestConfigFileInBuildDir/CMakeLists.txt new file mode 100644 index 0000000..3c53e66 --- /dev/null +++ b/Tests/CTestTestConfigFileInBuildDir/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(CTestTestConfigFileInBuildDir) +include(CTest) diff --git a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake b/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake new file mode 100644 index 0000000..d2c28f9 --- /dev/null +++ b/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake @@ -0,0 +1,7 @@ +set(CTEST_PROJECT_NAME "CTestTestConfigFileInBuildDir") +set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") +set(CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in new file mode 100644 index 0000000..498cab2 --- /dev/null +++ b/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in @@ -0,0 +1,17 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +# Settings: +SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +SET(CTEST_SITE "@SITE@") +SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuildDir1") + +SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") +SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir1") +SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") +SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in new file mode 100644 index 0000000..d359f2d --- /dev/null +++ b/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in @@ -0,0 +1,17 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +# Settings: +SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +SET(CTEST_SITE "@SITE@") +SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuildDir2") + +SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") +SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir2") +SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") +SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/ExternalProject/Example/CMakeLists.txt b/Tests/ExternalProject/Example/CMakeLists.txt index 2cadd7d..69ebaaf 100644 --- a/Tests/ExternalProject/Example/CMakeLists.txt +++ b/Tests/ExternalProject/Example/CMakeLists.txt @@ -6,6 +6,6 @@ include(ExternalProject) ExternalProject_Add( cmake281 URL http://www.cmake.org/files/v2.8/cmake-2.8.1.tar.gz - CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=<INSTALL_DIR> + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> BUILD_COMMAND "" ) diff --git a/Tests/MFC/CMakeLists.txt b/Tests/MFC/CMakeLists.txt new file mode 100644 index 0000000..62ff749 --- /dev/null +++ b/Tests/MFC/CMakeLists.txt @@ -0,0 +1,61 @@ +cmake_minimum_required(VERSION 2.8) +project(mfc_driver) + +include(CTest) +include(ExternalProject) + + +set(CMAKE_MFC_FLAG_VALUE "2") +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.SharedMfcDll.txt + @ONLY + ) + +ExternalProject_Add(mfcShared + URL ${CMAKE_CURRENT_SOURCE_DIR}/mfc1 + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.SharedMfcDll.txt + <SOURCE_DIR>/CMakeLists.txt + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + ) + + +set(CMAKE_MFC_FLAG_VALUE "1") +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.StaticMfcLib.txt + @ONLY + ) + +ExternalProject_Add(mfcStatic + URL ${CMAKE_CURRENT_SOURCE_DIR}/mfc1 + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.StaticMfcLib.txt + <SOURCE_DIR>/CMakeLists.txt + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + ) + + +set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}") +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/ValidateBuild.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/ValidateBuild.cmake + @ONLY + ) +add_test( + NAME validate + COMMAND ${CMAKE_COMMAND} + -P "${CMAKE_CURRENT_BINARY_DIR}/ValidateBuild.cmake" + ) + + +add_test( + NAME environment + COMMAND ${CMAKE_COMMAND} -E environment + ) + + +message(STATUS "===== environment =====") +execute_process(COMMAND ${CMAKE_COMMAND} -E environment) +message(STATUS "===== /environment =====") diff --git a/Tests/MFC/CMakeLists.txt.in b/Tests/MFC/CMakeLists.txt.in new file mode 100644 index 0000000..e6bfabd --- /dev/null +++ b/Tests/MFC/CMakeLists.txt.in @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 2.8) +project(mfc1) + +macro(replace_flags var these those) + if("${${var}}" MATCHES "${these}") + string(REGEX REPLACE "${these}" "${those}" ${var} "${${var}}") + #message(STATUS "info: ${var} changed to '${${var}}'") + endif() + message(STATUS "info: ${var}='${${var}}'") +endmacro() + +macro(msvc_link_to_static_crt) + if(MSVC) + set(has_correct_flag 0) + foreach(lang C CXX) + foreach(suffix "" _DEBUG _MINSIZEREL _RELEASE _RELWITHDEBINFO) + replace_flags("CMAKE_${lang}_FLAGS${suffix}" "/MD" "/MT") + if(CMAKE_${lang}_FLAGS${suffix} MATCHES "/MT") + set(has_correct_flag 1) + endif() + endforeach() + endforeach() + if(NOT has_correct_flag) + message(FATAL_ERROR "no CMAKE_*_FLAGS var contains /MT") + endif() + endif() +endmacro() + +set(files + ChildFrm.cpp + ChildFrm.h + MainFrm.cpp + MainFrm.h + mfc1.cpp + mfc1.h + mfc1.rc + mfc1Doc.cpp + mfc1Doc.h + mfc1View.cpp + mfc1View.h + Resource.h + stdafx.cpp + stdafx.h +) + +set(CMAKE_MFC_FLAG "@CMAKE_MFC_FLAG_VALUE@") + +if("${CMAKE_MFC_FLAG}" STREQUAL "1") + msvc_link_to_static_crt() +else() + # VS generators add this automatically based on the CMAKE_MFC_FLAG value, + # but generators matching "Make" require: + add_definitions(-D_AFXDLL) +endif() + +add_executable(mfc1 WIN32 ${files}) +install(TARGETS mfc1 DESTINATION bin) + +if("${CMAKE_MFC_FLAG}" STREQUAL "2") + set(CMAKE_INSTALL_MFC_LIBRARIES ON) + include(InstallRequiredSystemLibraries) +endif() diff --git a/Tests/MFC/ValidateBuild.cmake.in b/Tests/MFC/ValidateBuild.cmake.in new file mode 100644 index 0000000..ed923f5 --- /dev/null +++ b/Tests/MFC/ValidateBuild.cmake.in @@ -0,0 +1,68 @@ +# +# This code validates that the install trees of the shared and static builds +# of "mfc1" have the expected contents: +# +set(binary_dir "@binary_dir@") +message("binary_dir='${binary_dir}'") + +# There should be exactly one file in the static install tree "bin" directory +# and it should be named "mfc1.exe" +# +message(STATUS "===== mfcStatic install tree =====") +file(GLOB_RECURSE files "${binary_dir}/mfcStatic-prefix/bin/*.*") +message(STATUS "mfcStatic files='${files}'") +list(LENGTH files len) +if(NOT len EQUAL 1) + message(FATAL_ERROR + "len='${len}' is not '1' (count of static 'bin' files)") +endif() +get_filename_component(name "${files}" NAME) +string(TOLOWER "${name}" name) +if(NOT "${name}" STREQUAL "mfc1.exe") + message(FATAL_ERROR "unexpected mfcStatic file name '${name}'") +endif() + +# There should be at least 3 files in the shared install tree "bin" +# directory: mfc1.exe, the main MFC dll and the C runtime dll. With more +# recent versions of VS, there will also be an MFC language dll and a +# manifest file. +# +message(STATUS "===== mfcShared install tree =====") +file(GLOB_RECURSE files "${binary_dir}/mfcShared-prefix/bin/*.*") +message(STATUS "mfcShared files='${files}'") +list(LENGTH files len) + +set(msvc6 "@MSVC60@") +if("${msvc6}" STREQUAL "1") + set(expected_minimum_file_count 1) +else() + set(expected_minimum_file_count 3) +endif() + +if(len LESS ${expected_minimum_file_count}) + message(FATAL_ERROR + "len='${len}' is less than '${expected_minimum_file_count}' (count of shared 'bin' files)") +endif() +foreach(f ${files}) + message(STATUS "file '${f}'") + get_filename_component(ext "${f}" EXT) + string(TOLOWER "${ext}" ext) + + if("${ext}" MATCHES "\\.exe$") + message(STATUS " exe file") + get_filename_component(name "${f}" NAME) + string(TOLOWER "${name}" name) + if(NOT "${name}" STREQUAL "mfc1.exe") + message(FATAL_ERROR "unexpected mfcShared .exe file name '${name}'") + endif() + elseif("${ext}" MATCHES "\\.dll$") + message(STATUS " dll file") + elseif("${ext}" MATCHES "\\.manifest$") + message(STATUS " manifest file") + else() + message(STATUS " unknown file") + message(FATAL_ERROR "unexpected mfcShared ${ext} file name '${f}'") + endif() +endforeach() + +message(STATUS "All mfc1 build validation tests pass.") diff --git a/Tests/MFC/mfc1/.gitattributes b/Tests/MFC/mfc1/.gitattributes new file mode 100644 index 0000000..59be5dc --- /dev/null +++ b/Tests/MFC/mfc1/.gitattributes @@ -0,0 +1,6 @@ +.gitattributes export-ignore + +*.sln -crlf +*.vcproj -crlf + +* -whitespace diff --git a/Tests/MFC/mfc1/ChildFrm.cpp b/Tests/MFC/mfc1/ChildFrm.cpp new file mode 100644 index 0000000..b04c4f2 --- /dev/null +++ b/Tests/MFC/mfc1/ChildFrm.cpp @@ -0,0 +1,59 @@ +// ChildFrm.cpp : implementation of the CChildFrame class +// +#include "stdafx.h" +#include "mfc1.h" + +#include "ChildFrm.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CChildFrame + +IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) + +BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) +END_MESSAGE_MAP() + + +// CChildFrame construction/destruction + +CChildFrame::CChildFrame() +{ + // TODO: add member initialization code here +} + +CChildFrame::~CChildFrame() +{ +} + + +BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs + if( !CMDIChildWnd::PreCreateWindow(cs) ) + return FALSE; + + return TRUE; +} + + +// CChildFrame diagnostics + +#ifdef _DEBUG +void CChildFrame::AssertValid() const +{ + CMDIChildWnd::AssertValid(); +} + +void CChildFrame::Dump(CDumpContext& dc) const +{ + CMDIChildWnd::Dump(dc); +} + +#endif //_DEBUG + + +// CChildFrame message handlers diff --git a/Tests/MFC/mfc1/ChildFrm.h b/Tests/MFC/mfc1/ChildFrm.h new file mode 100644 index 0000000..34b80f1 --- /dev/null +++ b/Tests/MFC/mfc1/ChildFrm.h @@ -0,0 +1,34 @@ +// ChildFrm.h : interface of the CChildFrame class +// + + +#pragma once + + +class CChildFrame : public CMDIChildWnd +{ + DECLARE_DYNCREATE(CChildFrame) +public: + CChildFrame(); + +// Attributes +public: + +// Operations +public: + +// Overrides + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + +// Implementation +public: + virtual ~CChildFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +// Generated message map functions +protected: + DECLARE_MESSAGE_MAP() +}; diff --git a/Tests/MFC/mfc1/MainFrm.cpp b/Tests/MFC/mfc1/MainFrm.cpp new file mode 100644 index 0000000..44554bf --- /dev/null +++ b/Tests/MFC/mfc1/MainFrm.cpp @@ -0,0 +1,98 @@ +// MainFrm.cpp : implementation of the CMainFrame class +// + +#include "stdafx.h" +#include "mfc1.h" + +#include "MainFrm.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CMainFrame + +IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) + ON_WM_CREATE() +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + + +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() +{ + // TODO: add member initialization code here +} + +CMainFrame::~CMainFrame() +{ +} + + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP + | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + // TODO: Delete these three lines if you don't want the toolbar to be dockable + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; +} + +BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + if( !CMDIFrameWnd::PreCreateWindow(cs) ) + return FALSE; + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return TRUE; +} + + +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const +{ + CMDIFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext& dc) const +{ + CMDIFrameWnd::Dump(dc); +} + +#endif //_DEBUG + + +// CMainFrame message handlers diff --git a/Tests/MFC/mfc1/MainFrm.h b/Tests/MFC/mfc1/MainFrm.h new file mode 100644 index 0000000..1039ac5 --- /dev/null +++ b/Tests/MFC/mfc1/MainFrm.h @@ -0,0 +1,38 @@ +// MainFrm.h : interface of the CMainFrame class +// + + +#pragma once +class CMainFrame : public CMDIFrameWnd +{ + DECLARE_DYNAMIC(CMainFrame) +public: + CMainFrame(); + +// Attributes +public: + +// Operations +public: + +// Overrides +public: + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + +// Implementation +public: + virtual ~CMainFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + CToolBar m_wndToolBar; + +// Generated message map functions +protected: + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + DECLARE_MESSAGE_MAP() +}; diff --git a/Tests/MFC/mfc1/ReadMe.txt b/Tests/MFC/mfc1/ReadMe.txt new file mode 100644 index 0000000..d84608e --- /dev/null +++ b/Tests/MFC/mfc1/ReadMe.txt @@ -0,0 +1,135 @@ +================================================================================ + MICROSOFT FOUNDATION CLASS LIBRARY : mfc1 Project Overview +=============================================================================== + +The application wizard has created this mfc1 application for +you. This application not only demonstrates the basics of using the Microsoft +Foundation Classes but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your mfc1 application. + +mfc1.vcproj + This is the main project file for VC++ projects generated using an application wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + application wizard. + +mfc1.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + Cmfc1App application class. + +mfc1.cpp + This is the main application source file that contains the application + class Cmfc1App. + +mfc1.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. Your project resources are in 1033. + +res\mfc1.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file mfc1.rc. + +res\mfc1.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. +mfc1.reg + This is an example .reg file that shows you the kind of registration + settings the framework will set for you. You can use this as a .reg + file to go along with your application or just delete it and rely + on the default RegisterShellFileTypes registration. +///////////////////////////////////////////////////////////////////////////// + +For the main frame window: + The project includes a standard MFC interface. +MainFrm.h, MainFrm.cpp + These files contain the frame class CMainFrame, which is derived from + CMDIFrameWnd and controls all MDI frame features. +res\Toolbar.bmp + This bitmap file is used to create tiled images for the toolbar. + The initial toolbar and status bar are constructed in the CMainFrame + class. Edit this toolbar bitmap using the resource editor, and + update the IDR_MAINFRAME TOOLBAR array in mfc1.rc to add + toolbar buttons. +///////////////////////////////////////////////////////////////////////////// + +For the child frame window: + +ChildFrm.h, ChildFrm.cpp + These files define and implement the CChildFrame class, which + supports the child windows in an MDI application. + +///////////////////////////////////////////////////////////////////////////// + +The application wizard creates one document type and one view: + +mfc1Doc.h, mfc1Doc.cpp - the document + These files contain your Cmfc1Doc class. Edit these files to + add your special document data and to implement file saving and loading + (via Cmfc1Doc::Serialize). + The Document will have the following strings: + File extension: mf1 + File type ID: mfc1.Document + Main frame caption: mfc1 + Doc type name: mfc1 + Filter name: mfc1 Files (*.mf1) + File new short name: mfc1 + File type long name: mfc1.Document +mfc1View.h, mfc1View.cpp - the view of the document + These files contain your Cmfc1View class. + Cmfc1View objects are used to view Cmfc1Doc objects. +res\mfc1Doc.ico + This is an icon file, which is used as the icon for MDI child windows + for the Cmfc1Doc class. This icon is included by the main + resource file mfc1.rc. +///////////////////////////////////////////////////////////////////////////// + +Other Features: + +ActiveX Controls + The application includes support to use ActiveX controls. + +Printing and Print Preview support + The application wizard has generated code to handle the print, print setup, and print preview + commands by calling member functions in the CView class from the MFC library. +///////////////////////////////////////////////////////////////////////////// + +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named mfc1.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +mfc1.manifest + Application manifest files are used by Windows XP to describe an applications + dependency on specific versions of Side-by-Side assemblies. The loader uses this + information to load the appropriate assembly from the assembly cache or private + from the application. The Application manifest maybe included for redistribution + as an external .manifest file that is installed in the same folder as the application + executable or it may be included in the executable in the form of a resource. +///////////////////////////////////////////////////////////////////////////// + +Other notes: + +The application wizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, and your application is in a +language other than the operating system's current language, you will need +to copy the corresponding localized resources MFC70XXX.DLL from the Microsoft +Visual C++ CD-ROM under the Win\System directory to your computer's system or +system32 directory, and rename it to be MFCLOC.DLL. ("XXX" stands for the +language abbreviation. For example, MFC70DEU.DLL contains resources +translated to German.) If you don't do this, some of the UI elements of +your application will remain in the language of the operating system. + +///////////////////////////////////////////////////////////////////////////// diff --git a/Tests/MFC/mfc1/Resource.h b/Tests/MFC/mfc1/Resource.h new file mode 100644 index 0000000..0a9c13f --- /dev/null +++ b/Tests/MFC/mfc1/Resource.h @@ -0,0 +1,20 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by mfc1.rc +// +#define IDD_ABOUTBOX 100 +#define IDP_OLE_INIT_FAILED 100 +#define IDR_MAINFRAME 128 +#define IDR_mfc1TYPE 129 +#define IDR_MANIFEST CREATEPROCESS_MANIFEST_RESOURCE_ID + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 32771 +#endif +#endif diff --git a/Tests/MFC/mfc1/mfc1.cpp b/Tests/MFC/mfc1/mfc1.cpp new file mode 100644 index 0000000..9530cd2 --- /dev/null +++ b/Tests/MFC/mfc1/mfc1.cpp @@ -0,0 +1,144 @@ +// mfc1.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "mfc1.h" +#include "MainFrm.h" + +#include "ChildFrm.h" +#include "mfc1Doc.h" +#include "mfc1View.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// Cmfc1App + +BEGIN_MESSAGE_MAP(Cmfc1App, CWinApp) + ON_COMMAND(ID_APP_ABOUT, OnAppAbout) + // Standard file based document commands + ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) + ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) + // Standard print setup command + ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) +END_MESSAGE_MAP() + + +// Cmfc1App construction + +Cmfc1App::Cmfc1App() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + + +// The one and only Cmfc1App object + +Cmfc1App theApp; + +// Cmfc1App initialization + +BOOL Cmfc1App::InitInstance() +{ + // InitCommonControls() is required on Windows XP if an application + // manifest specifies use of ComCtl32.dll version 6 or later to enable + // visual styles. Otherwise, any window creation will fail. + InitCommonControls(); + + CWinApp::InitInstance(); + + // Initialize OLE libraries + if (!AfxOleInit()) + { + AfxMessageBox(IDP_OLE_INIT_FAILED); + return FALSE; + } + AfxEnableControlContainer(); + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need + // Change the registry key under which our settings are stored + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + LoadStdProfileSettings(4); // Load standard INI file options (including MRU) + // Register the application's document templates. Document templates + // serve as the connection between documents, frame windows and views + CMultiDocTemplate* pDocTemplate; + pDocTemplate = new CMultiDocTemplate(IDR_mfc1TYPE, + RUNTIME_CLASS(Cmfc1Doc), + RUNTIME_CLASS(CChildFrame), // custom MDI child frame + RUNTIME_CLASS(Cmfc1View)); + if (!pDocTemplate) + return FALSE; + AddDocTemplate(pDocTemplate); + // create main MDI Frame window + CMainFrame* pMainFrame = new CMainFrame; + if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) + return FALSE; + m_pMainWnd = pMainFrame; + // call DragAcceptFiles only if there's a suffix + // In an MDI app, this should occur immediately after setting m_pMainWnd + // Enable drag/drop open + m_pMainWnd->DragAcceptFiles(); + // Enable DDE Execute open + EnableShellOpen(); + RegisterShellFileTypes(TRUE); + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + // Dispatch commands specified on the command line. Will return FALSE if + // app was launched with /RegServer, /Register, /Unregserver or /Unregister. + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + // The main window has been initialized, so show and update it + pMainFrame->ShowWindow(m_nCmdShow); + pMainFrame->UpdateWindow(); + return TRUE; +} + + + +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + +// Dialog Data + enum { IDD = IDD_ABOUTBOX }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + +// Implementation +protected: + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) +END_MESSAGE_MAP() + +// App command to run the dialog +void Cmfc1App::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + + +// Cmfc1App message handlers diff --git a/Tests/MFC/mfc1/mfc1.h b/Tests/MFC/mfc1/mfc1.h new file mode 100644 index 0000000..c273601 --- /dev/null +++ b/Tests/MFC/mfc1/mfc1.h @@ -0,0 +1,31 @@ +// mfc1.h : main header file for the mfc1 application +// +#pragma once + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + + +// Cmfc1App: +// See mfc1.cpp for the implementation of this class +// + +class Cmfc1App : public CWinApp +{ +public: + Cmfc1App(); + + +// Overrides +public: + virtual BOOL InitInstance(); + +// Implementation + afx_msg void OnAppAbout(); + DECLARE_MESSAGE_MAP() +}; + +extern Cmfc1App theApp; diff --git a/Tests/MFC/mfc1/mfc1.rc b/Tests/MFC/mfc1/mfc1.rc new file mode 100644 index 0000000..346c5fb --- /dev/null +++ b/Tests/MFC/mfc1/mfc1.rc @@ -0,0 +1,393 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// + +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#ifdef APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""res\\mfc1.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#include ""afxprint.rc"" // printing/print preview resources\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +IDR_MAINFRAME ICON "res\\mfc1.ico" +IDR_mfc1TYPE ICON "res\\mfc1Doc.ico" +#endif +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_MAINFRAME BITMAP "res\\Toolbar.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_MAINFRAME TOOLBAR 16, 15 +BEGIN + BUTTON ID_FILE_NEW + BUTTON ID_FILE_OPEN + BUTTON ID_FILE_SAVE + SEPARATOR + BUTTON ID_EDIT_CUT + BUTTON ID_EDIT_COPY + BUTTON ID_EDIT_PASTE + SEPARATOR + BUTTON ID_FILE_PRINT + BUTTON ID_APP_ABOUT +END + + + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINFRAME MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM SEPARATOR + MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP + MENUITEM SEPARATOR + MENUITEM "Recent File", ID_FILE_MRU_FILE1,GRAYED + MENUITEM SEPARATOR + MENUITEM "&Close", ID_FILE_CLOSE + MENUITEM "E&xit", ID_APP_EXIT + END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_VIEW_TOOLBAR + MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR + END + POPUP "&Help" + BEGIN + MENUITEM "&About mfc1...", ID_APP_ABOUT + END +END +IDR_mfc1TYPE MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Close", ID_FILE_CLOSE + MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE + MENUITEM "Save &As...", ID_FILE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT + MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW + MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP + MENUITEM SEPARATOR + MENUITEM "Recent File", ID_FILE_MRU_FILE1,GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_APP_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO + MENUITEM SEPARATOR + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_VIEW_TOOLBAR + MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR + END + POPUP "&Window" + BEGIN + MENUITEM "&New Window", ID_WINDOW_NEW + MENUITEM "&Cascade", ID_WINDOW_CASCADE + MENUITEM "&Tile", ID_WINDOW_TILE_HORZ + MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE + END + POPUP "&Help" + BEGIN + MENUITEM "&About mfc1...", ID_APP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS +BEGIN + "N", ID_FILE_NEW, VIRTKEY,CONTROL + "O", ID_FILE_OPEN, VIRTKEY,CONTROL + "S", ID_FILE_SAVE, VIRTKEY,CONTROL + "P", ID_FILE_PRINT, VIRTKEY,CONTROL + "Z", ID_EDIT_UNDO, VIRTKEY,CONTROL + "X", ID_EDIT_CUT, VIRTKEY,CONTROL + "C", ID_EDIT_COPY, VIRTKEY,CONTROL + "V", ID_EDIT_PASTE, VIRTKEY,CONTROL + VK_BACK, ID_EDIT_UNDO, VIRTKEY,ALT + VK_DELETE, ID_EDIT_CUT, VIRTKEY,SHIFT + VK_INSERT, ID_EDIT_COPY, VIRTKEY,CONTROL + VK_INSERT, ID_EDIT_PASTE, VIRTKEY,SHIFT + VK_F6, ID_NEXT_PANE, VIRTKEY + VK_F6, ID_PREV_PANE, VIRTKEY,SHIFT +END + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +#if _MSC_VER < 1300 +#define DS_SHELLFONT_FLAG 0 +#else +#define DS_SHELLFONT_FLAG DS_SHELLFONT +#endif + +IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55 +CAPTION "About mfc1" +STYLE DS_MODALFRAME | DS_SHELLFONT_FLAG | WS_POPUP | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 + LTEXT "mfc1 Version 1.0",IDC_STATIC,40,10,119,8, + SS_NOPREFIX + LTEXT "Copyright (C) 2011",IDC_STATIC,40,25,119,8 + DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "TODO: <Company name>" + VALUE "FileDescription", "TODO: <File description>" + VALUE "FileVersion", "1.0.0.1" + VALUE "InternalName", "mfc1.exe" + VALUE "LegalCopyright", "TODO: (c) <Company name>. All rights reserved." + VALUE "OriginalFilename","mfc1.exe" + VALUE "ProductName", "TODO: <Product name>" + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 228 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END +END +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN +// Non-mac-targeting apps remove the two extra substrings + IDR_MAINFRAME "mfc1" + // has a file suffix - shell file type too + IDR_mfc1TYPE "\nmfc1\nmfc1\nmfc1 Files (*.mf1)\n.mf1\nmfc1.Document\nmfc1.Document" +END +STRINGTABLE +BEGIN + AFX_IDS_APP_TITLE "mfc1" + AFX_IDS_IDLEMESSAGE "Ready" +END +STRINGTABLE +BEGIN + ID_INDICATOR_EXT "EXT" + ID_INDICATOR_CAPS "CAP" + ID_INDICATOR_NUM "NUM" + ID_INDICATOR_SCRL "SCRL" + ID_INDICATOR_OVR "OVR" + ID_INDICATOR_REC "REC" +END +STRINGTABLE +BEGIN + ID_FILE_NEW "Create a new document\nNew" + ID_FILE_OPEN "Open an existing document\nOpen" + ID_FILE_CLOSE "Close the active document\nClose" + ID_FILE_SAVE "Save the active document\nSave" + ID_FILE_SAVE_AS "Save the active document with a new name\nSave As" + ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup" + ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup" + ID_FILE_PRINT "Print the active document\nPrint" + ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview" + ID_APP_ABOUT "Display program information, version number and copyright\nAbout" + ID_APP_EXIT "Quit the application; prompts to save documents\nExit" + ID_FILE_MRU_FILE1 "Open this document" + ID_FILE_MRU_FILE2 "Open this document" + ID_FILE_MRU_FILE3 "Open this document" + ID_FILE_MRU_FILE4 "Open this document" + ID_FILE_MRU_FILE5 "Open this document" + ID_FILE_MRU_FILE6 "Open this document" + ID_FILE_MRU_FILE7 "Open this document" + ID_FILE_MRU_FILE8 "Open this document" + ID_FILE_MRU_FILE9 "Open this document" + ID_FILE_MRU_FILE10 "Open this document" + ID_FILE_MRU_FILE11 "Open this document" + ID_FILE_MRU_FILE12 "Open this document" + ID_FILE_MRU_FILE13 "Open this document" + ID_FILE_MRU_FILE14 "Open this document" + ID_FILE_MRU_FILE15 "Open this document" + ID_FILE_MRU_FILE16 "Open this document" + ID_NEXT_PANE "Switch to the next window pane\nNext Pane" + ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" + ID_WINDOW_NEW "Open another window for the active document\nNew Window" + ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons" + ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows" + ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows" + ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows" + ID_WINDOW_SPLIT "Split the active window into panes\nSplit" + ID_EDIT_CLEAR "Erase the selection\nErase" + ID_EDIT_CLEAR_ALL "Erase everything\nErase All" + ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy" + ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut" + ID_EDIT_FIND "Find the specified text\nFind" + ID_EDIT_PASTE "Insert Clipboard contents\nPaste" + ID_EDIT_REPEAT "Repeat the last action\nRepeat" + ID_EDIT_REPLACE "Replace specific text with different text\nReplace" + ID_EDIT_SELECT_ALL "Select the entire document\nSelect All" + ID_EDIT_UNDO "Undo the last action\nUndo" + ID_EDIT_REDO "Redo the previously undone action\nRedo" + ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar" + ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar" +END + +STRINGTABLE +BEGIN + AFX_IDS_SCSIZE "Change the window size" + AFX_IDS_SCMOVE "Change the window position" + AFX_IDS_SCMINIMIZE "Reduce the window to an icon" + AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" + AFX_IDS_SCNEXTWINDOW "Switch to the next document window" + AFX_IDS_SCPREVWINDOW "Switch to the previous document window" + AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" + AFX_IDS_SCRESTORE "Restore the window to normal size" + AFX_IDS_SCTASKLIST "Activate Task List" + AFX_IDS_MDICHILD "Activate this window" + AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview" +END + +#endif + +#ifdef _UNICODE +IDR_MANIFEST RT_MANIFEST "res\\mfc1.manifest" +#endif + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "res\\mfc1.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#include "afxprint.rc" // printing/print preview resources +#endif +#endif // not APSTUDIO_INVOKED diff --git a/Tests/MFC/mfc1/mfc1.reg b/Tests/MFC/mfc1/mfc1.reg new file mode 100644 index 0000000..9f3a86f --- /dev/null +++ b/Tests/MFC/mfc1/mfc1.reg @@ -0,0 +1,13 @@ +REGEDIT +; This .REG file may be used by your SETUP program. +; If a SETUP program is not available, the entries below will be +; registered in your InitInstance automatically with a call to +; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll. + +HKEY_CLASSES_ROOT\.mf1 = mfc1.Document +HKEY_CLASSES_ROOT\mfc1.Document\shell\open\command = mfc1.EXE %1 +HKEY_CLASSES_ROOT\mfc1.Document\shell\open\ddeexec = [open("%1")] +HKEY_CLASSES_ROOT\mfc1.Document\shell\open\ddeexec\application = mfc1 + ; note: the application is optional + ; (it defaults to the app name in "command") +HKEY_CLASSES_ROOT\mfc1.Document = mfc1.Document diff --git a/Tests/MFC/mfc1/mfc1.sln b/Tests/MFC/mfc1/mfc1.sln new file mode 100644 index 0000000..78bbe56 --- /dev/null +++ b/Tests/MFC/mfc1/mfc1.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mfc1", "mfc1.vcproj", "{06C08100-1145-4104-AEC3-6BC8C608B819}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {06C08100-1145-4104-AEC3-6BC8C608B819}.Debug.ActiveCfg = Debug|Win32
+ {06C08100-1145-4104-AEC3-6BC8C608B819}.Debug.Build.0 = Debug|Win32
+ {06C08100-1145-4104-AEC3-6BC8C608B819}.Release.ActiveCfg = Release|Win32
+ {06C08100-1145-4104-AEC3-6BC8C608B819}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/Tests/MFC/mfc1/mfc1.vcproj b/Tests/MFC/mfc1/mfc1.vcproj new file mode 100644 index 0000000..6df86e5 --- /dev/null +++ b/Tests/MFC/mfc1/mfc1.vcproj @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="mfc1"
+ ProjectGUID="{06C08100-1145-4104-AEC3-6BC8C608B819}"
+ Keyword="MFCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\ChildFrm.cpp">
+ </File>
+ <File
+ RelativePath=".\MainFrm.cpp">
+ </File>
+ <File
+ RelativePath=".\mfc1.cpp">
+ </File>
+ <File
+ RelativePath=".\mfc1Doc.cpp">
+ </File>
+ <File
+ RelativePath=".\mfc1View.cpp">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\ChildFrm.h">
+ </File>
+ <File
+ RelativePath=".\MainFrm.h">
+ </File>
+ <File
+ RelativePath=".\mfc1.h">
+ </File>
+ <File
+ RelativePath=".\mfc1Doc.h">
+ </File>
+ <File
+ RelativePath=".\mfc1View.h">
+ </File>
+ <File
+ RelativePath=".\Resource.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ <File
+ RelativePath=".\res\mfc1.ico">
+ </File>
+ <File
+ RelativePath=".\mfc1.rc">
+ </File>
+ <File
+ RelativePath=".\res\mfc1.rc2">
+ </File>
+ <File
+ RelativePath=".\res\mfc1Doc.ico">
+ </File>
+ <File
+ RelativePath=".\res\Toolbar.bmp">
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\res\mfc1.manifest">
+ </File>
+ <File
+ RelativePath=".\mfc1.reg">
+ </File>
+ <File
+ RelativePath=".\ReadMe.txt">
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Tests/MFC/mfc1/mfc1Doc.cpp b/Tests/MFC/mfc1/mfc1Doc.cpp new file mode 100644 index 0000000..8767052 --- /dev/null +++ b/Tests/MFC/mfc1/mfc1Doc.cpp @@ -0,0 +1,78 @@ +// mfc1Doc.cpp : implementation of the Cmfc1Doc class +// + +#include "stdafx.h" +#include "mfc1.h" + +#include "mfc1Doc.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// Cmfc1Doc + +IMPLEMENT_DYNCREATE(Cmfc1Doc, CDocument) + +BEGIN_MESSAGE_MAP(Cmfc1Doc, CDocument) +END_MESSAGE_MAP() + + +// Cmfc1Doc construction/destruction + +Cmfc1Doc::Cmfc1Doc() +{ + // TODO: add one-time construction code here + +} + +Cmfc1Doc::~Cmfc1Doc() +{ +} + +BOOL Cmfc1Doc::OnNewDocument() +{ + if (!CDocument::OnNewDocument()) + return FALSE; + + // TODO: add reinitialization code here + // (SDI documents will reuse this document) + + return TRUE; +} + + + + +// Cmfc1Doc serialization + +void Cmfc1Doc::Serialize(CArchive& ar) +{ + if (ar.IsStoring()) + { + // TODO: add storing code here + } + else + { + // TODO: add loading code here + } +} + + +// Cmfc1Doc diagnostics + +#ifdef _DEBUG +void Cmfc1Doc::AssertValid() const +{ + CDocument::AssertValid(); +} + +void Cmfc1Doc::Dump(CDumpContext& dc) const +{ + CDocument::Dump(dc); +} +#endif //_DEBUG + + +// Cmfc1Doc commands diff --git a/Tests/MFC/mfc1/mfc1Doc.h b/Tests/MFC/mfc1/mfc1Doc.h new file mode 100644 index 0000000..92d8e35 --- /dev/null +++ b/Tests/MFC/mfc1/mfc1Doc.h @@ -0,0 +1,37 @@ +// mfc1Doc.h : interface of the Cmfc1Doc class +// + + +#pragma once + +class Cmfc1Doc : public CDocument +{ +protected: // create from serialization only + Cmfc1Doc(); + DECLARE_DYNCREATE(Cmfc1Doc) + +// Attributes +public: + +// Operations +public: + +// Overrides + public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); + +// Implementation +public: + virtual ~Cmfc1Doc(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + DECLARE_MESSAGE_MAP() +}; diff --git a/Tests/MFC/mfc1/mfc1View.cpp b/Tests/MFC/mfc1/mfc1View.cpp new file mode 100644 index 0000000..06c7652 --- /dev/null +++ b/Tests/MFC/mfc1/mfc1View.cpp @@ -0,0 +1,99 @@ +// mfc1View.cpp : implementation of the Cmfc1View class +// + +#include "stdafx.h" +#include "mfc1.h" + +#include "mfc1Doc.h" +#include "mfc1View.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// Cmfc1View + +IMPLEMENT_DYNCREATE(Cmfc1View, CView) + +BEGIN_MESSAGE_MAP(Cmfc1View, CView) + // Standard printing commands + ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) + ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) + ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) +END_MESSAGE_MAP() + +// Cmfc1View construction/destruction + +Cmfc1View::Cmfc1View() +{ + // TODO: add construction code here + +} + +Cmfc1View::~Cmfc1View() +{ +} + +BOOL Cmfc1View::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CView::PreCreateWindow(cs); +} + +// Cmfc1View drawing + +void Cmfc1View::OnDraw(CDC* /*pDC*/) +{ + Cmfc1Doc* pDoc = GetDocument(); + ASSERT_VALID(pDoc); + if (!pDoc) + return; + + // TODO: add draw code for native data here +} + + +// Cmfc1View printing + +BOOL Cmfc1View::OnPreparePrinting(CPrintInfo* pInfo) +{ + // default preparation + return DoPreparePrinting(pInfo); +} + +void Cmfc1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) +{ + // TODO: add extra initialization before printing +} + +void Cmfc1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) +{ + // TODO: add cleanup after printing +} + + +// Cmfc1View diagnostics + +#ifdef _DEBUG +void Cmfc1View::AssertValid() const +{ + CView::AssertValid(); +} + +void Cmfc1View::Dump(CDumpContext& dc) const +{ + CView::Dump(dc); +} + +Cmfc1Doc* Cmfc1View::GetDocument() const // non-debug version is inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Cmfc1Doc))); + return (Cmfc1Doc*)m_pDocument; +} +#endif //_DEBUG + + +// Cmfc1View message handlers diff --git a/Tests/MFC/mfc1/mfc1View.h b/Tests/MFC/mfc1/mfc1View.h new file mode 100644 index 0000000..4244653 --- /dev/null +++ b/Tests/MFC/mfc1/mfc1View.h @@ -0,0 +1,48 @@ +// mfc1View.h : interface of the Cmfc1View class +// + + +#pragma once + + +class Cmfc1View : public CView +{ +protected: // create from serialization only + Cmfc1View(); + DECLARE_DYNCREATE(Cmfc1View) + +// Attributes +public: + Cmfc1Doc* GetDocument() const; + +// Operations +public: + +// Overrides + public: + virtual void OnDraw(CDC* pDC); // overridden to draw this view +virtual BOOL PreCreateWindow(CREATESTRUCT& cs); +protected: + virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); + virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); + virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); + +// Implementation +public: + virtual ~Cmfc1View(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + DECLARE_MESSAGE_MAP() +}; + +#ifndef _DEBUG // debug version in mfc1View.cpp +inline Cmfc1Doc* Cmfc1View::GetDocument() const + { return reinterpret_cast<Cmfc1Doc*>(m_pDocument); } +#endif diff --git a/Tests/MFC/mfc1/res/Toolbar.bmp b/Tests/MFC/mfc1/res/Toolbar.bmp Binary files differnew file mode 100644 index 0000000..d501723 --- /dev/null +++ b/Tests/MFC/mfc1/res/Toolbar.bmp diff --git a/Tests/MFC/mfc1/res/mfc1.ico b/Tests/MFC/mfc1/res/mfc1.ico Binary files differnew file mode 100644 index 0000000..8a84ca3 --- /dev/null +++ b/Tests/MFC/mfc1/res/mfc1.ico diff --git a/Tests/MFC/mfc1/res/mfc1.manifest b/Tests/MFC/mfc1/res/mfc1.manifest new file mode 100644 index 0000000..b15d2f2 --- /dev/null +++ b/Tests/MFC/mfc1/res/mfc1.manifest @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> +<assemblyIdentity + version="1.0.0.0" + processorArchitecture="X86" + name="Microsoft.Windows.mfc1" + type="win32" +/> +<description>Your app description here</description> +<dependency> + <dependentAssembly> + <assemblyIdentity + type="win32" + name="Microsoft.Windows.Common-Controls" + version="6.0.0.0" + processorArchitecture="X86" + publicKeyToken="6595b64144ccf1df" + language="*" + /> + </dependentAssembly> +</dependency> +</assembly> diff --git a/Tests/MFC/mfc1/res/mfc1.rc2 b/Tests/MFC/mfc1/res/mfc1.rc2 new file mode 100644 index 0000000..62a3ab0 --- /dev/null +++ b/Tests/MFC/mfc1/res/mfc1.rc2 @@ -0,0 +1,13 @@ +// +// mfc1.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/Tests/MFC/mfc1/res/mfc1Doc.ico b/Tests/MFC/mfc1/res/mfc1Doc.ico Binary files differnew file mode 100644 index 0000000..2a1f1ae --- /dev/null +++ b/Tests/MFC/mfc1/res/mfc1Doc.ico diff --git a/Tests/MFC/mfc1/stdafx.cpp b/Tests/MFC/mfc1/stdafx.cpp new file mode 100644 index 0000000..67fd1b5 --- /dev/null +++ b/Tests/MFC/mfc1/stdafx.cpp @@ -0,0 +1,5 @@ +// stdafx.cpp : source file that includes just the standard includes +// mfc1.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" diff --git a/Tests/MFC/mfc1/stdafx.h b/Tests/MFC/mfc1/stdafx.h new file mode 100644 index 0000000..35a678d --- /dev/null +++ b/Tests/MFC/mfc1/stdafx.h @@ -0,0 +1,56 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +// See http://msdn.microsoft.com/en-us/library/6sehtctf.aspx for more info +// on WINVER and _WIN32_WINNT + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. +#if _MSC_VER < 1600 +#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#else +#define WINVER 0x0501 // Target Windows XP and later with VS 10 and later +#endif +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. +#if _MSC_VER < 1600 +#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#else +#define _WIN32_WINNT 0x0501 // Target Windows XP and later with VS 10 and later +#endif +#endif + +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#if _MSC_VER < 1600 +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. +#if _MSC_VER < 1600 +#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. +#endif +#endif + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include <afxwin.h> // MFC core and standard components +#include <afxext.h> // MFC extensions +#include <afxdisp.h> // MFC Automation classes + +#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in new file mode 100644 index 0000000..c4121ff --- /dev/null +++ b/Utilities/KWIML/ABI.h.in @@ -0,0 +1,461 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +#ifndef @KWIML@_ABI_H +#define @KWIML@_ABI_H +/* +This header defines macros with information about the C ABI. +Only information that can be determined using the preprocessor at +compilation time is available. No try-compile results may be added +here. Instead we memorize results on platforms of interest. + +An includer may optionally define the following macros to suppress errors: + + @KWIML@_ABI_NO_VERIFY = skip verification declarations + @KWIML@_ABI_NO_ERROR_CHAR_SIGN = signedness of 'char' may be unknown + @KWIML@_ABI_NO_ERROR_LONG_LONG = existence of 'long long' may be unknown + @KWIML@_ABI_NO_ERROR_ENDIAN = byte order of CPU may be unknown + +An includer may test the following macros after inclusion: + + @KWIML@_ABI_SIZEOF_DATA_PTR = sizeof(void*) + @KWIML@_ABI_SIZEOF_CODE_PTR = sizeof(void(*)(void)) + @KWIML@_ABI_SIZEOF_FLOAT = sizeof(float) + @KWIML@_ABI_SIZEOF_DOUBLE = sizeof(double) + @KWIML@_ABI_SIZEOF_CHAR = sizeof(char) + @KWIML@_ABI_SIZEOF_SHORT = sizeof(short) + @KWIML@_ABI_SIZEOF_INT = sizeof(int) + @KWIML@_ABI_SIZEOF_LONG = sizeof(long) + + @KWIML@_ABI_SIZEOF_LONG_LONG = sizeof(long long) or 0 if not a type + Undefined if existence is unknown and error suppression macro + @KWIML@_ABI_NO_ERROR_LONG_LONG was defined. + + @KWIML@_ABI_SIZEOF___INT64 = 8 if '__int64' exists or 0 if not + Undefined if existence is unknown. + + @KWIML@_ABI___INT64_IS_LONG = 1 if '__int64' is 'long' (same type) + Undefined otherwise. + @KWIML@_ABI___INT64_IS_LONG_LONG = 1 if '__int64' is 'long long' (same type) + Undefined otherwise. + @KWIML@_ABI___INT64_IS_UNIQUE = 1 if '__int64' is a distinct type + Undefined otherwise. + + @KWIML@_ABI_CHAR_IS_UNSIGNED = 1 if 'char' is unsigned, else undefined + @KWIML@_ABI_CHAR_IS_SIGNED = 1 if 'char' is signed, else undefined + One of these is defined unless signedness of 'char' is unknown and + error suppression macro @KWIML@_ABI_NO_ERROR_CHAR_SIGN was defined. + + @KWIML@_ABI_ENDIAN_ID_BIG = id for big-endian (always defined) + @KWIML@_ABI_ENDIAN_ID_LITTLE = id for little-endian (always defined) + @KWIML@_ABI_ENDIAN_ID = id of byte order of target CPU + Defined to @KWIML@_ABI_ENDIAN_ID_BIG or @KWIML@_ABI_ENDIAN_ID_LITTLE + unless byte order is unknown and error suppression macro + @KWIML@_ABI_NO_ERROR_ENDIAN was defined. + +We verify most results using dummy "extern" declarations that are +invalid if the macros are wrong. Verification is disabled if +suppression macro @KWIML@_ABI_NO_VERIFY was defined. +*/ + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR) +# if defined(__SIZEOF_POINTER__) +# define @KWIML@_ABI_SIZEOF_DATA_PTR __SIZEOF_POINTER__ +# elif defined(_SIZE_PTR) +# define @KWIML@_ABI_SIZEOF_DATA_PTR (_SIZE_PTR >> 3) +# elif defined(_LP64) || defined(__LP64__) +# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 +# elif defined(_ILP32) +# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 +# elif defined(__64BIT__) /* IBM XL */ +# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 +# elif defined(_M_X64) +# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__ia64) +# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__sparcv9) +# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__x86_64) || defined(__x86_64__) +# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__amd64) || defined(__amd64__) +# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__i386) || defined(__i386__) +# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 +# endif +#endif +#if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR) +# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 +#endif +#if !defined(@KWIML@_ABI_SIZEOF_CODE_PTR) +# define @KWIML@_ABI_SIZEOF_CODE_PTR @KWIML@_ABI_SIZEOF_DATA_PTR +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_ABI_SIZEOF_CHAR) +# define @KWIML@_ABI_SIZEOF_CHAR 1 +#endif + +#if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) +# if defined(__CHAR_UNSIGNED__) /* GNU, some IBM XL, others? */ +# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(_CHAR_UNSIGNED) /* Intel, IBM XL, MSVC, Borland, others? */ +# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(_CHAR_SIGNED) /* IBM XL, others? */ +# define @KWIML@_ABI_CHAR_IS_SIGNED 1 +# elif defined(__CHAR_SIGNED__) /* IBM XL, Watcom, others? */ +# define @KWIML@_ABI_CHAR_IS_SIGNED 1 +# elif defined(__SIGNED_CHARS__) /* EDG, Intel, SGI MIPSpro */ +# define @KWIML@_ABI_CHAR_IS_SIGNED 1 +# elif defined(_CHAR_IS_SIGNED) /* Some SunPro, others? */ +# define @KWIML@_ABI_CHAR_IS_SIGNED 1 +# elif defined(_CHAR_IS_UNSIGNED) /* SunPro, others? */ +# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__GNUC__) /* GNU default */ +# define @KWIML@_ABI_CHAR_IS_SIGNED 1 +# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro default */ +# define @KWIML@_ABI_CHAR_IS_SIGNED 1 +# elif defined(__HP_cc) || defined(__HP_aCC) /* HP default (unless +uc) */ +# define @KWIML@_ABI_CHAR_IS_SIGNED 1 +# elif defined(_SGI_COMPILER_VERSION) /* SGI MIPSpro default */ +# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(_MSC_VER) /* MSVC default */ +# define @KWIML@_ABI_CHAR_IS_SIGNED 1 +# elif defined(__WATCOMC__) /* Watcom default */ +# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__BORLANDC__) /* Borland default */ +# define @KWIML@_ABI_CHAR_IS_SIGNED 1 +# endif +#endif +#if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) \ + && !defined(@KWIML@_ABI_NO_ERROR_CHAR_SIGN) +# error "Signedness of 'char' unknown." +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_ABI_SIZEOF_SHORT) +# if defined(__SIZEOF_SHORT__) +# define @KWIML@_ABI_SIZEOF_SHORT __SIZEOF_SHORT__ +# endif +#endif +#if !defined(@KWIML@_ABI_SIZEOF_SHORT) +# define @KWIML@_ABI_SIZEOF_SHORT 2 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_ABI_SIZEOF_INT) +# if defined(__SIZEOF_INT__) +# define @KWIML@_ABI_SIZEOF_INT __SIZEOF_INT__ +# elif defined(_SIZE_INT) +# define @KWIML@_ABI_SIZEOF_INT (_SIZE_INT >> 3) +# endif +#endif +#if !defined(@KWIML@_ABI_SIZEOF_INT) +# define @KWIML@_ABI_SIZEOF_INT 4 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_ABI_SIZEOF_LONG) +# if defined(__SIZEOF_LONG__) +# define @KWIML@_ABI_SIZEOF_LONG __SIZEOF_LONG__ +# elif defined(_SIZE_LONG) +# define @KWIML@_ABI_SIZEOF_LONG (_SIZE_LONG >> 3) +# elif defined(__LONG_MAX__) +# if __LONG_MAX__ == 0x7fffffff +# define @KWIML@_ABI_SIZEOF_LONG 4 +# elif __LONG_MAX__>>32 == 0x7fffffff +# define @KWIML@_ABI_SIZEOF_LONG 8 +# endif +# elif defined(_MSC_VER) /* MSVC and Intel on Windows */ +# define @KWIML@_ABI_SIZEOF_LONG 4 +# endif +#endif +#if !defined(@KWIML@_ABI_SIZEOF_LONG) +# define @KWIML@_ABI_SIZEOF_LONG @KWIML@_ABI_SIZEOF_DATA_PTR +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) +# if defined(__SIZEOF_LONG_LONG__) +# define @KWIML@_ABI_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__ +# elif defined(__LONG_LONG_MAX__) +# if __LONG_LONG_MAX__ == 0x7fffffff +# define @KWIML@_ABI_SIZEOF_LONG_LONG 4 +# elif __LONG_LONG_MAX__>>32 == 0x7fffffff +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# endif +# endif +#endif +#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) +# if defined(_LONGLONG) /* SGI, some GNU, perhaps others. */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# elif defined(_LONG_LONG) /* IBM XL, perhaps others. */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__NO_LONG_LONG) /* EDG */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 +# elif defined(__cplusplus) && __cplusplus > 199711L /* C++0x */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__HP_cc) || defined(__HP_aCC) /* HP */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__WATCOMC__) /* Watcom */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__INTEL_COMPILER) /* Intel */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__BORLANDC__) /* Borland */ +# if __BORLANDC__ >= 0x0560 +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# else +# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 +# endif +# elif defined(_MSC_VER) /* Microsoft */ +# if _MSC_VER >= 1310 +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# else +# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 +# endif +# endif +#endif +#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && !defined(@KWIML@_ABI_NO_ERROR_LONG_LONG) +# error "Existence of 'long long' unknown." +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_ABI_SIZEOF___INT64) +# if defined(__INTEL_COMPILER) +# define @KWIML@_ABI_SIZEOF___INT64 8 +# elif defined(_MSC_VER) +# define @KWIML@_ABI_SIZEOF___INT64 8 +# elif defined(__BORLANDC__) +# define @KWIML@_ABI_SIZEOF___INT64 8 +# else +# define @KWIML@_ABI_SIZEOF___INT64 0 +# endif +#endif + +#if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 +# if @KWIML@_ABI_SIZEOF_LONG == 8 +# define @KWIML@_ABI___INT64_IS_LONG 1 +# elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 +# define @KWIML@_ABI___INT64_IS_LONG_LONG 1 +# else +# define @KWIML@_ABI___INT64_IS_UNIQUE 1 +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_ABI_SIZEOF_FLOAT) +# if defined(__SIZEOF_FLOAT__) +# define @KWIML@_ABI_SIZEOF_FLOAT __SIZEOF_FLOAT__ +# endif +#endif +#if !defined(@KWIML@_ABI_SIZEOF_FLOAT) +# define @KWIML@_ABI_SIZEOF_FLOAT 4 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_ABI_SIZEOF_DOUBLE) +# if defined(__SIZEOF_DOUBLE__) +# define @KWIML@_ABI_SIZEOF_DOUBLE __SIZEOF_DOUBLE__ +# endif +#endif +#if !defined(@KWIML@_ABI_SIZEOF_DOUBLE) +# define @KWIML@_ABI_SIZEOF_DOUBLE 8 +#endif + +/*--------------------------------------------------------------------------*/ +/* Identify possible endian cases. The macro @KWIML@_ABI_ENDIAN_ID will be + defined to one of these, or undefined if unknown. */ +#if !defined(@KWIML@_ABI_ENDIAN_ID_BIG) +# define @KWIML@_ABI_ENDIAN_ID_BIG 4321 +#endif +#if !defined(@KWIML@_ABI_ENDIAN_ID_LITTLE) +# define @KWIML@_ABI_ENDIAN_ID_LITTLE 1234 +#endif +#if @KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE +# error "@KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE" +#endif + +#if defined(@KWIML@_ABI_ENDIAN_ID) /* Skip #elif cases if already defined. */ + +/* Use dedicated symbols if the compiler defines them. Do this first + because some architectures allow runtime byte order selection by + the operating system (values for such architectures below are + guesses for compilers that do not define a dedicated symbol). + Ensure that only one is defined in case the platform or a header + defines both as possible values for some third symbol. */ +#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG +#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE +#elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG +#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE + +/* Alpha */ +#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE + +/* Arm */ +#elif defined(__arm__) +# if !defined(__ARMEB__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE +# else +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG +# endif + +/* Intel x86 */ +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE +#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE +#elif defined(__MWERKS__) && defined(__INTEL__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE + +/* Intel x86-64 */ +#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE +#elif defined(__amd64) || defined(__amd64__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE + +/* Intel Architecture-64 (Itanium) */ +#elif defined(__ia64) || defined(__ia64__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE +#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE + +/* PowerPC */ +#elif defined(__powerpc) || defined(__powerpc__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG +#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* SPARC */ +#elif defined(__sparc) || defined(__sparc__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* HP/PA RISC */ +#elif defined(__hppa) || defined(__hppa__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* Motorola 68k */ +#elif defined(__m68k__) || defined(M68000) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* MIPS */ +#elif defined(__mips) || defined(__mips__) || defined(__MIPS__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* RS/6000 */ +#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG +#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* System/370 */ +#elif defined(__370__) || defined(__THW_370__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* System/390 */ +#elif defined(__s390__) || defined(__s390x__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* z/Architecture */ +#elif defined(__SYSC_ZARCH__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* Unknown CPU */ +#elif !defined(@KWIML@_ABI_NO_ERROR_ENDIAN) +# error "Byte order of target CPU unknown." +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_ABI_NO_VERIFY) +#define @KWIML@_ABI__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y] +#define @KWIML@_ABI__VERIFY2(n, x, y) extern int (*n)(x*); extern int (*n)(y*) +#if defined(__cplusplus) +# define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*); extern char* n(y*) +#else +# define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*) /* TODO: possible? */ +#endif +#define @KWIML@_ABI__VERIFY_BOOL(m, b) @KWIML@_ABI__VERIFY(m##__VERIFY__, 2, (b)?2:3) +#define @KWIML@_ABI__VERIFY_SIZE(m, t) @KWIML@_ABI__VERIFY(m##__VERIFY__, m, sizeof(t)) +#define @KWIML@_ABI__VERIFY_SAME(m, x, y) @KWIML@_ABI__VERIFY2(m##__VERIFY__, x, y) +#define @KWIML@_ABI__VERIFY_DIFF(m, x, y) @KWIML@_ABI__VERIFY3(m##__VERIFY__, x, y) + +@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DATA_PTR, int*); +@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CODE_PTR, int(*)(int)); +@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CHAR, char); +@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_SHORT, short); +@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_INT, int); +@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG, long); +#if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0 +@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG_LONG, long long); +#endif +#if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 +@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF___INT64, __int64); +#endif +@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_FLOAT, float); +@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DOUBLE, double); + +#if defined(@KWIML@_ABI___INT64_IS_LONG) +@KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG, __int64, long); +#elif defined(@KWIML@_ABI___INT64_IS_LONG_LONG) +@KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG_LONG, __int64, long long); +#elif defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 +@KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG, __int64, long); +# if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0 +@KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG_LONG, __int64, long long); +# endif +#endif + +#if defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) +@KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0); +#elif defined(@KWIML@_ABI_CHAR_IS_SIGNED) +@KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_SIGNED, (char)0x80 < 0); +#endif + +#undef @KWIML@_ABI__VERIFY_DIFF +#undef @KWIML@_ABI__VERIFY_SAME +#undef @KWIML@_ABI__VERIFY_SIZE +#undef @KWIML@_ABI__VERIFY_BOOL +#undef @KWIML@_ABI__VERIFY3 +#undef @KWIML@_ABI__VERIFY2 +#undef @KWIML@_ABI__VERIFY + +#endif + +#endif diff --git a/Utilities/KWIML/CMakeLists.txt b/Utilities/KWIML/CMakeLists.txt new file mode 100644 index 0000000..6a8641a --- /dev/null +++ b/Utilities/KWIML/CMakeLists.txt @@ -0,0 +1,79 @@ +#============================================================================= +# Kitware Information Macro Library +# Copyright 2010-2011 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# Import the KWIML directory tree into a subdirectory under a parent +# project and configure the library as follows: +# +# SET(KWIML myIML) +# SUBDIRS(KWIML) +# +# Optional settings are as follows: +# +# KWIML_HEADER_ROOT = build tree directory to hold KWIML headers. +# Headers will go in a directory called "${KWIML}" under this root. +# For example: +# +# SET(KWIML_HEADER_ROOT ${PROJECT_BINARY_DIR}) +# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) +# +# KWIML_INSTALL_INCLUDE_DIR = install KWIML with "make install" +# Specify a value relative to the install prefix and do NOT start with '/'. +# KWIML_INSTALL_INCLUDE_OPTIONS = extra header installation options +# Specify options for the install(FILES) command. +# +# KWIML_LABELS_TEST = list of labels for KWIML tests + +cmake_minimum_required(VERSION 2.6.3 FATAL_ERROR) + +#----------------------------------------------------------------------------- +if(NOT DEFINED KWIML) + if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + message(FATAL_ERROR "Set KWIML namespace in parent directory!") + endif() + set(KWIML KWIML) + set(KWIML_STANDALONE 1) + project(KWIML) + include(CTest) + mark_as_advanced(BUILD_TESTING) +endif() + +#----------------------------------------------------------------------------- +get_property(KWIML_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(lang ${KWIML_LANGUAGES}) + set(KWIML_LANGUAGE_${lang} 1) +endforeach() +if(NOT KWIML_LANGUAGE_C AND NOT KWIML_LANGUAGE_CXX) + set(BUILD_TESTING OFF) +endif() + +#----------------------------------------------------------------------------- +if(NOT KWIML_HEADER_ROOT) + set(KWIML_HEADER_ROOT "${PROJECT_BINARY_DIR}") +endif() +set(KWIML_HEADER_DIR "${KWIML_HEADER_ROOT}/${KWIML}") +include_directories(${KWIML_HEADER_ROOT}) + +#----------------------------------------------------------------------------- +foreach(h ABI INT) + set(header ${KWIML_HEADER_DIR}/${h}.h) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${h}.h.in ${header} @ONLY) + if(KWIML_INSTALL_INCLUDE_DIR) + install(FILES ${header} + DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/${KWIML} + ${KWIML_INSTALL_INCLUDE_OPTIONS}) + endif() +endforeach() + +#----------------------------------------------------------------------------- +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/Utilities/KWIML/Copyright.txt b/Utilities/KWIML/Copyright.txt new file mode 100644 index 0000000..c1e5ebc --- /dev/null +++ b/Utilities/KWIML/Copyright.txt @@ -0,0 +1,30 @@ +Kitware Information Macro Library +Copyright 2010-2011 Kitware, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Utilities/KWIML/INT.h.in b/Utilities/KWIML/INT.h.in new file mode 100644 index 0000000..3c1f05d --- /dev/null +++ b/Utilities/KWIML/INT.h.in @@ -0,0 +1,736 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +#ifndef @KWIML@_INT_H +#define @KWIML@_INT_H +/* +This header defines macros with information about sized integer types. +Only information that can be determined using the preprocessor at +compilation time is available. No try-compile results may be added +here. Instead we memorize results on platforms of interest. + +An includer may optionally define the following macros to suppress errors: + +Input: + @KWIML@_INT_NO_VERIFY = skip verification declarations + @KWIML@_INT_NO_ERROR_INT64_T = type '@KWIML@_INT_int64_t' is optional (*) + @KWIML@_INT_NO_ERROR_UINT64_T = type '@KWIML@_INT_uint64_t' is optional (*) + @KWIML@_INT_NO_ERROR_INTPTR_T = type '@KWIML@_INT_intptr_t' is optional (*) + @KWIML@_INT_NO_ERROR_UINTPTR_T = type '@KWIML@_INT_uintptr_t' is optional (*) + +An includer may optionally define the following macros to override defaults. +Either way, an includer may test these macros after inclusion: + + @KWIML@_INT_HAVE_STDINT_H = include <stdint.h> + @KWIML@_INT_NO_STDINT_H = do not include <stdint.h> + @KWIML@_INT_HAVE_INTTYPES_H = include <inttypes.h> + @KWIML@_INT_NO_INTTYPES_H = do not include <inttypes.h> + +An includer may test the following macros after inclusion: + + @KWIML@_INT_HAVE_INT#_T = type 'int#_t' is available + @KWIML@_INT_HAVE_UINT#_T = type 'uint#_t' is available + # = 8, 16, 32, 64, PTR + + @KWIML@_INT_int#_t = signed integer type exactly # bits wide + @KWIML@_INT_uint#_t = unsigned integer type exactly # bits wide + # = 8, 16, 32, 64 (*), ptr (*) + + @KWIML@_INT_NO_INT64_T = type '@KWIML@_INT_int64_t' not available + @KWIML@_INT_NO_UINT64_T = type '@KWIML@_INT_uint64_t' not available + @KWIML@_INT_NO_INTPTR_T = type '@KWIML@_INT_intptr_t' not available + @KWIML@_INT_NO_UINTPTR_T = type '@KWIML@_INT_uintptr_t' not available + + @KWIML@_INT_INT#_C(c) = signed integer constant at least # bits wide + @KWIML@_INT_UINT#_C(c) = unsigned integer constant at least # bits wide + # = 8, 16, 32, 64 (*) + + @KWIML@_INT_<fmt># = print or scan format, <fmt> in table below + # = 8, 16, 32, 64, PTR (*) + + signed unsigned + ----------- ------------------------------ + | decimal | decimal octal hexadecimal | + print | PRId PRIi | PRIu PRIo PRIx PRIX | + scan | SCNd SCNi | SCNu SCNo SCNx | + ----------- ------------------------------ + + The SCN*8 and SCN*64 format macros will not be defined on systems + with scanf implementations known not to support them. + + @KWIML@_INT_BROKEN_INT64_C = macro INT64_C is incorrect if defined + @KWIML@_INT_BROKEN_UINT64_C = macro UINT64_C is incorrect if defined + Some compilers define integer constant macros incorrectly and + cannot handle literals as large as the integer type. + + @KWIML@_INT_BROKEN_INT8_T = type 'int8_t' is available but incorrect + Some compilers have a flag to make 'char' (un)signed but do not account + for it while defining int8_t in the non-default case. + + The broken cases do not affect correctness of the macros documented above. +*/ + +#include "ABI.h" + +/*--------------------------------------------------------------------------*/ +#if defined(@KWIML@_INT_HAVE_STDINT_H) /* Already defined. */ +#elif defined(@KWIML@_INT_NO_STDINT_H) /* Already defined. */ +#elif defined(HAVE_STDINT_H) /* Optionally provided by includer. */ +# define @KWIML@_INT_HAVE_STDINT_H 1 +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define @KWIML@_INT_HAVE_STDINT_H 1 +#elif defined(_MSC_VER) /* MSVC */ +# if _MSC_VER >= 1600 +# define @KWIML@_INT_HAVE_STDINT_H 1 +# else +# define @KWIML@_INT_NO_STDINT_H 1 +# endif +#elif defined(__BORLANDC__) /* Borland */ +# if __BORLANDC__ >= 0x560 +# define @KWIML@_INT_HAVE_STDINT_H 1 +# else +# define @KWIML@_INT_NO_STDINT_H 1 +# endif +#elif defined(__WATCOMC__) /* Watcom */ +# define @KWIML@_INT_NO_STDINT_H 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(@KWIML@_INT_HAVE_INTTYPES_H) /* Already defined. */ +#elif defined(@KWIML@_INT_NO_INTTYPES_H) /* Already defined. */ +#elif defined(HAVE_INTTYPES_H) /* Optionally provided by includer. */ +# define @KWIML@_INT_HAVE_INTTYPES_H 1 +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define @KWIML@_INT_HAVE_INTTYPES_H 1 +#elif defined(_MSC_VER) /* MSVC */ +# define @KWIML@_INT_NO_INTTYPES_H 1 +#elif defined(__BORLANDC__) /* Borland */ +# define @KWIML@_INT_NO_INTTYPES_H 1 +#elif defined(__WATCOMC__) /* Watcom */ +# define @KWIML@_INT_NO_INTTYPES_H 1 +#else /* Assume it exists. */ +# define @KWIML@_INT_HAVE_INTTYPES_H 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(@KWIML@_INT_HAVE_STDINT_H) && defined(@KWIML@_INT_NO_STDINT_H) +# error "Both @KWIML@_INT_HAVE_STDINT_H and @KWIML@_INT_NO_STDINT_H defined!" +#endif +#if defined(@KWIML@_INT_HAVE_INTTYPES_H) && defined(@KWIML@_INT_NO_INTTYPES_H) +# error "Both @KWIML@_INT_HAVE_INTTYPES_H and @KWIML@_INT_NO_INTTYPES_H defined!" +#endif + +#if defined(@KWIML@_INT_HAVE_STDINT_H) +# include <stdint.h> +#endif +#if defined(@KWIML@_INT_HAVE_INTTYPES_H) +# if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) +# define __STDC_FORMAT_MACROS +# endif +# include <inttypes.h> +#endif + +#if defined(@KWIML@_INT_HAVE_STDINT_H) || defined(@KWIML@_INT_HAVE_INTTYPES_H) +#define @KWIML@_INT_HAVE_INT8_T 1 +#define @KWIML@_INT_HAVE_UINT8_T 1 +#define @KWIML@_INT_HAVE_INT16_T 1 +#define @KWIML@_INT_HAVE_UINT16_T 1 +#define @KWIML@_INT_HAVE_INT32_T 1 +#define @KWIML@_INT_HAVE_UINT32_T 1 +#define @KWIML@_INT_HAVE_INT64_T 1 +#define @KWIML@_INT_HAVE_UINT64_T 1 +#define @KWIML@_INT_HAVE_INTPTR_T 1 +#define @KWIML@_INT_HAVE_UINTPTR_T 1 +#endif + +#if (defined(__SUNPRO_C)||defined(__SUNPRO_CC)) && defined(_CHAR_IS_UNSIGNED) +# define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */ +#elif defined(__BORLANDC__) && defined(_CHAR_UNSIGNED) +# define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */ +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(@KWIML@_INT_HAVE_INT8_T) && !defined(@KWIML@_INT_BROKEN_INT8_T) +# define @KWIML@_INT_int8_t int8_t +#else +# define @KWIML@_INT_int8_t signed char +#endif +#if defined(@KWIML@_INT_HAVE_UINT8_T) +# define @KWIML@_INT_uint8_t uint8_t +#else +# define @KWIML@_INT_uint8_t unsigned char +#endif + +#if defined(__INTEL_COMPILER) +# if defined(_WIN32) +# define @KWIML@_INT__NO_SCN8 +# endif +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# define @KWIML@_INT__NO_SCN8 +#elif defined(__HP_cc) || defined(__HP_aCC) +# define @KWIML@_INT__NO_SCN8 +#elif defined(__BORLANDC__) +# define @KWIML@_INT__NO_SCN8 +# define @KWIML@_INT__NO_SCN64 +#elif defined(_MSC_VER) +# define @KWIML@_INT__NO_SCN8 +#elif defined(__WATCOMC__) +# define @KWIML@_INT__NO_SCN8 +#endif + +/* 8-bit d, i */ +#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRId8) +# define @KWIML@_INT_PRId8 PRId8 +#else +# define @KWIML@_INT_PRId8 "d" +#endif +#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNd8) +# define @KWIML@_INT_SCNd8 SCNd8 +#elif !defined(@KWIML@_INT__NO_SCN8) +# define @KWIML@_INT_SCNd8 "hhd" +#endif +#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRIi8) +# define @KWIML@_INT_PRIi8 PRIi8 +#else +# define @KWIML@_INT_PRIi8 "i" +#endif +#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNi8) +# define @KWIML@_INT_SCNi8 SCNi8 +#elif !defined(@KWIML@_INT__NO_SCN8) +# define @KWIML@_INT_SCNi8 "hhi" +#endif + +/* 8-bit o, u, x, X */ +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIo8) +# define @KWIML@_INT_PRIo8 PRIo8 +#else +# define @KWIML@_INT_PRIo8 "o" +#endif +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNo8) +# define @KWIML@_INT_SCNo8 SCNo8 +#elif !defined(@KWIML@_INT__NO_SCN8) +# define @KWIML@_INT_SCNo8 "hho" +#endif +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIu8) +# define @KWIML@_INT_PRIu8 PRIu8 +#else +# define @KWIML@_INT_PRIu8 "u" +#endif +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNu8) +# define @KWIML@_INT_SCNu8 SCNu8 +#elif !defined(@KWIML@_INT__NO_SCN8) +# define @KWIML@_INT_SCNu8 "hhu" +#endif +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIx8) +# define @KWIML@_INT_PRIx8 PRIx8 +#else +# define @KWIML@_INT_PRIx8 "x" +#endif +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNx8) +# define @KWIML@_INT_SCNx8 SCNx8 +#elif !defined(@KWIML@_INT__NO_SCN8) +# define @KWIML@_INT_SCNx8 "hhx" +#endif +#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIX8) +# define @KWIML@_INT_PRIX8 PRIX8 +#else +# define @KWIML@_INT_PRIX8 "X" +#endif + +/* 8-bit constants */ +#if defined(INT8_C) +# define @KWIML@_INT_INT8_C(c) INT8_C(c) +#else +# define @KWIML@_INT_INT8_C(c) c +#endif +#if defined(UINT8_C) +# define @KWIML@_INT_UINT8_C(c) UINT8_C(c) +#else +# define @KWIML@_INT_UINT8_C(c) c ## u +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(@KWIML@_INT_HAVE_INT16_T) +# define @KWIML@_INT_int16_t int16_t +#else +# define @KWIML@_INT_int16_t signed short +#endif +#if defined(@KWIML@_INT_HAVE_UINT16_T) +# define @KWIML@_INT_uint16_t uint16_t +#else +# define @KWIML@_INT_uint16_t unsigned short +#endif + +/* 16-bit d, i */ +#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRId16) +# define @KWIML@_INT_PRId16 PRId16 +#else +# define @KWIML@_INT_PRId16 "d" +#endif +#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNd16) +# define @KWIML@_INT_SCNd16 SCNd16 +#else +# define @KWIML@_INT_SCNd16 "hd" +#endif +#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRIi16) +# define @KWIML@_INT_PRIi16 PRIi16 +#else +# define @KWIML@_INT_PRIi16 "i" +#endif +#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNi16) +# define @KWIML@_INT_SCNi16 SCNi16 +#else +# define @KWIML@_INT_SCNi16 "hi" +#endif + +/* 16-bit o, u, x, X */ +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIo16) +# define @KWIML@_INT_PRIo16 PRIo16 +#else +# define @KWIML@_INT_PRIo16 "o" +#endif +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNo16) +# define @KWIML@_INT_SCNo16 SCNo16 +#else +# define @KWIML@_INT_SCNo16 "ho" +#endif +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIu16) +# define @KWIML@_INT_PRIu16 PRIu16 +#else +# define @KWIML@_INT_PRIu16 "u" +#endif +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNu16) +# define @KWIML@_INT_SCNu16 SCNu16 +#else +# define @KWIML@_INT_SCNu16 "hu" +#endif +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIx16) +# define @KWIML@_INT_PRIx16 PRIx16 +#else +# define @KWIML@_INT_PRIx16 "x" +#endif +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNx16) +# define @KWIML@_INT_SCNx16 SCNx16 +#else +# define @KWIML@_INT_SCNx16 "hx" +#endif +#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIX16) +# define @KWIML@_INT_PRIX16 PRIX16 +#else +# define @KWIML@_INT_PRIX16 "X" +#endif + +/* 16-bit constants */ +#if defined(INT16_C) +# define @KWIML@_INT_INT16_C(c) INT16_C(c) +#else +# define @KWIML@_INT_INT16_C(c) c +#endif +#if defined(UINT16_C) +# define @KWIML@_INT_UINT16_C(c) UINT16_C(c) +#else +# define @KWIML@_INT_UINT16_C(c) c ## u +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(@KWIML@_INT_HAVE_INT32_T) +# define @KWIML@_INT_int32_t int32_t +#else +# define @KWIML@_INT_int32_t signed int +#endif +#if defined(@KWIML@_INT_HAVE_UINT32_T) +# define @KWIML@_INT_uint32_t uint32_t +#else +# define @KWIML@_INT_uint32_t unsigned int +#endif + +/* 32-bit d, i */ +#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRId32) +# define @KWIML@_INT_PRId32 PRId32 +#else +# define @KWIML@_INT_PRId32 "d" +#endif +#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNd32) +# define @KWIML@_INT_SCNd32 SCNd32 +#else +# define @KWIML@_INT_SCNd32 "d" +#endif +#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRIi32) +# define @KWIML@_INT_PRIi32 PRIi32 +#else +# define @KWIML@_INT_PRIi32 "i" +#endif +#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNi32) +# define @KWIML@_INT_SCNi32 SCNi32 +#else +# define @KWIML@_INT_SCNi32 "i" +#endif + +/* 32-bit o, u, x, X */ +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIo32) +# define @KWIML@_INT_PRIo32 PRIo32 +#else +# define @KWIML@_INT_PRIo32 "o" +#endif +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNo32) +# define @KWIML@_INT_SCNo32 SCNo32 +#else +# define @KWIML@_INT_SCNo32 "o" +#endif +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIu32) +# define @KWIML@_INT_PRIu32 PRIu32 +#else +# define @KWIML@_INT_PRIu32 "u" +#endif +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNu32) +# define @KWIML@_INT_SCNu32 SCNu32 +#else +# define @KWIML@_INT_SCNu32 "u" +#endif +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIx32) +# define @KWIML@_INT_PRIx32 PRIx32 +#else +# define @KWIML@_INT_PRIx32 "x" +#endif +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNx32) +# define @KWIML@_INT_SCNx32 SCNx32 +#else +# define @KWIML@_INT_SCNx32 "x" +#endif +#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIX32) +# define @KWIML@_INT_PRIX32 PRIX32 +#else +# define @KWIML@_INT_PRIX32 "X" +#endif + +/* 32-bit constants */ +#if defined(INT32_C) +# define @KWIML@_INT_INT32_C(c) INT32_C(c) +#else +# define @KWIML@_INT_INT32_C(c) c +#endif +#if defined(UINT32_C) +# define @KWIML@_INT_UINT32_C(c) UINT32_C(c) +#else +# define @KWIML@_INT_UINT32_C(c) c ## u +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(@KWIML@_INT_HAVE_INT64_T) +# define @KWIML@_INT_int64_t int64_t +#elif @KWIML@_ABI_SIZEOF_LONG == 8 +# define @KWIML@_INT_int64_t signed long +#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 +# define @KWIML@_INT_int64_t signed long long +#elif defined(@KWIML@_ABI_SIZEOF___INT64) +# define @KWIML@_INT_int64_t signed __int64 +#elif defined(@KWIML@_INT_NO_ERROR_INT64_T) +# define @KWIML@_INT_NO_INT64_T +#else +# error "No type known for 'int64_t'." +#endif +#if defined(@KWIML@_INT_HAVE_UINT64_T) +# define @KWIML@_INT_uint64_t uint64_t +#elif @KWIML@_ABI_SIZEOF_LONG == 8 +# define @KWIML@_INT_uint64_t unsigned long +#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 +# define @KWIML@_INT_uint64_t unsigned long long +#elif defined(@KWIML@_ABI_SIZEOF___INT64) +# define @KWIML@_INT_uint64_t unsigned __int64 +#elif defined(@KWIML@_INT_NO_ERROR_UINT64_T) +# define @KWIML@_INT_NO_UINT64_T +#else +# error "No type known for 'uint64_t'." +#endif + +#if defined(__INTEL_COMPILER) +#elif defined(__BORLANDC__) +# define @KWIML@_INT__NO_FMTLL /* type 'long long' but not 'll' format */ +# define @KWIML@_INT_BROKEN_INT64_C /* system macro defined incorrectly */ +# define @KWIML@_INT_BROKEN_UINT64_C /* system macro defined incorrectly */ +#elif defined(_MSC_VER) && _MSC_VER < 1400 +# define @KWIML@_INT__NO_FMTLL /* type 'long long' but not 'll' format */ +#endif + +#if @KWIML@_ABI_SIZEOF_LONG == 8 +# define @KWIML@_INT__FMT64 "l" +#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 +# if !defined(@KWIML@_INT__NO_FMTLL) +# define @KWIML@_INT__FMT64 "ll" +# else +# define @KWIML@_INT__FMT64 "I64" +# endif +#elif defined(@KWIML@_ABI_SIZEOF___INT64) +# if defined(__BORLANDC__) +# define @KWIML@_INT__FMT64 "L" +# else +# define @KWIML@_INT__FMT64 "I64" +# endif +#endif + +/* 64-bit d, i */ +#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRId64) +# define @KWIML@_INT_PRId64 PRId64 +#elif defined(@KWIML@_INT__FMT64) +# define @KWIML@_INT_PRId64 @KWIML@_INT__FMT64 "d" +#endif +#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNd64) +# define @KWIML@_INT_SCNd64 SCNd64 +#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) +# define @KWIML@_INT_SCNd64 @KWIML@_INT__FMT64 "d" +#endif +#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRIi64) +# define @KWIML@_INT_PRIi64 PRIi64 +#elif defined(@KWIML@_INT__FMT64) +# define @KWIML@_INT_PRIi64 @KWIML@_INT__FMT64 "d" +#endif +#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNi64) +# define @KWIML@_INT_SCNi64 SCNi64 +#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) +# define @KWIML@_INT_SCNi64 @KWIML@_INT__FMT64 "d" +#endif + +/* 64-bit o, u, x, X */ +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIo64) +# define @KWIML@_INT_PRIo64 PRIo64 +#elif defined(@KWIML@_INT__FMT64) +# define @KWIML@_INT_PRIo64 @KWIML@_INT__FMT64 "o" +#endif +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNo64) +# define @KWIML@_INT_SCNo64 SCNo64 +#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) +# define @KWIML@_INT_SCNo64 @KWIML@_INT__FMT64 "o" +#endif +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIu64) +# define @KWIML@_INT_PRIu64 PRIu64 +#elif defined(@KWIML@_INT__FMT64) +# define @KWIML@_INT_PRIu64 @KWIML@_INT__FMT64 "u" +#endif +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNu64) +# define @KWIML@_INT_SCNu64 SCNu64 +#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) +# define @KWIML@_INT_SCNu64 @KWIML@_INT__FMT64 "u" +#endif +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIx64) +# define @KWIML@_INT_PRIx64 PRIx64 +#elif defined(@KWIML@_INT__FMT64) +# define @KWIML@_INT_PRIx64 @KWIML@_INT__FMT64 "x" +#endif +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNx64) +# define @KWIML@_INT_SCNx64 SCNx64 +#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) +# define @KWIML@_INT_SCNx64 @KWIML@_INT__FMT64 "x" +#endif +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIX64) +# define @KWIML@_INT_PRIX64 PRIX64 +#elif defined(@KWIML@_INT__FMT64) +# define @KWIML@_INT_PRIX64 @KWIML@_INT__FMT64 "X" +#endif + +/* 64-bit constants */ +#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(INT64_C) \ + && !defined(@KWIML@_INT_BROKEN_INT64_C) +# define @KWIML@_INT_INT64_C(c) INT64_C(c) +#elif @KWIML@_ABI_SIZEOF_LONG == 8 +# define @KWIML@_INT_INT64_C(c) c ## l +#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 +# define @KWIML@_INT_INT64_C(c) c ## ll +#elif defined(@KWIML@_ABI_SIZEOF___INT64) +# define @KWIML@_INT_INT64_C(c) c ## i64 +#endif +#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(UINT64_C) \ + && !defined(@KWIML@_INT_BROKEN_UINT64_C) +# define @KWIML@_INT_UINT64_C(c) UINT64_C(c) +#elif @KWIML@_ABI_SIZEOF_LONG == 8 +# define @KWIML@_INT_UINT64_C(c) c ## ul +#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 +# define @KWIML@_INT_UINT64_C(c) c ## ull +#elif defined(@KWIML@_ABI_SIZEOF___INT64) +# define @KWIML@_INT_UINT64_C(c) c ## ui64 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(@KWIML@_INT_HAVE_INTPTR_T) +# define @KWIML@_INT_intptr_t intptr_t +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_intptr_t @KWIML@_INT_int32_t +#elif !defined(@KWIML@_INT_NO_INT64_T) +# define @KWIML@_INT_intptr_t @KWIML@_INT_int64_t +#elif defined(@KWIML@_INT_NO_ERROR_INTPTR_T) +# define @KWIML@_INT_NO_INTPTR_T +#else +# error "No type known for 'intptr_t'." +#endif +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) +# define @KWIML@_INT_uintptr_t uintptr_t +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_uintptr_t @KWIML@_INT_uint32_t +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_uintptr_t @KWIML@_INT_uint64_t +#elif defined(@KWIML@_INT_NO_ERROR_UINTPTR_T) +# define @KWIML@_INT_NO_UINTPTR_T +#else +# error "No type known for 'uintptr_t'." +#endif + +#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIdPTR) +# define @KWIML@_INT_PRIdPTR PRIdPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId64 +#endif +#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNdPTR) +# define @KWIML@_INT_SCNdPTR SCNdPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd64 +#endif +#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIiPTR) +# define @KWIML@_INT_PRIiPTR PRIiPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi64 +#endif +#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNiPTR) +# define @KWIML@_INT_SCNiPTR SCNiPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi64 +#endif + +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIoPTR) +# define @KWIML@_INT_PRIoPTR PRIoPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo64 +#endif +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNoPTR) +# define @KWIML@_INT_SCNoPTR SCNoPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo64 +#endif +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIuPTR) +# define @KWIML@_INT_PRIuPTR PRIuPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu64 +#endif +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNuPTR) +# define @KWIML@_INT_SCNuPTR SCNuPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu64 +#endif +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIxPTR) +# define @KWIML@_INT_PRIxPTR PRIxPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx64 +#endif +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNxPTR) +# define @KWIML@_INT_SCNxPTR SCNxPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx64 +#endif +#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIXPTR) +# define @KWIML@_INT_PRIXPTR PRIXPTR +#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +# define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX32 +#elif !defined(@KWIML@_INT_NO_UINT64_T) +# define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX64 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(@KWIML@_INT_NO_VERIFY) +#define @KWIML@_INT__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y] +#define @KWIML@_INT__VERIFY_BOOL(m, b) @KWIML@_INT__VERIFY(m##__VERIFY__, 2, (b)?2:3) +#define @KWIML@_INT__VERIFY_TYPE(t, s) @KWIML@_INT__VERIFY(t##__VERIFY__, s, sizeof(t)) +#define @KWIML@_INT__VERIFY_SIGN(t, u, o) @KWIML@_INT__VERIFY_BOOL(t##__SIGN, (t)((u)1 << ((sizeof(t)<<3)-1)) o 0) + +@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int8_t, 1); +@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint8_t, 1); +@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int16_t, 2); +@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint16_t, 2); +@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int32_t, 4); +@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint32_t, 4); +#if !defined(@KWIML@_INT_NO_INT64_T) +@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int64_t, 8); +#endif +#if !defined(@KWIML@_INT_NO_UINT64_T) +@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint64_t, 8); +#endif +#if !defined(@KWIML@_INT_NO_INTPTR_T) +@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_intptr_t, sizeof(void*)); +#endif +#if !defined(@KWIML@_INT_NO_UINTPTR_T) +@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uintptr_t, sizeof(void*)); +#endif + +@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int8_t, @KWIML@_INT_uint8_t, <); +@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint8_t, @KWIML@_INT_uint8_t, >); +@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int16_t, @KWIML@_INT_uint16_t, <); +@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint16_t, @KWIML@_INT_uint16_t, >); +@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int32_t, @KWIML@_INT_uint32_t, <); +@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint32_t, @KWIML@_INT_uint32_t, >); +#if !defined(@KWIML@_INT_NO_INT64_T) +@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int64_t, @KWIML@_INT_uint64_t, <); +#endif +#if !defined(@KWIML@_INT_NO_UINT64_T) +@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint64_t, @KWIML@_INT_uint64_t, >); +#endif +#if !defined(@KWIML@_INT_NO_INTPTR_T) +@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_intptr_t, @KWIML@_INT_uintptr_t, <); +#endif +#if !defined(@KWIML@_INT_NO_UINTPTR_T) +@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uintptr_t, @KWIML@_INT_uintptr_t, >); +#endif + +#undef @KWIML@_INT__VERIFY_SIGN +#undef @KWIML@_INT__VERIFY_TYPE +#undef @KWIML@_INT__VERIFY_BOOL +#undef @KWIML@_INT__VERIFY + +#endif + +#endif diff --git a/Utilities/KWIML/README.txt b/Utilities/KWIML/README.txt new file mode 100644 index 0000000..6bdf859 --- /dev/null +++ b/Utilities/KWIML/README.txt @@ -0,0 +1,29 @@ +KWIML - The Kitware Information Macro Library + +KWIML provides header files that use preprocessor tests to detect and +provide information about the compiler and its target architecture. The +headers contain no configuration-time test results and thus may be +installed into an architecture-independent include directory. This +makes them suitable for use in the public interface of any package. + +This source tree is intended for distribution inside the source trees of +other packages. In order to avoid name collisions among multiple +packages the KWIML headers are configured with a per-package prefix on +both the header locations and the macros they define. See comments in +CMakeLists.txt for instructions to include KWIML inside another project. + +The entire KWIML source tree is distributed under the OSI-approved +3-clause BSD License. Files used only for build and test purposes +contain a copyright notice and reference Copyright.txt for details. +Headers meant for installation and distribution outside the source tree +come with full inlined copies of the copyright notice and license text. +This makes them suitable for distribution with any package under +compatible license terms. + +The following components are provided. See header comments for details: + + ABI.h = Fundamental type size and representation + INT.h = Fixed-size integer types and format specifiers + +The "test" subdirectory builds tests that verify correctness of the +information provided by each header. diff --git a/Utilities/KWIML/test/CMakeLists.txt b/Utilities/KWIML/test/CMakeLists.txt new file mode 100644 index 0000000..febc994 --- /dev/null +++ b/Utilities/KWIML/test/CMakeLists.txt @@ -0,0 +1,68 @@ +#============================================================================= +# Kitware Information Macro Library +# Copyright 2010-2011 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +set(test_defs KWIML_NAMESPACE=${KWIML}) + +# Tell CMake how to follow dependencies of sources in this directory. +set_property(DIRECTORY + PROPERTY IMPLICIT_DEPENDS_INCLUDE_TRANSFORM + "KWIML_HEADER(%)=<${KWIML}/%>" + ) + +# Suppress printf/scanf format warnings; we test if the sizes match. +foreach(lang C CXX) + if(KWIML_LANGUAGE_${lang} AND "${CMAKE_${lang}_COMPILER_ID}" STREQUAL GNU) + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format") + endif() +endforeach() + +if(KWIML_LANGUAGE_C) + set(test_srcs test.c) +else() + set(test_srcs test.cxx) +endif() +if(KWIML_LANGUAGE_C) + list(APPEND test_defs KWIML_LANGUAGE_C) + list(APPEND test_srcs + test_ABI_C.c + test_INT_C.c + ) +endif() +if(KWIML_LANGUAGE_CXX) + list(APPEND test_defs KWIML_LANGUAGE_CXX) + list(APPEND test_srcs + test_ABI_CXX.cxx + test_INT_CXX.cxx + ) +endif() + +foreach(th test_ABI_endian test_INT_format) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${th}.h.in + ${CMAKE_CURRENT_BINARY_DIR}/${th}.h @ONLY) +endforeach() +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) +add_executable(${KWIML}_test ${test_srcs}) +set_property(TARGET ${KWIML}_test PROPERTY COMPILE_DEFINITIONS ${test_defs}) +set_property(TARGET ${KWIML}_test PROPERTY + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(${KWIML}.test ${CMAKE_CURRENT_BINARY_DIR}/${KWIML}_test) +set_property(TEST ${KWIML}.test PROPERTY LABELS ${KWIML_LABELS_TEST}) + +# Xcode 2.x forgets to create the output directory before linking +# the individual architectures. +if(CMAKE_OSX_ARCHITECTURES AND XCODE + AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") + add_custom_command( + TARGET ${KWIML}_test + PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" + ) +endif() diff --git a/Utilities/KWIML/test/test.c b/Utilities/KWIML/test/test.c new file mode 100644 index 0000000..d71a284 --- /dev/null +++ b/Utilities/KWIML/test/test.c @@ -0,0 +1,35 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifdef __cplusplus +extern "C" { +#endif +extern int test_ABI_C(void); +extern int test_INT_C(void); +extern int test_ABI_CXX(void); +extern int test_INT_CXX(void); +#ifdef __cplusplus +} // extern "C" +#endif + +int main(void) +{ + int result = 1; +#ifdef KWIML_LANGUAGE_C + result = test_ABI_C() && result; + result = test_INT_C() && result; +#endif +#ifdef KWIML_LANGUAGE_CXX + result = test_ABI_CXX() && result; + result = test_INT_CXX() && result; +#endif + return result? 0 : 1; +} diff --git a/Utilities/KWIML/test/test.cxx b/Utilities/KWIML/test/test.cxx new file mode 100644 index 0000000..bf61421 --- /dev/null +++ b/Utilities/KWIML/test/test.cxx @@ -0,0 +1,12 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "test.c" diff --git a/Utilities/KWIML/test/test.h b/Utilities/KWIML/test/test.h new file mode 100644 index 0000000..b87a0e7 --- /dev/null +++ b/Utilities/KWIML/test/test.h @@ -0,0 +1,37 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef KWIML_NAMESPACE +# error "Do not include test.h outside of KWIML test files." +#endif + +#ifndef KWIML_TEST_H +#define KWIML_TEST_H + +/* + Define KWIML_HEADER macro to help the test files include kwiml + headers from the configured namespace directory. The macro can be + used like this: + + #include KWIML_HEADER(ABI.h) +*/ +#define KWIML_HEADER(x) KWIML_HEADER0(KWIML_NAMESPACE/x) +#define KWIML_HEADER0(x) KWIML_HEADER1(x) +#define KWIML_HEADER1(x) <x> + +/* Quiet MS standard library deprecation warnings. */ +#ifndef _CRT_SECURE_NO_DEPRECATE +# define _CRT_SECURE_NO_DEPRECATE +#endif + +#else +# error "test.h included multiple times." +#endif diff --git a/Utilities/KWIML/test/test_ABI_C.c b/Utilities/KWIML/test/test_ABI_C.c new file mode 100644 index 0000000..3ca4ad3 --- /dev/null +++ b/Utilities/KWIML/test/test_ABI_C.c @@ -0,0 +1,22 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "test.h" +#include KWIML_HEADER(ABI.h) +#include "test_ABI_endian.h" +int test_ABI_C(void) +{ + if(!test_ABI_endian()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_ABI_CXX.cxx b/Utilities/KWIML/test/test_ABI_CXX.cxx new file mode 100644 index 0000000..7ede20e --- /dev/null +++ b/Utilities/KWIML/test/test_ABI_CXX.cxx @@ -0,0 +1,22 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "test.h" +#include KWIML_HEADER(ABI.h) +#include "test_ABI_endian.h" +extern "C" int test_ABI_CXX(void) +{ + if(!test_ABI_endian()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_ABI_endian.h.in b/Utilities/KWIML/test/test_ABI_endian.h.in new file mode 100644 index 0000000..992baea --- /dev/null +++ b/Utilities/KWIML/test/test_ABI_endian.h.in @@ -0,0 +1,47 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include <stdio.h> + +#ifdef __cplusplus +# define LANG "C++ " +#else +# define LANG "C " +#endif + +static int test_ABI_endian(void) +{ + int result = 1; + { +#if defined(@KWIML@_ABI_ENDIAN_ID) + int expect; + union { short s; unsigned char c[sizeof(short)]; } x; + x.s = 1; + expect = (x.c[0] == 1 ? + @KWIML@_ABI_ENDIAN_ID_LITTLE : @KWIML@_ABI_ENDIAN_ID_BIG); + printf(LANG "@KWIML@_ABI_ENDIAN_ID: expected [%d], got [%d]", + expect, @KWIML@_ABI_ENDIAN_ID); + if(@KWIML@_ABI_ENDIAN_ID == expect) + { + printf(", PASSED\n"); + } + else + { + printf(", FAILED\n"); + result = 0; + } +#else + printf(LANG "@KWIML@_ABI_ENDIAN_ID: unknown, FAILED\n"); + result = 0; +#endif + } + return result; +} diff --git a/Utilities/KWIML/test/test_INT_C.c b/Utilities/KWIML/test/test_INT_C.c new file mode 100644 index 0000000..5513a0b --- /dev/null +++ b/Utilities/KWIML/test/test_INT_C.c @@ -0,0 +1,22 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "test.h" +#include KWIML_HEADER(INT.h) +#include "test_INT_format.h" +int test_INT_C(void) +{ + if(!test_INT_format()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_INT_CXX.cxx b/Utilities/KWIML/test/test_INT_CXX.cxx new file mode 100644 index 0000000..9f74e96 --- /dev/null +++ b/Utilities/KWIML/test/test_INT_CXX.cxx @@ -0,0 +1,22 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "test.h" +#include KWIML_HEADER(INT.h) +#include "test_INT_format.h" +extern "C" int test_INT_CXX(void) +{ + if(!test_INT_format()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_INT_format.h.in b/Utilities/KWIML/test/test_INT_format.h.in new file mode 100644 index 0000000..72a62f2 --- /dev/null +++ b/Utilities/KWIML/test/test_INT_format.h.in @@ -0,0 +1,188 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include <stdio.h> +#include <string.h> + +#ifdef __cplusplus +# define LANG "C++ " +#else +# define LANG "C " +#endif + +#define VALUE(T, U) \ + (@KWIML@_INT_##T)((@KWIML@_INT_##U)0xab << \ + ((sizeof(@KWIML@_INT_##T)-1)<<3)) \ + +#define TEST_C(C, V, PRI, T, U) \ + { \ + @KWIML@_INT_##T const x = VALUE(T, U); \ + @KWIML@_INT_##T y = @KWIML@_INT_##C(V); \ + printf(LANG "@KWIML@_INT_" #C ":" \ + " expression [%"@KWIML@_INT_PRI##PRI"]," \ + " literal [%"@KWIML@_INT_PRI##PRI"]", x, y); \ + if(x == y) \ + { \ + printf(", PASSED\n"); \ + } \ + else \ + { \ + printf(", FAILED\n"); \ + result = 0; \ + } \ + } + +#define TEST_PRI(PRI, T, U, STR) \ + { \ + @KWIML@_INT_##T const x = VALUE(T, U); \ + char const* str = STR; \ + sprintf(buf, "%"@KWIML@_INT_PRI##PRI, x); \ + printf(LANG "@KWIML@_INT_PRI" #PRI ":" \ + " expected [%s], got [%s]", str, buf); \ + if(strcmp(str, buf) == 0) \ + { \ + printf(", PASSED\n"); \ + } \ + else \ + { \ + printf(", FAILED\n"); \ + result = 0; \ + } \ + } + +#define TEST_SCN(SCN, T, U, STR) TEST_SCN2(SCN, SCN, T, U, STR) +#define TEST_SCN2(PRI, SCN, T, U, STR) \ + { \ + @KWIML@_INT_##T const x = VALUE(T, U); \ + @KWIML@_INT_##T y; \ + char const* str = STR; \ + if(sscanf(str, "%"@KWIML@_INT_SCN##SCN, &y) != 1) \ + { \ + y = 0; \ + } \ + printf(LANG "@KWIML@_INT_SCN" #SCN ":" \ + " expected [%"@KWIML@_INT_PRI##PRI"]," \ + " got [%"@KWIML@_INT_PRI##PRI"]", x, y); \ + if(x == y) \ + { \ + printf(", PASSED\n"); \ + } \ + else \ + { \ + printf(", FAILED\n"); \ + result = 0; \ + } \ + } + +#define TEST(FMT, T, U, STR) TEST2(FMT, FMT, T, U, STR) +#define TEST2(PRI, SCN, T, U, STR) \ + TEST_PRI(PRI, T, U, STR) \ + TEST_SCN2(PRI, SCN, T, U, STR) + +static int test_INT_format(void) +{ + int result = 1; + char buf[256]; + TEST_PRI(i8, int8_t, uint8_t, "-85") +#if defined(@KWIML@_INT_SCNi8) + TEST_SCN(i8, int8_t, uint8_t, "-85") +#endif + TEST_PRI(d8, int8_t, uint8_t, "-85") +#if defined(@KWIML@_INT_SCNd8) + TEST_SCN(d8, int8_t, uint8_t, "-85") +#endif + TEST_PRI(o8, uint8_t, uint8_t, "253") +#if defined(@KWIML@_INT_SCNo8) + TEST_SCN(o8, uint8_t, uint8_t, "253") +#endif + TEST_PRI(u8, uint8_t, uint8_t, "171") +#if defined(@KWIML@_INT_SCNu8) + TEST_SCN(u8, uint8_t, uint8_t, "171") +#endif + TEST_PRI(x8, uint8_t, uint8_t, "ab") + TEST_PRI(X8, uint8_t, uint8_t, "AB") +#if defined(@KWIML@_INT_SCNx8) + TEST_SCN(x8, uint8_t, uint8_t, "ab") + TEST_SCN2(X8, x8, uint8_t, uint8_t, "AB") +#endif + + TEST(i16, int16_t, uint16_t, "-21760") + TEST(d16, int16_t, uint16_t, "-21760") + TEST(o16, uint16_t, uint16_t, "125400") + TEST(u16, uint16_t, uint16_t, "43776") + TEST(x16, uint16_t, uint16_t, "ab00") + TEST2(X16, x16, uint16_t, uint16_t, "AB00") + + TEST(i32, int32_t, uint32_t, "-1426063360") + TEST(d32, int32_t, uint32_t, "-1426063360") + TEST(o32, uint32_t, uint32_t, "25300000000") + TEST(u32, uint32_t, uint32_t, "2868903936") + TEST(x32, uint32_t, uint32_t, "ab000000") + TEST2(X32, x32, uint32_t, uint32_t, "AB000000") + + TEST_PRI(i64, int64_t, uint64_t, "-6124895493223874560") +#if defined(@KWIML@_INT_SCNi64) + TEST_SCN(i64, int64_t, uint64_t, "-6124895493223874560") +#endif + TEST_PRI(d64, int64_t, uint64_t, "-6124895493223874560") +#if defined(@KWIML@_INT_SCNd64) + TEST_SCN(d64, int64_t, uint64_t, "-6124895493223874560") +#endif + TEST_PRI(o64, uint64_t, uint64_t, "1254000000000000000000") +#if defined(@KWIML@_INT_SCNo64) + TEST_SCN(o64, uint64_t, uint64_t, "1254000000000000000000") +#endif + TEST_PRI(u64, uint64_t, uint64_t, "12321848580485677056") +#if defined(@KWIML@_INT_SCNu64) + TEST_SCN(u64, uint64_t, uint64_t, "12321848580485677056") +#endif + TEST_PRI(x64, uint64_t, uint64_t, "ab00000000000000") + TEST_PRI(X64, uint64_t, uint64_t, "AB00000000000000") +#if defined(@KWIML@_INT_SCNx64) + TEST_SCN(x64, uint64_t, uint64_t, "ab00000000000000") + TEST_SCN2(X64, x64, uint64_t, uint64_t, "AB00000000000000") +#endif + +#if !defined(@KWIML@_INT_NO_INTPTR_T) +# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4 + TEST(iPTR, intptr_t, uint32_t, "-1426063360") + TEST(dPTR, intptr_t, uint32_t, "-1426063360") +# else + TEST(iPTR, intptr_t, uint64_t, "-6124895493223874560") + TEST(dPTR, intptr_t, uint64_t, "-6124895493223874560") +# endif +#endif + +#if !defined(@KWIML@_INT_NO_UINTPTR_T) +# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4 + TEST(oPTR, uintptr_t, uintptr_t, "25300000000") + TEST(uPTR, uintptr_t, uintptr_t, "2868903936") + TEST(xPTR, uintptr_t, uintptr_t, "ab000000") + TEST2(XPTR, xPTR, uintptr_t, uintptr_t, "AB000000") +# else + TEST(oPTR, uintptr_t, uintptr_t, "1254000000000000000000") + TEST(uPTR, uintptr_t, uintptr_t, "12321848580485677056") + TEST(xPTR, uintptr_t, uintptr_t, "ab00000000000000") + TEST2(XPTR, xPTR, uintptr_t, uintptr_t, "AB00000000000000") +# endif +#endif + + TEST_C(INT8_C, -0x55, i8, int8_t, uint8_t) + TEST_C(UINT8_C, 0xAB, u8, uint8_t, uint8_t) + TEST_C(INT16_C, -0x5500, i16, int16_t, uint16_t) + TEST_C(UINT16_C, 0xAB00, u16, uint16_t, uint16_t) + TEST_C(INT32_C, -0x55000000, i32, int32_t, uint32_t) + TEST_C(UINT32_C, 0xAB000000, u32, uint32_t, uint32_t) + TEST_C(INT64_C, -0x5500000000000000, i64, int64_t, uint64_t) + TEST_C(UINT64_C, 0xAB00000000000000, u64, uint64_t, uint64_t) + + return result; +} |