summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-02-24 19:44:00 -0500
committerbd <bdunahu@operationnull.com>2025-02-24 19:44:00 -0500
commit9028b78a0d668a8893d4e5ce65fa1d332be35cfa (patch)
treed7c2716391e501dfcb2834463771a7a1c1968c91
parent42c03e2ad6110625b54c8aab5960a5d3723e54b0 (diff)
Configure CMake
-rw-r--r--.gitignore6
-rw-r--r--CMakeLists.txt13
-rw-r--r--Makefile18
-rw-r--r--README.md13
4 files changed, 27 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index 6b5e70f..e788ced 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
# IDE
-.dir-locals.el
-manifest.scm
+/.dir-locals.el
+/manifest.scm
# generated
__pycache__
-rv
+/build/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..505517f
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.11)
+project(risc_vector)
+
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_COMPILER "g++")
+set(SRCDIR src)
+set(PYTHON_VERSION 3.10)
+
+find_package(Python3 COMPONENTS Development REQUIRED)
+
+add_executable(${PROJECT_NAME} ${SRCDIR}/rv.cc)
+
+target_link_libraries(${PROJECT_NAME} Python3::Python)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 0d06904..0000000
--- a/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-CXX = g++
-PYTHON_VERSION = 3.10
-
-CXXFLAGS = -I$(shell python$(PYTHON_VERSION)-config --includes)
-LDFLAGS = $(shell python$(PYTHON_VERSION)-config --ldflags --embed)
-
-SRCDIR = src
-
-all: rv
-
-rv: $(SRCDIR)/rv.cc
- $(CXX) $(CXXFLAGS) -o rv $(SRCDIR)/rv.cc $(LDFLAGS)
-
-test:
- @echo "foo"
-
-clean:
- rm -f rv
diff --git a/README.md b/README.md
index e06b7aa..6a8982d 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,15 @@
# Risc V[ECTOR]
-# About
+## to compile
+Generate the build directory with
+`cmake -S . -B build`
+then
+`cmake --build build`
+
+## to test
+
+# about
University of Massachusetts, Amherst
-CS535 -- Computer Architecture and ISA Design \ No newline at end of file
+CS535 -- Computer Architecture and ISA Design
+