[CMake] assembly files with masm in vs2005 64bit
Alexander Neundorf
a.neundorf-work at gmx.net
Tue Oct 28 16:45:22 EDT 2008
Hi Bram,
On Tuesday 28 October 2008, Bram de Greve wrote:
...
> Hi Alex,
>
> On the nmake front: the problem with the unresolved symbols is one of
> building a DLL instead of static library, and the symbols don't get
> exported ... So, at least, I'm successful at using masm with nmake.
>
> That still leaves open the issue of the visual studio projects not
> including any build rule for the assembly. So it's not a build rule that
> fails, but it is simply missing ...
Hmm, I think Bill or Brad can help better with this.
...
> For comparison, this is what I get using the nmake generator (which
> immediately gives you the locations requested for. it can be assumed
> ml64.exe is next to cl.exe):
>
> The C compiler identification is MSVC
> The CXX compiler identification is MSVC
> Check for CL compiler version
> Check for CL compiler version - 1400
> Check if this is a free VC compiler
> Check if this is a free VC compiler - no
> Check CL platform
> Check CL platform - 64 bit
> Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
> Studio 8/VC/bin/amd64/cl.exe
> Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
> Studio 8/VC/bin/amd64/cl.exe -- works
> Detecting C compiler ABI info
> Detecting C compiler ABI info - done
> Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
> Studio 8/VC/bin/amd64/cl.exe
> Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
> Studio 8/VC/bin/amd64/cl.exe -- works
> Detecting CXX compiler ABI info
> Detecting CXX compiler ABI info - done
> CMAKE_C_COMPILER_PATH: -
> CMAKE_C_COMPILER: -C:/Program Files (x86)/Microsoft Visual Studio
> 8/VC/bin/amd64/cl.exe
> TOOLCHAIN LOCATION: -C:/Program Files (x86)/Microsoft Visual Studio
> 8/VC/bin/amd64
> Found assembler: C:/Program Files (x86)/Microsoft Visual Studio
> 8/VC/bin/amd64/ml64.exe
> Loaded CMakeASM_MASMInformation - ASM_MASM support is still experimental,
> please report issues
Ok.
Please check if nmake works out of the box if you use the two attached files
and let me know.
The location of the C compiler is now used as additional search path for the
assembler and it also checks if a 32 or 64 bit compiler are used and searches
for ml.exe and ml64.exe respectively.
Alex
-------------- next part --------------
# determine the compiler to use for ASM programs
message(STATUS "CMAKE_C_COMPILER_PATH: -${_CMAKE_USER_C_COMPILER_PATH}")
message(STATUS "CMAKE_C_COMPILER: -${CMAKE_C_COMPILER}")
message(STATUS "TOOLCHAIN LOCATION: -${_CMAKE_TOOLCHAIN_LOCATION}")
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
# prefer the environment variable ASM
IF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}")
ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
# finally list compilers to try
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)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}as ${_CMAKE_TOOLCHAIN_PREFIX}gas)
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
# Find the compiler.
IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_USER_C_COMPILER_PATH} ${_CMAKE_USER_CXX_COMPILER_PATH} DOC "Assembler" NO_DEFAULT_PATH)
ENDIF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_TOOLCHAIN_LOCATION} DOC "Assembler")
ELSE(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
# we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt
# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
#
# if a compiler was specified by the user but without path,
# now try to find it with the full path
# if it is found, force it into the cache,
# if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
GET_FILENAME_COMPONENT(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
IF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER})
MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER ${CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH} CACHE FILEPATH "Assembler" FORCE)
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
ENDIF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_COMPILER)
IF (NOT _CMAKE_TOOLCHAIN_LOCATION)
GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
# If we have a gcc cross compiler, they have usually some prefix, like
# e.g. powerpc-linux-gcc, arm-elf-gcc or i586-mingw32msvc-gcc .
# The other tools of the toolchain usually have the same prefix
# NAME_WE cannot be used since then this test will fail for names lile
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME)
IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(\\.exe)?$")
STRING(REGEX REPLACE "^(.+-)g?as(\\.exe)?$" "\\1" _CMAKE_TOOLCHAIN_PREFIX "${COMPILER_BASENAME}")
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(\\.exe)?$")
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
INCLUDE(CMakeFindBinUtils)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM")
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
MESSAGE(STATUS "Found assembler: ${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER)
MESSAGE(STATUS "Didn't find assembler")
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}")
SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}")
# configure variables set in this file for fast reload later on
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY)
SET(_CMAKE_ASM_COMPILER)
SET(_CMAKE_ASM_COMPILER_ARG1)
SET(_CMAKE_ASM_COMPILER_ENV_VAR)
-------------- next part --------------
# determine the compiler to use for ASM using AT&T syntax
SET(ASM_DIALECT "_MASM")
# if we are using the 64bit cl compiler, assume we also want the 64bit assembler
IF(CMAKE_CL_64)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64)
ELSE(CMAKE_CL_64)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml)
ENDIF(CMAKE_CL_64)
INCLUDE(CMakeDetermineASMCompiler)
SET(ASM_DIALECT)
More information about the CMake
mailing list