diff options
44 files changed, 1234 insertions, 92 deletions
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index c279d50..61e4bb4 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -115,6 +115,7 @@ All Modules /module/FindHg /module/FindHSPELL /module/FindHTMLHelp + /module/FindIce /module/FindIcotool /module/FindImageMagick /module/FindITK @@ -207,6 +208,7 @@ All Modules /module/FindWish /module/FindwxWidgets /module/FindwxWindows + /module/FindXerces /module/FindX11 /module/FindXMLRPC /module/FindZLIB diff --git a/Help/module/FindIce.rst b/Help/module/FindIce.rst new file mode 100644 index 0000000..3af9405 --- /dev/null +++ b/Help/module/FindIce.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindIce.cmake diff --git a/Help/module/FindXerces.rst b/Help/module/FindXerces.rst new file mode 100644 index 0000000..166d8dd --- /dev/null +++ b/Help/module/FindXerces.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindXerces.cmake diff --git a/Help/release/dev/FindOpenMP-add-Fortran-support.rst b/Help/release/dev/FindOpenMP-add-Fortran-support.rst new file mode 100644 index 0000000..0205718 --- /dev/null +++ b/Help/release/dev/FindOpenMP-add-Fortran-support.rst @@ -0,0 +1,4 @@ +FindOpenMP-add-Fortran-support +------------------------------ + +* The :module:`FindOpenMP` module learned to support Fortran. diff --git a/Help/release/dev/vs-masm.rst b/Help/release/dev/vs-masm.rst new file mode 100644 index 0000000..d7a19d0 --- /dev/null +++ b/Help/release/dev/vs-masm.rst @@ -0,0 +1,5 @@ +vs-masm +------- + +* Visual Studio generators for VS 8 and later learned to support + the ``ASM_MASM`` language. diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake index eb105ab..972883c 100644 --- a/Modules/CMakeASM_MASMInformation.cmake +++ b/Modules/CMakeASM_MASMInformation.cmake @@ -18,7 +18,7 @@ set(ASM_DIALECT "_MASM") set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm) -set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> /c /Fo <OBJECT> <SOURCE>") +set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <FLAGS> /c /Fo <OBJECT> <SOURCE>") include(CMakeASMInformation) set(ASM_DIALECT) diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake index aa7d96a..19b2bbc 100644 --- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake +++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake @@ -28,6 +28,7 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) FAIL_REGEX "option.*not supported" # Intel FAIL_REGEX "invalid argument .*option" # Intel FAIL_REGEX "ignoring option .*argument required" # Intel + FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake index 665a65c..142ef95 100644 --- a/Modules/CMakeDetermineASM_MASMCompiler.cmake +++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake @@ -17,7 +17,8 @@ set(ASM_DIALECT "_MASM") # if we are using the 64bit cl compiler, assume we also want the 64bit assembler -if(CMAKE_CL_64) +if(";${CMAKE_VS_PLATFORM_NAME};${MSVC_C_ARCHITECTURE_ID};${MSVC_CXX_ARCHITECTURE_ID};" + MATCHES ";(Win64|Itanium|x64|IA64);") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64) else() set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml) diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index 01a652b..4c4334f 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -38,7 +38,7 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) - if(NOT DEFINED "${VARIABLE}") + if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") if(NOT CMAKE_REQUIRED_QUIET) diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index 718e667..eff982c 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -44,7 +44,7 @@ # License text for the above reference.) macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) - if(NOT DEFINED "${VARIABLE}") + if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") if(CMAKE_REQUIRED_INCLUDES) set(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") else() diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index 6f50c88..c31f6b6 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -50,7 +50,7 @@ macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) endmacro() macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) - if(NOT DEFINED "${VARIABLE}") + if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) if(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index dbce9f4..218066c 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -26,7 +26,7 @@ # [CVS_MODULE mod] # Module to checkout from CVS repo # [CVS_TAG tag] # Tag to checkout from CVS repo # [SVN_REPOSITORY url] # URL of Subversion repo -# [SVN_REVISION rev] # Revision to checkout from Subversion repo +# [SVN_REVISION -r<rev>] # Revision to checkout from Subversion repo # [SVN_USERNAME john ] # Username for Subversion checkout and update # [SVN_PASSWORD doe ] # Password for Subversion checkout and update # [SVN_TRUST_CERT 1 ] # Trust the Subversion server site certificate diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake new file mode 100644 index 0000000..c437a40 --- /dev/null +++ b/Modules/FindIce.cmake @@ -0,0 +1,396 @@ +#.rst: +# FindIce +# ------- +# +# Find the ZeroC Internet Communication Engine (ICE) programs, +# libraries and datafiles. +# +# This module supports multiple components. +# Components can include any of: ``Freeze``, ``Glacier2``, ``Ice``, +# ``IceBox``, ``IceDB``, ``IceGrid``, ``IcePatch``, ``IceSSL``, +# ``IceStorm``, ``IceUtil``, ``IceXML``, or ``Slice``. +# +# This module reports information about the Ice installation in +# several variables. General variables:: +# +# Ice_VERSION - Ice release version +# Ice_FOUND - true if the main programs and libraries were found +# Ice_LIBRARIES - component libraries to be linked +# Ice_INCLUDE_DIRS - the directories containing the Ice headers +# Ice_SLICE_DIRS - the directories containing the Ice slice interface +# definitions +# +# Ice programs are reported in:: +# +# Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable +# Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable +# Ice_SLICE2FREEZEJ_EXECUTABLE - path to slice2freezej executable +# Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable +# Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable +# Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable +# Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable +# Ice_SLICE2PY_EXECUTABLE - path to slice2py executable +# Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable +# +# Ice component libraries are reported in:: +# +# Ice_<C>_FOUND - ON if component was found +# Ice_<C>_LIBRARIES - libraries for component +# +# Note that ``<C>`` is the uppercased name of the component. +# +# This module reads hints about search results from:: +# +# Ice_HOME - the root of the Ice installation +# +# The environment variable :envvar:`ICE_HOME` may also be used; the +# Ice_HOME variable takes precedence. +# +# The following cache variables may also be set:: +# +# Ice_<P>_EXECUTABLE - the path to executable <P> +# Ice_INCLUDE_DIR - the directory containing the Ice headers +# Ice_SLICE_DIR - the directory containing the Ice slice interface +# definitions +# Ice_<C>_LIBRARY - the library for component <C> +# +# .. note:: +# +# In most cases none of the above variables will require setting, +# unless multiple Ice versions are available and a specific version +# is required. On Windows, the most recent version of Ice will be +# found through the registry. On Unix, the programs, headers and +# libraries will usually be in standard locations, but Ice_SLICE_DIRS +# might not be automatically detected (commonly known locations are +# searched). All the other variables are defaulted using Ice_HOME, +# if set. It's possible to set Ice_HOME and selectively specify +# alternative locations for the other components; this might be +# required for e.g. newer versions of Visual Studio if the +# heuristics are not sufficient to identify the correct programs and +# libraries for the specific Visual Studio version. +# +# Other variables one may set to control this module are:: +# +# Ice_DEBUG - Set to ON to enable debug output from FindIce. + +# Written by Roger Leigh <rleigh@codelibre.net> + +#============================================================================= +# Copyright 2014 University of Dundee +# +# 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. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# The Ice checks are contained in a function due to the large number +# of temporary variables needed. +function(_Ice_FIND) + # Released versions of Ice, including generic short forms + set(ice_versions + 3 + 3.5 + 3.5.1 + 3.5.0 + 3.4 + 3.4.2 + 3.4.1 + 3.4.0 + 3.3 + 3.3.1 + 3.3.0) + + # Set up search paths, taking compiler into account. Search Ice_HOME, + # with ICE_HOME in the environment as a fallback if unset. + if(Ice_HOME) + list(APPEND ice_roots "${Ice_HOME}") + else() + if(NOT "$ENV{ICE_HOME}" STREQUAL "") + file(TO_CMAKE_PATH "$ENV{ICE_HOME}" NATIVE_PATH) + list(APPEND ice_roots "${NATIVE_PATH}") + set(Ice_HOME "${NATIVE_PATH}" + CACHE PATH "Location of the Ice installation" FORCE) + endif() + endif() + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + # 64-bit path suffix + set(_x64 "/x64") + # 64-bit library directory + set(_lib64 "lib64") + endif() + + if(MSVC_VERSION) + # VS 8.0 + if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500) + set(vcver "vc80") + set(vcyear "2005") + # VS 9.0 + elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600) + set(vcver "vc90") + set(vcyear "2008") + # VS 10.0 + elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700) + set(vcver "vc100") + # VS 11.0 + elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800) + set(vcver "vc110") + # VS 12.0 + elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900) + set(vcver "vc120") + # VS 14.0 + elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 2000) + set(vcver "vc140") + endif() + endif() + + # For compatibility with ZeroC Windows builds. + if(vcver) + # Earlier Ice (3.3) builds don't use vcnnn subdirectories, but are harmless to check. + list(APPEND ice_binary_suffixes "bin/${vcver}${_x64}" "bin/${vcver}") + list(APPEND ice_library_suffixes "lib/${vcver}${_x64}" "lib/${vcver}") + endif() + # Generic 64-bit and 32-bit directories + list(APPEND ice_binary_suffixes "bin${_x64}" "bin") + list(APPEND ice_library_suffixes "${_lib64}" "lib${_x64}" "lib") + list(APPEND ice_include_suffixes "include") + list(APPEND ice_slice_suffixes "slice") + + # On Windows, look in the registry for install locations. Different + # versions of Ice install support different compiler versions. + if(vcver) + foreach(ice_version ${ice_versions}) + # Ice 3.3 releases use a Visual Studio year suffix and value is + # enclosed in double quotes, though only the leading quote is + # returned by get_filename_component. + unset(ice_location) + if(vcyear) + get_filename_component(ice_location + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version} for Visual Studio ${vcyear};InstallDir]" + PATH) + if(ice_location AND NOT ("${ice_location}" STREQUAL "/registry" OR "${ice_location}" STREQUAL "/")) + string(REGEX REPLACE "^\"(.*)\"?$" "\\1" ice_location "${ice_location}") + get_filename_component(ice_location "${ice_location}" ABSOLUTE) + else() + unset(ice_location) + endif() + endif() + # Ice 3.4+ releases don't use a suffix + if(NOT ice_location OR "${ice_location}" STREQUAL "/registry") + get_filename_component(ice_location + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version};InstallDir]" + ABSOLUTE) + endif() + + if(ice_location AND NOT "${ice_location}" STREQUAL "/registry") + list(APPEND ice_roots "${ice_location}") + endif() + endforeach() + else() + foreach(ice_version ${ice_versions}) + # Prefer 64-bit variants if present (and using a 64-bit compiler) + list(APPEND ice_roots "/opt/Ice-${ice_version}") + endforeach() + endif() + + set(ice_programs + slice2cpp + slice2cs + slice2freezej + slice2freeze + slice2html + slice2java + slice2php + slice2py + slice2rb) + + # Find all Ice programs + foreach(program ${ice_programs}) + string(TOUPPER "${program}" program_upcase) + set(cache_var "Ice_${program_upcase}_EXECUTABLE") + set(program_var "Ice_${program_upcase}_EXECUTABLE") + find_program("${cache_var}" "${program}" + HINTS ${ice_roots} + PATH_SUFFIXES ${ice_binary_suffixes} + DOC "Ice ${program} executable") + mark_as_advanced(cache_var) + set("${program_var}" "${${cache_var}}" PARENT_SCOPE) + endforeach() + + # Get version. + if(Ice_SLICE2CPP_EXECUTABLE) + # Execute in C locale for safety + set(_Ice_SAVED_LC_ALL "$ENV{LC_ALL}") + set(ENV{LC_ALL} C) + + execute_process(COMMAND ${Ice_SLICE2CPP_EXECUTABLE} --version + ERROR_VARIABLE Ice_VERSION_SLICE2CPP_FULL + ERROR_STRIP_TRAILING_WHITESPACE) + + # restore the previous LC_ALL + set(ENV{LC_ALL} ${_Ice_SAVED_LC_ALL}) + + # Make short version + string(REGEX REPLACE "^(.*)\\.[^.]*$" "\\1" Ice_VERSION_SLICE2CPP_SHORT "${Ice_VERSION_SLICE2CPP_FULL}") + set(Ice_VERSION "${Ice_VERSION_SLICE2CPP_FULL}" PARENT_SCOPE) + endif() + + message(STATUS "Ice version: ${Ice_VERSION_SLICE2CPP_FULL}") + + # The following searches prefer the version found; note reverse + # order due to prepending. + if(NOT MSVC) + list(INSERT ice_roots 0 "/opt/Ice-${Ice_VERSION_SLICE2CPP_SHORT}") + list(INSERT ice_roots 0 "/opt/Ice-${Ice_VERSION_SLICE2CPP_FULL}") + endif() + + # Find include directory + find_path(Ice_INCLUDE_DIR + NAMES "Ice/Ice.h" + HINTS ${ice_roots} + PATH_SUFFIXES ${ice_include_suffixes} + DOC "Ice include directory") + set(Ice_INCLUDE_DIR "${Ice_INCLUDE_DIR}" PARENT_SCOPE) + + # In common use on Linux, MacOS X (homebrew) and FreeBSD; prefer + # version-specific dir + list(APPEND ice_slice_paths + /usr/local/share /usr/share) + list(APPEND ice_slice_suffixes + "Ice-${Ice_VERSION_SLICE2CPP_FULL}/slice" + "Ice-${Ice_VERSION_SLICE2CPP_SHORT}/slice" + Ice) + + # Find slice directory + find_path(Ice_SLICE_DIR + NAMES "Ice/Connection.ice" + HINTS ${ice_roots} + ${ice_slice_paths} + PATH_SUFFIXES ${ice_slice_suffixes} + NO_DEFAULT_PATH + DOC "Ice slice directory") + set(Ice_SLICE_DIR "${Ice_SLICE_DIR}" PARENT_SCOPE) + + # Find all Ice libraries + set(Ice_REQUIRED_LIBS_FOUND ON) + foreach(component ${Ice_FIND_COMPONENTS}) + string(TOUPPER "${component}" component_upcase) + set(component_cache "Ice_${component_upcase}_LIBRARY") + set(component_found "${component_upcase}_FOUND") + find_library("${component_cache}" "${component}" + HINTS ${ice_roots} + PATH_SUFFIXES ${ice_library_suffixes} + DOC "Ice ${component} library") + mark_as_advanced("${component_cache}") + if("${component_cache}") + set("${component_found}" ON) + list(APPEND Ice_LIBRARY "${${component_cache}}") + endif() + mark_as_advanced("${component_found}") + set("${component_cache}" "${${component_cache}}" PARENT_SCOPE) + set("${component_found}" "${${component_found}}" PARENT_SCOPE) + if("${component_found}") + if ("Ice_FIND_REQUIRED_${component}") + list(APPEND Ice_LIBS_FOUND "${component} (required)") + else() + list(APPEND Ice_LIBS_FOUND "${component} (optional)") + endif() + else() + if ("Ice_FIND_REQUIRED_${component}") + set(Ice_REQUIRED_LIBS_FOUND OFF) + list(APPEND Ice_LIBS_NOTFOUND "${component} (required)") + else() + list(APPEND Ice_LIBS_NOTFOUND "${component} (optional)") + endif() + endif() + endforeach() + set(_Ice_REQUIRED_LIBS_FOUND "${Ice_REQUIRED_LIBS_FOUND}" PARENT_SCOPE) + set(Ice_LIBRARY "${Ice_LIBRARY}" PARENT_SCOPE) + + if(Ice_LIBS_FOUND) + message(STATUS "Found the following Ice libraries:") + foreach(found ${Ice_LIBS_FOUND}) + message(STATUS " ${found}") + endforeach() + endif() + if(Ice_LIBS_NOTFOUND) + message(STATUS "The following Ice libraries were not found:") + foreach(notfound ${Ice_LIBS_NOTFOUND}) + message(STATUS " ${notfound}") + endforeach() + endif() + + if(Ice_DEBUG) + message(STATUS "--------FindIce.cmake search debug--------") + message(STATUS "ICE binary path search order: ${ice_roots}") + message(STATUS "ICE include path search order: ${ice_roots}") + message(STATUS "ICE slice path search order: ${ice_roots} ${ice_slice_paths}") + message(STATUS "ICE library path search order: ${ice_roots}") + message(STATUS "----------------") + endif() +endfunction() + +_Ice_FIND() + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ice + FOUND_VAR Ice_FOUND + REQUIRED_VARS Ice_SLICE2CPP_EXECUTABLE + Ice_INCLUDE_DIR + Ice_SLICE_DIR + Ice_LIBRARY + _Ice_REQUIRED_LIBS_FOUND + VERSION_VAR Ice_VERSION + FAIL_MESSAGE "Failed to find all Ice components") + +unset(_Ice_REQUIRED_LIBS_FOUND) + +if(Ice_FOUND) + set(Ice_INCLUDE_DIRS "${Ice_INCLUDE_DIR}") + set(Ice_SLICE_DIRS "${Ice_SLICE_DIR}") + set(Ice_LIBRARIES "${Ice_LIBRARY}") + foreach(_Ice_component ${Ice_FIND_COMPONENTS}) + string(TOUPPER "${_Ice_component}" _Ice_component_upcase) + set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY") + set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES") + set(_Ice_component_found "${_Ice_component_upcase}_FOUND") + if("${_Ice_component_found}") + set("${_Ice_component_lib}" "${${_Ice_component_cache}}") + endif() + unset(_Ice_component_upcase) + unset(_Ice_component_cache) + unset(_Ice_component_lib) + unset(_Ice_component_found) + endforeach() +endif() + +if(Ice_DEBUG) + message(STATUS "--------FindIce.cmake results debug--------") + message(STATUS "Ice_VERSION number: ${Ice_VERSION}") + message(STATUS "Ice_HOME directory: ${Ice_HOME}") + message(STATUS "Ice_INCLUDE_DIR directory: ${Ice_INCLUDE_DIR}") + message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}") + message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}") + message(STATUS "slice2cpp executable: ${Ice_SLICE2CPP_EXECUTABLE}") + message(STATUS "slice2cs executable: ${Ice_SLICE2CS_EXECUTABLE}") + message(STATUS "slice2freezej executable: ${Ice_SLICE2FREEZEJ_EXECUTABLE}") + message(STATUS "slice2freeze executable: ${Ice_SLICE2FREEZE_EXECUTABLE}") + message(STATUS "slice2html executable: ${Ice_SLICE2HTML_EXECUTABLE}") + message(STATUS "slice2java executable: ${Ice_SLICE2JAVA_EXECUTABLE}") + message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}") + message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}") + message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}") + foreach(component ${Ice_FIND_COMPONENTS}) + string(TOUPPER "${component}" component_upcase) + set(component_lib "Ice_${component_upcase}_LIBRARIES") + set(component_found "${component_upcase}_FOUND") + message(STATUS "${component} library found: ${${component_found}}") + message(STATUS "${component} library: ${${component_lib}}") + endforeach() + message(STATUS "----------------") +endif() diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 935a0ca..801b4f8 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -16,6 +16,7 @@ # # OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support # OpenMP_CXX_FLAGS - flags to add to the CXX compiler for OpenMP support +# OpenMP_Fortran_FLAGS - flags to add to the Fortran compiler for OpenMP support # OPENMP_FOUND - true if openmp is detected # # @@ -27,6 +28,7 @@ # Copyright 2009 Kitware, Inc. # Copyright 2008-2009 André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no> # Copyright 2012 Rolf Eike Beer <eike@sf-mail.de> +# Copyright 2014 Nicolas Bock <nicolasbock@gmail.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -106,6 +108,17 @@ int main() { } ") +# same in Fortran +set(OpenMP_Fortran_TEST_SOURCE + " +program test +use omp_lib +integer :: n +n = omp_get_num_threads() +end program test + " + ) + # check c compiler if(CMAKE_C_COMPILER_LOADED) # if these are set then do not try to find them again, @@ -176,6 +189,40 @@ if(CMAKE_CXX_COMPILER_LOADED) unset(OpenMP_CXX_TEST_SOURCE) endif() +# check Fortran compiler +if(CMAKE_Fortran_COMPILER_LOADED) + # if these are set then do not try to find them again, + # by avoiding any try_compiles for the flags + if(OpenMP_Fortran_FLAGS) + unset(OpenMP_Fortran_FLAG_CANDIDATES) + else() + _OPENMP_FLAG_CANDIDATES("Fortran") + include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranSourceCompiles.cmake) + endif() + + foreach(FLAG IN LISTS OpenMP_Fortran_FLAG_CANDIDATES) + set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${FLAG}") + unset(OpenMP_FLAG_DETECTED CACHE) + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Try OpenMP Fortran flag = [${FLAG}]") + endif() + check_fortran_source_compiles("${OpenMP_Fortran_TEST_SOURCE}" OpenMP_FLAG_DETECTED) + set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") + if(OpenMP_FLAG_DETECTED) + set(OpenMP_Fortran_FLAGS_INTERNAL "${FLAG}") + break() + endif() + endforeach() + + set(OpenMP_Fortran_FLAGS "${OpenMP_Fortran_FLAGS_INTERNAL}" + CACHE STRING "Fortran compiler flags for OpenMP parallization") + + list(APPEND _OPENMP_REQUIRED_VARS OpenMP_Fortran_FLAGS) + unset(OpenMP_Fortran_FLAG_CANDIDATES) + unset(OpenMP_Fortran_TEST_SOURCE) +endif() + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) if(_OPENMP_REQUIRED_VARS) diff --git a/Modules/FindXerces.cmake b/Modules/FindXerces.cmake new file mode 100644 index 0000000..325bb6d --- /dev/null +++ b/Modules/FindXerces.cmake @@ -0,0 +1,85 @@ +#.rst: +# FindXerces +# ---------- +# +# Find the Apache Xerces-C++ validating XML parser headers and libraries. +# +# This module reports information about the Xerces installation in +# several variables. General variables:: +# +# Xerces_FOUND - true if the Xerces headers and libraries were found +# Xerces_VERSION - Xerces release version +# Xerces_INCLUDE_DIRS - the directory containing the Xerces headers +# Xerces_LIBRARIES - Xerces libraries to be linked +# +# The following cache variables may also be set:: +# +# Xerces_INCLUDE_DIR - the directory containing the Xerces headers +# Xerces_LIBRARY - the Xerces library + +# Written by Roger Leigh <rleigh@codelibre.net> + +#============================================================================= +# Copyright 2014 University of Dundee +# +# 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. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +function(_Xerces_GET_VERSION version_hdr) + file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XERCES_VERSION_.*") + if(_contents) + string(REGEX REPLACE ".*#define XERCES_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" Xerces_MAJOR "${_contents}") + string(REGEX REPLACE ".*#define XERCES_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" Xerces_MINOR "${_contents}") + string(REGEX REPLACE ".*#define XERCES_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" Xerces_PATCH "${_contents}") + + if(NOT Xerces_MAJOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MAJOR!") + endif() + if(NOT Xerces_MINOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MINOR!") + endif() + if(NOT Xerces_PATCH MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_REVISION!") + endif() + + set(Xerces_VERSION "${Xerces_MAJOR}.${Xerces_MINOR}.${Xerces_PATCH}" PARENT_SCOPE) + else() + message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information") + endif() +endfunction() + +# Find include directory +find_path(Xerces_INCLUDE_DIR + NAMES "xercesc/util/PlatformUtils.hpp" + DOC "Xerces-C++ include directory") +mark_as_advanced(Xerces_INCLUDE_DIR) + +# Find all Xerces libraries +find_library(Xerces_LIBRARY "xerces-c" + DOC "Xerces-C++ libraries") +mark_as_advanced(Xerces_LIBRARY) + +if(Xerces_INCLUDE_DIR) + _Xerces_GET_VERSION("${Xerces_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") +endif() + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xerces + FOUND_VAR Xerces_FOUND + REQUIRED_VARS Xerces_LIBRARY + Xerces_INCLUDE_DIR + Xerces_VERSION + VERSION_VAR Xerces_VERSION + FAIL_MESSAGE "Failed to find Xerces") + +if(Xerces_FOUND) + set(Xerces_INCLUDE_DIRS "${Xerces_INCLUDE_DIR}") + set(Xerces_LIBRARIES "${Xerces_LIBRARY}") +endif() diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 45596a0..7ef06a8 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -229,13 +229,12 @@ else() endif() #===================================================================== +# Determine whether unix or win32 paths should be used #===================================================================== -if(WIN32 AND NOT CYGWIN AND NOT MSYS) +if(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING) set(wxWidgets_FIND_STYLE "win32") else() - if(UNIX OR MSYS) - set(wxWidgets_FIND_STYLE "unix") - endif() + set(wxWidgets_FIND_STYLE "unix") endif() #===================================================================== diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake index f2f260d..b3633a6 100644 --- a/Modules/UsewxWidgets.cmake +++ b/Modules/UsewxWidgets.cmake @@ -88,8 +88,11 @@ if (wxWidgets_FOUND) endif() if (wxWidgets_CXX_FLAGS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}") - MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}") + # Flags are expected to be a string here, not a list. + string(REPLACE ";" " " wxWidgets_CXX_FLAGS_str "${wxWidgets_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS_str}") + MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS_str}") + unset(wxWidgets_CXX_FLAGS_str) endif() # DEPRECATED JW diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7a5d940..8a87fba 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140818) +set(CMake_VERSION_PATCH 20140902) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 3f948b5..3681515 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -620,7 +620,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, "No " << compilerName << " could be found.\n" ; } - else if(strcmp(lang, "RC") != 0) + else if(strcmp(lang, "RC") != 0 && + strcmp(lang, "ASM_MASM") != 0) { if(!cmSystemTools::FileIsFullPath(compilerFile)) { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index c708a08..19aa52c 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -99,7 +99,6 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); this->SystemIsWindowsPhone = false; this->SystemIsWindowsStore = false; - this->MasmEnabled = false; this->MSBuildCommandInitialized = false; } @@ -257,15 +256,6 @@ void cmGlobalVisualStudio10Generator ::EnableLanguage(std::vector<std::string>const & lang, cmMakefile *mf, bool optional) { - for(std::vector<std::string>::const_iterator it = lang.begin(); - it != lang.end(); ++it) - { - if(*it == "ASM_MASM") - { - this->MasmEnabled = true; - } - } - cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 6245b28..11fa954 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -58,9 +58,6 @@ public: /** Is the installed VS an Express edition? */ bool IsExpressEdition() const { return this->ExpressEdition; } - /** Is the Microsoft Assembler enabled? */ - bool IsMasmEnabled() const { return this->MasmEnabled; } - /** The toolset name for the target platform. */ const char* GetPlatformToolset() const; @@ -123,7 +120,6 @@ protected: bool SystemIsWindowsPhone; bool SystemIsWindowsStore; bool ExpressEdition; - bool MasmEnabled; bool UseFolderProperty(); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 3d79357..e312ff1 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -23,6 +23,7 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( { this->IntelProjectVersion = 0; this->DevEnvCommandInitialized = false; + this->MasmEnabled = false; if (platformName.empty()) { diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 390b97c..7e3ed23 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -102,6 +102,9 @@ public: virtual void FindMakeProgram(cmMakefile*); + /** Is the Microsoft Assembler enabled? */ + bool IsMasmEnabled() const { return this->MasmEnabled; } + // Encoding for Visual Studio files virtual std::string Encoding(); @@ -173,6 +176,7 @@ protected: // There is one SLN file per project. std::string CurrentProject; std::string PlatformName; + bool MasmEnabled; private: char* IntelProjectVersion; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 6bfef68..c91730f 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -136,6 +136,14 @@ void cmGlobalVisualStudio8Generator ::EnableLanguage(std::vector<std::string>const & lang, cmMakefile *mf, bool optional) { + for(std::vector<std::string>::const_iterator it = lang.begin(); + it != lang.end(); ++it) + { + if(*it == "ASM_MASM") + { + this->MasmEnabled = true; + } + } this->AddPlatformDefinitions(mf); cmGlobalVisualStudio7Generator::EnableLanguage(lang, mf, optional); } diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index 72bd593..0eb903d 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -203,12 +203,26 @@ void cmIDEOptions::AppendFlag(std::string const& flag, } //---------------------------------------------------------------------------- +void cmIDEOptions::AppendFlag(std::string const& flag, + std::vector<std::string> const& value) +{ + FlagValue& fv = this->FlagMap[flag]; + std::copy(value.begin(), value.end(), std::back_inserter(fv)); +} + +//---------------------------------------------------------------------------- void cmIDEOptions::RemoveFlag(const char* flag) { this->FlagMap.erase(flag); } //---------------------------------------------------------------------------- +bool cmIDEOptions::HasFlag(std::string const& flag) const +{ + return this->FlagMap.find(flag) != this->FlagMap.end(); +} + +//---------------------------------------------------------------------------- const char* cmIDEOptions::GetFlag(const char* flag) { // This method works only for single-valued flags! diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index 9b60f80..7386016 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -31,7 +31,10 @@ public: void AddFlag(const char* flag, const char* value); void AddFlag(const char* flag, std::vector<std::string> const& value); void AppendFlag(std::string const& flag, std::string const& value); + void AppendFlag(std::string const& flag, + std::vector<std::string> const& value); void RemoveFlag(const char* flag); + bool HasFlag(std::string const& flag) const; const char* GetFlag(const char* flag); protected: diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c index bfa388e..af4fc3d 100644 --- a/Source/cmListFileLexer.c +++ b/Source/cmListFileLexer.c @@ -369,8 +369,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 23 -#define YY_END_OF_BUFFER 24 +#define YY_NUM_RULES 24 +#define YY_END_OF_BUFFER 25 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -381,10 +381,10 @@ struct yy_trans_info static yyconst flex_int16_t yy_accept[77] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, - 24, 13, 21, 1, 15, 3, 13, 5, 6, 7, - 22, 22, 16, 18, 19, 20, 10, 11, 8, 12, - 9, 4, 13, 0, 13, 0, 21, 0, 0, 7, - 13, 0, 13, 0, 2, 0, 13, 16, 0, 17, + 25, 13, 22, 1, 16, 3, 13, 5, 6, 7, + 15, 23, 17, 19, 20, 21, 10, 11, 8, 12, + 9, 4, 13, 0, 13, 0, 22, 0, 0, 7, + 13, 0, 13, 0, 2, 0, 13, 17, 0, 18, 10, 8, 4, 0, 14, 0, 0, 0, 0, 14, 0, 0, 14, 0, 0, 0, 2, 14, 0, 0, 0, 0, 0, 0, 0, 0 @@ -523,10 +523,10 @@ static yyconst flex_int16_t yy_chk[253] = } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[24] = +static yyconst flex_int32_t yy_rule_can_match_eol[25] = { 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, - 0, 0, 0, 0, }; +1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, + 0, 0, 0, 0, 0, }; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -615,7 +615,7 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer); -#line 621 "cmListFileLexer.c" +#line 628 "cmListFileLexer.c" #define INITIAL 0 #define STRING 1 @@ -850,7 +850,7 @@ YY_DECL #line 91 "cmListFileLexer.in.l" -#line 858 "cmListFileLexer.c" +#line 865 "cmListFileLexer.c" if ( !yyg->yy_init ) { @@ -1111,75 +1111,84 @@ case 15: YY_RULE_SETUP #line 215 "cmListFileLexer.in.l" { + lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted; + cmListFileLexerSetToken(lexer, yytext, yyleng); + lexer->column += yyleng; + return 1; +} +case 16: +YY_RULE_SETUP +#line 222 "cmListFileLexer.in.l" +{ lexer->token.type = cmListFileLexer_Token_ArgumentQuoted; cmListFileLexerSetToken(lexer, "", 0); lexer->column += yyleng; BEGIN(STRING); } YY_BREAK -case 16: +case 17: YY_RULE_SETUP -#line 222 "cmListFileLexer.in.l" +#line 229 "cmListFileLexer.in.l" { cmListFileLexerAppend(lexer, yytext, yyleng); lexer->column += yyleng; } YY_BREAK -case 17: -/* rule 17 can match eol */ +case 18: +/* rule 18 can match eol */ YY_RULE_SETUP -#line 227 "cmListFileLexer.in.l" +#line 234 "cmListFileLexer.in.l" { /* Continuation: text is not part of string */ ++lexer->line; lexer->column = 1; } YY_BREAK -case 18: -/* rule 18 can match eol */ +case 19: +/* rule 19 can match eol */ YY_RULE_SETUP -#line 233 "cmListFileLexer.in.l" +#line 240 "cmListFileLexer.in.l" { cmListFileLexerAppend(lexer, yytext, yyleng); ++lexer->line; lexer->column = 1; } YY_BREAK -case 19: +case 20: YY_RULE_SETUP -#line 239 "cmListFileLexer.in.l" +#line 246 "cmListFileLexer.in.l" { lexer->column += yyleng; BEGIN(INITIAL); return 1; } -case 20: +case 21: YY_RULE_SETUP -#line 245 "cmListFileLexer.in.l" +#line 252 "cmListFileLexer.in.l" { cmListFileLexerAppend(lexer, yytext, yyleng); lexer->column += yyleng; } YY_BREAK case YY_STATE_EOF(STRING): -#line 250 "cmListFileLexer.in.l" +#line 257 "cmListFileLexer.in.l" { lexer->token.type = cmListFileLexer_Token_BadString; BEGIN(INITIAL); return 1; } -case 21: +case 22: YY_RULE_SETUP -#line 256 "cmListFileLexer.in.l" +#line 263 "cmListFileLexer.in.l" { lexer->token.type = cmListFileLexer_Token_Space; cmListFileLexerSetToken(lexer, yytext, yyleng); lexer->column += yyleng; return 1; } -case 22: +case 23: YY_RULE_SETUP -#line 263 "cmListFileLexer.in.l" +#line 270 "cmListFileLexer.in.l" { lexer->token.type = cmListFileLexer_Token_BadCharacter; cmListFileLexerSetToken(lexer, yytext, yyleng); @@ -1188,18 +1197,18 @@ YY_RULE_SETUP } case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT): -#line 270 "cmListFileLexer.in.l" +#line 277 "cmListFileLexer.in.l" { lexer->token.type = cmListFileLexer_Token_None; cmListFileLexerSetToken(lexer, 0, 0); return 0; } -case 23: +case 24: YY_RULE_SETUP -#line 276 "cmListFileLexer.in.l" +#line 283 "cmListFileLexer.in.l" ECHO; YY_BREAK -#line 1220 "cmListFileLexer.c" +#line 1238 "cmListFileLexer.c" case YY_END_OF_BUFFER: { @@ -2320,7 +2329,7 @@ void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 276 "cmListFileLexer.in.l" +#line 282 "cmListFileLexer.in.l" diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l index ed4bf6b..a520c72 100644 --- a/Source/cmListFileLexer.in.l +++ b/Source/cmListFileLexer.in.l @@ -212,6 +212,13 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t[=])*\" return 1; } +\[ { + lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted; + cmListFileLexerSetToken(lexer, yytext, yyleng); + lexer->column += yyleng; + return 1; +} + \" { lexer->token.type = cmListFileLexer_Token_ArgumentQuoted; cmListFileLexerSetToken(lexer, "", 0); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 3ed4a48..11a9627 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -44,6 +44,16 @@ private: extern cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[]; +static void cmConvertToWindowsSlash(std::string& s) +{ + std::string::size_type pos = 0; + while((pos = s.find('/', pos)) != std::string::npos) + { + s[pos] = '\\'; + pos++; + } +} + //---------------------------------------------------------------------------- cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator(VSVersion v): cmLocalVisualStudioGenerator(v) @@ -862,6 +872,31 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, } } fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool + if(gg->IsMasmEnabled() && !this->FortranProject) + { + Options masmOptions(this, Options::MasmCompiler, 0, 0); + fout << + "\t\t\t<Tool\n" + "\t\t\t\tName=\"MASM\"\n" + "\t\t\t\tIncludePaths=\"" + ; + const char* sep = ""; + for(i = includes.begin(); i != includes.end(); ++i) + { + std::string inc = *i; + cmConvertToWindowsSlash(inc); + fout << sep << this->EscapeForXML(inc); + sep = ";"; + } + fout << "\"\n"; + // Use same preprocessor definitions as VCCLCompilerTool. + targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", + "ASM_MASM"); + masmOptions.OutputFlagMap(fout, "\t\t\t\t"); + fout << + "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n" + "\t\t\t/>\n"; + } tool = "VCCustomBuildTool"; if(this->FortranProject) { @@ -1695,11 +1730,12 @@ bool cmLocalVisualStudio7Generator else if(!fcinfo.FileConfigMap.empty()) { const char* aCompilerTool = "VCCLCompilerTool"; - const char* lang = "CXX"; + const char* ppLang = "CXX"; if(this->FortranProject) { aCompilerTool = "VFFortranCompilerTool"; } + std::string const& lang = (*sf)->GetLanguage(); std::string ext = (*sf)->GetExtension(); ext = cmSystemTools::LowerCase(ext); if(ext == "idl") @@ -1713,7 +1749,7 @@ bool cmLocalVisualStudio7Generator if(ext == "rc") { aCompilerTool = "VCResourceCompilerTool"; - lang = "RC"; + ppLang = "RC"; if(this->FortranProject) { aCompilerTool = "VFResourceCompilerTool"; @@ -1727,6 +1763,11 @@ bool cmLocalVisualStudio7Generator aCompilerTool = "VFCustomBuildTool"; } } + if (gg->IsMasmEnabled() && !this->FortranProject && + lang == "ASM_MASM") + { + aCompilerTool = "MASM"; + } for(std::map<std::string, cmLVS7GFileConfig>::const_iterator fci = fcinfo.FileConfigMap.begin(); fci != fcinfo.FileConfigMap.end(); ++fci) @@ -1763,7 +1804,7 @@ bool cmLocalVisualStudio7Generator fileOptions.OutputFlagMap(fout, "\t\t\t\t\t"); fileOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t\t", "\n", - lang); + ppLang); } if(!fc.AdditionalDeps.empty()) { @@ -2095,6 +2136,16 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, << "\t<Platforms>\n" << "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n" << "\t</Platforms>\n"; + if(gg->IsMasmEnabled()) + { + fout << + "\t<ToolFiles>\n" + "\t\t<DefaultToolFile\n" + "\t\t\tFileName=\"masm.rules\"\n" + "\t\t/>\n" + "\t</ToolFiles>\n" + ; + } } diff --git a/Source/cmVS10MASMFlagTable.h b/Source/cmVS10MASMFlagTable.h new file mode 100644 index 0000000..8fb6f33 --- /dev/null +++ b/Source/cmVS10MASMFlagTable.h @@ -0,0 +1,96 @@ +static cmVS7FlagTable cmVS10MASMFlagTable[] = +{ + + //Enum Properties + {"PreserveIdentifierCase", "", + "Default", "0", 0}, + {"PreserveIdentifierCase", "/Cp", + "Preserves Identifier Case (/Cp)", "1", 0}, + {"PreserveIdentifierCase", "/Cu", + "Maps all identifiers to upper case. (/Cu)", "2", 0}, + {"PreserveIdentifierCase", "/Cx", + "Preserves case in public and extern symbols. (/Cx)", "3", 0}, + + {"WarningLevel", "/W0", + "Warning Level 0 (/W0)", "0", 0}, + {"WarningLevel", "/W1", + "Warning Level 1 (/W1)", "1", 0}, + {"WarningLevel", "/W2", + "Warning Level 2 (/W2)", "2", 0}, + {"WarningLevel", "/W3", + "Warning Level 3 (/W3)", "3", 0}, + + {"PackAlignmentBoundary", "", + "Default", "0", 0}, + {"PackAlignmentBoundary", "/Zp1", + "One Byte Boundary (/Zp1)", "1", 0}, + {"PackAlignmentBoundary", "/Zp2", + "Two Byte Boundary (/Zp2)", "2", 0}, + {"PackAlignmentBoundary", "/Zp4", + "Four Byte Boundary (/Zp4)", "3", 0}, + {"PackAlignmentBoundary", "/Zp8", + "Eight Byte Boundary (/Zp8)", "4", 0}, + {"PackAlignmentBoundary", "/Zp16", + "Sixteen Byte Boundary (/Zp16)", "5", 0}, + + {"CallingConvention", "", + "Default", "0", 0}, + {"CallingConvention", "/Gd", + "Use C-style Calling Convention (/Gd)", "1", 0}, + {"CallingConvention", "/Gz", + "Use stdcall Calling Convention (/Gz)", "2", 0}, + {"CallingConvention", "/Gc", + "Use Pascal Calling Convention (/Gc)", "3", 0}, + + {"ErrorReporting", "/errorReport:prompt", + "Prompt to send report immediately (/errorReport:prompt)", "0", 0}, + {"ErrorReporting", "/errorReport:queue", + "Prompt to send report at the next logon (/errorReport:queue)", "1", 0}, + {"ErrorReporting", "/errorReport:send", + "Automatically send report (/errorReport:send)", "2", 0}, + {"ErrorReporting", "/errorReport:none", + "Do not send report (/errorReport:none)", "3", 0}, + + + //Bool Properties + {"NoLogo", "/nologo", "", "true", 0}, + {"GeneratePreprocessedSourceListing", "/EP", "", "true", 0}, + {"ListAllAvailableInformation", "/Sa", "", "true", 0}, + {"UseSafeExceptionHandlers", "/safeseh", "", "true", 0}, + {"AddFirstPassListing", "/Sf", "", "true", 0}, + {"EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0}, + {"DisableSymbolTable", "/Sn", "", "true", 0}, + {"EnableFalseConditionalsInListing", "/Sx", "", "true", 0}, + {"TreatWarningsAsErrors", "/WX", "", "true", 0}, + {"MakeAllSymbolsPublic", "/Zf", "", "true", 0}, + {"GenerateDebugInformation", "/Zi", "", "true", 0}, + {"EnableMASM51Compatibility", "/Zm", "", "true", 0}, + {"PerformSyntaxCheckOnly", "/Zs", "", "true", 0}, + + //Bool Properties With Argument + + //String List Properties + {"PreprocessorDefinitions", "/D", + "Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"IncludePaths", "/I", + "Include Paths", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"BrowseFile", "/FR", + "Generate Browse Information File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + // Skip [AdditionalDependencies] - no command line Switch. + + //String Properties + // Skip [Inputs] - no command line Switch. + {"ObjectFileName", "/Fo", + "Object File Name", + "", cmVS7FlagTable::UserValue}, + {"AssembledCodeListingFile", "/Fl", + "Assembled Code Listing File", + "", cmVS7FlagTable::UserValue}, + // Skip [CommandLineTemplate] - no command line Switch. + // Skip [ExecutionDescription] - no command line Switch. + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS11MASMFlagTable.h b/Source/cmVS11MASMFlagTable.h new file mode 100644 index 0000000..2ff95ad --- /dev/null +++ b/Source/cmVS11MASMFlagTable.h @@ -0,0 +1,96 @@ +static cmVS7FlagTable cmVS11MASMFlagTable[] = +{ + + //Enum Properties + {"PreserveIdentifierCase", "", + "Default", "0", 0}, + {"PreserveIdentifierCase", "/Cp", + "Preserves Identifier Case (/Cp)", "1", 0}, + {"PreserveIdentifierCase", "/Cu", + "Maps all identifiers to upper case. (/Cu)", "2", 0}, + {"PreserveIdentifierCase", "/Cx", + "Preserves case in public and extern symbols. (/Cx)", "3", 0}, + + {"WarningLevel", "/W0", + "Warning Level 0 (/W0)", "0", 0}, + {"WarningLevel", "/W1", + "Warning Level 1 (/W1)", "1", 0}, + {"WarningLevel", "/W2", + "Warning Level 2 (/W2)", "2", 0}, + {"WarningLevel", "/W3", + "Warning Level 3 (/W3)", "3", 0}, + + {"PackAlignmentBoundary", "", + "Default", "0", 0}, + {"PackAlignmentBoundary", "/Zp1", + "One Byte Boundary (/Zp1)", "1", 0}, + {"PackAlignmentBoundary", "/Zp2", + "Two Byte Boundary (/Zp2)", "2", 0}, + {"PackAlignmentBoundary", "/Zp4", + "Four Byte Boundary (/Zp4)", "3", 0}, + {"PackAlignmentBoundary", "/Zp8", + "Eight Byte Boundary (/Zp8)", "4", 0}, + {"PackAlignmentBoundary", "/Zp16", + "Sixteen Byte Boundary (/Zp16)", "5", 0}, + + {"CallingConvention", "", + "Default", "0", 0}, + {"CallingConvention", "/Gd", + "Use C-style Calling Convention (/Gd)", "1", 0}, + {"CallingConvention", "/Gz", + "Use stdcall Calling Convention (/Gz)", "2", 0}, + {"CallingConvention", "/Gc", + "Use Pascal Calling Convention (/Gc)", "3", 0}, + + {"ErrorReporting", "/errorReport:prompt", + "Prompt to send report immediately (/errorReport:prompt)", "0", 0}, + {"ErrorReporting", "/errorReport:queue", + "Prompt to send report at the next logon (/errorReport:queue)", "1", 0}, + {"ErrorReporting", "/errorReport:send", + "Automatically send report (/errorReport:send)", "2", 0}, + {"ErrorReporting", "/errorReport:none", + "Do not send report (/errorReport:none)", "3", 0}, + + + //Bool Properties + {"NoLogo", "/nologo", "", "true", 0}, + {"GeneratePreprocessedSourceListing", "/EP", "", "true", 0}, + {"ListAllAvailableInformation", "/Sa", "", "true", 0}, + {"UseSafeExceptionHandlers", "/safeseh", "", "true", 0}, + {"AddFirstPassListing", "/Sf", "", "true", 0}, + {"EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0}, + {"DisableSymbolTable", "/Sn", "", "true", 0}, + {"EnableFalseConditionalsInListing", "/Sx", "", "true", 0}, + {"TreatWarningsAsErrors", "/WX", "", "true", 0}, + {"MakeAllSymbolsPublic", "/Zf", "", "true", 0}, + {"GenerateDebugInformation", "/Zi", "", "true", 0}, + {"EnableMASM51Compatibility", "/Zm", "", "true", 0}, + {"PerformSyntaxCheckOnly", "/Zs", "", "true", 0}, + + //Bool Properties With Argument + + //String List Properties + {"PreprocessorDefinitions", "/D", + "Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"IncludePaths", "/I", + "Include Paths", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"BrowseFile", "/FR", + "Generate Browse Information File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + // Skip [AdditionalDependencies] - no command line Switch. + + //String Properties + // Skip [Inputs] - no command line Switch. + {"ObjectFileName", "/Fo", + "Object File Name", + "", cmVS7FlagTable::UserValue}, + {"AssembledCodeListingFile", "/Fl", + "Assembled Code Listing File", + "", cmVS7FlagTable::UserValue}, + // Skip [CommandLineTemplate] - no command line Switch. + // Skip [ExecutionDescription] - no command line Switch. + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS12MASMFlagTable.h b/Source/cmVS12MASMFlagTable.h new file mode 100644 index 0000000..74d529c --- /dev/null +++ b/Source/cmVS12MASMFlagTable.h @@ -0,0 +1,96 @@ +static cmVS7FlagTable cmVS12MASMFlagTable[] = +{ + + //Enum Properties + {"PreserveIdentifierCase", "", + "Default", "0", 0}, + {"PreserveIdentifierCase", "/Cp", + "Preserves Identifier Case (/Cp)", "1", 0}, + {"PreserveIdentifierCase", "/Cu", + "Maps all identifiers to upper case. (/Cu)", "2", 0}, + {"PreserveIdentifierCase", "/Cx", + "Preserves case in public and extern symbols. (/Cx)", "3", 0}, + + {"WarningLevel", "/W0", + "Warning Level 0 (/W0)", "0", 0}, + {"WarningLevel", "/W1", + "Warning Level 1 (/W1)", "1", 0}, + {"WarningLevel", "/W2", + "Warning Level 2 (/W2)", "2", 0}, + {"WarningLevel", "/W3", + "Warning Level 3 (/W3)", "3", 0}, + + {"PackAlignmentBoundary", "", + "Default", "0", 0}, + {"PackAlignmentBoundary", "/Zp1", + "One Byte Boundary (/Zp1)", "1", 0}, + {"PackAlignmentBoundary", "/Zp2", + "Two Byte Boundary (/Zp2)", "2", 0}, + {"PackAlignmentBoundary", "/Zp4", + "Four Byte Boundary (/Zp4)", "3", 0}, + {"PackAlignmentBoundary", "/Zp8", + "Eight Byte Boundary (/Zp8)", "4", 0}, + {"PackAlignmentBoundary", "/Zp16", + "Sixteen Byte Boundary (/Zp16)", "5", 0}, + + {"CallingConvention", "", + "Default", "0", 0}, + {"CallingConvention", "/Gd", + "Use C-style Calling Convention (/Gd)", "1", 0}, + {"CallingConvention", "/Gz", + "Use stdcall Calling Convention (/Gz)", "2", 0}, + {"CallingConvention", "/Gc", + "Use Pascal Calling Convention (/Gc)", "3", 0}, + + {"ErrorReporting", "/errorReport:prompt", + "Prompt to send report immediately (/errorReport:prompt)", "0", 0}, + {"ErrorReporting", "/errorReport:queue", + "Prompt to send report at the next logon (/errorReport:queue)", "1", 0}, + {"ErrorReporting", "/errorReport:send", + "Automatically send report (/errorReport:send)", "2", 0}, + {"ErrorReporting", "/errorReport:none", + "Do not send report (/errorReport:none)", "3", 0}, + + + //Bool Properties + {"NoLogo", "/nologo", "", "true", 0}, + {"GeneratePreprocessedSourceListing", "/EP", "", "true", 0}, + {"ListAllAvailableInformation", "/Sa", "", "true", 0}, + {"UseSafeExceptionHandlers", "/safeseh", "", "true", 0}, + {"AddFirstPassListing", "/Sf", "", "true", 0}, + {"EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0}, + {"DisableSymbolTable", "/Sn", "", "true", 0}, + {"EnableFalseConditionalsInListing", "/Sx", "", "true", 0}, + {"TreatWarningsAsErrors", "/WX", "", "true", 0}, + {"MakeAllSymbolsPublic", "/Zf", "", "true", 0}, + {"GenerateDebugInformation", "/Zi", "", "true", 0}, + {"EnableMASM51Compatibility", "/Zm", "", "true", 0}, + {"PerformSyntaxCheckOnly", "/Zs", "", "true", 0}, + + //Bool Properties With Argument + + //String List Properties + {"PreprocessorDefinitions", "/D", + "Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"IncludePaths", "/I", + "Include Paths", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"BrowseFile", "/FR", + "Generate Browse Information File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + // Skip [AdditionalDependencies] - no command line Switch. + + //String Properties + // Skip [Inputs] - no command line Switch. + {"ObjectFileName", "/Fo", + "Object File Name", + "", cmVS7FlagTable::UserValue}, + {"AssembledCodeListingFile", "/Fl", + "Assembled Code Listing File", + "", cmVS7FlagTable::UserValue}, + // Skip [CommandLineTemplate] - no command line Switch. + // Skip [ExecutionDescription] - no command line Switch. + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS14MASMFlagTable.h b/Source/cmVS14MASMFlagTable.h new file mode 100644 index 0000000..dce846f --- /dev/null +++ b/Source/cmVS14MASMFlagTable.h @@ -0,0 +1,96 @@ +static cmVS7FlagTable cmVS14MASMFlagTable[] = +{ + + //Enum Properties + {"PreserveIdentifierCase", "", + "Default", "0", 0}, + {"PreserveIdentifierCase", "/Cp", + "Preserves Identifier Case (/Cp)", "1", 0}, + {"PreserveIdentifierCase", "/Cu", + "Maps all identifiers to upper case. (/Cu)", "2", 0}, + {"PreserveIdentifierCase", "/Cx", + "Preserves case in public and extern symbols. (/Cx)", "3", 0}, + + {"WarningLevel", "/W0", + "Warning Level 0 (/W0)", "0", 0}, + {"WarningLevel", "/W1", + "Warning Level 1 (/W1)", "1", 0}, + {"WarningLevel", "/W2", + "Warning Level 2 (/W2)", "2", 0}, + {"WarningLevel", "/W3", + "Warning Level 3 (/W3)", "3", 0}, + + {"PackAlignmentBoundary", "", + "Default", "0", 0}, + {"PackAlignmentBoundary", "/Zp1", + "One Byte Boundary (/Zp1)", "1", 0}, + {"PackAlignmentBoundary", "/Zp2", + "Two Byte Boundary (/Zp2)", "2", 0}, + {"PackAlignmentBoundary", "/Zp4", + "Four Byte Boundary (/Zp4)", "3", 0}, + {"PackAlignmentBoundary", "/Zp8", + "Eight Byte Boundary (/Zp8)", "4", 0}, + {"PackAlignmentBoundary", "/Zp16", + "Sixteen Byte Boundary (/Zp16)", "5", 0}, + + {"CallingConvention", "", + "Default", "0", 0}, + {"CallingConvention", "/Gd", + "Use C-style Calling Convention (/Gd)", "1", 0}, + {"CallingConvention", "/Gz", + "Use stdcall Calling Convention (/Gz)", "2", 0}, + {"CallingConvention", "/Gc", + "Use Pascal Calling Convention (/Gc)", "3", 0}, + + {"ErrorReporting", "/errorReport:prompt", + "Prompt to send report immediately (/errorReport:prompt)", "0", 0}, + {"ErrorReporting", "/errorReport:queue", + "Prompt to send report at the next logon (/errorReport:queue)", "1", 0}, + {"ErrorReporting", "/errorReport:send", + "Automatically send report (/errorReport:send)", "2", 0}, + {"ErrorReporting", "/errorReport:none", + "Do not send report (/errorReport:none)", "3", 0}, + + + //Bool Properties + {"NoLogo", "/nologo", "", "true", 0}, + {"GeneratePreprocessedSourceListing", "/EP", "", "true", 0}, + {"ListAllAvailableInformation", "/Sa", "", "true", 0}, + {"UseSafeExceptionHandlers", "/safeseh", "", "true", 0}, + {"AddFirstPassListing", "/Sf", "", "true", 0}, + {"EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0}, + {"DisableSymbolTable", "/Sn", "", "true", 0}, + {"EnableFalseConditionalsInListing", "/Sx", "", "true", 0}, + {"TreatWarningsAsErrors", "/WX", "", "true", 0}, + {"MakeAllSymbolsPublic", "/Zf", "", "true", 0}, + {"GenerateDebugInformation", "/Zi", "", "true", 0}, + {"EnableMASM51Compatibility", "/Zm", "", "true", 0}, + {"PerformSyntaxCheckOnly", "/Zs", "", "true", 0}, + + //Bool Properties With Argument + + //String List Properties + {"PreprocessorDefinitions", "/D", + "Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"IncludePaths", "/I", + "Include Paths", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"BrowseFile", "/FR", + "Generate Browse Information File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + // Skip [AdditionalDependencies] - no command line Switch. + + //String Properties + // Skip [Inputs] - no command line Switch. + {"ObjectFileName", "/Fo", + "Object File Name", + "", cmVS7FlagTable::UserValue}, + {"AssembledCodeListingFile", "/Fl", + "Assembled Code Listing File", + "", cmVS7FlagTable::UserValue}, + // Skip [CommandLineTemplate] - no command line Switch. + // Skip [ExecutionDescription] - no command line Switch. + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index c00d400..c525b7c 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -24,18 +24,22 @@ #include "cmVS10RCFlagTable.h" #include "cmVS10LinkFlagTable.h" #include "cmVS10LibFlagTable.h" +#include "cmVS10MASMFlagTable.h" #include "cmVS11CLFlagTable.h" #include "cmVS11RCFlagTable.h" #include "cmVS11LinkFlagTable.h" #include "cmVS11LibFlagTable.h" +#include "cmVS11MASMFlagTable.h" #include "cmVS12CLFlagTable.h" #include "cmVS12RCFlagTable.h" #include "cmVS12LinkFlagTable.h" #include "cmVS12LibFlagTable.h" +#include "cmVS12MASMFlagTable.h" #include "cmVS14CLFlagTable.h" #include "cmVS14RCFlagTable.h" #include "cmVS14LinkFlagTable.h" #include "cmVS14LibFlagTable.h" +#include "cmVS14MASMFlagTable.h" #include <cmsys/auto_ptr.hxx> @@ -111,6 +115,24 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const return 0; } +cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetMasmFlagTable() const +{ + if(this->MSTools) + { + cmLocalVisualStudioGenerator::VSVersion + v = this->LocalGenerator->GetVersion(); + if(v >= cmLocalVisualStudioGenerator::VS14) + { return cmVS14MASMFlagTable; } + else if(v >= cmLocalVisualStudioGenerator::VS12) + { return cmVS12MASMFlagTable; } + else if(v == cmLocalVisualStudioGenerator::VS11) + { return cmVS11MASMFlagTable; } + else + { return cmVS10MASMFlagTable; } + } + return 0; +} + static std::string cmVS10EscapeXML(std::string arg) { cmSystemTools::ReplaceString(arg, "&", "&"); @@ -256,6 +278,10 @@ void cmVisualStudio10TargetGenerator::Generate() { return; } + if(!this->ComputeMasmOptions()) + { + return; + } if(!this->ComputeLinkOptions()) { return; @@ -1271,7 +1297,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() { tool = "ClCompile"; } - else if (lang == "ASM_NASM" && + else if (lang == "ASM_MASM" && this->GlobalGenerator->IsMasmEnabled()) { tool = "MASM"; @@ -1467,6 +1493,11 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( clOptions.AddFlag("CompileAsWinRT", "false"); } clOptions.Parse(flags.c_str()); + if(clOptions.HasFlag("AdditionalIncludeDirectories")) + { + clOptions.AppendFlag("AdditionalIncludeDirectories", + "%(AdditionalIncludeDirectories)"); + } clOptions.AddDefines(configDefines.c_str()); clOptions.SetConfiguration((*config).c_str()); clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); @@ -1738,7 +1769,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( Options& clOptions = *(this->ClOptions[configName]); this->WriteString("<ClCompile>\n", 2); clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); - this->OutputIncludes(includes); + clOptions.AppendFlag("AdditionalIncludeDirectories", includes); + clOptions.AppendFlag("AdditionalIncludeDirectories", + "%(AdditionalIncludeDirectories)"); clOptions.OutputFlagMap(*this->BuildFileStream, " "); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", "CXX"); @@ -1769,23 +1802,6 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( this->WriteString("</ClCompile>\n", 2); } -void cmVisualStudio10TargetGenerator:: -OutputIncludes(std::vector<std::string> const & includes) -{ - this->WriteString("<AdditionalIncludeDirectories>", 3); - for(std::vector<std::string>::const_iterator i = includes.begin(); - i != includes.end(); ++i) - { - std::string incDir = *i; - this->ConvertToWindowsSlash(incDir); - *this->BuildFileStream << cmVS10EscapeXML(incDir) << ";"; - } - this->WriteString("%(AdditionalIncludeDirectories)" - "</AdditionalIncludeDirectories>\n", 0); -} - - - //---------------------------------------------------------------------------- bool cmVisualStudio10TargetGenerator::ComputeRcOptions() { @@ -1837,15 +1853,82 @@ WriteRCOptions(std::string const& configName, Options& clOptions = *(this->ClOptions[configName]); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", "RC"); - this->OutputIncludes(includes); Options& rcOptions = *(this->RcOptions[configName]); + rcOptions.AppendFlag("AdditionalIncludeDirectories", includes); + rcOptions.AppendFlag("AdditionalIncludeDirectories", + "%(AdditionalIncludeDirectories)"); rcOptions.OutputFlagMap(*this->BuildFileStream, " "); rcOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); this->WriteString("</ResourceCompile>\n", 2); } +//---------------------------------------------------------------------------- +bool cmVisualStudio10TargetGenerator::ComputeMasmOptions() +{ + if(!this->GlobalGenerator->IsMasmEnabled()) + { + return true; + } + std::vector<std::string> const* configs = + this->GlobalGenerator->GetConfigurations(); + for(std::vector<std::string>::const_iterator i = configs->begin(); + i != configs->end(); ++i) + { + if(!this->ComputeMasmOptions(*i)) + { + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- +bool cmVisualStudio10TargetGenerator::ComputeMasmOptions( + std::string const& configName) +{ + cmsys::auto_ptr<Options> pOptions( + new Options(this->LocalGenerator, Options::MasmCompiler, + this->GetMasmFlagTable())); + Options& masmOptions = *pOptions; + + std::string CONFIG = cmSystemTools::UpperCase(configName); + std::string configFlagsVar = std::string("CMAKE_ASM_MASM_FLAGS_") + CONFIG; + std::string flags = + std::string(this->Makefile->GetSafeDefinition("CMAKE_ASM_MASM_FLAGS")) + + std::string(" ") + + std::string(this->Makefile->GetSafeDefinition(configFlagsVar)); + + masmOptions.Parse(flags.c_str()); + this->MasmOptions[configName] = pOptions.release(); + return true; +} + +void cmVisualStudio10TargetGenerator:: +WriteMasmOptions(std::string const& configName, + std::vector<std::string> const& includes) +{ + if(!this->MSTools || !this->GlobalGenerator->IsMasmEnabled()) + { + return; + } + this->WriteString("<MASM>\n", 2); + + // Preprocessor definitions and includes are shared with clOptions. + Options& clOptions = *(this->ClOptions[configName]); + clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", + "\n", "ASM_MASM"); + + Options& masmOptions = *(this->MasmOptions[configName]); + masmOptions.AppendFlag("IncludePaths", includes); + masmOptions.AppendFlag("IncludePaths", "%(IncludePaths)"); + masmOptions.OutputFlagMap(*this->BuildFileStream, " "); + masmOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); + + this->WriteString("</MASM>\n", 2); +} + void cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) @@ -2179,7 +2262,14 @@ WriteMidlOptions(std::string const& /*config*/, // only). Perhaps there's something to be done to make this more automatic // on the CMake side? this->WriteString("<Midl>\n", 2); - this->OutputIncludes(includes); + this->WriteString("<AdditionalIncludeDirectories>", 3); + for(std::vector<std::string>::const_iterator i = includes.begin(); + i != includes.end(); ++i) + { + *this->BuildFileStream << cmVS10EscapeXML(*i) << ";"; + } + this->WriteString("%(AdditionalIncludeDirectories)" + "</AdditionalIncludeDirectories>\n", 0); this->WriteString("<OutputDirectory>$(IntDir)</OutputDirectory>\n", 3); this->WriteString("<HeaderFileName>%(Filename).h</HeaderFileName>\n", 3); this->WriteString( @@ -2204,6 +2294,11 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, "C", i->c_str()); + for(std::vector<std::string>::iterator ii = includes.begin(); + ii != includes.end(); ++ii) + { + this->ConvertToWindowsSlash(*ii); + } this->WritePlatformConfigTag("ItemDefinitionGroup", i->c_str(), 1); *this->BuildFileStream << "\n"; // output cl compile flags <ClCompile></ClCompile> @@ -2212,6 +2307,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() this->WriteClOptions(*i, includes); // output rc compile flags <ResourceCompile></ResourceCompile> this->WriteRCOptions(*i, includes); + this->WriteMasmOptions(*i, includes); } // output midl flags <Midl></Midl> this->WriteMidlOptions(*i, includes); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index e558f74..d6db18a 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -87,12 +87,15 @@ private: bool ComputeRcOptions(std::string const& config); void WriteRCOptions(std::string const& config, std::vector<std::string> const & includes); + bool ComputeMasmOptions(); + bool ComputeMasmOptions(std::string const& config); + void WriteMasmOptions(std::string const& config, + std::vector<std::string> const& includes); bool ComputeLinkOptions(); bool ComputeLinkOptions(std::string const& config); void WriteLinkOptions(std::string const& config); void WriteMidlOptions(std::string const& config, std::vector<std::string> const & includes); - void OutputIncludes(std::vector<std::string> const & includes); void OutputLinkIncremental(std::string const& configName); void WriteCustomRule(cmSourceFile const* source, cmCustomCommand const & command); @@ -119,12 +122,14 @@ private: cmIDEFlagTable const* GetRcFlagTable() const; cmIDEFlagTable const* GetLibFlagTable() const; cmIDEFlagTable const* GetLinkFlagTable() const; + cmIDEFlagTable const* GetMasmFlagTable() const; private: typedef cmVisualStudioGeneratorOptions Options; typedef std::map<std::string, Options*> OptionsMap; OptionsMap ClOptions; OptionsMap RcOptions; + OptionsMap MasmOptions; OptionsMap LinkOptions; std::string PathToVcxproj; cmTarget* Target; diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index eeaf126..cdc8879 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -330,10 +330,6 @@ cmVisualStudioGeneratorOptions fout << sep << cmVisualStudio10GeneratorOptionsEscapeForXML(*i); sep = ";"; } - if (m->first == "AdditionalIncludeDirectories") - { - fout << sep << "%(AdditionalIncludeDirectories)"; - } fout << "</" << m->first << ">\n"; } } diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 5829e17..9951033 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -28,6 +28,7 @@ public: { Compiler, ResourceCompiler, + MasmCompiler, Linker, FortranCompiler }; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 249e185..a091d40 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1679,6 +1679,14 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC") endif() + if(MSVC AND NOT MSVC_VERSION LESS 1310 + AND NOT CMAKE_GENERATOR MATCHES "Visual Studio [67]( |$)" + AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio [89]( |$)" + OR CMAKE_SIZEOF_VOID_P EQUAL 4) + ) + ADD_TEST_MACRO(VSMASM VSMASM) + endif() + if(${CMAKE_GENERATOR} MATCHES "Visual Studio") if(NOT MSVC60) ADD_TEST_MACRO(SBCS SBCS) diff --git a/Tests/RunCMake/Syntax/Unquoted1-stderr.txt b/Tests/RunCMake/Syntax/Unquoted1-stderr.txt index ff8194a..85a7a9d 100644 --- a/Tests/RunCMake/Syntax/Unquoted1-stderr.txt +++ b/Tests/RunCMake/Syntax/Unquoted1-stderr.txt @@ -1 +1 @@ -^\[\]\[=\]\[\$\$\(MV\)-DSTR=" \[="\[;\]$ +^\[\]\[=\]\[\$\$\(MV\)-DSTR=" \[="\[;\]\]\[$ diff --git a/Tests/RunCMake/Syntax/Unquoted1.cmake b/Tests/RunCMake/Syntax/Unquoted1.cmake index 0344fbd..515161f 100644 --- a/Tests/RunCMake/Syntax/Unquoted1.cmake +++ b/Tests/RunCMake/Syntax/Unquoted1.cmake @@ -1 +1 @@ -message([] [=] [$ $(MV) -DSTR=" [=" [;]) +message([] [=] [$ $(MV) -DSTR=" [=" [;] ] [) diff --git a/Tests/VSMASM/CMakeLists.txt b/Tests/VSMASM/CMakeLists.txt new file mode 100644 index 0000000..f2570a3 --- /dev/null +++ b/Tests/VSMASM/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8.12) +project(VSMASM C ASM_MASM) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + add_definitions(-DTESTx64) +else() + add_definitions(-DTESTi386) + set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /safeseh") +endif() +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +add_executable(VSMASM main.c foo.asm) diff --git a/Tests/VSMASM/foo.asm b/Tests/VSMASM/foo.asm new file mode 100644 index 0000000..51cb969 --- /dev/null +++ b/Tests/VSMASM/foo.asm @@ -0,0 +1,7 @@ +ifndef TESTx64 +.386 +.model flat, c +endif +.code +include <foo-proc.asm> +end diff --git a/Tests/VSMASM/include/foo-proc.asm b/Tests/VSMASM/include/foo-proc.asm new file mode 100644 index 0000000..e8ba5dc --- /dev/null +++ b/Tests/VSMASM/include/foo-proc.asm @@ -0,0 +1,4 @@ +foo proc public + mov eax,0 + ret +foo endp diff --git a/Tests/VSMASM/main.c b/Tests/VSMASM/main.c new file mode 100644 index 0000000..570ba16 --- /dev/null +++ b/Tests/VSMASM/main.c @@ -0,0 +1,2 @@ +extern int foo(void); +int main(void) { return foo(); } |