Merge topic 'ReworkedAsmSupport'
b3ce420
Do not bother enabling C++ in Assembler test80f6a34
Teach Assembler test to generate main.s at build time1dafa74
Fix Assembler test to parse C flags string before using4139a73
-only enable the asm test for the Intel compiler if we are under UNIX1f6c6b1
-use CMAKE_C_FLAGS when generating the assembler filed0f71e2
Add ASM platform information for HP compiler on HPbd580be
Merge branch 'hp-compiler-info' into ReworkedAsmSupporta0bab7a
Add ASM platform information for XL compiler on AIXc03b610
Merge branch 'aix-xl-platform-info' into ReworkedAsmSupportc623008
Initialize ASM rpath flags for executables with those for shared libs17c658f
Add support for the Intel compiler used for ASM under Windows4258b24
Add more regex for gcc, always print the ASM compiler ID9071b8b
Add temporary debug output for compiler ID detection for ASM48f7199
It's ELSEIF(), not ELSIF()d103c75
Fix bad comparison in the detect assembler-code20fe0be
Only try assembler support for Makefile-based generators8614470
Use a regexp instead a lot of ORs for checking the compiler IDcf88092
The Assembler test now tests ASM for GNU, Intel, HP, XL and SunPro66614a8
Add assemble- and preprocess commands for HP78f7c59
Fix the default CMAKE_ASM_COMPILE_OBJECT, make XL-ASM use it7456461
Change the default rules so they fit better to the new ASM handling5542d58
Set the HP asm file suffixf745220
Add support for ASm for the HP compiler.00735d4
Add suport for ASM for the IBM XL compilerd3e9e8a
Add support for ASM for the SunPro compiler64e66eb
Actually use CMAKE_ASM_COMPILER for asm, instead of CMAKE_C_COMPILER38f92bf
Add ASM support for the Intel compiler4b40d42
Rework the way assembler is handled, use the C/CXX compiler by default
This commit is contained in:
commit
036aab093b
|
@ -18,5 +18,8 @@ SET(ASM_DIALECT "-ATT")
|
||||||
# *.S files are supposed to be preprocessed, so they should not be passed to
|
# *.S files are supposed to be preprocessed, so they should not be passed to
|
||||||
# assembler but should be processed by gcc
|
# assembler but should be processed by gcc
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;asm)
|
SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;asm)
|
||||||
|
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>")
|
||||||
|
|
||||||
INCLUDE(CMakeASMInformation)
|
INCLUDE(CMakeASMInformation)
|
||||||
SET(ASM_DIALECT)
|
SET(ASM_DIALECT)
|
||||||
|
|
|
@ -4,6 +4,7 @@ SET(CMAKE_AR "@CMAKE_AR@")
|
||||||
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
||||||
SET(CMAKE_LINKER "@CMAKE_LINKER@")
|
SET(CMAKE_LINKER "@CMAKE_LINKER@")
|
||||||
SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
|
SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
|
||||||
|
SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@")
|
||||||
SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@")
|
SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@")
|
||||||
|
|
||||||
SET(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
SET(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
# (To distribute this file outside of CMake, substitute the full
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
# License text for the above reference.)
|
# License text for the above reference.)
|
||||||
|
|
||||||
MESSAGE(STATUS "Loaded CMakeASM${ASM_DIALECT}Information - ASM${ASM_DIALECT} support is still experimental, please report issues")
|
|
||||||
|
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o)
|
SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o)
|
||||||
ELSE(UNIX)
|
ELSE(UNIX)
|
||||||
|
@ -34,6 +32,9 @@ IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
INCLUDE(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
INCLUDE(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||||
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
IF(NOT _INCLUDED_FILE)
|
IF(NOT _INCLUDED_FILE)
|
||||||
|
IF("ASM${ASM_DIALECT}" STREQUAL "ASM")
|
||||||
|
MESSAGE(FATAL_ERROR "Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}")
|
||||||
|
ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM")
|
||||||
INCLUDE(Platform/${CMAKE_BASE_NAME} OPTIONAL)
|
INCLUDE(Platform/${CMAKE_BASE_NAME} OPTIONAL)
|
||||||
ENDIF(NOT _INCLUDED_FILE)
|
ENDIF(NOT _INCLUDED_FILE)
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_FLAGS
|
||||||
|
|
||||||
|
|
||||||
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
|
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>")
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||||
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
|
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
|
||||||
|
|
||||||
IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
|
IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
|
||||||
|
@ -100,9 +101,21 @@ ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
|
||||||
|
|
||||||
IF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
|
IF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
|
SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
|
||||||
"<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
"<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||||
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
|
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
|
||||||
|
|
||||||
|
IF(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG)
|
||||||
|
SET(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP)
|
||||||
|
SET(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG)
|
||||||
|
SET(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# to be done
|
# to be done
|
||||||
IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
|
IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
|
SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
|
||||||
|
|
|
@ -21,11 +21,37 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||||
ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
|
ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
|
||||||
|
|
||||||
# finally list compilers to try
|
# finally list compilers to try
|
||||||
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
IF("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
|
|
||||||
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
IF(CMAKE_ASM_COMPILER_INIT)
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}as ${_CMAKE_TOOLCHAIN_PREFIX}gas)
|
SET(CMAKE_ASM_COMPILER_LIST ${CMAKE_ASM_COMPILER_INIT})
|
||||||
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
ELSE(CMAKE_ASM_COMPILER_INIT)
|
||||||
|
|
||||||
|
IF(CMAKE_C_COMPILER)
|
||||||
|
SET(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler")
|
||||||
|
SET(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}")
|
||||||
|
ELSEIF(CMAKE_CXX_COMPILER)
|
||||||
|
SET(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler")
|
||||||
|
SET(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}")
|
||||||
|
ELSE(CMAKE_CXX_COMPILER)
|
||||||
|
# List all default C and CXX compilers
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc
|
||||||
|
${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC)
|
||||||
|
ENDIF(CMAKE_C_COMPILER)
|
||||||
|
|
||||||
|
ENDIF(CMAKE_ASM_COMPILER_INIT)
|
||||||
|
|
||||||
|
|
||||||
|
ELSE("ASM${ASM_DIALECT}" STREQUAL "ASM") # some specific assembler "dialect"
|
||||||
|
|
||||||
|
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
|
||||||
|
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
||||||
|
MESSAGE(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !")
|
||||||
|
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
||||||
|
|
||||||
|
ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM")
|
||||||
|
|
||||||
|
|
||||||
# Find the compiler.
|
# Find the compiler.
|
||||||
IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
|
IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
|
||||||
|
@ -63,7 +89,24 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
# Table of per-vendor compiler id flags with expected output.
|
# Table of per-vendor compiler id flags with expected output.
|
||||||
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU )
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU )
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version")
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version")
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "GNU assembler")
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)")
|
||||||
|
|
||||||
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP )
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V")
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C")
|
||||||
|
|
||||||
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Intel )
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version")
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)")
|
||||||
|
|
||||||
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro )
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V")
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C")
|
||||||
|
|
||||||
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XL )
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XL "-qversion")
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C")
|
||||||
|
|
||||||
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP )
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP )
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h")
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h")
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments")
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments")
|
||||||
|
@ -71,14 +114,15 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
INCLUDE(CMakeDetermineCompilerId)
|
INCLUDE(CMakeDetermineCompilerId)
|
||||||
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
|
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
|
||||||
|
|
||||||
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
|
||||||
MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
|
|
||||||
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
|
||||||
MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
|
|
||||||
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
|
MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
|
||||||
|
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
|
MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
|
||||||
|
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# If we have a gas/as cross compiler, they have usually some prefix, like
|
# If we have a gas/as cross compiler, they have usually some prefix, like
|
||||||
# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally
|
# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally
|
||||||
|
@ -90,10 +134,25 @@ ENDIF()
|
||||||
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||||
GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME)
|
GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME)
|
||||||
IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
STRING(REGEX REPLACE "^(.+-)g?as(\\.exe)?$" "\\1" _CMAKE_TOOLCHAIN_PREFIX "${COMPILER_BASENAME}")
|
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||||
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||||
|
|
||||||
|
# Now try the C compiler regexp:
|
||||||
|
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||||
|
IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
|
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||||
|
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
|
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||||
|
|
||||||
|
# Finally try the CXX compiler regexp:
|
||||||
|
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||||
|
IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
|
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||||
|
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
|
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||||
|
|
||||||
|
|
||||||
INCLUDE(CMakeFindBinUtils)
|
INCLUDE(CMakeFindBinUtils)
|
||||||
|
|
||||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM${ASM_DIALECT}")
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM${ASM_DIALECT}")
|
||||||
|
@ -106,6 +165,7 @@ ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||||
|
|
||||||
|
|
||||||
SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
|
SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
|
||||||
|
SET(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
|
||||||
SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}")
|
SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}")
|
||||||
SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}")
|
SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}")
|
||||||
|
|
||||||
|
|
|
@ -287,6 +287,13 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
|
||||||
RESULT_VARIABLE result
|
RESULT_VARIABLE result
|
||||||
TIMEOUT 10
|
TIMEOUT 10
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IF("${lang}" STREQUAL "ASM")
|
||||||
|
MESSAGE(STATUS "Checked for ${vendor}")
|
||||||
|
MESSAGE(STATUS " Output: -${output}-")
|
||||||
|
MESSAGE(STATUS " Result: -${result}-")
|
||||||
|
ENDIF("${lang}" STREQUAL "ASM")
|
||||||
|
|
||||||
IF("${output}" MATCHES "${regex}")
|
IF("${output}" MATCHES "${regex}")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||||
"Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
|
"Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
# This file is loaded when gcc/g++ is used for assembler files (the "ASM" cmake language)
|
||||||
|
include(Compiler/GNU)
|
||||||
|
|
||||||
|
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)
|
||||||
|
|
||||||
|
__compiler_gnu(ASM)
|
|
@ -0,0 +1,3 @@
|
||||||
|
SET(CMAKE_ASM_VERBOSE_FLAG "-v")
|
||||||
|
|
||||||
|
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s )
|
|
@ -1 +1,4 @@
|
||||||
SET(CMAKE_C_VERBOSE_FLAG "-v")
|
SET(CMAKE_C_VERBOSE_FLAG "-v")
|
||||||
|
|
||||||
|
SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
|
||||||
|
SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
SET(CMAKE_CXX_VERBOSE_FLAG "-v")
|
SET(CMAKE_CXX_VERBOSE_FLAG "-v")
|
||||||
|
|
||||||
|
SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
|
||||||
|
SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
SET(CMAKE_ASM_VERBOSE_FLAG "-v")
|
||||||
|
|
||||||
|
SET(CMAKE_ASM_FLAGS_INIT "")
|
||||||
|
SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
|
||||||
|
SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
|
||||||
|
SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
|
||||||
|
SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
|
||||||
|
|
||||||
|
IF(UNIX)
|
||||||
|
SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S)
|
||||||
|
ELSE(UNIX)
|
||||||
|
SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm)
|
||||||
|
ENDIF(UNIX)
|
|
@ -0,0 +1,24 @@
|
||||||
|
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s )
|
||||||
|
|
||||||
|
SET(CMAKE_ASM_VERBOSE_FLAG "-#")
|
||||||
|
|
||||||
|
SET(CMAKE_SHARED_LIBRARY_ASM_FLAGS "-KPIC")
|
||||||
|
SET(CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS "-G")
|
||||||
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG "-R")
|
||||||
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG_SEP ":")
|
||||||
|
SET(CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG "-h")
|
||||||
|
|
||||||
|
SET(CMAKE_ASM_FLAGS_INIT "")
|
||||||
|
SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
|
||||||
|
SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
|
||||||
|
SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
|
||||||
|
SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g -xO2")
|
||||||
|
|
||||||
|
# Initialize ASM link type selection flags. These flags are used when
|
||||||
|
# building a shared library, shared module, or executable that links
|
||||||
|
# to other libraries to select whether to use the static or shared
|
||||||
|
# versions of the libraries.
|
||||||
|
FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
|
||||||
|
SET(CMAKE_${type}_LINK_STATIC_ASM_FLAGS "-Bstatic")
|
||||||
|
SET(CMAKE_${type}_LINK_DYNAMIC_ASM_FLAGS "-Bdynamic")
|
||||||
|
ENDFOREACH(type)
|
|
@ -0,0 +1,13 @@
|
||||||
|
SET(CMAKE_ASM_VERBOSE_FLAG "-V")
|
||||||
|
|
||||||
|
# -qthreaded = Ensures that all optimizations will be thread-safe
|
||||||
|
# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer)
|
||||||
|
# -qhalt=e = Halt on error messages (rather than just severe errors)
|
||||||
|
SET(CMAKE_ASM_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e -qsourcetype=assembler")
|
||||||
|
|
||||||
|
SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
|
||||||
|
SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG")
|
||||||
|
SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG")
|
||||||
|
SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g")
|
||||||
|
|
||||||
|
SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s )
|
|
@ -0,0 +1,2 @@
|
||||||
|
include(Platform/AIX-XL)
|
||||||
|
__aix_compiler_xl(ASM)
|
|
@ -0,0 +1,6 @@
|
||||||
|
include(Platform/HP-UX-HP)
|
||||||
|
__hpux_compiler_hp(ASM)
|
||||||
|
|
||||||
|
set(CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS "-E -b +nodefaultrpath -L/usr/lib")
|
||||||
|
|
||||||
|
set(CMAKE_ASM_CREATE_SHARED_LIBRARY "ld <CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
|
@ -20,6 +20,7 @@ set(__HPUX_COMPILER_HP 1)
|
||||||
set(_Wl_C "")
|
set(_Wl_C "")
|
||||||
set(_Wl_CXX "-Wl,")
|
set(_Wl_CXX "-Wl,")
|
||||||
set(_Wl_Fortran "")
|
set(_Wl_Fortran "")
|
||||||
|
set(_Wl_ASM "")
|
||||||
|
|
||||||
macro(__hpux_compiler_hp lang)
|
macro(__hpux_compiler_hp lang)
|
||||||
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z")
|
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z")
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
include(Platform/Windows-Intel)
|
||||||
|
__windows_compiler_intel(ASM)
|
|
@ -1,26 +1,32 @@
|
||||||
cmake_minimum_required (VERSION 2.6)
|
cmake_minimum_required (VERSION 2.6)
|
||||||
project(Assembler)
|
project(Assembler C)
|
||||||
|
message("CTEST_FULL_OUTPUT ")
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE 1)
|
||||||
|
|
||||||
set(SRCS)
|
set(SRCS)
|
||||||
|
|
||||||
# if no file has been set as source and we are on linux with an x86 processor try to use the gas/as assembler
|
# (at least) the following toolchains can process assembler files directly
|
||||||
# main-linux-x86-gas.s seems to work for Linux and FreeBSD
|
# and also generate assembler files from C:
|
||||||
if(NOT SRCS AND CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86$")
|
if("${CMAKE_GENERATOR}" MATCHES "Makefile")
|
||||||
if(CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES FreeBSD)
|
if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX))
|
||||||
message(STATUS "Trying to enable ASM-ATT for Linux or FreeBSD on x86")
|
set(C_FLAGS "${CMAKE_C_FLAGS}")
|
||||||
enable_language(ASM-ATT OPTIONAL)
|
separate_arguments(C_FLAGS)
|
||||||
if(CMAKE_ASM-ATT_COMPILER_WORKS)
|
set(SRCS main.s)
|
||||||
message(STATUS "Trying to enable ASM-ATT for Linux/x86 - succeeded")
|
add_custom_command(
|
||||||
# this assembler file was created using gcc -S main.c
|
OUTPUT main.s
|
||||||
set(SRCS main-linux-x86-gas.s)
|
COMMAND ${CMAKE_C_COMPILER} ${C_FLAGS} -S ${CMAKE_CURRENT_SOURCE_DIR}/main.c -o main.s
|
||||||
endif(CMAKE_ASM-ATT_COMPILER_WORKS)
|
DEPENDS main.c
|
||||||
endif(CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES FreeBSD)
|
VERBATIM
|
||||||
endif(NOT SRCS AND CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86$")
|
)
|
||||||
|
endif(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX))
|
||||||
|
endif("${CMAKE_GENERATOR}" MATCHES "Makefile")
|
||||||
|
|
||||||
if(NOT SRCS)
|
|
||||||
|
if(SRCS)
|
||||||
|
enable_language(ASM OPTIONAL)
|
||||||
|
else(SRCS)
|
||||||
message(STATUS "No assembler enabled, using C")
|
message(STATUS "No assembler enabled, using C")
|
||||||
set(SRCS main.c)
|
set(SRCS main.c)
|
||||||
endif(NOT SRCS)
|
endif(SRCS)
|
||||||
|
|
||||||
add_executable(HelloAsm ${SRCS})
|
add_executable(HelloAsm ${SRCS})
|
||||||
set_target_properties(HelloAsm PROPERTIES LINKER_LANGUAGE C)
|
|
||||||
|
|
Loading…
Reference in New Issue