cmake_minimum_required(VERSION 3.20)

include(FetchContent)

project(groovylight-sim)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 11)


FetchContent_Declare(
    dear_imgui
    GIT_REPOSITORY https://github.com/ocornut/imgui.git
    GIT_TAG 231cbee0fc4f59dbe5b8b853a11b08dc84e57c65 # version 1.90.5
)

FetchContent_Declare(
    sokol
    GIT_REPOSITORY https://github.com/floooh/sokol.git
    GIT_TAG 55bc9cf3fa4051d485d10412c75c893c3135e885
)

FetchContent_MakeAvailable(sokol dear_imgui)

set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)

find_package(verilator HINTS $ENV{VERILATOR_ROOT})
add_executable(sim)

target_sources(sim PRIVATE
    src/main.cpp
)

list(APPEND VSOURCES ../verilog/hub75e.sv ../verilog/lineram.v)

verilate(sim SOURCES ${VSOURCES} TRACE VERILATOR_ARGS -Wno-MULTITOP)