cmake: Use preprocessor for conditional compilation in Common

CommonExtra is gone!
Still need to fix CommonFake later though.
This commit is contained in:
Florent Castelli 2016-10-11 03:26:33 +02:00
parent fef8847a58
commit 83aaf30207
8 changed files with 73 additions and 52 deletions

View File

@ -312,16 +312,7 @@ endmacro()
# Commented-out files are files that don't compile # Commented-out files are files that don't compile
# and were disabled in the original MSVC project anyway # and were disabled in the original MSVC project anyway
set(CommonExtra) set(CommonX86
if(ARM)
set(CommonExtra ${CommonExtra}
Common/ArmCPUDetect.cpp)
if(ARMV7)
set(CommonExtra ${CommonExtra}
Common/ColorConvNEON.cpp)
endif()
elseif(X86)
set(CommonExtra ${CommonExtra}
Common/ABI.cpp Common/ABI.cpp
Common/ABI.h Common/ABI.h
Common/CPUDetect.cpp Common/CPUDetect.cpp
@ -332,39 +323,48 @@ elseif(X86)
Common/x64Analyzer.h Common/x64Analyzer.h
Common/x64Emitter.cpp Common/x64Emitter.cpp
Common/x64Emitter.h) Common/x64Emitter.h)
elseif(MIPS) source_group(x86 FILES ${CommonX86})
set(CommonExtra ${CommonExtra}
Common/MipsCPUDetect.cpp
Common/MipsEmitter.cpp
Common/MipsEmitter.h)
else()
set(CommonExtra ${CommonExtra}
Common/FakeCPUDetect.cpp
Common/FakeEmitter.h)
endif()
if(UNITTEST) set(CommonARM
set(CommonExtra ${CommonExtra} Common/ArmCPUDetect.cpp
Common/ArmEmitter.h
Common/ArmEmitter.cpp
Common/ColorConvNEON.cpp)
source_group(ARM FILES ${CommonARM})
set(CommonARM64
Common/Arm64Emitter.h Common/Arm64Emitter.h
Common/Arm64Emitter.cpp Common/Arm64Emitter.cpp
Common/ArmEmitter.h Common/ArmEmitter.h
Common/ArmEmitter.cpp Common/ArmEmitter.cpp
Core/Util/DisArm64.cpp) Core/Util/DisArm64.cpp)
else() source_group(ARM64 FILES ${CommonARM64})
#Blackberry appears to depend on this being here, should clean it up.
set(CommonExtra ${CommonExtra} set(CommonMIPS
Common/ArmEmitter.h Common/MipsCPUDetect.cpp
Common/ArmEmitter.cpp) Common/MipsEmitter.cpp
Common/MipsEmitter.h)
source_group(MIPS FILES ${CommonMIPS})
if(NOT (X86 OR ARM OR MIPS))
set(CommonFake
Common/FakeCPUDetect.cpp
Common/FakeEmitter.h)
source_group(Fake FILES ${CommonFake})
endif() endif()
if(WIN32) set(CommonWindows
set(CommonExtra ${CommonExtra}
Common/stdafx.cpp Common/stdafx.cpp
Common/stdafx.h) Common/stdafx.h)
endif() source_group(Windows FILES ${CommonWindows})
add_library(Common STATIC add_library(Common STATIC
${CommonExtra} ${CommonX86}
${CommonARM}
${CommonARM64}
${CommonMIPS}
${CommonFake}
${CommonWindows}
Common/ColorConv.cpp Common/ColorConv.cpp
Common/ColorConv.h Common/ColorConv.h
Common/ChunkFile.cpp Common/ChunkFile.cpp

View File

@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#if defined(_M_IX86) || defined(_M_X64)
#include "x64Emitter.h" #include "x64Emitter.h"
#include "ABI.h" #include "ABI.h"
@ -679,4 +681,4 @@ void XEmitter::ABI_RestoreStack(unsigned int /*frameSize*/) {
#endif // 32bit #endif // 32bit
#endif // defined(_M_IX86) || defined(_M_X64)

View File

@ -18,6 +18,10 @@
#include "CommonTypes.h" #include "CommonTypes.h"
#include "CPUDetect.h" #include "CPUDetect.h"
#ifdef IOS
#include <libkern/OSCacheControl.h>
#endif
namespace Arm64Gen namespace Arm64Gen
{ {

View File

@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#if defined(__arm__) || defined(__aarch64__)
#include <ctype.h> #include <ctype.h>
#include "Common.h" #include "Common.h"
#include "CPUDetect.h" #include "CPUDetect.h"
@ -299,3 +301,5 @@ std::string CPUInfo::Summarize()
return sum; return sum;
} }
#endif // defined(__arm__) || defined(__aarch64__)

View File

@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#if defined(_M_IX86) || defined(_M_X64)
#ifdef ANDROID #ifdef ANDROID
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
@ -285,3 +287,5 @@ std::string CPUInfo::Summarize()
if (bLongMode) sum += ", 64-bit support"; if (bLongMode) sum += ", 64-bit support";
return sum; return sum;
} }
#endif // defined(_M_IX86) || defined(_M_X64)

View File

@ -15,15 +15,13 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#if defined(__arm__) || defined(__aarch64__)
#include <arm_neon.h> #include <arm_neon.h>
#include "ColorConvNEON.h" #include "ColorConvNEON.h"
#include "Common.h" #include "Common.h"
#include "CPUDetect.h" #include "CPUDetect.h"
#if !defined(ARM) && !defined(ARM64)
#error Should not be compiled on non-ARM.
#endif
// TODO: More NEON color conversion funcs. // TODO: More NEON color conversion funcs.
void ConvertRGBA4444ToABGR4444NEON(u16 *dst, const u16 *src, const u32 numPixels) { void ConvertRGBA4444ToABGR4444NEON(u16 *dst, const u16 *src, const u32 numPixels) {
@ -109,3 +107,5 @@ void ConvertRGB565ToBGR565NEON(u16 *dst, const u16 *src, const u32 numPixels) {
ConvertRGB565ToBGR565Basic(dstp, srcp, numPixels - simdable); ConvertRGB565ToBGR565Basic(dstp, srcp, numPixels - simdable);
} }
} }
#endif // defined(__arm__) || defined(__aarch64__)

View File

@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifdef __mips__
#include "Common.h" #include "Common.h"
#include "CPUDetect.h" #include "CPUDetect.h"
#include "StringUtils.h" #include "StringUtils.h"
@ -196,3 +198,5 @@ std::string CPUInfo::Summarize()
return sum; return sum;
} }
#endif // __mips__

View File

@ -2,7 +2,10 @@
// Common.pch will be the pre-compiled header // Common.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information // stdafx.obj will contain the pre-compiled type information
#ifdef _WIN32
#include "stdafx.h" #include "stdafx.h"
#endif
// TODO: reference any additional headers you need in STDAFX.H // TODO: reference any additional headers you need in STDAFX.H
// and not in this file // and not in this file