Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for architecture registration #2252

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ option(CAPSTONE_BUILD_TESTS "Build tests" ${PROJECT_IS_TOP_LEVEL})
option(CAPSTONE_BUILD_CSTOOL "Build cstool" ${PROJECT_IS_TOP_LEVEL})
option(CAPSTONE_BUILD_CSTEST "Build cstest" OFF)
option(CAPSTONE_USE_DEFAULT_ALLOC "Use default memory allocation functions" ON)
option(CAPSTONE_USE_ARCH_REGISTRATION "Use explicit architecture registration" OFF)
option(CAPSTONE_ARCHITECTURE_DEFAULT "Whether architectures are enabled by default" ON)
option(CAPSTONE_DEBUG "Whether to enable extra debug assertions" OFF)
option(CAPSTONE_INSTALL "Generate install target" ${PROJECT_IS_TOP_LEVEL})
Expand Down Expand Up @@ -96,6 +97,10 @@ if(CAPSTONE_USE_DEFAULT_ALLOC)
add_definitions(-DCAPSTONE_USE_SYS_DYN_MEM)
endif()

if(CAPSTONE_USE_ARCH_REGISTRATION)
add_definitions(-DCAPSTONE_USE_ARCH_REGISTRATION)
endif()

if(CAPSTONE_X86_REDUCE)
add_definitions(-DCAPSTONE_X86_REDUCE)
endif()
Expand Down
7 changes: 5 additions & 2 deletions COMPILE_CMAKE.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ Get CMake for free from http://www.cmake.org.
Set this of OFF with -DCAPSTONE_ARCHITECTURE_DEFAULT=OFF to disable all architectures by default.
You can then enable them again with one of the CAPSTONE_<ARCH>_SUPPORT options.

By default, all architectures are compiled in.

By default, all architectures are compiled in. If you're building a static library that you intend to link into
multiple consumers, and they have differing architecture requirements, you may want -DCAPSTONE_USE_ARCH_REGISTRATION=1
and call cs_arch_register_*() for the architectures you need in each particular consumer. In this way you only pay
footprint size for the the architectures you're actually using in each consumer, without having to compile Capstone
multiple times.

Besides, Capstone also allows some more customization via following macros.

Expand Down
Loading