Use cmake instead of Makefile.
This commit is contained in:
parent
724cf258ce
commit
7409f9c07a
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
53
Makefile
53
Makefile
|
@ -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)
|
Loading…
Reference in New Issue