[CMAKE/ARM]

* Add armasm assembler support. Inspired by Yuntian Zhang's patch.
CORE-7439

svn path=/trunk/; revision=63468
This commit is contained in:
Amine Khaldi 2014-05-26 15:28:12 +00:00
parent 9d2d8d8d7d
commit 5d6f7e30d2
2 changed files with 42 additions and 7 deletions

View file

@ -103,9 +103,15 @@ else()
set(rc_nologo_flag)
endif()
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_nologo_flag} <FLAGS> <DEFINES> ${I18N_DEFS} /fo<OBJECT> <SOURCE>")
set(CMAKE_ASM_COMPILE_OBJECT
"cl ${cl_includes_flag} /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
"<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <OBJECT>.tmp")
if(ARCH STREQUAL "arm")
set(CMAKE_ASM_COMPILE_OBJECT
"cl ${cl_includes_flag} /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
"<CMAKE_ASM_COMPILER> -nologo -o <OBJECT> <OBJECT>.tmp")
else()
set(CMAKE_ASM_COMPILE_OBJECT
"cl ${cl_includes_flag} /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
"<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <OBJECT>.tmp")
endif()
endif()
if(_VS_ANALYZE_)
@ -222,7 +228,13 @@ endfunction()
# Define those for having real libraries
set(CMAKE_IMPLIB_CREATE_STATIC_LIBRARY "LINK /LIB /NOLOGO <LINK_FLAGS> /OUT:<TARGET> <OBJECTS>")
set(CMAKE_STUB_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <SOURCE>")
if(ARCH STREQUAL "arm")
set(CMAKE_STUB_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -nologo -o <OBJECT> <SOURCE>")
else()
set(CMAKE_STUB_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <SOURCE>")
endif()
function(add_delay_importlibs _module)
get_target_property(_module_type ${_module} TYPE)
if(_module_type STREQUAL "STATIC_LIBRARY")
@ -248,9 +260,14 @@ function(generate_import_lib _libname _dllname _spec_file)
if(MSVC_IDE)
# Compile the generated asm stub file
if(ARCH STREQUAL "arm")
set(_asm_stub_command ${CMAKE_ASM_COMPILER} -nologo -o ${_asm_stubs_file}.obj ${_asm_stubs_file})
else()
set(_asm_stub_command ${CMAKE_ASM_COMPILER} /Cp /Fo${_asm_stubs_file}.obj /c /Ta ${_asm_stubs_file})
endif()
add_custom_command(
OUTPUT ${_asm_stubs_file}.obj
COMMAND ${CMAKE_ASM_COMPILER} /Cp /Fo${_asm_stubs_file}.obj /c /Ta ${_asm_stubs_file}
COMMAND ${_asm_stub_command}
DEPENDS ${_asm_stubs_file})
else()
# Be clear about the "language"
@ -276,6 +293,9 @@ endfunction()
if(ARCH STREQUAL "amd64")
add_definitions(/D__x86_64)
set(SPEC2DEF_ARCH x86_64)
elseif(ARCH STREQUAL "arm")
add_definitions(/D__arm__)
set(SPEC2DEF_ARCH arm)
else()
set(SPEC2DEF_ARCH i386)
endif()
@ -320,6 +340,8 @@ set(PSEH_LIB "pseh")
# both the x86 and x64 versions of ml are available.
if((ARCH STREQUAL "amd64") AND (DEFINED ENV{VCINSTALLDIR}))
set(CMAKE_ASM16_COMPILER $ENV{VCINSTALLDIR}/bin/ml.exe)
elseif(ARCH STREQUAL "arm")
set(CMAKE_ASM16_COMPILER armasm.exe)
else()
set(CMAKE_ASM16_COMPILER ml.exe)
endif()
@ -333,9 +355,15 @@ function(CreateBootSectorTarget _target_name _asm_file _binary_file _base_addres
COMMAND ${CMAKE_C_COMPILER} /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm /D__ASM__ /D_USE_ML /EP /c ${_asm_file} > ${_temp_file}
DEPENDS ${_asm_file})
if(ARCH STREQUAL "arm")
set(_asm16_command ${CMAKE_ASM16_COMPILER} -nologo -o ${_object_file} ${_temp_file})
else()
set(_asm16_command ${CMAKE_ASM16_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_temp_file})
endif()
add_custom_command(
OUTPUT ${_object_file}
COMMAND ${CMAKE_ASM16_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_temp_file}
COMMAND ${_asm16_command}
DEPENDS ${_temp_file})
add_custom_command(
@ -368,9 +396,14 @@ macro(add_asm_files _target)
list(APPEND _source_file_defines -D${_define})
endif()
endforeach()
if(ARCH STREQUAL "arm")
set(_pp_asm_compile_command ${CMAKE_ASM_COMPILER} -nologo -o ${_object_file} ${_preprocessed_asm_file})
else()
set(_pp_asm_compile_command ${CMAKE_ASM_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_preprocessed_asm_file})
endif()
add_custom_command(
OUTPUT ${_preprocessed_asm_file} ${_object_file}
COMMAND cl /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm ${_directory_includes} ${_source_file_defines} ${_directory_defines} /D__ASM__ /D_USE_ML /EP /c ${_source_file_full_path} > ${_preprocessed_asm_file} && ${CMAKE_ASM_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_preprocessed_asm_file}
COMMAND cl /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm ${_directory_includes} ${_source_file_defines} ${_directory_defines} /D__ASM__ /D_USE_ML /EP /c ${_source_file_full_path} > ${_preprocessed_asm_file} && ${_pp_asm_compile_command}
DEPENDS ${_source_file_full_path})
set_source_files_properties(${_object_file} PROPERTIES EXTERNAL_OBJECT 1)
list(APPEND ${_target} ${_object_file})

View file

@ -21,6 +21,8 @@ set(CMAKE_MC_COMPILER mc)
set(CMAKE_RC_COMPILER rc)
if(ARCH STREQUAL "amd64")
set(CMAKE_ASM_COMPILER ml64)
elseif(ARCH STREQUAL "arm")
set(CMAKE_ASM_COMPILER armasm)
else()
set(CMAKE_ASM_COMPILER ml)
endif()