Switch to cmake and fetch nlohmann::json
This will be used to dynamically set a label table
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
out
|
out
|
||||||
hack-assembler
|
hack-assembler
|
||||||
|
build
|
||||||
|
|||||||
26
CMakeLists.txt
Normal file
26
CMakeLists.txt
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.18)
|
||||||
|
set(NAME "hack-assembly")
|
||||||
|
project(${NAME} CXX)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
# nlohmann::json
|
||||||
|
FetchContent_Declare(
|
||||||
|
json
|
||||||
|
GIT_REPOSITORY https://github.com/nlohmann/json.git
|
||||||
|
GIT_TAG v3.11.3
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(json)
|
||||||
|
|
||||||
|
|
||||||
|
set(SRC_CXX_FILES "./main.cpp")
|
||||||
|
|
||||||
|
add_executable(${NAME} ${SRC_CXX_FILES})
|
||||||
|
|
||||||
|
target_link_libraries(${NAME} PUBLIC nlohmann_json::nlohmann_json)
|
||||||
|
|
||||||
@@ -2,11 +2,18 @@
|
|||||||
|
|
||||||
An implementation of a hack assembler in C++.
|
An implementation of a hack assembler in C++.
|
||||||
|
|
||||||
|
## Compilation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake -S . -B build
|
||||||
|
cmake --build build
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
g++ -o hack-assembler main.cpp
|
g++ -o hack-assembler main.cpp
|
||||||
cat <input_file.asm> | ./hack-assembler > <output_file.hack>
|
cat <input_file.asm> | ./hack-assembler > ./out/<output_file.hack>
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|||||||
Reference in New Issue
Block a user