svf-tools 1.0.1097 → 1.0.1099
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitignore +1 -0
- package/CMakeLists.txt +357 -143
- package/cmake/Modules/FindZ3.cmake +93 -0
- package/cmake/SVF.pc.in +12 -0
- package/cmake/SVFConfig.cmake.in +82 -0
- package/cmake/SVFConfigHdr.cmake.in +46 -0
- package/package.json +1 -1
- package/svf/CMakeLists.txt +21 -27
- package/svf/lib/Util/ExtAPI.cpp +10 -11
- package/svf-llvm/CMakeLists.txt +127 -117
- package/svf-llvm/tools/AE/CMakeLists.txt +0 -1
- package/svf-llvm/tools/CFL/CMakeLists.txt +0 -1
- package/svf-llvm/tools/CMakeLists.txt +30 -10
- package/svf-llvm/tools/DDA/CMakeLists.txt +0 -1
- package/svf-llvm/tools/Example/CMakeLists.txt +0 -1
- package/svf-llvm/tools/LLVM2SVF/CMakeLists.txt +0 -1
- package/svf-llvm/tools/MTA/CMakeLists.txt +0 -1
- package/svf-llvm/tools/SABER/CMakeLists.txt +0 -1
- package/svf-llvm/tools/WPA/CMakeLists.txt +3 -2
- package/.config.cmake.in +0 -34
- package/.config.in +0 -26
- package/SVF-doxygen/doxygen.config +0 -2548
- package/SVF-doxygen/wiki/PAG.png +0 -0
- package/SVF-doxygen/wiki/andersen.png +0 -0
- package/SVF-doxygen/wiki/callgraph.png +0 -0
- package/SVF-doxygen/wiki/consG.png +0 -0
- package/SVF-doxygen/wiki/cpu2000-flto +0 -432
- package/SVF-doxygen/wiki/cpu2006-flto +0 -417
- package/SVF-doxygen/wiki/cpu2017-wllvm.cfg +0 -999
- package/SVF-doxygen/wiki/database.png +0 -0
- package/SVF-doxygen/wiki/framework.png +0 -0
- package/SVF-doxygen/wiki/help.png +0 -0
- package/SVF-doxygen/wiki/icfg.png +0 -0
- package/SVF-doxygen/wiki/mssa-cha.png +0 -0
- package/SVF-doxygen/wiki/pagedge.png +0 -0
- package/SVF-doxygen/wiki/pagnode.png +0 -0
- package/SVF-doxygen/wiki/pt.png +0 -0
- package/SVF-doxygen/wiki/setupcmake.png +0 -0
- package/SVF-doxygen/wiki/setupconfiguration.png +0 -0
- package/SVF-doxygen/wiki/setupdashboard.png +0 -0
- package/SVF-doxygen/wiki/setupdebug.png +0 -0
- package/SVF-doxygen/wiki/setupenv.png +0 -0
- package/SVF-doxygen/wiki/startup.png +0 -0
- package/SVF-doxygen/wiki/svf-stat.pdf +0 -0
- package/SVF-doxygen/wiki/svfg-framework.png +0 -0
- package/SVF-doxygen/wiki/svfg.png +0 -0
- package/SVF-doxygen/wiki/svfg_opt.png +0 -0
- package/SVF-doxygen/wiki/svfgedge-cha.png +0 -0
- package/SVF-doxygen/wiki/svfgnode-cha.png +0 -0
- package/SVF-doxygen/wiki/svfpic/README.md +0 -6
- package/SVF-doxygen/wiki/svfpic/ass-1debug1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/ass-1debug2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/build.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/cmd.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect3.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect4.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect5.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/connect6.png +0 -0
- package/SVF-doxygen/wiki/svfpic/connect7.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/continue.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug-new.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug-new2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug1.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug2.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug3.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug4.png +0 -0
- package/SVF-doxygen/wiki/svfpic/debug5.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/debug6.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/docker_sys_requirement.png +0 -0
- package/SVF-doxygen/wiki/svfpic/docker_sys_requirements.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild4.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuild5.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerbuildimage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercmd.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercmd2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockercontainer.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb10.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb4.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb5.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb6.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb7.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb8.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerdb9.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerfinshbuilt.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerimage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockernameImage.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerpull.png +0 -0
- package/SVF-doxygen/wiki/svfpic/dockerpull2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/download.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/extension1.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/extension2.jpeg +0 -0
- package/SVF-doxygen/wiki/svfpic/graphviz.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hellodb.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hellodb2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_0.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/hviz_2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installC:C++Ext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installCMakeExt.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installRCext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/installdockerext.png +0 -0
- package/SVF-doxygen/wiki/svfpic/launch1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/openfile.png +0 -0
- package/SVF-doxygen/wiki/svfpic/pathfolder.png +0 -0
- package/SVF-doxygen/wiki/svfpic/restart.png +0 -0
- package/SVF-doxygen/wiki/svfpic/rundocker.png +0 -0
- package/SVF-doxygen/wiki/svfpic/runinCLI.png +0 -0
- package/SVF-doxygen/wiki/svfpic/screen.png +0 -0
- package/SVF-doxygen/wiki/svfpic/settings1.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/settings2.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/settings3.jpg +0 -0
- package/SVF-doxygen/wiki/svfpic/shortlists.png +0 -0
- package/SVF-doxygen/wiki/svfpic/start.png +0 -0
- package/SVF-doxygen/wiki/svfpic/start1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/update0.png +0 -0
- package/SVF-doxygen/wiki/svfpic/verify_docker.png +0 -0
- package/SVF-doxygen/wiki/svfpic/vs_entry_window.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_1.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_2.png +0 -0
- package/SVF-doxygen/wiki/svfpic/wsl_3.png +0 -0
- package/SVF-doxygen/wiki/tools.png +0 -0
- package/SVF-doxygen/wiki/users.png +0 -0
- package/SVF-doxygen/wiki/vm1.png +0 -0
- package/SVF-doxygen/wiki/vm2.png +0 -0
- package/SVF-doxygen/wiki/vm3.png +0 -0
- package/SVF-doxygen/wiki/vm4.png +0 -0
- package/SVF-doxygen/wiki/vm5.png +0 -0
- package/SVF-doxygen/wiki/vscode_build_tasks.png +0 -0
- package/SVF-doxygen/wiki/vscode_cpp_extension.png +0 -0
- package/SVF-doxygen/wiki/vscode_debug_list.png +0 -0
- package/SVF-doxygen/wiki/vscode_dir_structure.png +0 -0
package/.gitignore
CHANGED
package/CMakeLists.txt
CHANGED
|
@@ -1,180 +1,394 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.23)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# =================================================================================
|
|
4
|
+
# SVF project definition
|
|
5
|
+
# =================================================================================
|
|
6
|
+
|
|
7
|
+
project(
|
|
8
|
+
SVF
|
|
4
9
|
VERSION 3.1
|
|
5
10
|
DESCRIPTION "SVF is a static value-flow analysis tool for LLVM-based languages"
|
|
6
11
|
HOMEPAGE_URL "https://github.com/SVF-tools/SVF"
|
|
7
12
|
LANGUAGES C CXX
|
|
8
13
|
)
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
|
|
15
|
+
# Export compile commands for clangd & IDE support
|
|
16
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
17
|
+
|
|
18
|
+
# Set SVF's default C/C++ standards (C11/C++17)
|
|
19
|
+
set(CMAKE_C_STANDARD 11)
|
|
20
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
21
|
+
set(CMAKE_C_EXTENSIONS ON)
|
|
22
|
+
set(CMAKE_CXX_EXTENSIONS ON)
|
|
23
|
+
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
24
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
25
|
+
|
|
26
|
+
# Ensure all build artifacts end up in <build>/bin, <build>/lib, etc.
|
|
27
|
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SVF_BINARY_DIR}/bin)
|
|
28
|
+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SVF_BINARY_DIR}/lib)
|
|
29
|
+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SVF_BINARY_DIR}/lib)
|
|
30
|
+
|
|
31
|
+
# If SVF is included as a subdirectory (add_subdirectory(SVF)), expose version info to parent scope
|
|
32
|
+
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|
33
|
+
set(SVF_VERSION
|
|
34
|
+
"${PROJECT_VERSION}"
|
|
35
|
+
PARENT_SCOPE
|
|
36
|
+
)
|
|
37
|
+
endif()
|
|
11
38
|
|
|
12
39
|
# Ensure installation directories like ${CMAKE_INSTALL_LIBDIR} are available
|
|
13
40
|
include(GNUInstallDirs)
|
|
14
41
|
|
|
42
|
+
# Include helpers to package the SVF CMake package
|
|
43
|
+
include(CMakePackageConfigHelpers)
|
|
44
|
+
|
|
45
|
+
# Allow checking for IPO support by the used compiler
|
|
46
|
+
include(CheckIPOSupported)
|
|
47
|
+
|
|
48
|
+
# Since SVF builds into non-standard directories; symlink/copy compile commands into top-level directory
|
|
49
|
+
if(WIN32
|
|
50
|
+
OR MINGW
|
|
51
|
+
OR MSYS
|
|
52
|
+
OR CYGWIN
|
|
53
|
+
)
|
|
54
|
+
file(
|
|
55
|
+
COPY ${SVF_BINARY_DIR}/compile_commands.json
|
|
56
|
+
DESTINATION ${CMAKE_CURRENT_LIST_DIR}
|
|
57
|
+
RENAME compile_commands.json
|
|
58
|
+
)
|
|
59
|
+
else()
|
|
60
|
+
file(CREATE_LINK ${SVF_BINARY_DIR}/compile_commands.json compile_commands.json COPY_ON_ERROR SYMBOLIC)
|
|
61
|
+
endif()
|
|
62
|
+
|
|
63
|
+
# Ensure the configuration input files & module definitions are findable by default
|
|
64
|
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules")
|
|
65
|
+
|
|
66
|
+
# Store global build opts
|
|
67
|
+
set(SVF_BUILD_TYPE ${CMAKE_BUILD_TYPE})
|
|
68
|
+
set(SVF_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
|
69
|
+
|
|
70
|
+
# =================================================================================
|
|
71
|
+
# SVF options & settings
|
|
72
|
+
# =================================================================================
|
|
73
|
+
|
|
15
74
|
# Configurable (string) options for building SVF
|
|
16
|
-
set(SVF_SANITIZE
|
|
75
|
+
set(SVF_SANITIZE
|
|
76
|
+
""
|
|
77
|
+
CACHE STRING "Create sanitizer build (address)"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# Sanity check
|
|
81
|
+
if(SVF_SANITIZE AND NOT (SVF_SANITIZE STREQUAL "thread" OR SVF_SANITIZE STREQUAL "address"))
|
|
82
|
+
message(FATAL_ERROR "Unrecognised sanitiser type: ${SVF_SANITIZE}")
|
|
83
|
+
endif()
|
|
17
84
|
|
|
18
85
|
# Configurable (boolean) options for building SVF
|
|
19
|
-
option(
|
|
20
|
-
option(
|
|
21
|
-
option(
|
|
22
|
-
option(
|
|
86
|
+
option(SVF_USE_PIC "Compile with position-independent code (-fPIC)" ON)
|
|
87
|
+
option(SVF_USE_LTO "Compile with link-time optimisations enabled (-flto)")
|
|
88
|
+
option(SVF_USE_LLD "Use LLVM's ld.lld linker instead of the default linker")
|
|
89
|
+
option(SVF_COVERAGE "Create a coverage build (-fprofile-arcs & -ftest-coverage)")
|
|
90
|
+
option(SVF_DEBUG_INFO "Enable & explicitly preserve debug info (-g3); also in release builds")
|
|
91
|
+
option(SVF_WARN_AS_ERROR "Treat all compiler warnings as errors when building SVF (default: on)" ON)
|
|
92
|
+
option(SVF_EXPORT_DYNAMIC "Export all (not only the actually used) symbols to dynamic symbol table" OFF)
|
|
93
|
+
option(SVF_ENABLE_ASSERTIONS "Always enable debugging assertions, also if the build type is a release build")
|
|
94
|
+
option(SVF_ENABLE_RTTI "Disables runtime type information generation by adding the -fno-rtti build flag" ON)
|
|
95
|
+
option(SVF_ENABLE_EH "Disables handling of thrown exceptions by adding the -fno-exceptions build flag" ON)
|
|
96
|
+
|
|
97
|
+
# For convenience, also declare SVF_ENABLE_EXCEPTIONS as a local variable (for config)
|
|
98
|
+
set(SVF_ENABLE_EXCEPTIONS ${SVF_ENABLE_EH})
|
|
99
|
+
|
|
100
|
+
# If building dynamic libraries, always enable PIC
|
|
101
|
+
if(SVF_SHARED_LIBS AND NOT SVF_USE_PIC)
|
|
102
|
+
message(WARNING "PIC must be enabled while compiling shared libraries; forcing SVF_USE_PIC to ON!")
|
|
103
|
+
set(SVF_USE_PIC
|
|
104
|
+
ON
|
|
105
|
+
CACHE BOOL "" FORCE
|
|
106
|
+
)
|
|
107
|
+
endif()
|
|
108
|
+
|
|
109
|
+
# Ensure the compiler supports LTO if building with LTO enabled
|
|
110
|
+
if(SVF_USE_LTO)
|
|
111
|
+
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
|
|
112
|
+
if(NOT ipo_supported)
|
|
113
|
+
message(FATAL_ERROR "Cannot build with LTO; compiler doesn't support LTO")
|
|
114
|
+
endif()
|
|
115
|
+
endif()
|
|
23
116
|
|
|
24
117
|
# Configure top-level SVF variables (used by CMake for configuring installed SVF package)
|
|
25
|
-
set(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
CMake current list directory: ${CMAKE_CURRENT_LIST_DIR}
|
|
49
|
-
CMake current source directory: ${CMAKE_CURRENT_SOURCE_DIR}
|
|
50
|
-
CMake current binary directory: ${CMAKE_CURRENT_BINARY_DIR}")
|
|
51
|
-
|
|
52
|
-
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include)
|
|
53
|
-
# Create config.h based on config.in
|
|
54
|
-
configure_file(${SVF_SOURCE_DIR}/.config.in ${SVF_BINARY_DIR}/include/Util/config.h)
|
|
55
|
-
|
|
56
|
-
# Include the directory where the configuration header is exported for all targets
|
|
57
|
-
include_directories(${SVF_BINARY_DIR}/include)
|
|
58
|
-
|
|
59
|
-
# Install generated configuration header (see `configure_file()`) to top-level include dir of SVF
|
|
60
|
-
install(
|
|
61
|
-
FILES ${SVF_BINARY_DIR}/include/Util/config.h
|
|
62
|
-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Util
|
|
118
|
+
set(SVF_INSTALL_BINDIR
|
|
119
|
+
${CMAKE_INSTALL_BINDIR}
|
|
120
|
+
CACHE PATH "Set binaries install dir"
|
|
121
|
+
)
|
|
122
|
+
set(SVF_INSTALL_LIBDIR
|
|
123
|
+
${CMAKE_INSTALL_LIBDIR}
|
|
124
|
+
CACHE PATH "Set libraries install dir"
|
|
125
|
+
)
|
|
126
|
+
set(SVF_INSTALL_EXTAPIDIR
|
|
127
|
+
${CMAKE_INSTALL_INCLUDEDIR}/SVF
|
|
128
|
+
CACHE PATH "Set extapi.bc install dir"
|
|
129
|
+
)
|
|
130
|
+
set(SVF_INSTALL_INCLUDEDIR
|
|
131
|
+
${CMAKE_INSTALL_INCLUDEDIR}/SVF
|
|
132
|
+
CACHE PATH "Set public headers install dir"
|
|
133
|
+
)
|
|
134
|
+
set(SVF_INSTALL_PKGCONFDIR
|
|
135
|
+
${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
|
136
|
+
CACHE PATH "Override pkgconfig install dir"
|
|
137
|
+
)
|
|
138
|
+
set(SVF_INSTALL_CMAKECONFIGDIR
|
|
139
|
+
${CMAKE_INSTALL_LIBDIR}/cmake/SVF
|
|
140
|
+
CACHE PATH "Set CMake package install dir"
|
|
63
141
|
)
|
|
64
142
|
|
|
65
|
-
#
|
|
66
|
-
set(
|
|
67
|
-
set(
|
|
68
|
-
set(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"$<$<OR:$<BOOL:${SVF_COVERAGE}>,$<BOOL:$ENV{SVF_COVERAGE}>>:-ftest-coverage>"
|
|
89
|
-
)
|
|
90
|
-
add_link_options(
|
|
91
|
-
"$<$<OR:$<BOOL:${SVF_COVERAGE}>,$<BOOL:$ENV{SVF_COVERAGE}>>:-fprofile-arcs>"
|
|
92
|
-
"$<$<OR:$<BOOL:${SVF_COVERAGE}>,$<BOOL:$ENV{SVF_COVERAGE}>>:-ftest-coverage>"
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
# If building with sanitiser, load the given sanitiser mode
|
|
96
|
-
if(SVF_SANITIZE STREQUAL "address")
|
|
97
|
-
add_compile_options("-fno-omit-frame-pointer" "-fsanitize=address")
|
|
98
|
-
add_link_options("-fsanitize=address")
|
|
99
|
-
message(STATUS "Sanitizer build: ${SVF_SANITIZE}")
|
|
100
|
-
elseif(SVF_SANITIZE STREQUAL "thread")
|
|
101
|
-
add_compile_options("-fsanitize=thread")
|
|
102
|
-
add_link_options("-fsanitize=thread")
|
|
103
|
-
message(STATUS "Sanitizer build: ${SVF_SANITIZE}")
|
|
104
|
-
elseif(NOT SVF_SANITIZE STREQUAL "")
|
|
105
|
-
message(FATAL_ERROR "Unknown sanitizer type: ${SVF_SANITIZE}")
|
|
143
|
+
# Set location of extapi.bc (installed)
|
|
144
|
+
set(SVF_EXTAPI_BC_NAME extapi.bc)
|
|
145
|
+
set(SVF_BUILD_EXTAPI_BC ${SVF_BINARY_DIR}/lib/${SVF_EXTAPI_BC_NAME})
|
|
146
|
+
set(SVF_INSTALL_EXTAPI_BC ${SVF_INSTALL_EXTAPIDIR}/${SVF_EXTAPI_BC_NAME})
|
|
147
|
+
|
|
148
|
+
# Depending on the configuration, globally enable PIC/LTO/LLD for targets defined hereafter
|
|
149
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE
|
|
150
|
+
${SVF_USE_PIC}
|
|
151
|
+
CACHE BOOL "" FORCE
|
|
152
|
+
)
|
|
153
|
+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION
|
|
154
|
+
${SVF_USE_LTO}
|
|
155
|
+
CACHE BOOL "" FORCE
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
# Setting the linker type like this is only supported since CMake 3.29+
|
|
159
|
+
if(SVF_USE_LLD)
|
|
160
|
+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.29")
|
|
161
|
+
set(CMAKE_LINKER_TYPE
|
|
162
|
+
LLD
|
|
163
|
+
CACHE STRING "" FORCE
|
|
164
|
+
)
|
|
165
|
+
endif()
|
|
106
166
|
endif()
|
|
107
167
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
168
|
+
message(
|
|
169
|
+
STATUS
|
|
170
|
+
"Using SVF build configuration:
|
|
171
|
+
Project: ${PROJECT_NAME}
|
|
172
|
+
SVF version: ${SVF_VERSION}
|
|
173
|
+
SVF root directory: ${SVF_SOURCE_DIR}
|
|
174
|
+
SVF binary directory: ${SVF_BINARY_DIR}
|
|
175
|
+
Project root directory: ${PROJECT_SOURCE_DIR}
|
|
176
|
+
Project binary directory: ${PROJECT_BINARY_DIR}
|
|
177
|
+
|
|
178
|
+
Installing executables to: ${SVF_INSTALL_BINDIR}
|
|
179
|
+
Installing libraries to: ${SVF_INSTALL_LIBDIR}
|
|
180
|
+
Installing headers to: ${SVF_INSTALL_INCLUDEDIR}
|
|
181
|
+
Installing extapi.bc to: ${SVF_INSTALL_EXTAPIDIR}
|
|
182
|
+
Installing pkgconfig to: ${SVF_INSTALL_PKGCONFDIR}
|
|
183
|
+
Installing CMake package to: ${SVF_INSTALL_CMAKECONFIGDIR}
|
|
184
|
+
|
|
185
|
+
SVF option - Build type: ${SVF_BUILD_TYPE}
|
|
186
|
+
SVF option - Building shared libs: ${SVF_SHARED_LIBS}
|
|
187
|
+
SVF option - Enabled exception handling: ${SVF_ENABLE_EH}
|
|
188
|
+
SVF option - Enabled runtime type information: ${SVF_ENABLE_RTTI}
|
|
189
|
+
SVF option - Enabling position-independent code: ${SVF_USE_PIC}
|
|
190
|
+
SVF option - Enabling link-time optimisations: ${SVF_USE_LTO}
|
|
191
|
+
SVF option - Using ld.lld as default linker: ${SVF_USE_LLD}
|
|
192
|
+
SVF option - Enabling coverage build: ${SVF_COVERAGE}
|
|
193
|
+
SVF option - Treating warnings as errors: ${SVF_DEBUG_INFO}
|
|
194
|
+
SVF option - Generating debug information: ${SVF_WARN_AS_ERROR}
|
|
195
|
+
SVF option - Exporting all dynamic symbols: ${SVF_EXPORT_DYNAMIC}
|
|
196
|
+
SVF option - Forcefully enabling assertions: ${SVF_ENABLE_ASSERTIONS}
|
|
197
|
+
|
|
198
|
+
CMake root directory: ${CMAKE_SOURCE_DIR}
|
|
199
|
+
CMake binary directory: ${CMAKE_BINARY_DIR}
|
|
200
|
+
Current CMake root directory: ${CMAKE_CURRENT_SOURCE_DIR}
|
|
201
|
+
Current CMake binary directory: ${CMAKE_CURRENT_BINARY_DIR}
|
|
202
|
+
|
|
203
|
+
CMake generator: ${CMAKE_GENERATOR}
|
|
204
|
+
CMake C compiler: ${CMAKE_C_COMPILER_ID}
|
|
205
|
+
CMake C++ compiler: ${CMAKE_CXX_COMPILER_ID}
|
|
206
|
+
Using CMake C standard: ${CMAKE_C_STANDARD}
|
|
207
|
+
Using CMake C++ standard: ${CMAKE_CXX_STANDARD}
|
|
208
|
+
Current CMake install prefix: ${CMAKE_INSTALL_PREFIX}"
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
# =================================================================================
|
|
212
|
+
# SVF Z3 dependency finding
|
|
213
|
+
# =================================================================================
|
|
214
|
+
|
|
215
|
+
# Find the local FindZ3.cmake package; internally finds system Z3; falls back to manual search
|
|
216
|
+
find_package(Z3 REQUIRED)
|
|
217
|
+
message(
|
|
218
|
+
STATUS
|
|
219
|
+
"Using Z3 package:
|
|
220
|
+
Z3 major version: ${Z3_VERSION_MAJOR}
|
|
221
|
+
Z3 minor version: ${Z3_VERSION_MINOR}
|
|
222
|
+
Z3 patch version: ${Z3_VERSION_PATCH}
|
|
223
|
+
Z3 tweak version: ${Z3_VERSION_TWEAK}
|
|
224
|
+
Z3 version string: ${Z3_VERSION_STRING}
|
|
225
|
+
Z3 link libraries: ${Z3_LIBRARIES}
|
|
226
|
+
Z3 C include dirs: ${Z3_C_INCLUDE_DIRS}
|
|
227
|
+
Z3 C++ include dirs: ${Z3_CXX_INCLUDE_DIRS}"
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
# =================================================================================
|
|
231
|
+
# SVF configuration interface library
|
|
232
|
+
# =================================================================================
|
|
233
|
+
|
|
234
|
+
# Define an interface library which contains publically exposed properties/flags/defs
|
|
235
|
+
add_library(SvfFlags INTERFACE)
|
|
236
|
+
|
|
237
|
+
# Set the C++ standard as a public required feature
|
|
238
|
+
target_compile_features(SvfFlags INTERFACE c_std_11 cxx_std_17)
|
|
239
|
+
|
|
240
|
+
# Expose headers in build-tree only to in-tree users (not as system headers; in-tree users see warnings)
|
|
241
|
+
target_include_directories(
|
|
242
|
+
SvfFlags
|
|
243
|
+
INTERFACE $<BUILD_INTERFACE:${SVF_BINARY_DIR}>
|
|
244
|
+
INTERFACE $<BUILD_INTERFACE:${SVF_BINARY_DIR}/include>
|
|
245
|
+
INTERFACE $<BUILD_INTERFACE:${SVF_BINARY_DIR}/include/SVF>
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
# Expose installed headers publicly (as system headers to suppress internal warnings to end-users)
|
|
249
|
+
target_include_directories(
|
|
250
|
+
SvfFlags
|
|
251
|
+
SYSTEM
|
|
252
|
+
INTERFACE $<INSTALL_INTERFACE:${SVF_INSTALL_INCLUDEDIR}>
|
|
253
|
+
INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
# Expose build-tree compiled artifacts only to in-tree users; expose install tree publicly
|
|
257
|
+
target_link_directories(
|
|
258
|
+
SvfFlags
|
|
259
|
+
INTERFACE $<BUILD_INTERFACE:${SVF_BINARY_DIR}>
|
|
260
|
+
INTERFACE $<BUILD_INTERFACE:${SVF_BINARY_DIR}/lib>
|
|
261
|
+
INTERFACE $<INSTALL_INTERFACE:${SVF_INSTALL_LIBDIR}>
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
# Expose build-tree extapi.bc to in-tree users of SVF (i.e. building SVF as subproject)
|
|
265
|
+
target_compile_definitions(SvfFlags INTERFACE $<BUILD_INTERFACE:SVF_INSTALL_EXTAPI_BC="${SVF_BUILD_EXTAPI_BC}">)
|
|
266
|
+
|
|
267
|
+
# Add Z3 as a public dependency on the interface to ensure any users inherit the dependency
|
|
268
|
+
target_link_libraries(SvfFlags INTERFACE ${Z3_LIBRARIES})
|
|
269
|
+
|
|
270
|
+
# Ensure the interface library is exposed during installation
|
|
271
|
+
install(TARGETS SvfFlags EXPORT SVFTargets)
|
|
272
|
+
|
|
273
|
+
# =================================================================================
|
|
274
|
+
# SVF test suite
|
|
275
|
+
# =================================================================================
|
|
276
|
+
|
|
277
|
+
# If ./Test-Suite exists, add & run the tests
|
|
278
|
+
if(EXISTS "${SVF_SOURCE_DIR}/Test-Suite")
|
|
279
|
+
include(CTest)
|
|
111
280
|
enable_testing()
|
|
112
281
|
add_subdirectory(Test-Suite)
|
|
113
|
-
include(CTest)
|
|
114
282
|
endif()
|
|
115
283
|
|
|
116
|
-
#
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
NAMES z3
|
|
121
|
-
HINTS ${Z3_DIR} ENV Z3_DIR
|
|
122
|
-
PATH_SUFFIXES bin lib)
|
|
123
|
-
find_path(
|
|
124
|
-
Z3_INCLUDES
|
|
125
|
-
REQUIRED
|
|
126
|
-
NAMES z3++.h
|
|
127
|
-
HINTS ${Z3_DIR} ENV Z3_DIR
|
|
128
|
-
PATH_SUFFIXES include z3)
|
|
129
|
-
message(STATUS "Z3 STATUS:
|
|
130
|
-
Z3 library file: ${Z3_LIBRARIES}
|
|
131
|
-
Z3 include directory: ${Z3_INCLUDES}")
|
|
132
|
-
|
|
133
|
-
# Add the Z3 include directory and link the Z3 library to all targets of SVF
|
|
134
|
-
set(CMAKE_INSTALL_RPATH ${Z3_INCLUDES})
|
|
135
|
-
link_libraries(${Z3_LIBRARIES})
|
|
136
|
-
include_directories(SYSTEM ${Z3_INCLUDES})
|
|
137
|
-
|
|
138
|
-
# Add the actual SVF and SVF-LLVM targets
|
|
284
|
+
# =================================================================================
|
|
285
|
+
# SVF core definitions
|
|
286
|
+
# =================================================================================
|
|
287
|
+
|
|
139
288
|
add_subdirectory(svf)
|
|
140
289
|
add_subdirectory(svf-llvm)
|
|
141
290
|
|
|
142
|
-
#
|
|
143
|
-
# SVF
|
|
144
|
-
#
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
291
|
+
# =================================================================================
|
|
292
|
+
# SVF build configuration handling (post linking LLVM)
|
|
293
|
+
# =================================================================================
|
|
294
|
+
|
|
295
|
+
# Expose the required ABI flags (e.g., whether RTTI was disabled) in the build & install trees
|
|
296
|
+
target_compile_options(SvfFlags INTERFACE $<$<NOT:$<BOOL:${SVF_ENABLE_RTTI}>>:-fno-rtti>)
|
|
297
|
+
target_link_options(SvfFlags INTERFACE $<$<NOT:$<BOOL:${SVF_ENABLE_RTTI}>>:-fno-rtti>)
|
|
298
|
+
|
|
299
|
+
# Expose build/link flags not required for users of SVF only in the build tree
|
|
300
|
+
target_compile_options(
|
|
301
|
+
SvfFlags
|
|
302
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_DEBUG_INFO}>:-g3>>
|
|
303
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_WARN_AS_ERROR}>:-Wall>>
|
|
304
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_WARN_AS_ERROR}>:-Werror>>
|
|
305
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_WARN_AS_ERROR}>:-Wno-deprecated-declarations>>
|
|
306
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_ENABLE_ASSERTIONS}>:-UNDEBUG>>
|
|
307
|
+
INTERFACE $<BUILD_INTERFACE:$<$<NOT:$<BOOL:${SVF_ENABLE_EH}>>:-fno-exceptions>>
|
|
308
|
+
INTERFACE $<BUILD_INTERFACE:$<$<OR:$<BOOL:${SVF_COVERAGE}>,$<BOOL:$ENV{SVF_COVERAGE}>>:-fprofile-arcs>>
|
|
309
|
+
INTERFACE $<BUILD_INTERFACE:$<$<OR:$<BOOL:${SVF_COVERAGE}>,$<BOOL:$ENV{SVF_COVERAGE}>>:-ftest-coverage>>
|
|
310
|
+
INTERFACE $<BUILD_INTERFACE:$<$<STREQUAL:${SVF_SANITIZE},thread>:-fsanitize=thread>>
|
|
311
|
+
INTERFACE $<BUILD_INTERFACE:$<$<STREQUAL:${SVF_SANITIZE},address>:-fsanitize=address>>
|
|
312
|
+
INTERFACE $<BUILD_INTERFACE:$<$<STREQUAL:${SVF_SANITIZE},address>:-fno-omit-frame-pointer>>
|
|
313
|
+
)
|
|
314
|
+
target_link_options(
|
|
315
|
+
SvfFlags
|
|
316
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_DEBUG_INFO}>:-g3>>
|
|
317
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_WARN_AS_ERROR}>:-Wall>>
|
|
318
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_WARN_AS_ERROR}>:-Werror>>
|
|
319
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_WARN_AS_ERROR}>:-Wno-deprecated-declarations>>
|
|
320
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_USE_LLD}>:-fuse-ld=lld>>
|
|
321
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_EXPORT_DYNAMIC}>:-rdynamic>>
|
|
322
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_EXPORT_DYNAMIC}>:-Wl,--export-dynamic>>
|
|
323
|
+
INTERFACE $<BUILD_INTERFACE:$<$<BOOL:${SVF_ENABLE_ASSERTIONS}>:-UNDEBUG>>
|
|
324
|
+
INTERFACE $<BUILD_INTERFACE:$<$<NOT:$<BOOL:${SVF_ENABLE_EH}>>:-fno-exceptions>>
|
|
325
|
+
INTERFACE $<BUILD_INTERFACE:$<$<OR:$<BOOL:${SVF_COVERAGE}>,$<BOOL:$ENV{SVF_COVERAGE}>>:-fprofile-arcs>>
|
|
326
|
+
INTERFACE $<BUILD_INTERFACE:$<$<OR:$<BOOL:${SVF_COVERAGE}>,$<BOOL:$ENV{SVF_COVERAGE}>>:-ftest-coverage>>
|
|
327
|
+
INTERFACE $<BUILD_INTERFACE:$<$<STREQUAL:${SVF_SANITIZE},thread>:-fsanitize=thread>>
|
|
328
|
+
INTERFACE $<BUILD_INTERFACE:$<$<STREQUAL:${SVF_SANITIZE},address>:-fsanitize=address>>
|
|
148
329
|
)
|
|
149
330
|
|
|
150
|
-
#
|
|
151
|
-
|
|
331
|
+
# =================================================================================
|
|
332
|
+
# SVF configuration header
|
|
333
|
+
# =================================================================================
|
|
334
|
+
|
|
335
|
+
# (1) Generate config.h into <build_tree>/include/SVF/Util; (2) Install it under <install_prefix>/include/SVF/Util
|
|
336
|
+
configure_file(${SVF_SOURCE_DIR}/cmake/SVFConfigHdr.cmake.in ${SVF_BINARY_DIR}/include/SVF/Util/config.h @ONLY)
|
|
337
|
+
install(FILES ${SVF_BINARY_DIR}/include/SVF/Util/config.h DESTINATION ${SVF_INSTALL_INCLUDEDIR}/Util)
|
|
338
|
+
|
|
339
|
+
# =================================================================================
|
|
340
|
+
# SVF pkgconf package configuration
|
|
341
|
+
# =================================================================================
|
|
152
342
|
|
|
153
|
-
|
|
343
|
+
configure_file(cmake/SVF.pc.in ${SVF_BINARY_DIR}/SVF.pc @ONLY)
|
|
344
|
+
install(FILES ${SVF_BINARY_DIR}/SVF.pc DESTINATION ${SVF_INSTALL_PKGCONFDIR})
|
|
345
|
+
|
|
346
|
+
# =================================================================================
|
|
347
|
+
# SVF CMake package configuration
|
|
348
|
+
# =================================================================================
|
|
349
|
+
|
|
350
|
+
# Export targets for in-tree `find_package(SVF)` support
|
|
351
|
+
export(
|
|
352
|
+
EXPORT SVFTargets
|
|
353
|
+
NAMESPACE SVF::
|
|
354
|
+
FILE ${SVF_BINARY_DIR}/SVFTargets.cmake
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
# Install the SVFTargets.cmake file along with the package
|
|
358
|
+
install(
|
|
359
|
+
EXPORT SVFTargets
|
|
360
|
+
NAMESPACE SVF::
|
|
361
|
+
DESTINATION ${SVF_INSTALL_CMAKECONFIGDIR}
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
# Create the CMake configuration file (to find SVF with find_package(SVF))
|
|
154
365
|
configure_package_config_file(
|
|
155
|
-
.
|
|
156
|
-
${
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
# Generate SVFConfigVersion.cmake
|
|
366
|
+
cmake/SVFConfig.cmake.in ${SVF_BINARY_DIR}/SVFConfig.cmake
|
|
367
|
+
INSTALL_DESTINATION ${SVF_INSTALL_CMAKECONFIGDIR}
|
|
368
|
+
PATH_VARS SVF_INSTALL_BINDIR
|
|
369
|
+
SVF_INSTALL_LIBDIR
|
|
370
|
+
SVF_INSTALL_EXTAPIDIR
|
|
371
|
+
SVF_INSTALL_EXTAPI_BC
|
|
372
|
+
SVF_INSTALL_INCLUDEDIR
|
|
373
|
+
SVF_INSTALL_PKGCONFDIR
|
|
374
|
+
SVF_INSTALL_CMAKECONFIGDIR
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
# Create the CMake version configuration package (to support finding specific SVF versions)
|
|
168
378
|
write_basic_package_version_file(
|
|
169
|
-
|
|
170
|
-
VERSION
|
|
379
|
+
${SVF_BINARY_DIR}/SVFConfigVersion.cmake
|
|
380
|
+
VERSION ${SVF_VERSION}
|
|
171
381
|
COMPATIBILITY AnyNewerVersion
|
|
172
382
|
)
|
|
173
383
|
|
|
174
|
-
# Install
|
|
384
|
+
# Install the generated configuration files
|
|
385
|
+
install(FILES ${SVF_BINARY_DIR}/SVFConfig.cmake DESTINATION ${SVF_INSTALL_CMAKECONFIGDIR})
|
|
386
|
+
install(FILES ${SVF_BINARY_DIR}/SVFConfigVersion.cmake DESTINATION ${SVF_INSTALL_CMAKECONFIGDIR})
|
|
387
|
+
|
|
388
|
+
# Also install the extra module finding package definitions (e.g., FindZ3.cmake)
|
|
175
389
|
install(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
390
|
+
DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules"
|
|
391
|
+
DESTINATION "${SVF_INSTALL_CMAKECONFIGDIR}"
|
|
392
|
+
FILES_MATCHING
|
|
393
|
+
PATTERN "*.cmake"
|
|
180
394
|
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#
|
|
2
|
+
# FindZ3.cmake - Locate Z3 either via a packaged config or by header+lib
|
|
3
|
+
#
|
|
4
|
+
|
|
5
|
+
include(GNUInstallDirs)
|
|
6
|
+
|
|
7
|
+
# Try upstream/system CONFIG package first; use it if found (sets required variables):
|
|
8
|
+
find_package(Z3 CONFIG QUIET HINTS ${Z3_HOME} $ENV{Z3_HOME} ${Z3_DIR} $ENV{Z3_DIR})
|
|
9
|
+
if(Z3_FOUND)
|
|
10
|
+
if(NOT Z3_FIND_QUIETLY)
|
|
11
|
+
message(STATUS "Found upstream/system Z3 package (Z3Config.cmake)")
|
|
12
|
+
endif()
|
|
13
|
+
else()
|
|
14
|
+
if(NOT Z3_FIND_QUIETLY)
|
|
15
|
+
message(STATUS "Failed to find upstream/system Z3 package; reverting to manual search")
|
|
16
|
+
endif()
|
|
17
|
+
|
|
18
|
+
# Fall back to explicit manual header + lib search (prioritise searching $Z3_DIR)
|
|
19
|
+
find_library(
|
|
20
|
+
Z3_LIBRARY_DIR
|
|
21
|
+
NAMES z3 libz3
|
|
22
|
+
HINTS ${Z3_HOME} $ENV{Z3_HOME} ${Z3_DIR} $ENV{Z3_DIR}
|
|
23
|
+
PATH_SUFFIXES bin lib ${CMAKE_INSTALL_BINDIR} ${CMAKE_INSTALL_LIBDIR}
|
|
24
|
+
)
|
|
25
|
+
find_path(
|
|
26
|
+
Z3_INCLUDE_DIR
|
|
27
|
+
NAMES z3++.h
|
|
28
|
+
HINTS ${Z3_HOME} $ENV{Z3_HOME} ${Z3_DIR} $ENV{Z3_DIR}
|
|
29
|
+
PATH_SUFFIXES include ${CMAKE_INSTALL_INCLUDEDIR}
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# If the headers were found, find & extract the Z3 version number
|
|
33
|
+
set(_ver_h "${Z3_INCLUDE_DIR}/z3_version.h")
|
|
34
|
+
if(EXISTS "${_ver_h}")
|
|
35
|
+
file(READ "${_ver_h}" _z3_ver_h)
|
|
36
|
+
message(STATUS "Extracted Z3 version information from ${_ver_h}")
|
|
37
|
+
|
|
38
|
+
# Match each component explicitly
|
|
39
|
+
string(REGEX MATCH "#define Z3_MAJOR_VERSION[ \t]+([0-9]+)" _major "${_z3_ver_h}")
|
|
40
|
+
set(Z3_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
|
41
|
+
|
|
42
|
+
string(REGEX MATCH "#define Z3_MINOR_VERSION[ \t]+([0-9]+)" _minor "${_z3_ver_h}")
|
|
43
|
+
set(Z3_VERSION_MINOR "${CMAKE_MATCH_1}")
|
|
44
|
+
|
|
45
|
+
string(REGEX MATCH "#define Z3_BUILD_NUMBER[ \t]+([0-9]+)" _patch "${_z3_ver_h}")
|
|
46
|
+
set(Z3_VERSION_PATCH "${CMAKE_MATCH_1}")
|
|
47
|
+
|
|
48
|
+
string(REGEX MATCH "#define Z3_REVISION_NUMBER[ \t]+([0-9]+)" _tweak "${_z3_ver_h}")
|
|
49
|
+
set(Z3_VERSION_TWEAK "${CMAKE_MATCH_1}")
|
|
50
|
+
|
|
51
|
+
# Fallback if any of the components are unset
|
|
52
|
+
foreach(_part MAJOR MINOR PATCH TWEAK)
|
|
53
|
+
if(NOT Z3_VERSION_${_part})
|
|
54
|
+
set(Z3_VERSION_${_part} 0)
|
|
55
|
+
endif()
|
|
56
|
+
endforeach()
|
|
57
|
+
|
|
58
|
+
set(Z3_VERSION_STRING "${Z3_VERSION_MAJOR}.${Z3_VERSION_MINOR}.${Z3_VERSION_PATCH}.${Z3_VERSION_TWEAK}")
|
|
59
|
+
message(STATUS "Parsed Z3 version: ${Z3_VERSION_STRING}")
|
|
60
|
+
else()
|
|
61
|
+
message(WARNING "Z3 version header not found: ${_ver_h}")
|
|
62
|
+
set(Z3_VERSION_MAJOR 0)
|
|
63
|
+
set(Z3_VERSION_MINOR 0)
|
|
64
|
+
set(Z3_VERSION_PATCH 0)
|
|
65
|
+
set(Z3_VERSION_TWEAK 0)
|
|
66
|
+
set(Z3_VERSION_STRING "0.0.0.0")
|
|
67
|
+
endif()
|
|
68
|
+
|
|
69
|
+
# Validate that both the public headers & the library files were found
|
|
70
|
+
include(FindPackageHandleStandardArgs)
|
|
71
|
+
find_package_handle_standard_args(
|
|
72
|
+
Z3
|
|
73
|
+
REQUIRED_VARS Z3_INCLUDE_DIR Z3_LIBRARY_DIR
|
|
74
|
+
VERSION_VAR Z3_VERSION_STRING
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Create an imported target if all required variables were found
|
|
78
|
+
if(Z3_FOUND)
|
|
79
|
+
add_library(z3::libz3 UNKNOWN IMPORTED)
|
|
80
|
+
set_target_properties(z3::libz3 PROPERTIES IMPORTED_LOCATION "${Z3_LIBRARY_DIR}")
|
|
81
|
+
set_target_properties(z3::libz3 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Z3_INCLUDE_DIR}")
|
|
82
|
+
message(STATUS "Manually found Z3 (libs: ${Z3_LIBRARY_DIR}; public headers: ${Z3_INCLUDE_DIR})")
|
|
83
|
+
|
|
84
|
+
# Expose other equivalents for variables exported by the regular Z3 CMake package
|
|
85
|
+
set(Z3_CXX_INCLUDE_DIRS ${Z3_INCLUDE_DIR})
|
|
86
|
+
set(Z3_C_INCLUDE_DIRS ${Z3_INCLUDE_DIR})
|
|
87
|
+
set(Z3_LIBRARIES z3::libz3)
|
|
88
|
+
elseif(Z3_FIND_REQUIRED)
|
|
89
|
+
message(FATAL_ERROR "Failed to find Z3 library files/public headers!")
|
|
90
|
+
elseif(NOT Z3_FIND_QUIETLY)
|
|
91
|
+
message(WARNING "Failed to manually find Z3 libraries/headers")
|
|
92
|
+
endif()
|
|
93
|
+
endif()
|
package/cmake/SVF.pc.in
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
prefix=${pcfiledir}/../..
|
|
2
|
+
exec_prefix=${prefix}
|
|
3
|
+
bindir=${exec_prefix}/@SVF_INSTALL_BINDIR@
|
|
4
|
+
libdir=${exec_prefix}/@SVF_INSTALL_LIBDIR@
|
|
5
|
+
includedir=${exec_prefix}/@SVF_INSTALL_INCLUDEDIR@
|
|
6
|
+
|
|
7
|
+
Name: SVF
|
|
8
|
+
Description: SVF Points to Analysis Framework
|
|
9
|
+
Version: @SVF_VERSION@
|
|
10
|
+
Requires: z3
|
|
11
|
+
Libs: -L${libdir} -lSvfCore -lSvfLLVM
|
|
12
|
+
Cflags: -I${includedir}
|