From e1fc9b902ac737c98ecaf236568d3e685ea3dce1 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sat, 25 Sep 2010 20:57:03 +0200 Subject: Add support for nasm assembler, patch by Peter Collingbourne (see #10069) Alex --- Modules/CMakeASM_NASMInformation.cmake | 30 ++++++++++++++++++++++++++++ Modules/CMakeDetermineASM_NASMCompiler.cmake | 13 ++++++++++++ Modules/CMakeTestASM_NASMCompiler.cmake | 9 +++++++++ 3 files changed, 52 insertions(+) create mode 100644 Modules/CMakeASM_NASMInformation.cmake create mode 100644 Modules/CMakeDetermineASM_NASMCompiler.cmake create mode 100644 Modules/CMakeTestASM_NASMCompiler.cmake diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake new file mode 100644 index 0000000..2a73aca --- /dev/null +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -0,0 +1,30 @@ +# support for the nasm assembler + +set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm) + +if(WIN32) + if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + SET(CMAKE_ASM_NASM_OBJECT_FORMAT win64) + else() + SET(CMAKE_ASM_NASM_OBJECT_FORMAT win32) + endif() +elseif(APPLE) + if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho64) + else() + SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho) + endif() +else() + if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) + else() + SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf) + endif() +endif() + +set(CMAKE_ASM_NASM_COMPILE_OBJECT " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") + +# Load the generic ASMInformation file: +set(ASM_DIALECT "_NASM") +include(CMakeASMInformation) +set(ASM_DIALECT) diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake new file mode 100644 index 0000000..2c8cda5 --- /dev/null +++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake @@ -0,0 +1,13 @@ +# Find the nasm assembler + +SET(CMAKE_ASM_NASM_COMPILER_INIT nasm) + +IF(NOT CMAKE_ASM_NASM_COMPILER) + FIND_PROGRAM(CMAKE_ASM_NASM_COMPILER nasm + "$ENV{ProgramFiles}/NASM") +ENDIF(NOT CMAKE_ASM_NASM_COMPILER) + +# Load the generic DetermineASM compiler file with the DIALECT set properly: +SET(ASM_DIALECT "_NASM") +INCLUDE(CMakeDetermineASMCompiler) +SET(ASM_DIALECT) diff --git a/Modules/CMakeTestASM_NASMCompiler.cmake b/Modules/CMakeTestASM_NASMCompiler.cmake new file mode 100644 index 0000000..ba0e658 --- /dev/null +++ b/Modules/CMakeTestASM_NASMCompiler.cmake @@ -0,0 +1,9 @@ +# This file is used by EnableLanguage in cmGlobalGenerator to +# determine that the selected ASM_NASM "compiler" works. +# For assembler this can only check whether the compiler has been found, +# because otherwise there would have to be a separate assembler source file +# for each assembler on every architecture. + +SET(ASM_DIALECT "_NASM") +INCLUDE(CMakeTestASMCompiler) +SET(ASM_DIALECT) -- cgit v0.12 From 7b337ac8e20437bf134319bf3131505f69892447 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sat, 25 Sep 2010 21:00:52 +0200 Subject: Improve misleading comments. (the assembler is not really tested) Alex --- Modules/CMakeTestASM-ATTCompiler.cmake | 8 ++++---- Modules/CMakeTestASMCompiler.cmake | 9 +++++---- Modules/CMakeTestASM_MASMCompiler.cmake | 8 ++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Modules/CMakeTestASM-ATTCompiler.cmake b/Modules/CMakeTestASM-ATTCompiler.cmake index 3b7a74f..581ad0c 100644 --- a/Modules/CMakeTestASM-ATTCompiler.cmake +++ b/Modules/CMakeTestASM-ATTCompiler.cmake @@ -13,10 +13,10 @@ # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to -# determine that that selected ASM-ATT compiler can actually compile -# and link the most basic of programs. If not, a fatal error -# is set and cmake stops processing commands and will not generate -# any makefiles or projects. +# determine that the selected ASM-ATT "compiler" works. +# For assembler this can only check whether the compiler has been found, +# because otherwise there would have to be a separate assembler source file +# for each assembler on every architecture. SET(ASM_DIALECT "-ATT") INCLUDE(CMakeTestASMCompiler) diff --git a/Modules/CMakeTestASMCompiler.cmake b/Modules/CMakeTestASMCompiler.cmake index 54def81..56cf332 100644 --- a/Modules/CMakeTestASMCompiler.cmake +++ b/Modules/CMakeTestASMCompiler.cmake @@ -13,10 +13,11 @@ # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to -# determine that that selected ASM compiler can actually compile -# and link the most basic of programs. If not, a fatal error -# is set and cmake stops processing commands and will not generate -# any makefiles or projects. +# determine that the selected ASM compiler works. +# For assembler this can only check whether the compiler has been found, +# because otherwise there would have to be a separate assembler source file +# for each assembler on every architecture. + IF(CMAKE_ASM${ASM_DIALECT}_COMPILER) SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_WORKS 1 CACHE INTERNAL "") ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER) diff --git a/Modules/CMakeTestASM_MASMCompiler.cmake b/Modules/CMakeTestASM_MASMCompiler.cmake index 84ca98f..8369b94 100644 --- a/Modules/CMakeTestASM_MASMCompiler.cmake +++ b/Modules/CMakeTestASM_MASMCompiler.cmake @@ -13,10 +13,10 @@ # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to -# determine that the selected ASM_MASM "compiler" (should be masm or masm64) -# can actually "compile" and link the most basic of programs. If not, a -# fatal error is set and cmake stops processing commands and will not generate -# any makefiles or projects. +# determine that the selected ASM_MASM "compiler" (should be masm or masm64) +# works. For assembler this can only check whether the compiler has been found, +# because otherwise there would have to be a separate assembler source file +# for each assembler on every architecture. SET(ASM_DIALECT "_MASM") INCLUDE(CMakeTestASMCompiler) -- cgit v0.12 From ffeca06a93eca70ef7505ac087cbb246e5191ed2 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Mon, 27 Sep 2010 18:04:34 +0200 Subject: Add missing copyright headers Alex --- Modules/CMakeASM_NASMInformation.cmake | 14 ++++++++++++++ Modules/CMakeDetermineASM_NASMCompiler.cmake | 14 ++++++++++++++ Modules/CMakeTestASM_NASMCompiler.cmake | 14 ++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake index 2a73aca..ca9b8ae 100644 --- a/Modules/CMakeASM_NASMInformation.cmake +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -1,3 +1,17 @@ + +#============================================================================= +# Copyright 2008-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + # support for the nasm assembler set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm) diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake index 2c8cda5..41326ee 100644 --- a/Modules/CMakeDetermineASM_NASMCompiler.cmake +++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake @@ -1,3 +1,17 @@ + +#============================================================================= +# Copyright 2008-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + # Find the nasm assembler SET(CMAKE_ASM_NASM_COMPILER_INIT nasm) diff --git a/Modules/CMakeTestASM_NASMCompiler.cmake b/Modules/CMakeTestASM_NASMCompiler.cmake index ba0e658..477c43b 100644 --- a/Modules/CMakeTestASM_NASMCompiler.cmake +++ b/Modules/CMakeTestASM_NASMCompiler.cmake @@ -1,3 +1,17 @@ + +#============================================================================= +# Copyright 2008-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that the selected ASM_NASM "compiler" works. # For assembler this can only check whether the compiler has been found, -- cgit v0.12 From 79dd9becadd39b518a90bbe4c86cd17a57ab1d54 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Mon, 27 Sep 2010 22:14:39 +0200 Subject: We already have 2010, fix copyright year. Alex --- Modules/CMakeASM_NASMInformation.cmake | 2 +- Modules/CMakeDetermineASM_NASMCompiler.cmake | 2 +- Modules/CMakeTestASM_NASMCompiler.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake index ca9b8ae..4b533a7 100644 --- a/Modules/CMakeASM_NASMInformation.cmake +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2008-2009 Kitware, Inc. +# Copyright 2010 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake index 41326ee..18aa813 100644 --- a/Modules/CMakeDetermineASM_NASMCompiler.cmake +++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2008-2009 Kitware, Inc. +# Copyright 2010 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. diff --git a/Modules/CMakeTestASM_NASMCompiler.cmake b/Modules/CMakeTestASM_NASMCompiler.cmake index 477c43b..a5e2bea 100644 --- a/Modules/CMakeTestASM_NASMCompiler.cmake +++ b/Modules/CMakeTestASM_NASMCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2008-2009 Kitware, Inc. +# Copyright 2010 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. -- cgit v0.12 From e614e9b3d7387b5aa1611f5547744e84b3a0645f Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Thu, 21 Oct 2010 20:51:46 +0200 Subject: Add support for yasm, a nasm compatible assembler Alex --- Modules/CMakeASM_NASMInformation.cmake | 2 +- Modules/CMakeDetermineASM_NASMCompiler.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake index 4b533a7..afe53b3 100644 --- a/Modules/CMakeASM_NASMInformation.cmake +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -14,7 +14,7 @@ # support for the nasm assembler -set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm) +set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm asm) if(WIN32) if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake index 18aa813..d184c0a 100644 --- a/Modules/CMakeDetermineASM_NASMCompiler.cmake +++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake @@ -12,9 +12,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# Find the nasm assembler +# Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible -SET(CMAKE_ASM_NASM_COMPILER_INIT nasm) +SET(CMAKE_ASM_NASM_COMPILER_INIT nasm yasm) IF(NOT CMAKE_ASM_NASM_COMPILER) FIND_PROGRAM(CMAKE_ASM_NASM_COMPILER nasm -- cgit v0.12 From d25c2eb0c0a942d60826e6263d96a2ba59b97b92 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Thu, 21 Oct 2010 20:57:14 +0200 Subject: Use CMAKE_ASM_NASM_FLAGS for nasm instead of FLAGS Alex --- Modules/CMakeASM_NASMInformation.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake index afe53b3..449d1d6 100644 --- a/Modules/CMakeASM_NASMInformation.cmake +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -36,7 +36,7 @@ else() endif() endif() -set(CMAKE_ASM_NASM_COMPILE_OBJECT " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") +set(CMAKE_ASM_NASM_COMPILE_OBJECT " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") # Load the generic ASMInformation file: set(ASM_DIALECT "_NASM") -- cgit v0.12 From e0b60166d4c8526db0cf2e8b1eae49ba8ed45ff6 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Fri, 12 Nov 2010 20:27:18 +0100 Subject: Some more fixes for nasm support, from Etienne (#10069) Alex --- Modules/CMakeASM_NASMInformation.cmake | 36 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake index 449d1d6..9da7d30 100644 --- a/Modules/CMakeASM_NASMInformation.cmake +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -16,27 +16,29 @@ set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm asm) -if(WIN32) - if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) - SET(CMAKE_ASM_NASM_OBJECT_FORMAT win64) +if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT) + if(WIN32) + if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + SET(CMAKE_ASM_NASM_OBJECT_FORMAT win64) + else() + SET(CMAKE_ASM_NASM_OBJECT_FORMAT win32) + endif() + elseif(APPLE) + if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho64) + else() + SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho) + endif() else() - SET(CMAKE_ASM_NASM_OBJECT_FORMAT win32) - endif() -elseif(APPLE) - if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) - SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho64) - else() - SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho) - endif() -else() - if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) - SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) - else() - SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf) + if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) + else() + SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf) + endif() endif() endif() -set(CMAKE_ASM_NASM_COMPILE_OBJECT " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") +set(CMAKE_ASM_NASM_COMPILE_OBJECT " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") # Load the generic ASMInformation file: set(ASM_DIALECT "_NASM") -- cgit v0.12