Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake cleanup #75

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
261 changes: 127 additions & 134 deletions CMakeLists.txt

Large diffs are not rendered by default.

69 changes: 1 addition & 68 deletions cmake/INSTALL_USING_CMAKE
Original file line number Diff line number Diff line change
Expand Up @@ -144,74 +144,7 @@ OS/processor/compiler tuple.
The build process can be configured through the configuration
variables offered to the user in the CMake console and GUI (ccmake and
cmake-gui, respectively). Each variable is annotated with a brief
documentation string. The most important variables are:

BUILD_SHARED_LIBS Build shared instead of static libraries
(default: ON if not targetting Windows).

BUILD_SOURCE_DOCUMENTATION Build source code documentation using Doxygen
(default: OFF).

CMAKE_BUILD_TYPE Specifies the build type on single-configuration
generators. (default: Release).

CMAKE_CXX_STANDARD C++ standard to build all targets. Supported
values are 98, 11, 14, and 17. (default: 98)

CMAKE_CXX_STANDARD_REQUIRED The with CMAKE_CXX_STANDARD selected C++ standard
is a requirement. (default: ON)

CMAKE_INSTALL_PREFIX Root directory of the SystemC libraries
installation (defaults to $ENV{SYSTEMC_HOME}
if set to an absolute path and otherwise to either
/opt/systemc/ (Unix-like platforms including
CYGWIN), $ENV{ProgramFiles}/SystemC/ (on Windows
systems), or ${CMAKE_INSTALL_PREFIX}/systemc.

CMAKE_OSX_ARCHITECTURES Architectures for cross-compilation on Mac OS X
(default: empty, i.e., only for the system
processor).

CMAKE_VERBOSE_MAKEFILE Generate a verbose Makefile (default: OFF).

DISABLE_COPYRIGHT_MESSAGE Do not print the copyright message when starting
the application. (default: OFF)

DISABLE_VIRTUAL_BIND Disable the definition of bind() member
functions of ports and exports as "virtual",
which is incompatible with old TLM library
implementations (< 2.0.2).

ENABLE_ASSERTIONS Always enable the `sc_assert' expressions
(default: ON)

ENABLE_IMMEDIATE_SELF_NOTIFICATIONS Enable immediate self-notification of
processes, which is no longer supported due to
changes in IEEE Std 1666-2011 (see
sc_event::notify, 5.10.6).

ENABLE_PTHREADS Use POSIX threads for SystemC processes instead
of QuickThreads on Unix or Fiber on Windows.

SystemC_TARGET_ARCH Target architecture according to the
Accellera SystemC conventions set either from
$ENV{SYSTEMC_TARGET_ARCH}, $ENV{SYSTEMC_ARCH},
or detected by CMake.

INSTALL_TO_LIB_BUILD_TYPE_DIR Install the libraries to lib-${CMAKE_BUILD_TYPE}
to enable parallel installation of the different
build variants. (default: OFF)

INSTALL_TO_LIB_TARGET_ARCH_DIR Install the libraries to lib-<target-arch>
to facilitate linking applications, which
build systems assume to find SystemC in
lib-<target-arch>. (default: OFF)

INSTALL_LIB_TARGET_ARCH_SYMLINK On Unix, install a symlink lib-<target-arch>
to lib-${CMAKE_BUILD_TYPE} facilitating the
linking of user code, which build system assumes
to find the SystemC libraries under
lib-<target-arch>. (default: OFF)
documentation string in the CMakeLists.txt at the top level.

Other configuration variables will be proposed by CMake depending on the OS
and detected processor, compiler, and libraries. For more information, please
Expand Down
2 changes: 1 addition & 1 deletion docker/alma.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY . /app

RUN cmake -B BUILD/RELEASE/BUILD -DCMAKE_INSTALL_PREFIX=$PWD/BUILD/RELEASE -DCMAKE_CXX_FLAGS="-Werror" .
RUN cmake --build BUILD/RELEASE/BUILD/ --parallel
RUN cmake -B BUILD/RELEASE_STATIC/BUILD -DCMAKE_INSTALL_PREFIX=$PWD/BUILD/RELEASE -DCMAKE_CXX_FLAGS="-Werror" -DBUILD_SHARED_LIBS=OFF .
RUN cmake -B BUILD/RELEASE_STATIC/BUILD -DCMAKE_INSTALL_PREFIX=$PWD/BUILD/RELEASE -DCMAKE_CXX_FLAGS="-Werror" -DSC_BUILD_SHARED_LIBS=OFF .
RUN cmake --build BUILD/RELEASE_STATIC/BUILD/ --parallel

CMD ["/bin/bash", "-c", "make -j `nproc` -C BUILD/RELEASE/BUILD/ check && make -j `nproc` -C BUILD/RELEASE_STATIC/BUILD/ check"]
2 changes: 1 addition & 1 deletion docker/ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ COPY . /app

RUN cmake -B BUILD/RELEASE/BUILD -DCMAKE_INSTALL_PREFIX=$PWD/BUILD/RELEASE -DCMAKE_CXX_FLAGS="-Werror" .
RUN cmake --build BUILD/RELEASE/BUILD/ --parallel
RUN cmake -B BUILD/RELEASE_STATIC/BUILD -DCMAKE_INSTALL_PREFIX=$PWD/BUILD/RELEASE -DCMAKE_CXX_FLAGS="-Werror" -DBUILD_SHARED_LIBS=OFF .
RUN cmake -B BUILD/RELEASE_STATIC/BUILD -DCMAKE_INSTALL_PREFIX=$PWD/BUILD/RELEASE -DCMAKE_CXX_FLAGS="-Werror" -DSC_BUILD_SHARED_LIBS=OFF .
RUN cmake --build BUILD/RELEASE_STATIC/BUILD/ --parallel

CMD ["/bin/bash", "-c", "make -j `nproc` -C BUILD/RELEASE/BUILD/ check && make -j `nproc` -C BUILD/RELEASE_STATIC/BUILD/ check"]
4 changes: 2 additions & 2 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ foreach (DOC_FILE ${DOC_FILES})
OPTIONAL)
endforeach (DOC_FILE ${DOC_FILES})

if (BUILD_SOURCE_DOCUMENTATION)
if (SC_BUILD_SOURCE_DOCUMENTATION)
find_package (Doxygen REQUIRED)
add_custom_target (doxygen ALL
DEPENDS doxygen-sysc doxygen-tlm)
Expand Down Expand Up @@ -108,4 +108,4 @@ if (BUILD_SOURCE_DOCUMENTATION)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/tlm/doxygen/tlm.tag
DESTINATION ${CMAKE_INSTALL_DOCDIR}/tlm/doxygen
COMPONENT doc)
endif (BUILD_SOURCE_DOCUMENTATION)
endif (SC_BUILD_SOURCE_DOCUMENTATION)
10 changes: 5 additions & 5 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#
###############################################################################

cmake_minimum_required (VERSION 3.0)
cmake_minimum_required (VERSION 3.5)

# Only built under "check" target
# - see https://cmake.org/Wiki/CMakeEmulateMakeCheck
Expand All @@ -53,12 +53,12 @@ set_target_properties(check PROPERTIES FOLDER "examples")
# Common definitions for all examples.
########################################################################

if (DEBUG_SYSTEMC)
if (SC_DEBUG_SYSTEMC)
add_definitions (-DDEBUG_SYSTEMC)
endif (DEBUG_SYSTEMC)
if (ENABLE_ASSERTIONS)
endif (SC_DEBUG_SYSTEMC)
if (SC_ENABLE_ASSERTIONS)
add_definitions (-DSC_ENABLE_ASSERTIONS)
endif (ENABLE_ASSERTIONS)
endif (SC_ENABLE_ASSERTIONS)

if (WIN32)
# Not sure, if these preprocessor definitions are strictly required to build
Expand Down
30 changes: 15 additions & 15 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ endif (QT_ARCH STREQUAL "sparc")
# Build rules for SystemC library
###############################################################################

add_library (systemc sysc/communication/sc_clock.cpp
add_library (systemc ${SC_LIB_TYPE} sysc/communication/sc_clock.cpp
sysc/communication/sc_event_finder.cpp
sysc/communication/sc_event_queue.cpp
sysc/communication/sc_export.cpp
Expand Down Expand Up @@ -449,26 +449,26 @@ target_compile_features(systemc PUBLIC cxx_std_17)
target_compile_definitions (
systemc
PUBLIC
$<$<BOOL:${DISABLE_VIRTUAL_BIND}>:SC_DISABLE_VIRTUAL_BIND>
$<$<BOOL:${SC_DISABLE_VIRTUAL_BIND}>:SC_DISABLE_VIRTUAL_BIND>
$<$<BOOL:${WIN32}>:WIN32>
$<$<AND:$<BOOL:${BUILD_SHARED_LIBS}>,$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>>:
$<$<AND:$<STREQUAL:${SC_LIB_TYPE},SHARED>,$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>>:
SC_WIN_DLL>
$<$<BOOL:${ALLOW_DEPRECATED_IEEE_API}>:SC_ALLOW_DEPRECATED_IEEE_API>
$<$<BOOL:${SC_ALLOW_DEPRECATED_IEEE_API}>:SC_ALLOW_DEPRECATED_IEEE_API>
PRIVATE
SC_BUILD
SC_INCLUDE_FX
$<$<BOOL:${DEBUG_SYSTEMC}>:DEBUG_SYSTEMC>
$<$<BOOL:${DISABLE_ASYNC_UPDATES}>:SC_DISABLE_ASYNC_UPDATES>
$<$<BOOL:${DISABLE_COPYRIGHT_MESSAGE}>:SC_DISABLE_COPYRIGHT_MESSAGE>
$<$<BOOL:${DISABLE_VCD_SCOPES}>:SC_DISABLE_VCD_SCOPES>
$<$<BOOL:${ENABLE_ASSERTIONS}>:SC_ENABLE_ASSERTIONS>
$<$<BOOL:${ENABLE_IMMEDIATE_SELF_NOTIFICATIONS}>:
$<$<BOOL:${SC_DEBUG_SYSTEMC}>:DEBUG_SYSTEMC>
$<$<BOOL:${SC_DISABLE_ASYNC_UPDATES}>:SC_DISABLE_ASYNC_UPDATES>
$<$<BOOL:${SC_DISABLE_COPYRIGHT_MESSAGE}>:SC_DISABLE_COPYRIGHT_MESSAGE>
$<$<BOOL:${SC_DISABLE_VCD_SCOPES}>:SC_DISABLE_VCD_SCOPES>
$<$<BOOL:${SC_ENABLE_ASSERTIONS}>:SC_ENABLE_ASSERTIONS>
$<$<BOOL:${SC_ENABLE_IMMEDIATE_SELF_NOTIFICATIONS}>:
SC_ENABLE_IMMEDIATE_SELF_NOTIFICATIONS>
$<$<BOOL:${ENABLE_PTHREADS}>:SC_USE_PTHREADS>
$<$<BOOL:${HAVE_POSIX_MEMALIGN}>:SC_HAVE_POSIX_MEMALIGN>
$<$<BOOL:${ENABLE_LEGACY_MEM_MGMT}>:SC_LEGACY_MEM_MGMT>
$<$<BOOL:${OVERRIDE_DEFAULT_STACK_SIZE}>:
SC_OVERRIDE_DEFAULT_STACK_SIZE=${OVERRIDE_DEFAULT_STACK_SIZE}>
$<$<BOOL:${SC_ENABLE_PTHREADS}>:SC_USE_PTHREADS>
$<$<BOOL:${SC_HAVE_POSIX_MEMALIGN}>:SC_HAVE_POSIX_MEMALIGN>
$<$<BOOL:${SC_ENABLE_LEGACY_MEM_MGMT}>:SC_LEGACY_MEM_MGMT>
$<$<BOOL:${SC_OVERRIDE_DEFAULT_STACK_SIZE}>:
SC_OVERRIDE_DEFAULT_STACK_SIZE=${SC_OVERRIDE_DEFAULT_STACK_SIZE}>
$<$<AND:$<BOOL:${WIN32}>,$<BOOL:${MSVC}>>:_LIB>)

target_compile_options(
Expand Down
Loading