Skip to content

Commit

Permalink
refactor: New semester updates
Browse files Browse the repository at this point in the history
* Bump version to 1.3.0
* Use new vcpkg bootstrap script
* Bump vcpkg baselines
* Use new traceEnabled constexpr for verilated models
  • Loading branch information
nickelpro committed Sep 3, 2024
1 parent e9eb1df commit f682cc9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 26 deletions.
24 changes: 2 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
cmake_minimum_required(VERSION 3.27)

if(NOT DEFINED SKIP_VCPKG AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
include(FetchContent)
FetchContent_Declare(
vcpkg
GIT_REPOSITORY https://github.com/microsoft/vcpkg.git
GIT_TAG master
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(vcpkg)
set(CMAKE_TOOLCHAIN_FILE
${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake
CACHE FILEPATH "Vcpkg toolchain file"
)
set(VCPKG_ROOT_DIR ${vcpkg_SOURCE_DIR} CACHE PATH "Vcpkg Root Directory")
endif()
include(cmake/BootstrapVcpkg.cmake)

if(DEFINED VCPKG_ROOT_DIR)
add_custom_target(UpdateVcpkgBaseline
${VCPKG_ROOT_DIR}/vcpkg x-update-baseline
)
endif()

project(nyu-util VERSION 1.2.0)
project(nyu-util VERSION 1.3.0)

find_package(Catch2 3 CONFIG REQUIRED)
find_package(verilator CONFIG REQUIRED)
Expand Down
45 changes: 45 additions & 0 deletions cmake/BootstrapVcpkg.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
if(NOT SKIP_VCPKG AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
include(FetchContent)

if(WIN32)
set(VCPKG vcpkg.exe)
elseif(LINUX)
if(EXISTS "/etc/alpine-release")
set(VCPKG vcpkg-musl)
else()
set(VCPKG vcpkg-glibc)
endif()
elseif(APPLE)
set(VCPKG vcpkg-macos)
else()
message(FATAL_ERROR "Cannot bootstrap vcpkg: Unsupported platform")
endif()

FetchContent_Declare(vcpkg
URL https://github.com/microsoft/vcpkg-tool/releases/latest/download/${VCPKG}
DOWNLOAD_NO_EXTRACT TRUE
)

FetchContent_MakeAvailable(vcpkg)
set(VCPKG ${vcpkg_SOURCE_DIR}/${VCPKG})

file(CHMOD ${VCPKG} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
set(ENV{VCPKG_ROOT} ${vcpkg_SOURCE_DIR})
execute_process(COMMAND ${VCPKG} bootstrap-standalone)

if(NOT WIN32)
file(RENAME ${VCPKG} ${vcpkg_SOURCE_DIR}/vcpkg)
endif()

set(CMAKE_TOOLCHAIN_FILE
${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake
CACHE FILEPATH "Vcpkg toolchain file"
)
set(VCPKG_ROOT_DIR ${vcpkg_SOURCE_DIR} CACHE PATH "Vcpkg Root Directory")
endif()

if(DEFINED VCPKG_ROOT_DIR)
add_custom_target(UpdateVcpkgBaseline
${VCPKG_ROOT_DIR}/vcpkg x-update-baseline
)
endif()
2 changes: 1 addition & 1 deletion src/NyuTestUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ concept resetable = requires(T a) {
};

template <typename T>
concept traceable = requires(T a, VerilatedFstC fst) { a.trace(&fst, 1); };
concept traceable = T::traceEnabled == true;

template <typename T>
concept not_traceable = evalable<T> && !traceable<T>;
Expand Down
6 changes: 3 additions & 3 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nyu-util",
"version": "1.1.5",
"version": "1.3.0",
"description": "NYU Processor Design's Utilities",
"homepage": "https://github.com/NYU-Processor-Design/nyu-util",
"maintainers": [
Expand All @@ -13,13 +13,13 @@
"vcpkg-configuration": {
"default-registry": {
"kind": "git",
"baseline": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31",
"baseline": "0f88ecb8528605f91980b90a2c5bad88e3cb565f",
"repository": "https://github.com/microsoft/vcpkg.git"
},
"registries": [
{
"kind": "git",
"baseline": "b6a23db783c5c5c2da5b9dbdcd3f852df94b83d4",
"baseline": "7a6b61ca47ca041f1c6558c649cbc2ddbf11d57a",
"repository": "https://github.com/NYU-Processor-Design/nyu-registry.git",
"packages": [
"nyu-*"
Expand Down

0 comments on commit f682cc9

Please sign in to comment.