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 CONFIGURE_COMMAND "" BUILD_COMMAND "" ) FetchContent_Declare( sokol GIT_REPOSITORY https://github.com/floooh/sokol.git GIT_TAG 55bc9cf3fa4051d485d10412c75c893c3135e885 CONFIGURE_COMMAND "" BUILD_COMMAND "" ) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.4.0 # or a later release ) FetchContent_MakeAvailable(sokol dear_imgui Catch2) # sokol add_library(sokol INTERFACE) target_include_directories(sokol INTERFACE ${sokol_SOURCE_DIR}) list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras) # needed for the catch_discover_tests function list(APPEND VSOURCES ../verilog/hub75e.sv ../verilog/lineram.v) set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) find_package(verilator HINTS $ENV{VERILATOR_ROOT}) add_executable(sim) target_sources(sim PRIVATE src/main.cpp ) target_include_directories(sim PRIVATE inc/) verilate(sim SOURCES ${VSOURCES} TRACE VERILATOR_ARGS -Wno-MULTITOP) target_link_libraries(sim PRIVATE sokol) add_executable(sim_test) target_sources(sim_test PRIVATE test/hub75.cpp ) target_include_directories(sim_test PRIVATE inc/) target_link_libraries(sim_test PRIVATE sokol) verilate(sim_test SOURCES ${VSOURCES} TRACE VERILATOR_ARGS -Wno-MULTITOP) target_link_libraries(sim_test PRIVATE Catch2::Catch2WithMain) include(CTest) include(Catch) catch_discover_tests(sim_test)