From a5ad26cd28de2e1a4a5077b829a7e4e93a9d3699 Mon Sep 17 00:00:00 2001 From: Kevin Nygaard <162383464+nygaard-ibm@users.noreply.github.com> Date: Sat, 16 Mar 2024 08:08:03 -0500 Subject: [PATCH] Fix tests on macOS (#4984) (#4985) --- docs/CONTRIBUTORS | 1 + examples/cmake_hello_c/CMakeLists.txt | 1 + examples/cmake_hello_c/Makefile | 2 +- examples/cmake_hello_sc/CMakeLists.txt | 1 + examples/cmake_hello_sc/Makefile | 2 +- examples/cmake_protect_lib/CMakeLists.txt | 3 +++ examples/cmake_protect_lib/Makefile | 2 +- examples/cmake_tracing_c/CMakeLists.txt | 1 + examples/cmake_tracing_c/Makefile | 2 +- examples/cmake_tracing_sc/CMakeLists.txt | 1 + examples/cmake_tracing_sc/Makefile | 2 +- 11 files changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS index dda0077ab..3756f9c5d 100644 --- a/docs/CONTRIBUTORS +++ b/docs/CONTRIBUTORS @@ -107,6 +107,7 @@ Kanad Kanhere Kefa Chen Keith Colbert Kevin Kiningham +Kevin Nygaard Kritik Bhimani Krzysztof Bieganski Krzysztof Boronski diff --git a/examples/cmake_hello_c/CMakeLists.txt b/examples/cmake_hello_c/CMakeLists.txt index 679abcc33..0bd119277 100644 --- a/examples/cmake_hello_c/CMakeLists.txt +++ b/examples/cmake_hello_c/CMakeLists.txt @@ -30,6 +30,7 @@ endif() # Create a new executable target that will contain all your sources add_executable(example ../make_hello_c/sim_main.cpp) +target_compile_features(example PUBLIC cxx_std_14) # Add the Verilated circuit to the target verilate(example diff --git a/examples/cmake_hello_c/Makefile b/examples/cmake_hello_c/Makefile index c1a2d7c64..940467662 100644 --- a/examples/cmake_hello_c/Makefile +++ b/examples/cmake_hello_c/Makefile @@ -31,7 +31,7 @@ endif ifeq ($(shell which cmake),) TARGET := nocmake else -CMAKE_VERSION := $(shell cmake --version | grep -Po '(\d[\.\d]+)') +CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+') CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.) CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.) CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true) diff --git a/examples/cmake_hello_sc/CMakeLists.txt b/examples/cmake_hello_sc/CMakeLists.txt index 16978bc80..647e7cf07 100644 --- a/examples/cmake_hello_sc/CMakeLists.txt +++ b/examples/cmake_hello_sc/CMakeLists.txt @@ -37,6 +37,7 @@ find_package(SystemCLanguage QUIET) # Create a new executable target that will contain all your sources add_executable(example ../make_hello_sc/sc_main.cpp) +target_compile_features(example PUBLIC cxx_std_14) set_property( TARGET example diff --git a/examples/cmake_hello_sc/Makefile b/examples/cmake_hello_sc/Makefile index 9ec875aba..d5a30694f 100644 --- a/examples/cmake_hello_sc/Makefile +++ b/examples/cmake_hello_sc/Makefile @@ -31,7 +31,7 @@ endif ifeq ($(shell which cmake),) TARGET := nocmake else -CMAKE_VERSION := $(shell cmake --version | grep -Po '(\d[\.\d]+)') +CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+') CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.) CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.) CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true) diff --git a/examples/cmake_protect_lib/CMakeLists.txt b/examples/cmake_protect_lib/CMakeLists.txt index 1e09cb5fd..eb581a3c8 100644 --- a/examples/cmake_protect_lib/CMakeLists.txt +++ b/examples/cmake_protect_lib/CMakeLists.txt @@ -30,9 +30,12 @@ endif() # Create the main executable target add_executable(example ../make_protect_lib/sim_main.cpp) +target_compile_features(example PUBLIC cxx_std_14) # Create a secret library add_library(verilated_secret STATIC) # or SHARED for a shared library +target_compile_features(verilated_secret PUBLIC cxx_std_14) + target_link_libraries(example PRIVATE verilated_secret) # To create both libraries on CMake >= 3.12 replace the above 2 lines with the following: # add_library(verilated_secret OBJECT) diff --git a/examples/cmake_protect_lib/Makefile b/examples/cmake_protect_lib/Makefile index 0dba12ccf..5b9c29738 100644 --- a/examples/cmake_protect_lib/Makefile +++ b/examples/cmake_protect_lib/Makefile @@ -31,7 +31,7 @@ endif ifeq ($(shell which cmake),) TARGET := nocmake else -CMAKE_VERSION := $(shell cmake --version | grep -Po '(\d[\.\d]+)') +CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+') CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.) CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.) CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true) diff --git a/examples/cmake_tracing_c/CMakeLists.txt b/examples/cmake_tracing_c/CMakeLists.txt index 3f69fc3c9..6d605b93b 100644 --- a/examples/cmake_tracing_c/CMakeLists.txt +++ b/examples/cmake_tracing_c/CMakeLists.txt @@ -30,6 +30,7 @@ endif() # Create a new executable target that will contain all your sources add_executable(example ../make_tracing_c/sim_main.cpp) +target_compile_features(example PUBLIC cxx_std_14) # Add the Verilated circuit to the target verilate(example COVERAGE TRACE diff --git a/examples/cmake_tracing_c/Makefile b/examples/cmake_tracing_c/Makefile index 22f59d125..a4f052a98 100644 --- a/examples/cmake_tracing_c/Makefile +++ b/examples/cmake_tracing_c/Makefile @@ -31,7 +31,7 @@ endif ifeq ($(shell which cmake),) TARGET := nocmake else -CMAKE_VERSION := $(shell cmake --version | grep -Po '(\d[\.\d]+)') +CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+') CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.) CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.) CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true) diff --git a/examples/cmake_tracing_sc/CMakeLists.txt b/examples/cmake_tracing_sc/CMakeLists.txt index 58d0aaceb..4ad12f861 100644 --- a/examples/cmake_tracing_sc/CMakeLists.txt +++ b/examples/cmake_tracing_sc/CMakeLists.txt @@ -38,6 +38,7 @@ find_package(SystemCLanguage QUIET) # Create a new executable target that will contain all your sources add_executable(example ../make_tracing_sc/sc_main.cpp) +target_compile_features(example PUBLIC cxx_std_14) set_property( TARGET example diff --git a/examples/cmake_tracing_sc/Makefile b/examples/cmake_tracing_sc/Makefile index fb10802cc..07f804d9a 100644 --- a/examples/cmake_tracing_sc/Makefile +++ b/examples/cmake_tracing_sc/Makefile @@ -31,7 +31,7 @@ endif ifeq ($(shell which cmake),) TARGET := nocmake else -CMAKE_VERSION := $(shell cmake --version | grep -Po '(\d[\.\d]+)') +CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+') CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.) CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.) CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)