diff --git a/CMakeLists.txt b/CMakeLists.txt index 058d4e4d..1e4c1c29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,15 @@ -# The project's name is VBA-M it uses assembly, C and C++ code -PROJECT(VBA-M ASM C CXX) +# The project's name is VBA-M it uses C and C++ code +PROJECT(VBA-M C CXX) -cmake_minimum_required( VERSION 2.4.6 ) +cmake_minimum_required( VERSION 2.6.0 ) if( COMMAND cmake_policy ) cmake_policy( SET CMP0003 NEW ) cmake_policy( SET CMP0005 OLD ) endif( COMMAND cmake_policy ) SET( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts ) -# Include the definition of the ASM compiler. It will look for nasm -# This is probably not needed if CMake 2.6 or above is used -INCLUDE(CMakeScripts/CMakeDetermineASMCompiler.cmake) -INCLUDE(CMakeScripts/CMakeASMInformation.cmake) +# Check for nasm +ENABLE_LANGUAGE( ASM_NASM ) # Also need to look for SFML INCLUDE(CMakeScripts/FindSFML.cmake) @@ -118,9 +116,9 @@ ENDIF( NOT USE_ASM_CORE ) # Compiler flags 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 ) - 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 ) SET( CMAKE_C_FLAGS "-O3 -Wall") SET( CMAKE_CXX_FLAGS "-O3 -Wall") @@ -273,11 +271,11 @@ IF( 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}) -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}) -ENDIF(CMAKE_ASM_COMPILER_LOADED AND USE_ASM_SCALERS) +ENDIF(CMAKE_ASM_NASM_COMPILER_LOADED AND USE_ASM_SCALERS) INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR} diff --git a/CMakeScripts/CMakeASMCompiler.cmake.in b/CMakeScripts/CMakeASMCompiler.cmake.in deleted file mode 100644 index a23bcd74..00000000 --- a/CMakeScripts/CMakeASMCompiler.cmake.in +++ /dev/null @@ -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) diff --git a/CMakeScripts/CMakeASMInformation.cmake b/CMakeScripts/CMakeASMInformation.cmake deleted file mode 100644 index 165695d4..00000000 --- a/CMakeScripts/CMakeASMInformation.cmake +++ /dev/null @@ -1,11 +0,0 @@ -IF(NOT CMAKE_ASM_COMPILE_OBJECT) - IF(UNIX AND NOT CYGWIN) - SET(CMAKE_ASM_COMPILE_OBJECT " -f elf -o ") - ENDIF(UNIX AND NOT CYGWIN) - IF(CYGWIN) - SET(CMAKE_ASM_COMPILE_OBJECT " -f gnuwin32 -o ") - ENDIF(CYGWIN) - IF(WIN32) - SET(CMAKE_ASM_COMPILE_OBJECT " -f win32 -DWIN32 -o -c ") - ENDIF(WIN32) -ENDIF(NOT CMAKE_ASM_COMPILE_OBJECT) diff --git a/CMakeScripts/CMakeASM_NASMInformation.cmake b/CMakeScripts/CMakeASM_NASMInformation.cmake new file mode 100644 index 00000000..6c394da1 --- /dev/null +++ b/CMakeScripts/CMakeASM_NASMInformation.cmake @@ -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 " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") + +# Load the generic ASMInformation file: +set(ASM_DIALECT "_NASM") +include(CMakeASMInformation) +set(ASM_DIALECT) diff --git a/CMakeScripts/CMakeDetermineASMCompiler.cmake b/CMakeScripts/CMakeDetermineASMCompiler.cmake deleted file mode 100644 index edbe7bea..00000000 --- a/CMakeScripts/CMakeDetermineASMCompiler.cmake +++ /dev/null @@ -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") diff --git a/CMakeScripts/CMakeDetermineASM_NASMCompiler.cmake b/CMakeScripts/CMakeDetermineASM_NASMCompiler.cmake new file mode 100644 index 00000000..d184c0a8 --- /dev/null +++ b/CMakeScripts/CMakeDetermineASM_NASMCompiler.cmake @@ -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) diff --git a/CMakeScripts/CMakeTestASM_NASMCompiler.cmake b/CMakeScripts/CMakeTestASM_NASMCompiler.cmake new file mode 100644 index 00000000..a5e2bea0 --- /dev/null +++ b/CMakeScripts/CMakeTestASM_NASMCompiler.cmake @@ -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)