diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-09-06 11:54:01 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-09-06 11:54:01 +0200 |
| commit | a10cf47a9701a4d0be83940a23a8edf9a5ed7b5e (patch) | |
| tree | d7757f29e9b027e19cd0fa339f487ce48a7790bd | |
| parent | 0fdd68c9e963f9e18a8dcc6ef990ccea98f4d764 (diff) | |
| download | openwar-a10cf47a9701a4d0be83940a23a8edf9a5ed7b5e.tar.gz openwar-a10cf47a9701a4d0be83940a23a8edf9a5ed7b5e.tar.bz2 openwar-a10cf47a9701a4d0be83940a23a8edf9a5ed7b5e.zip | |
Properly uses cmake to link with distorm3.
| -rw-r--r-- | CMakeLists.txt | 3 | ||||
| -rw-r--r-- | CMakeModules/distorm3Config.cmake | 10 | ||||
| -rw-r--r-- | disasm/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | disasm/disasm.cpp | 2 |
4 files changed, 19 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 36ad668..d226fea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.5.2) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules) +list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules) + project(openwar) add_subdirectory(fusion-utils) diff --git a/CMakeModules/distorm3Config.cmake b/CMakeModules/distorm3Config.cmake new file mode 100644 index 0000000..692e5d3 --- /dev/null +++ b/CMakeModules/distorm3Config.cmake @@ -0,0 +1,10 @@ + +add_library(distorm3 UNKNOWN IMPORTED) + +find_library(distorm3_LIBRARY NAMES "distorm3") + +set_property(TARGET distorm3 PROPERTY IMPORTED_LOCATION "${distorm3_LIBRARY}") + +find_path(distorm3_INCLUDE_DIR NAMES "distorm.h") + +set_property(TARGET distorm3 PROPERTY INCLUDE_DIRECTORIES ${distorm3_INCLUDE_DIR}) diff --git a/disasm/CMakeLists.txt b/disasm/CMakeLists.txt index e433d10..e9cd3d2 100644 --- a/disasm/CMakeLists.txt +++ b/disasm/CMakeLists.txt @@ -5,12 +5,12 @@ add_executable(disasm find_package(Boost COMPONENTS filesystem program_options system REQUIRED) +find_package(distorm3 REQUIRED CONFIG) + target_link_libraries(disasm PRIVATE le - PRIVATE ${Boost_LIBRARIES} + PRIVATE Boost::program_options + PRIVATE Boost::system + PRIVATE Boost::filesystem PRIVATE distorm3 ) - -target_include_directories(disasm - PRIVATE ${Boost_INCLUDE_DIRS} -)
\ No newline at end of file diff --git a/disasm/disasm.cpp b/disasm/disasm.cpp index 862813c..09b9b02 100644 --- a/disasm/disasm.cpp +++ b/disasm/disasm.cpp @@ -67,7 +67,7 @@ int main(int argc, char* argv[]) { auto index = eip_object.page_table_index; auto page = x.object_page_table.entries[index]; - binparse::Offset32 offset = x.le_offset + x.le_header.data_page_offset; + binparse::Offset32 offset = x.le_header.data_page_offset; auto result = distorm_decode64(0x00010000, code.data() + offset, x.object_table.entries[1].nr_page_table_entries * x.le_header.page_size, Decode32Bits, instructions.data(), instructions.size(), &read_inst); |
