Skip to content

Commit

Permalink
CMake support
Browse files Browse the repository at this point in the history
  • Loading branch information
makigumo committed May 16, 2017
1 parent 7a5fd42 commit 1182fb2
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 27 deletions.
51 changes: 51 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cmake_minimum_required(VERSION 3.0)

set(PRODUCT_NAME RISCV)
project(${PRODUCT_NAME})

set(HOPPER_SDK_PATH ${CMAKE_SOURCE_DIR}/HopperSDK/include)
set(HOPPER_PLUGINS_PATH "~/Library/Application Support/Hopper/Plugins/V4")
set(HOPPER_PLUGIN_CPU_DIRNAME CPUs)
set(HOPPER_PLUGIN_CPU_EXTENSION hopperCPU)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_INSTALL_PREFIX ${HOPPER_PLUGINS_PATH} CACHE PATH "Plugins install prefix" FORCE)

add_definitions(
# -std=c++11
# -fno-rtti
)

include_directories("${HOPPER_SDK_PATH}" "${CMAKE_SOURCE_DIR}")

add_library(
${PRODUCT_NAME} MODULE
RISCV/RISCVCPU.m
RISCV/RISCVCtx.m
)

target_compile_options(
${PRODUCT_NAME} PUBLIC
-fno-exceptions
-pedantic
-Wall
-Wextra
-fobjc-arc
)

set_target_properties(
${PRODUCT_NAME} PROPERTIES
BUNDLE TRUE
BUNDLE_EXTENSION ${HOPPER_PLUGIN_CPU_EXTENSION}
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
)

target_link_libraries(${PRODUCT_NAME} "-framework Foundation")

install(
TARGETS ${PRODUCT_NAME}
LIBRARY DESTINATION ${HOPPER_PLUGIN_CPU_DIRNAME}
)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)

12 changes: 12 additions & 0 deletions Info.plist.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>NSHumanReadableCopyright</key>
<string>©2016 – Makigumo</string>
</dict>
</plist>
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ Supported instruction sets:

* [Hopper Disassembler v4](https://www.hopperapp.com/)

## Building

* build with Xcode
* or, via `xcodebuild`
* or, using *cmake*
```
mkdir build
cd build
cmake ..
make
make install
```
## Resources
* [The RISC-V Instruction Set Manual, Volume I: User-Level ISA, Version 2.1](https://www2.eecs.berkeley.edu/Pubs/TechRpts/2016/EECS-2016-118.html)
Expand Down

This file was deleted.

0 comments on commit 1182fb2

Please sign in to comment.