feat: macOS support
This commit is contained in:
parent
079dd0e643
commit
3c52468fc6
|
@ -40,7 +40,7 @@ NVBoard(NJU Virtual Board)是基于SDL开发的虚拟FPGA开发板,可以在Ve
|
|||
## 安装教程
|
||||
|
||||
1. 将项目拷贝到本地,`git clone https://github.com/NJU-ProjectN/nvboard.git`
|
||||
2. 通过`apt-get install libsdl2-dev libsdl2-image-dev`安装SDL2和SDL2-image
|
||||
2. 通过`apt-get install libsdl2-dev libsdl2-image-dev`安装SDL2和SDL2-image;对于`macOS`,可以通过`brew install sdl2 sdl2_image`安装
|
||||
3. 把本项目的目录设置成环境变量`NVBOARD_HOME`
|
||||
|
||||
## 示例
|
||||
|
|
|
@ -29,14 +29,13 @@ include $(NVBOARD_HOME)/scripts/nvboard.mk
|
|||
|
||||
# rules for verilator
|
||||
INCFLAGS = $(addprefix -I, $(INC_PATH))
|
||||
CFLAGS += $(INCFLAGS) -DTOP_NAME="\"V$(TOPNAME)\""
|
||||
LDFLAGS += -lSDL2 -lSDL2_image
|
||||
CXXFLAGS += $(INCFLAGS) -DTOP_NAME="\"V$(TOPNAME)\""
|
||||
|
||||
$(BIN): $(VSRCS) $(CSRCS) $(NVBOARD_ARCHIVE)
|
||||
@rm -rf $(OBJ_DIR)
|
||||
$(VERILATOR) $(VERILATOR_CFLAGS) \
|
||||
--top-module $(TOPNAME) $^ \
|
||||
$(addprefix -CFLAGS , $(CFLAGS)) $(addprefix -LDFLAGS , $(LDFLAGS)) \
|
||||
$(addprefix -CFLAGS , $(CXXFLAGS)) $(addprefix -LDFLAGS , $(LDFLAGS)) \
|
||||
--Mdir $(OBJ_DIR) --exe -o $(abspath $(BIN))
|
||||
|
||||
all: default
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _VFPGA_COMPONENT_H
|
||||
#define _VFPGA_COMPONENT_H
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL.h>
|
||||
#include <vector>
|
||||
#include <constrs.h>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef VFPGA_RENDER_H
|
||||
#define VFPGA_RENDER_H
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#define WINDOW_WIDTH 640
|
||||
#define WINDOW_HEIGHT 480
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <component.h>
|
||||
#include <constrs.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#define VGA_DEFAULT_WIDTH 640
|
||||
#define VGA_DEFAULT_HEIGHT 480
|
||||
|
|
|
@ -9,7 +9,7 @@ NVBOARD_OBJS := $(addprefix $(NVBOARD_BUILD_DIR)/, $(addsuffix .o, $(basename $(
|
|||
|
||||
# The archive of NVBoard
|
||||
NVBOARD_ARCHIVE = $(NVBOARD_BUILD_DIR)/nvboard.a
|
||||
CXXFLAGS += -MMD -O3
|
||||
CXXFLAGS += -MMD -O3 $(shell sdl2-config --cflags)
|
||||
|
||||
$(NVBOARD_BUILD_DIR)/%.o: $(NVBOARD_SRC)/%.cpp
|
||||
@echo + CXX "->" NVBOARD_HOME/$(shell realpath $< --relative-to $(NVBOARD_HOME))
|
||||
|
@ -24,6 +24,9 @@ $(NVBOARD_ARCHIVE): $(NVBOARD_OBJS)
|
|||
# Rule (`#include` dependencies): paste in `.d` files generated by gcc on `-MMD`
|
||||
-include $(NVBOARD_OBJS:.o=.d)
|
||||
|
||||
# Link flags for examples
|
||||
LDFLAGS += $(shell sdl2-config --libs) -lSDL2_image
|
||||
|
||||
.PHONY: nvboard-archive nvboard-clean
|
||||
|
||||
nvboard-archive: $(NVBOARD_ARCHIVE)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL.h>
|
||||
|
||||
extern uint64_t input_map [];
|
||||
extern uint64_t output_map [];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <SDL2/SDL.h>
|
||||
#include <SDL.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_image.h>
|
||||
#include <nvboard.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <render.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_image.h>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
|
Loading…
Reference in New Issue