bitdefender / bddisasm

bddisasm is a fast, lightweight, x86/x64 instruction decoder. The project also features a fast, basic, x86/x64 instruction emulator, designed specifically to detect shellcode-like behavior.
Apache License 2.0
874 stars 112 forks source link

Improved installation #40

Closed ianichitei closed 3 years ago

ianichitei commented 3 years ago

This PR primarily changes the way bddisasm, bdshemu, and disasmtool are installed, with a focus on making it easier for other projects to use the libraries.

CMake is used as the main method of building, installing, and consuming the library.

If possible, when using CMake, users no longer need to provide nd_vsnprintf_s and nd_memset, making integration easier. This behavior is controllable at build-time. The only code changes that were done were to support this and are inside ifdefs.

Integration is greatly simplified, with two lines of CMake being all that's needed in all cases:

# Replace with add_subdirectory() or FetchContent_Declare, as needed
find_package(bddisasm)

target_link_libraries(my_target PRIVATE bddisasm::bddisasm bddisasm::bdshemu)

CMake can now be used on Windows, as well as on Linux. However, only the Visual Studio solution provides a build that can be used by HVMI, so that's unchanged.