From 9028b78a0d668a8893d4e5ce65fa1d332be35cfa Mon Sep 17 00:00:00 2001 From: bd Date: Mon, 24 Feb 2025 19:44:00 -0500 Subject: Configure CMake --- .gitignore | 6 +++--- CMakeLists.txt | 13 +++++++++++++ Makefile | 18 ------------------ README.md | 13 +++++++++++-- 4 files changed, 27 insertions(+), 23 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile 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 + -- cgit v1.2.3