Merge pull request #16620 from unknownbrackets/armips-flag

Build: Allow compiling without armips
This commit is contained in:
Henrik Rydgård 2022-12-19 08:11:36 +01:00 committed by GitHub
commit 621b91be57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 2 deletions

View File

@ -165,6 +165,7 @@ option(USE_LIBNX "Set to ON to build for Switch(libnx)" OFF)
option(USE_FFMPEG "Build with FFMPEG support" ON)
option(USE_DISCORD "Build with Discord support" ON)
option(USE_MINIUPNPC "Build with miniUPnPc support" ON)
option(USE_ARMIPS "Build with armips support in API/debugger" ON)
option(USE_SYSTEM_SNAPPY "Dynamically link against system snappy" ${USE_SYSTEM_SNAPPY})
option(USE_SYSTEM_FFMPEG "Dynamically link against system FFMPEG" ${USE_SYSTEM_FFMPEG})
option(USE_SYSTEM_LIBZIP "Dynamically link against system libzip" ${USE_SYSTEM_LIBZIP})
@ -2045,7 +2046,11 @@ if(ANDROID)
endif()
endif()
set(CoreExtraLibs ${CoreExtraLibs} armips)
if(USE_ARMIPS)
set(CoreExtraLibs ${CoreExtraLibs} armips)
else()
add_definitions(-DNO_ARMIPS=1)
endif()
# needed for VK_USE_PLATFORM_XCB_KHR only
#if(VULKAN AND NOT WIN32)

View File

@ -31,7 +31,9 @@
#include <algorithm>
#include <memory>
#ifndef NO_ARMIPS
#include <string_view>
#endif
#include <unordered_map>
#include "zlib.h"
@ -44,7 +46,19 @@
#include "Core/MemMap.h"
#include "Core/Debugger/SymbolMap.h"
#ifndef NO_ARMIPS
#include "ext/armips/Core/Assembler.h"
#else
struct Identifier {
explicit Identifier() {}
explicit Identifier(const std::string &s) {}
};
struct LabelDefinition {
Identifier name;
int64_t value;
};
#endif
SymbolMap *g_symbolMap;

View File

@ -1,12 +1,16 @@
#include <cstdarg>
#include <cstring>
#include <memory>
#ifndef NO_ARMIPS
#include <string_view>
#endif
#include <vector>
#include "Common/CommonTypes.h"
#ifndef NO_ARMIPS
#include "ext/armips/Core/Assembler.h"
#include "ext/armips/Core/FileManager.h"
#endif
#include "Common/Data/Encoding/Utf8.h"
#include "Core/Debugger/SymbolMap.h"
@ -23,6 +27,7 @@ std::string GetAssembleError()
return errorText;
}
#ifndef NO_ARMIPS
class PspAssemblerFile: public AssemblerFile
{
public:
@ -93,5 +98,11 @@ bool MipsAssembleOpcode(const char *line, DebugInterface *cpu, u32 address) {
return true;
}
#else
bool MipsAssembleOpcode(const char *line, DebugInterface *cpu, u32 address) {
errorText = "Built without armips, cannot assemble";
return false;
}
#endif
} // namespace

View File

@ -4,7 +4,9 @@ if(WIN32)
set(ARMIPS_USE_STD_FILESYSTEM ON CACHE BOOL "" FORCE)
endif()
add_subdirectory(armips)
if(USE_ARMIPS)
add_subdirectory(armips)
endif()
if(NOT USING_GLES2)
add_subdirectory(glew)
endif()