Hi all,
Thanks for opening this discussion and all the helpful hints. I managed to build SystemC on Apple M2 silicon using the cmake approach. @William Lock and @Philipp A Hartmann already mentioned that you have to change the CMAKE_CXX_STANDARD in the CmakeLists.txt, but as some people seem to still have trouble, I’d like to share what I did.
git clone git@github.com:accellera-official/systemc.git systemc-2.3.4
cd systemc-2.3.4
open the CMakeLists.txt and replace:
set (CMAKE_CXX_STANDARD 98 CACHE STRING "C++ standard to build all targets. Supported values are 98, 11, 14, and 17.")
set (CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "The with CMAKE_CXX_STANDARD selected C++ standard is a requirement.")
mark_as_advanced (CMAKE_CXX_STANDARD_REQUIRED)
with:
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
mkdir BUILD && mkdir INSTALL && cd BUILD
cmake -DCMAKE_INSTALL_PREFIX="../INSTALL" ..
make
make install
cd ../..
g++ -std=c++17 -I systemc-2.3.4/INSTALL/include -Lsystemc-2.3.4/INSTALL/lib -lsystemc -o systemc_helloworld systemc_helloworld.cpp
Add SystemC to default include path (to be able to use #include <systemc.h> in systemc_helloworld.cpp):
sudo cp -r systemc-2.3.4/INSTALL/include/* /usr/local/include/
sudo cp systemc-2.3.4/INSTALL/lib/libsystemc.dylib /usr/local/lib
g++ -std=c++17 -lsystemc -o systemc_helloworld systemc_helloworld.cpp
Greetings from Munich,
Lasse