Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CompileFlags:
Add: -ferror-limit=0
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ project(uppaal_libs)
include(cmake/stdcpp.cmake)
include(cmake/sanitizers.cmake)

option(UPPAALLIBS_WITH_TESTS "UPPAAL LIBS Unit Tests" ON)
option(UPPAALLIBS_WITH_TESTS "UPPAAL LIBS Unit Tests" ${PROJECT_IS_TOP_LEVEL})

include_directories(include)
add_subdirectory(src)

if (UPPAALLIBS_WITH_TESTS)
include(cmake/doctest.cmake)
enable_testing()
add_subdirectory(tests)
endif (UPPAALLIBS_WITH_TESTS)

add_subdirectory(src)
45 changes: 37 additions & 8 deletions cmake/doctest.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,46 @@
# Downloads and compiles DocTest unit testing framework
include(FetchContent)
set(FETCHCONTENT_QUIET ON)
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
#set(FETCHCONTENT_QUIET ON)
#set(FETCHCONTENT_UPDATES_DISCONNECTED ON)

set(DOCTEST_WITH_TESTS OFF CACHE BOOL "doctest tests and examples")
set(DOCTEST_WITH_MAIN_IN_STATIC_LIB ON CACHE BOOL "enable doctest_with_main")
set(DOCTEST_NO_INSTALL OFF CACHE BOOL "Skip the installation process")
#set(DOCTEST_USE_STD_HEADERS OFF CACHE BOOL "Use std headers")
set(CMAKE_POLICY_VERSION_MINIMUM 3.10) # turn off the CMake warnings

FetchContent_Declare(doctest
GIT_REPOSITORY https://github.com/doctest/doctest.git
GIT_TAG v2.4.11 # "main" for latest
GIT_TAG v2.4.12 # "main" for latest
GIT_SHALLOW TRUE # download specific revision only (git clone --depth 1)
GIT_PROGRESS TRUE # show download progress in Ninja
USES_TERMINAL_DOWNLOAD TRUE)
EXCLUDE_FROM_ALL ON # don't build if not used
FIND_PACKAGE_ARGS 2.4.12)

set(DOCTEST_WITH_TESTS OFF CACHE BOOL "Build tests/examples")
set(DOCTEST_WITH_MAIN_IN_STATIC_LIB ON CACHE BOOL "Build a static lib for doctest::doctest_with_main")
set(DOCTEST_NO_INSTALL OFF CACHE BOOL "Skip the installation process")
set(DOCTEST_USE_STD_HEADERS OFF CACHE BOOL "Use std headers")

FetchContent_MakeAvailable(doctest)

if(doctest_FOUND) # find_package
message(STATUS "Found doctest: ${doctest_DIR}")
else(doctest_FOUND) # FetchContent
message(STATUS "Fetched doctest: ${doctest_SOURCE_DIR}")
endif(doctest_FOUND)

if (TARGET doctest::doctest)
message(STATUS " Available target: doctest::doctest")
endif ()

if (TARGET doctest::doctest_with_main)
message(STATUS " Available target: doctest::doctest_with_main")
endif ()

macro(add_debug_test TEST_NAME)
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(isMultiConfig)
add_test(NAME ${TEST_NAME} COMMAND ${ARGN} CONFIGURATIONS Debug RelWithDebInfo)
else()
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
add_test(NAME ${TEST_NAME} COMMAND ${ARGN})
endif()
endif()
endmacro()
13 changes: 5 additions & 8 deletions cmake/stdcpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # -fPIC
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # for clang-tidy

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "Extra warnings for ${CMAKE_CXX_COMPILER_ID} compiler")
add_compile_options(-Wpedantic -Wall -Wextra -Wno-cast-function-type)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(STATUS "Extra warnings for ${CMAKE_CXX_COMPILER_ID} compiler")
add_compile_options(-Wpedantic -Wall -Wextra -Wno-cast-function-type)
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Enabled extra warnings for ${CMAKE_CXX_COMPILER}")
add_compile_options(-Wpedantic -Wall -Wextra -Wconversion -Wno-cast-function-type)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message(STATUS "Extra warnings for ${CMAKE_CXX_COMPILER_ID} compiler")
message(STATUS "Enabled extra warnings for ${CMAKE_CXX_COMPILER}")
add_compile_options(
/permissive- # strict standards
/Wall -wd4191 -wd4668 -wd4710 -wd4711 -wd5045)
/W4)
add_compile_definitions(__STDC_LIB_EXT1__ NOMINMAX) # enable fopen_s, kill min/max macros
else()
message(STATUS "No extra warnings for ${CMAKE_CXX_COMPILER_ID} compiler")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions cmake/toolchain/linux32-gcc14.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-14)
set(CMAKE_C_FLAGS -m32)
set(CMAKE_CXX_COMPILER g++-14)
set(CMAKE_CXX_FLAGS -m32)

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both target and host environments
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
18 changes: 18 additions & 0 deletions cmake/toolchain/linux32-gcc15.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-15)
set(CMAKE_C_FLAGS -m32)
set(CMAKE_CXX_COMPILER g++-15)
set(CMAKE_CXX_FLAGS -m32)

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both target and host environments
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
18 changes: 18 additions & 0 deletions cmake/toolchain/linux32-gcc16.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-16)
set(CMAKE_C_FLAGS -m32)
set(CMAKE_CXX_COMPILER g++-16)
set(CMAKE_CXX_FLAGS -m32)

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both target and host environments
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions cmake/toolchain/linux64-gcc14.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-14)
set(CMAKE_C_FLAGS -m64)
set(CMAKE_CXX_COMPILER g++-14)
set(CMAKE_CXX_FLAGS -m64)

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both target and host environments
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
18 changes: 18 additions & 0 deletions cmake/toolchain/linux64-gcc15.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-15)
set(CMAKE_C_FLAGS -m64)
set(CMAKE_CXX_COMPILER g++-15)
set(CMAKE_CXX_FLAGS -m64)

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both target and host environments
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
18 changes: 18 additions & 0 deletions cmake/toolchain/linux64-gcc16.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-16)
set(CMAKE_C_FLAGS -m64)
set(CMAKE_CXX_COMPILER g++-16)
set(CMAKE_CXX_FLAGS -m64)

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both target and host environments
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
File renamed without changes.
28 changes: 28 additions & 0 deletions cmake/toolchain/macos64-brew-gcc14.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Darwin)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-14)
set(CMAKE_CXX_COMPILER g++-14)
set(CMAKE_AR gcc-ar-14)
set(CMAKE_NM gcc-nm-14)
set(CMAKE_RANLIB gcc-ranlib-14) # https://stackoverflow.com/questions/53128049/ld-archive-has-no-table-of-contents-file-error-with-homebrew
set(RANLIB gcc-ranlib-14)
# silence superfluous "has no symbols" warnings (does not help):
# set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
# set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")
# Do not use RPATH:
#set(CMAKE_MACOSX_RPATH FALSE)
#set(MACOSX_RPATH FALSE)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# set(CMAKE_SKIP_RPATH TRUE)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both the target and host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
28 changes: 28 additions & 0 deletions cmake/toolchain/macos64-brew-gcc15.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Darwin)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-15)
set(CMAKE_CXX_COMPILER g++-15)
set(CMAKE_AR gcc-ar-15)
set(CMAKE_NM gcc-nm-15)
set(CMAKE_RANLIB gcc-ranlib-15) # https://stackoverflow.com/questions/53128049/ld-archive-has-no-table-of-contents-file-error-with-homebrew
set(RANLIB gcc-ranlib-15)
# silence superfluous "has no symbols" warnings (does not help):
# set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
# set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")
# Do not use RPATH:
#set(CMAKE_MACOSX_RPATH FALSE)
#set(MACOSX_RPATH FALSE)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# set(CMAKE_SKIP_RPATH TRUE)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both the target and host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
28 changes: 28 additions & 0 deletions cmake/toolchain/macos64-brew-gcc16.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Darwin)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-16)
set(CMAKE_CXX_COMPILER g++-16)
set(CMAKE_AR gcc-ar-16)
set(CMAKE_NM gcc-nm-16)
set(CMAKE_RANLIB gcc-ranlib-16) # https://stackoverflow.com/questions/53128049/ld-archive-has-no-table-of-contents-file-error-with-homebrew
set(RANLIB gcc-ranlib-16)
# silence superfluous "has no symbols" warnings (does not help):
# set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
# set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")
# Do not use RPATH:
#set(CMAKE_MACOSX_RPATH FALSE)
#set(MACOSX_RPATH FALSE)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# set(CMAKE_SKIP_RPATH TRUE)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both the target and host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
29 changes: 29 additions & 0 deletions cmake/toolchain/macos64-ports-gcc13.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Darwin)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-mp-13)
set(CMAKE_CXX_COMPILER g++-mp-13)
set(CMAKE_AR gcc-ar-mp-13)
set(CMAKE_NM gcc-nm-mp-13)
set(CMAKE_RANLIB gcc-ranlib-mp-13)
set(RANLIB gcc-ranlib-mp-13)
# silence superfluous "has no symbols" warnings (does not help):
# set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
# set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")
# Do not use RPATH:
#set(CMAKE_MACOSX_RPATH FALSE)
#set(MACOSX_RPATH TRUE)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# set(CMAKE_SKIP_RPATH TRUE)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both the target and host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

29 changes: 29 additions & 0 deletions cmake/toolchain/macos64-ports-gcc14.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Darwin)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-mp-14)
set(CMAKE_CXX_COMPILER g++-mp-14)
set(CMAKE_AR gcc-ar-mp-14)
set(CMAKE_NM gcc-nm-mp-14)
set(CMAKE_RANLIB gcc-ranlib-mp-14)
set(RANLIB gcc-ranlib-mp-14)
# silence superfluous "has no symbols" warnings (does not help):
# set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
# set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")
# Do not use RPATH:
#set(CMAKE_MACOSX_RPATH FALSE)
#set(MACOSX_RPATH TRUE)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# set(CMAKE_SKIP_RPATH TRUE)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both the target and host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

29 changes: 29 additions & 0 deletions cmake/toolchain/macos64-ports-gcc15.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Darwin)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER gcc-mp-15)
set(CMAKE_CXX_COMPILER g++-mp-15)
set(CMAKE_AR gcc-ar-mp-15)
set(CMAKE_NM gcc-nm-mp-15)
set(CMAKE_RANLIB gcc-ranlib-mp-15)
set(RANLIB gcc-ranlib-mp-15)
# silence superfluous "has no symbols" warnings (does not help):
# set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
# set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")
# Do not use RPATH:
#set(CMAKE_MACOSX_RPATH FALSE)
#set(MACOSX_RPATH TRUE)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# set(CMAKE_SKIP_RPATH TRUE)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment,
# search programs in both the target and host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Loading
Loading