make separate option for using nasm asm

Other asm is now enabled by default again, since asm blocks are now
smarter and won't fail to compile on non-i386 platforms.
This commit is contained in:
notaz 2016-04-24 21:38:59 +03:00
parent 1f70d4e242
commit ff57a29e0f
6 changed files with 23 additions and 17 deletions

View File

@ -188,13 +188,20 @@ else()
set(DEBUGSUFFIX "")
endif()
# This should not be needed anymore, but might be faster on 32bit x86
option(USE_I386_ASM "Use X86 ASM" FALSE)
option(USE_ASM "Use ASM code" TRUE)
if (USE_ASM)
MESSAGE(STATUS "Using assembler code (when available)")
else()
add_definitions(-DUSE_PORTABLE_C=1)
MESSAGE(STATUS "Using portable C instead of all ASM")
endif()
if (USE_I386_ASM)
option(USE_I386_NASM_ASM "Use i386 nasm ASM code" FALSE)
if (USE_ASM AND USE_I386_NASM_ASM)
# You need the Netwide Assembler (NASM) to build this on Intel systems.
# http://nasm.sf.net/
add_definitions(-DUSE_I386_ASM=1)
add_definitions(-DUSE_I386_NASM_ASM=1)
if (MACOSX)
set(ASMOBJFMT "macho")
list(APPEND ASMFLAGS --prefix _)
@ -203,10 +210,9 @@ if (USE_I386_ASM)
else()
set(ASMOBJFMT "elf")
endif()
MESSAGE(STATUS "Using i386 assembler")
MESSAGE(STATUS "Using i386 nasm ASM")
else()
add_definitions(-DUSE_PORTABLE_C=1)
MESSAGE(STATUS "Using portable C instead of ASM")
MESSAGE(STATUS "Not using i386 nasm ASM")
endif()
option(PANDORA "Compile for Pandora" FALSE)
@ -655,7 +661,7 @@ add_dependencies(${SHADERSLIB} ParseEntities)
add_parser_and_scanner("Engine/Base/Parser" "Engine/Base/Scanner")
add_parser_and_scanner("Engine/Ska/smcPars" "Engine/Ska/smcScan")
if (USE_I386_ASM)
if (USE_I386_NASM_ASM)
add_custom_command(
OUTPUT "SoundMixer386.o"
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/Engine/Sound/SoundMixer386.asm"

View File

@ -43,7 +43,7 @@ static CSoundData *psd;
// nasm on MacOS X is getting wrong addresses of external globals, so I have
// to define them in the .asm file...lame.
#if (defined __GNU_INLINE_X86_32__)
#if (defined __GNU_INLINE_X86_32__) && (defined USE_I386_NASM_ASM)
#define INASM extern
#elif (defined __MSVC_INLINE__)
#define INASM static
@ -283,7 +283,7 @@ void NormalizeMixerBuffer( const FLOAT fNormStrength, const SLONG slBytes, FLOAT
}
#ifdef __GNU_INLINE_X86_32__
#if (defined __GNU_INLINE_X86_32__) && (defined USE_I386_NASM_ASM)
// These are implemented in an external NASM file.
extern "C" {
void MixStereo_asm(CSoundObject *pso);
@ -430,7 +430,7 @@ loopEnd:
emms
}
#elif (defined __GNU_INLINE_X86_32__)
#elif (defined __GNU_INLINE_X86_32__) && (defined USE_I386_NASM_ASM)
// This is implemented in an external NASM file.
MixMono_asm(pso);
@ -658,7 +658,7 @@ loopEnd:
emms
}
#elif (defined __GNU_INLINE_X86_32__)
#elif (defined __GNU_INLINE_X86_32__) && (defined USE_I386_NASM_ASM)
// This is implemented in an external NASM file.
MixStereo_asm(pso);

View File

@ -14,10 +14,10 @@ cd $_
#ninja
# This is the eventual path for amd64.
#cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_I386_ASM=FALSE ..
#cmake -DCMAKE_BUILD_TYPE=Debug ..
# Right now we force x86, though...
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DUSE_I386_ASM=TRUE ..
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DUSE_I386_NASM_ASM=TRUE ..
make -j$NCPU

View File

@ -14,7 +14,7 @@ cd $_
#ninja
# This is the eventual path for amd64.
cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_I386_ASM=FALSE ..
cmake -DCMAKE_BUILD_TYPE=Debug ..
# Right now we force x86, though...
#cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 ..

View File

@ -9,6 +9,6 @@ set -x
rm -rf cmake-build
mkdir $_
cd $_
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES=i386 -DUSE_I386_ASM=TRUE -DUSE_SYSTEM_SDL2=FALSE ..
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES=i386 -DUSE_I386_NASM_ASM=TRUE -DUSE_SYSTEM_SDL2=FALSE ..
make -j$NCPU

View File

@ -9,6 +9,6 @@ set -x
rm -rf cmake-build
mkdir $_
cd $_
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES=x86_64 -DUSE_I386_ASM=FALSE ..
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES=x86_64 ..
make -j$NCPU