diff --git a/.gitignore b/.gitignore
index df7dd6a47c..f86934e8b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,7 +46,7 @@ build/*
.idea/*
# cache
-.cache/*
+.cache/
##### ignored files
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1dabb9361..91946ef34c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.16)
+cmake_minimum_required (VERSION 3.14...3.28)
# Avoid IPO/LTO Warnings:
cmake_policy(SET CMP0069 NEW)
@@ -39,6 +39,10 @@ else()
endif()
option(PHASAR_EXPERIMENTAL_CXX20 "Build phasar in C++20 mode. This is an experimental feature" OFF)
+if(PHASAR_EXPERIMENTAL_CXX20)
+ message(DEPRECATION "The option PHASAR_EXPERIMENTAL_CXX20 is deprecated and will be removed in a future version of PhASAR. Use CMAKE_CXX_STANDARD=20 instead.")
+ set(CMAKE_CXX_STANDARD 20)
+endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -258,24 +262,13 @@ else()
set(PHASAR_CONFIG_INSTALL_DIR "${PHASAR_CUSTOM_CONFIG_INSTALL_DIR}")
endif()
-
-# Headers
-
-add_library(phasar_interface INTERFACE)
-target_include_directories(phasar_interface
- INTERFACE
- $ # The regular include folder
- $ # The location of phasar-config.h
- $ # The installed include folder
-)
-
### Adding external libraries
# Threads
find_package(Threads)
# Boost
-find_package(Boost 1.65.1 COMPONENTS graph REQUIRED)
+find_package(Boost 1.65.1 COMPONENTS graph REQUIRED CONFIG)
# Disable clang-tidy for the external projects
set(CMAKE_CXX_CLANG_TIDY "")
@@ -291,10 +284,11 @@ if (NOT PHASAR_IN_TREE)
if(PHASAR_BUILD_UNITTESTS AND NOT TARGET gtest)
include(FetchContent)
+ set(INSTALL_GTEST OFF)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
- GIT_TAG v1.13.0
+ GIT_TAG v1.16.0
)
FetchContent_MakeAvailable(googletest)
endif()
@@ -368,9 +362,6 @@ if(NOT PHASAR_IN_TREE)
add_definitions(${LLVM_DEFINITIONS_LIST})
endif()
-# Installed config
-configure_file(config.h.in include/phasar/Config/phasar-config.h @ONLY)
-
# Warnings
option(PHASAR_ENABLE_WARNINGS "Enable warnings" ${PHASAR_BUILD_OPTIONAL_TARGETS_DEFAULT})
if (PHASAR_ENABLE_WARNINGS)
@@ -381,6 +372,18 @@ if (PHASAR_ENABLE_WARNINGS)
endif()
endif (PHASAR_ENABLE_WARNINGS)
+
+# Headers
+add_library(phasar_interface INTERFACE)
+file(GLOB_RECURSE PHASAR_PUBLIC_HEADERS include/*.h include/*.def)
+configure_file(config.h.in include/phasar/Config/phasar-config.h @ONLY)
+
+target_sources(phasar_interface INTERFACE
+ FILE_SET HEADERS
+ BASE_DIRS "${PHASAR_SRC_DIR}/include" "${PHASAR_BINARY_DIR}/include"
+ FILES ${PHASAR_PUBLIC_HEADERS} "${PHASAR_BINARY_DIR}/include/phasar/Config/phasar-config.h"
+)
+
# Some preprocessor symbols that need to be available in phasar sources, but should not be installed
add_cxx_compile_definitions(PHASAR_SRC_DIR="${CMAKE_SOURCE_DIR}")
add_cxx_compile_definitions(PHASAR_BUILD_DIR="${CMAKE_BINARY_DIR}")
@@ -425,25 +428,10 @@ set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Install dir of lib
# Install targets of phasar-cli, other executables, and libraries are to be
# found in the individual subdirectories of tools/
-# Install Phasar include directory
-install(DIRECTORY include/
- DESTINATION include
- FILES_MATCHING
- PATTERN "*.def"
- PATTERN "*.h"
-)
-
-# Install the config file
-install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/phasar/Config/
- DESTINATION include/phasar/Config
- FILES_MATCHING
- PATTERN "*.def"
- PATTERN "*.h"
-)
-
if(NOT PHASAR_IN_TREE)
install(TARGETS phasar_interface
EXPORT PhasarExports
+ FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if (NOT PHASAR_USE_CONAN)
# Install the export-set containing all the phasar targets
@@ -454,13 +442,14 @@ if(NOT PHASAR_IN_TREE)
)
install(EXPORT ${PHASAR_DEPS_EXPORT_SET}
FILE ${PHASAR_DEPS_EXPORT_SET}.cmake
- NAMESPACE phasar::
+ NAMESPACE phasar::deps::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/phasar"
)
endif()
else()
install(TARGETS phasar_interface
EXPORT LLVMExports
+ FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS phasar_interface)
endif()
@@ -470,6 +459,7 @@ install(DIRECTORY utils/
DESTINATION bin
FILES_MATCHING
PATTERN "CodeGen" EXCLUDE # CodeGen does not contain files to install
+ PATTERN "conan" EXCLUDE # Don't install conan utils
PATTERN "phasar-*"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
diff --git a/Config.cmake.in b/Config.cmake.in
index 107efdb2d9..e531879c5d 100644
--- a/Config.cmake.in
+++ b/Config.cmake.in
@@ -6,16 +6,22 @@ set_and_check(PHASAR_LIBRARY_DIR "@PACKAGE_LIBRARY_INSTALL_DIR@")
include (CMakeFindDependencyMacro)
+set(PHASAR_LLVM_VERSION @PHASAR_LLVM_VERSION@)
+
include("${CMAKE_CURRENT_LIST_DIR}/PhasarDepsExports.cmake")
-find_dependency(Boost 1.65.1 COMPONENTS graph REQUIRED)
-find_dependency(LLVM 14 REQUIRED CONFIG)
+find_dependency(Boost 1.65.1 COMPONENTS graph REQUIRED CONFIG)
+find_dependency(LLVM ${PHASAR_LLVM_VERSION} REQUIRED CONFIG)
set(PHASAR_USE_LLVM_FAT_LIB @USE_LLVM_FAT_LIB@)
set(PHASAR_BUILD_DYNLIB @PHASAR_BUILD_DYNLIB@)
set(PHASAR_USE_Z3 @PHASAR_USE_Z3@)
+set(PHASAR_HAS_SQLITE @PHASAR_HAS_SQLITE@)
if (PHASAR_USE_Z3)
- find_dependency(Z3)
+ find_dependency(Z3 REQUIRED)
+endif()
+if(PHASAR_HAS_SQLITE)
+ find_dependency(SQLite3 REQUIRED)
endif()
set(PHASAR_COMPONENTS
@@ -67,6 +73,8 @@ if (NOT DEFINED phasar_FOUND OR phasar_FOUND EQUAL TRUE)
endif()
function(phasar_config executable)
+ message(DEPRECATION "The function 'phasar_config' is deprecated. Use target_link_libraries(${executable} PUBLIC phasar::phasar) instead!")
+
target_link_libraries(${executable}
PUBLIC
${PHASAR_NEEDED_LIBS}
diff --git a/cmake/add_nlohmann_json.cmake b/cmake/add_nlohmann_json.cmake
index 8cfd3f69c8..b15afc1b5e 100644
--- a/cmake/add_nlohmann_json.cmake
+++ b/cmake/add_nlohmann_json.cmake
@@ -55,11 +55,16 @@ function(add_json_schema_validator)
INTERFACE_INCLUDE_DIRECTORIES $
)
+ # Silence warning that we do not install the PUBLIC_HEADER target property.
+ # We can't, since it contains a relative path located from deep inside the schema validator tree
+ set_target_properties(nlohmann_json_schema_validator PROPERTIES PUBLIC_HEADER "")
+
install(TARGETS nlohmann_json_schema_validator
EXPORT ${PHASAR_DEPS_EXPORT_SET}
LIBRARY DESTINATION ${PHASAR_DEPS_INSTALL_DESTINATION}/lib
ARCHIVE DESTINATION ${PHASAR_DEPS_INSTALL_DESTINATION}/lib
RUNTIME DESTINATION ${PHASAR_DEPS_INSTALL_DESTINATION}/bin
+ # PUBLIC_HEADER DESTINATION ${PHASAR_DEPS_INSTALL_DESTINATION}/include/nlohmann
)
install(FILES external/json-schema-validator/src/nlohmann/json-schema.hpp
DESTINATION ${PHASAR_DEPS_INSTALL_DESTINATION}/include/nlohmann
diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in
index aa681ea795..b45f14eebd 100644
--- a/docs/Doxyfile.in
+++ b/docs/Doxyfile.in
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
-PROJECT_NAME = "Phasar"
+PROJECT_NAME = "PhASAR"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
@@ -44,7 +44,7 @@ PROJECT_NUMBER = @PHASAR_VERSION@
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF = "Phasar a LLVM-based Static Analysis Framework"
+PROJECT_BRIEF = "PhASAR a LLVM-based Static Analysis Framework"
# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
# the documentation. The maximum height of the logo should not exceed 55 pixels
@@ -234,7 +234,7 @@ TCL_SUBST =
# members will be omitted, etc.
# The default value is: NO.
-OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_FOR_C = NO
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
# Python sources only. Doxygen will then generate output that is more tailored
@@ -298,7 +298,7 @@ AUTOLINK_SUPPORT = YES
# diagrams that involve STL classes more complete and accurate.
# The default value is: NO.
-BUILTIN_STL_SUPPORT = NO
+BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
@@ -424,7 +424,7 @@ EXTRACT_STATIC = NO
# for Java sources.
# The default value is: YES.
-EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_CLASSES = NO
# This flag is only useful for Objective-C code. When set to YES local methods,
# which are defined in the implementation section but not in the interface are
@@ -513,7 +513,7 @@ SHOW_GROUPED_MEMB_INC = NO
# files with double quotes in the documentation rather than with sharp brackets.
# The default value is: NO.
-FORCE_LOCAL_INCLUDES = NO
+FORCE_LOCAL_INCLUDES = YES
# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
# documentation for inline members.
@@ -892,7 +892,7 @@ USE_MDFILE_AS_MAINPAGE =
# also VERBATIM_HEADERS is set to NO.
# The default value is: NO.
-SOURCE_BROWSER = NO
+SOURCE_BROWSER = YES
# Setting the INLINE_SOURCES tag to YES will include the body of functions,
# classes and enums directly into the documentation.
@@ -911,7 +911,7 @@ STRIP_CODE_COMMENTS = YES
# function all documented functions referencing it will be listed.
# The default value is: NO.
-REFERENCED_BY_RELATION = NO
+REFERENCED_BY_RELATION = YES
# If the REFERENCES_RELATION tag is set to YES then for each documented function
# all documented entities called/used by that function will be listed.
diff --git a/docs/README.dox b/docs/README.dox
index 3113dfdaed..e00ef59771 100644
--- a/docs/README.dox
+++ b/docs/README.dox
@@ -1,6 +1,6 @@
/**
-@mainpage Phasar a LLVM-based Static Analysis Framework
+@mainpage PhASAR: A LLVM-based Static Analysis Framework
@author Philipp Schubert (E-Mail: philipp.schubert@upb.de) and others
diff --git a/examples/use-phasar-as-library/CMakeLists.txt b/examples/use-phasar-as-library/CMakeLists.txt
index a7bfaa8d96..5246e3b823 100644
--- a/examples/use-phasar-as-library/CMakeLists.txt
+++ b/examples/use-phasar-as-library/CMakeLists.txt
@@ -17,7 +17,7 @@ add_executable(myphasartool
myphasartool.cpp
)
-# Old way using phasar_config:
+# Old way using phasar_config (deprecated):
# phasar_config(myphasartool)
# New way using target_link_libraries:
diff --git a/examples/use-phasar-as-library/README.md b/examples/use-phasar-as-library/README.md
index 44dbce6ea8..5f5f6c1828 100644
--- a/examples/use-phasar-as-library/README.md
+++ b/examples/use-phasar-as-library/README.md
@@ -4,3 +4,5 @@ This small example shows how you can setup a CMake project that uses PhASAR as a
This guide assumes that you have installed PhASAR such that the `find_package` cmake command can find it.
You can choose the PhASAR components that you need in the `find_package` command.
+
+To use phasar from a custom install location, you may specify the `phasar_ROOT` CMake variable to point to phasar's install directory.
diff --git a/examples/use-phasar-with-fetch-content/CMakeLists.txt b/examples/use-phasar-with-fetch-content/CMakeLists.txt
index 15033beade..cd4d5bb5f2 100644
--- a/examples/use-phasar-with-fetch-content/CMakeLists.txt
+++ b/examples/use-phasar-with-fetch-content/CMakeLists.txt
@@ -12,7 +12,7 @@ include(FetchContent)
FetchContent_Declare(
phasar
GIT_REPOSITORY https://github.com/secure-software-engineering/phasar.git
- GIT_TAG development
+ GIT_TAG development # At best, use a tagged version, such as v2403
EXCLUDE_FROM_ALL
OVERRIDE_FIND_PACKAGE
)
@@ -20,22 +20,18 @@ FetchContent_Declare(
find_package(phasar REQUIRED)
# Build a small test tool to show how phasar may be used
-add_executable(myphasartool_fc
+add_executable(myphasartool
myphasartool.cpp
)
-# Old way using phasar_config:
-# phasar_config(myphasartool)
-
-# New way using target_link_libraries:
-target_link_libraries(myphasartool_fc phasar::llvm_ifdside)
+target_link_libraries(myphasartool phasar::llvm_ifdside)
# If find_package did not specify components:
# target_link_libraries(myphasartool phasar::phasar)
# alternatively using the default target:
# target_link_libraries(myphasartool phasar)
-install(TARGETS myphasartool_fc
+install(TARGETS myphasartool
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
diff --git a/external/json b/external/json
index bc889afb4c..9cca280a4d 160000
--- a/external/json
+++ b/external/json
@@ -1 +1 @@
-Subproject commit bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d
+Subproject commit 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03
diff --git a/external/json-schema-validator b/external/json-schema-validator
index 491ac44026..349cba9f7e 160000
--- a/external/json-schema-validator
+++ b/external/json-schema-validator
@@ -1 +1 @@
-Subproject commit 491ac44026e08f31790f5cacffa62e168bb35e32
+Subproject commit 349cba9f7e3cb423bbc1811bdd9f6770f520b468
diff --git a/lib/LibPhasar.cpp b/lib/LibPhasar.cpp
index 97bbc811c2..7c72ce7695 100644
--- a/lib/LibPhasar.cpp
+++ b/lib/LibPhasar.cpp
@@ -8,3 +8,6 @@
*****************************************************************************/
#include "phasar.h"
+
+/// PhASAR's main namespace. All phasar-APIs are found here
+namespace psr {}