From 7409f9c07a4a04b11348828422fa6d6df68fa832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A0rius=20Mont=C3=B3n?= Date: Thu, 25 Nov 2021 14:20:58 +0100 Subject: [PATCH] Use cmake instead of Makefile. --- .travis.yml | 7 ++++--- CMakeLists.txt | 3 ++- Makefile | 53 -------------------------------------------------- 3 files changed, 6 insertions(+), 57 deletions(-) delete mode 100644 Makefile diff --git a/.travis.yml b/.travis.yml index 110f4c0..5d268ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,14 +2,16 @@ language: cpp os: - linux script: - - make -j 4 + - mkdir -p build && cd build + - cmake .. + - make -j 2 compiler: - gcc before_install: - sudo apt-get update - - sudo apt-get -y install libboost-all-dev + - sudo apt-get -y install libboost-all-dev libspdlog-dev install: - cd .. @@ -23,4 +25,3 @@ install: - rm -r systemc-2.3.2/build - rm systemc-2.3.2.tar.gz - cd RISC-V-TLM - - mkdir obj diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c6a5cf..820f34e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,9 +24,10 @@ file(GLOB SRC "./src/*.cpp") find_package(SystemCLanguage CONFIG REQUIRED) set (CMAKE_CXX_STANDARD ${SystemC_CXX_STANDARD}) - +find_package(spdlog CONFIG REQUIRED) add_executable(RISCV_TLM ${SRC} ) target_link_libraries(RISCV_TLM SystemC::systemc) +target_link_libraries(RISCV_TLM spdlog::spdlog) option(BUILD_DOC "Build documentation" ON) find_package(Doxygen) diff --git a/Makefile b/Makefile deleted file mode 100644 index 87fa1b8..0000000 --- a/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -TARGET = RISCV_TLM - -SYSTEMC ?=../systemc-2.3.2 -TARGET_ARCH=linux64 - -CC = g++ -# compiling flags here -CFLAGS = -Wall -I. -O3 -std=c++11 -g -Wextra -Wunused-function - - - -LINKER = g++ -# linking flags here -LFLAGS = -Wall -I. -lm -g -LIBS = -lsystemc -lm $(EXTRA_LIBS) - - -# change these to proper directories where each file should be -SRCDIR = src -OBJDIR = obj -BINDIR = ./ -INCDIR = -I. -I./inc -I$(SYSTEMC)/include -Ibasic_protocol -I$(SYSTEMC)/include/tlm_core/tlm_2 -LIBDIR = -L. -L$(SYSTEMC)/lib-$(TARGET_ARCH) - - -SOURCES := $(wildcard $(SRCDIR)/*.cpp) -INCLUDES := $(wildcard $(INCDIR)/*.h) -OBJECTS := $(SOURCES:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o) -rm = rm -f - - -$(BINDIR)/$(TARGET): $(OBJECTS) - @$(LINKER) $(OBJECTS) $(LFLAGS) $(LIBS) $(LIBDIR) -o $@ - @echo "Linking complete!" - - -$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.cpp -# @$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@ - @echo "Compiling "$<" ..." - @$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@ - @echo "Done!" - -.PHONY: clean -clean: - @$(rm) $(OBJECTS) - @echo "Cleanup complete!" - -.PHONY: remove -remove: clean - @$(rm) $(BINDIR)/$(TARGET) - @echo "Executable removed!" - -all: $(BINDIR)/$(TARGET)