Skip to content

Commit

Permalink
[FEATURE] Allow to enable/disable ARM support in CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Sep 14, 2024
1 parent 20bb212 commit 324a8d9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ option(CAPSTONE_X86_REDUCE "x86 with reduce instruction sets to minimize library
option(CAPSTONE_X86_ATT_DISABLE "Disable x86 AT&T syntax" ON)
option(CAPSTONE_SH_SUPPORT "SH support" OFF)

if(CAPSTONE_ARM64_SUPPORT)
add_compile_definitions(USE_ARM64)
endif()

if(CAPSTONE_ARM_SUPPORT)
add_compile_definitions(USE_ARM32)
endif()

# Add sub-directories
#
# libs
Expand Down
19 changes: 18 additions & 1 deletion pe-bear/DisasmView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,32 @@ void DisasmTreeView::initHeaderMenu()
actionsI[0]->setData(0);

for (int i = 1; i < MODES_NUM; i++) {
bool isEnabled = true;
if (i < 4) {
int bitmode = 16<<(i-1);
actionsI[i] = group->addAction(QString(tr("Intel")) + ": " + QString::number(bitmode) + tr("-bit"));
} else {
int val = i - 2;
int bitmode = 16<<(val-1);
actionsI[i] = group->addAction(QString(tr("ARM")) + ": " + QString::number(bitmode) + tr("-bit"));
QString armInfo = QString(tr("ARM")) + ": " + QString::number(bitmode) + tr("-bit");

#ifndef USE_ARM32
if (bitmode == 32) {
armInfo += " [" + QString(tr("disabled")) + "]";
isEnabled = false;
}
#endif //USE_ARM32

#ifndef USE_ARM64
if (bitmode == 64) {
armInfo += " [" + QString(tr("disabled")) + "]";
isEnabled = false;
}
#endif //USE_ARM64
actionsI[i] = group->addAction(armInfo);
}
actionsI[i]->setData(i);
actionsI[i]->setEnabled(isEnabled);
}

for (int i = 0; i < MODES_NUM; i++) {
Expand Down

0 comments on commit 324a8d9

Please sign in to comment.