CMAKE: Use built in support for ASM compilers. Bump required version to 2.6.0

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@984 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
bgk 2011-02-20 13:31:49 +00:00
parent c7a3ab4c33
commit c4307833f9
7 changed files with 106 additions and 46 deletions

View File

@ -1,17 +1,15 @@
# The project's name is VBA-M it uses assembly, C and C++ code # The project's name is VBA-M it uses C and C++ code
PROJECT(VBA-M ASM C CXX) PROJECT(VBA-M C CXX)
cmake_minimum_required( VERSION 2.4.6 ) cmake_minimum_required( VERSION 2.6.0 )
if( COMMAND cmake_policy ) if( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW ) cmake_policy( SET CMP0003 NEW )
cmake_policy( SET CMP0005 OLD ) cmake_policy( SET CMP0005 OLD )
endif( COMMAND cmake_policy ) endif( COMMAND cmake_policy )
SET( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts ) SET( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts )
# Include the definition of the ASM compiler. It will look for nasm # Check for nasm
# This is probably not needed if CMake 2.6 or above is used ENABLE_LANGUAGE( ASM_NASM )
INCLUDE(CMakeScripts/CMakeDetermineASMCompiler.cmake)
INCLUDE(CMakeScripts/CMakeASMInformation.cmake)
# Also need to look for SFML # Also need to look for SFML
INCLUDE(CMakeScripts/FindSFML.cmake) INCLUDE(CMakeScripts/FindSFML.cmake)
@ -118,9 +116,9 @@ ENDIF( NOT USE_ASM_CORE )
# Compiler flags # Compiler flags
IF ( WIN32 ) IF ( WIN32 )
SET( CMAKE_ASM_FLAGS "-I$(CMAKE_SOURCE_DIR)/src/filters/hq/asm/ -O1 -w-orphan-labels") SET( CMAKE_ASM_NASM_FLAGS "-I$(CMAKE_SOURCE_DIR)/src/filters/hq/asm/ -O1 -w-orphan-labels")
ELSE ( WIN32 ) ELSE ( WIN32 )
SET( CMAKE_ASM_FLAGS "-I$(CMAKE_SOURCE_DIR)/src/filters/hq/asm/ -O1 -DELF -w-orphan-labels") SET( CMAKE_ASM_NASM_FLAGS "-I$(CMAKE_SOURCE_DIR)/src/filters/hq/asm/ -O1 -DELF -w-orphan-labels")
ENDIF ( WIN32 ) ENDIF ( WIN32 )
SET( CMAKE_C_FLAGS "-O3 -Wall") SET( CMAKE_C_FLAGS "-O3 -Wall")
SET( CMAKE_CXX_FLAGS "-O3 -Wall") SET( CMAKE_CXX_FLAGS "-O3 -Wall")
@ -273,11 +271,11 @@ IF( NOT NO_DEBUGGER )
) )
ENDIF( NOT NO_DEBUGGER ) ENDIF( NOT NO_DEBUGGER )
IF(CMAKE_ASM_COMPILER_LOADED AND USE_ASM_SCALERS) IF(CMAKE_ASM_NASM_COMPILER_LOADED AND USE_ASM_SCALERS)
SET(SRC_HQ ${SRC_HQ_ASM}) SET(SRC_HQ ${SRC_HQ_ASM})
ELSE(CMAKE_ASM_COMPILER_LOADED AND USE_ASM_SCALERS) ELSE(CMAKE_ASM_NASM_COMPILER_LOADED AND USE_ASM_SCALERS)
SET(SRC_HQ ${SRC_HQ_C}) SET(SRC_HQ ${SRC_HQ_C})
ENDIF(CMAKE_ASM_COMPILER_LOADED AND USE_ASM_SCALERS) ENDIF(CMAKE_ASM_NASM_COMPILER_LOADED AND USE_ASM_SCALERS)
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${ZLIB_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}

View File

@ -1,12 +0,0 @@
SET(CMAKE_ASM_COMPILER "@CMAKE_ASM_COMPILER@")
SET(CMAKE_ASM_COMPILER_LOADED 1)
SET(CMAKE_ASM_COMPILER_ENV_VAR "ASM")
SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS nasm;asm;nas)
SET(CMAKE_ASM_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_ASM_LINKER_PREFERENCE None)
IF(UNIX)
SET(CMAKE_ASM_OUTPUT_EXTENSION .o)
ELSE(UNIX)
SET(CMAKE_ASM_OUTPUT_EXTENSION .obj)
ENDIF(UNIX)

View File

@ -1,11 +0,0 @@
IF(NOT CMAKE_ASM_COMPILE_OBJECT)
IF(UNIX AND NOT CYGWIN)
SET(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -f elf <FLAGS> -o <OBJECT> <SOURCE>")
ENDIF(UNIX AND NOT CYGWIN)
IF(CYGWIN)
SET(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -f gnuwin32 <FLAGS> -o <OBJECT> <SOURCE>")
ENDIF(CYGWIN)
IF(WIN32)
SET(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -f win32 -DWIN32 <FLAGS> -o <OBJECT> -c <SOURCE>")
ENDIF(WIN32)
ENDIF(NOT CMAKE_ASM_COMPILE_OBJECT)

View File

@ -0,0 +1,46 @@
#=============================================================================
# Copyright 2010 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 asm)
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 macho32)
endif()
else()
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
else()
SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf32)
endif()
endif()
endif()
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
# Load the generic ASMInformation file:
set(ASM_DIALECT "_NASM")
include(CMakeASMInformation)
set(ASM_DIALECT)

View File

@ -1,11 +0,0 @@
IF(NOT CMAKE_ASM_COMPILER)
FIND_PROGRAM(CMAKE_ASM_COMPILER NAMES nasm )
ENDIF(NOT CMAKE_ASM_COMPILER)
MARK_AS_ADVANCED(CMAKE_ASM_COMPILER)
# configure variables set in this file for fast reload later on
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/CMakeScripts/CMakeASMCompiler.cmake.in
${CMAKE_BINARY_DIR}/CMakeFiles/CMakeASMCompiler.cmake
IMMEDIATE)
SET(CMAKE_ASM_COMPILER_ENV_VAR "ASM")

View File

@ -0,0 +1,27 @@
#=============================================================================
# Copyright 2010 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. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible
SET(CMAKE_ASM_NASM_COMPILER_INIT nasm yasm)
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)

View File

@ -0,0 +1,23 @@
#=============================================================================
# Copyright 2010 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,
# 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)