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: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ build/*
.idea/*

# cache
.cache/*
.cache/

##### ignored files

Expand Down
58 changes: 24 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
$<BUILD_INTERFACE:${PHASAR_SRC_DIR}/include/> # The regular include folder
$<BUILD_INTERFACE:${PHASAR_BINARY_DIR}/include/> # The location of phasar-config.h
$<INSTALL_INTERFACE:include/> # 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 "")
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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}")
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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
Expand Down
14 changes: 11 additions & 3 deletions Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
5 changes: 5 additions & 0 deletions cmake/add_nlohmann_json.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,16 @@ function(add_json_schema_validator)
INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:${PHASAR_DEPS_INSTALL_DESTINATION}/include>
)

# 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
Expand Down
16 changes: 8 additions & 8 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/README.dox
Original file line number Diff line number Diff line change
@@ -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: [email protected]) and others

Expand Down
2 changes: 1 addition & 1 deletion examples/use-phasar-as-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions examples/use-phasar-as-library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
12 changes: 4 additions & 8 deletions examples/use-phasar-with-fetch-content/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,26 @@ 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
)

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
Expand Down
2 changes: 1 addition & 1 deletion external/json
Submodule json updated 286 files
2 changes: 1 addition & 1 deletion external/json-schema-validator
Submodule json-schema-validator updated 43 files
+5 −8 .clang-format
+0 −83 .github/workflows/github-actions.yml
+31 −0 .github/workflows/release.yaml
+94 −0 .github/workflows/test.yaml
+5 −1 .gitignore
+32 −0 .pre-commit-config.yaml
+0 −78 .travis.yml
+208 −148 CMakeLists.txt
+7 −0 CMakePresets.json
+13 −9 README.md
+281 −0 cmake/CMakePresets-CI.json
+50 −0 cmake/CMakePresets-defaults.json
+0 −539 cmake/HunterGate.cmake
+0 −0 cmake/nlohmann_json_schema_validatorConfig.cmake.in
+14 −0 example/CMakeLists.txt
+0 −0 example/format.cpp
+0 −0 example/json-schema-validate.cpp
+0 −0 example/readme.cpp
+74 −0 src/CMakeLists.txt
+4 −1 src/json-patch.hpp
+19 −1 src/json-validator.cpp
+688 −726 src/smtp-address-validator.cpp
+1 −1 src/smtp-address-validator.hpp
+31 −21 src/string-format-check.cpp
+12 −0 test/CMakeLists.txt
+1 −1 test/JSON-Schema-Test-Suite/tests/draft7/not.json
+1 −1 test/JSON-Schema-Test-Suite/tests/draft7/optional/format/uuid.json
+2 −2 test/JSON-Schema-Test-Suite/tests/draft7/ref.json
+1 −1 test/binary-validation.cpp
+0 −15 test/cmake-install/CMakeLists.txt
+0 −34 test/cmake-install/project/CMakeLists.txt
+0 −55 test/cmake-install/test.sh.in
+1 −1 test/errors.cpp
+1 −1 test/id-ref.cpp
+69 −0 test/issue-229-oneof-default-values.cpp
+48 −0 test/issue-243-root-default-values.cpp
+3 −3 test/issue-25-default-values.cpp
+0 −2 test/issue-27/CMakeLists.txt
+32 −0 test/issue-293.cpp
+1 −1 test/issue-70-root-schema-constructor.cpp
+1 −1 test/issue-9/bar.json
+1 −1 test/issue-9/foo/baz/qux/qux.json
+9 −9 test/json-patch.cpp
3 changes: 3 additions & 0 deletions lib/LibPhasar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
*****************************************************************************/

#include "phasar.h"

/// PhASAR's main namespace. All phasar-APIs are found here
namespace psr {}
Loading