From c5030bb423d78168147a2bc728702534c9cb647e Mon Sep 17 00:00:00 2001 From: Philipp Schubert Date: Wed, 12 Feb 2020 20:27:08 +0100 Subject: [PATCH] Revert "f-CMakePackage" --- CMakeLists.txt | 32 +------- Config.cmake.in | 7 -- cmake/phasar_macros.cmake | 8 +- examples/use-phasar-as-library/CMakeLists.txt | 41 ---------- examples/use-phasar-as-library/README.md | 1 - .../use-phasar-as-library/myphasartool.cpp | 76 ------------------- lib/PhasarClang/CMakeLists.txt | 4 - lib/Utils/CMakeLists.txt | 30 +------- 8 files changed, 3 insertions(+), 196 deletions(-) delete mode 100644 Config.cmake.in delete mode 100644 examples/use-phasar-as-library/CMakeLists.txt delete mode 100644 examples/use-phasar-as-library/README.md delete mode 100644 examples/use-phasar-as-library/myphasartool.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 58dda12785..7582b4555b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,8 +51,6 @@ option(PHASAR_BUILD_IR "Build IR test code (default is OFF)" OFF) option(PHASAR_BUILD_DOC "Build documentation" OFF) -option(PHASAR_DEBUG_LIBDEPS "Debug internal library dependencies (private linkage)" OFF) - option(BUILD_SHARED_LIBS "Build shared libraries (default is ON)" ON) option(PHASAR_ENABLE_WARNINGS "Enable warnings" ON) @@ -105,6 +103,7 @@ endif() # Boost find_package(Boost 1.65.1 COMPONENTS filesystem graph system program_options log ${BOOST_THREAD} REQUIRED) include_directories(${Boost_INCLUDE_DIRS}) +add_definitions(-DBOOST_LOG_DYN_LINK) # JSON library option(JSON_BuildTests OFF) @@ -234,8 +233,6 @@ if (PHASAR_BUILD_IR) add_subdirectory(test) endif() -set(INCLUDE_INSTALL_DIR include/ CACHE PATH "Install dir of headers") - # Install targets of phasar-llvm, other executables, and libraries are to be # found in the individual subdirectories of tools/ @@ -276,33 +273,6 @@ install(DIRECTORY config/ WORLD_READ ) -install(EXPORT phasarTargets - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/phasar - NAMESPACE phasar:: - FILE phasarTargets.cmake -) - -include(CMakePackageConfigHelpers) -configure_package_config_file( - Config.cmake.in - phasarConfig.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/phasar - PATH_VARS INCLUDE_INSTALL_DIR - ) - -write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/phasarConfigVersion.cmake - VERSION 1.0.0 - COMPATIBILITY SameMajorVersion - ) - -### Install Config and ConfigVersion files -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/phasarConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/phasarConfigVersion.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/phasar" - ) - # If the Phasar shared object libraries are not installed into a system folder # the so libs must be added manually to the linker search path and the linker # config must be updated as follows: diff --git a/Config.cmake.in b/Config.cmake.in deleted file mode 100644 index bfd2dcc95c..0000000000 --- a/Config.cmake.in +++ /dev/null @@ -1,7 +0,0 @@ -set(PHASAR_VERSION 1.0.0) - -@PACKAGE_INIT@ -set_and_check(PHASAR_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") -include( "${CMAKE_CURRENT_LIST_DIR}/phasarTargets.cmake" ) - -check_required_components(phasar) diff --git a/cmake/phasar_macros.cmake b/cmake/phasar_macros.cmake index 5ac5f18828..219a057940 100644 --- a/cmake/phasar_macros.cmake +++ b/cmake/phasar_macros.cmake @@ -161,7 +161,6 @@ macro(add_phasar_library name) set(libkind) endif() add_library( ${name} ${libkind} ${srcs} ) - add_library( phasar::${name} ALIAS ${name} ) if( LLVM_COMMON_DEPENDS ) add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) endif( LLVM_COMMON_DEPENDS ) @@ -173,11 +172,7 @@ macro(add_phasar_library name) if(PHASAR_LINK_LIBS) foreach(lib ${PHASAR_LINK_LIBS}) - if(PHASAR_DEBUG_LIBDEPS) - target_link_libraries(${name} LINK_PRIVATE ${lib}) - else() - target_link_libraries(${name} LINK_PUBLIC ${lib}) - endif(PHASAR_DEBUG_LIBDEPS) + target_link_libraries(${name} LINK_PRIVATE ${lib}) endforeach(lib) endif(PHASAR_LINK_LIBS) @@ -194,7 +189,6 @@ macro(add_phasar_library name) endif(MSVC) install(TARGETS ${name} EXPORT LLVMExports - EXPORT phasarTargets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) diff --git a/examples/use-phasar-as-library/CMakeLists.txt b/examples/use-phasar-as-library/CMakeLists.txt deleted file mode 100644 index 86642f0e0e..0000000000 --- a/examples/use-phasar-as-library/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -cmake_minimum_required(VERSION 3.12) - -project(PhasarExttoolTest) - -set(CMAKE_EXPORT_COMPILE_COMMANDS YES) -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - - -# Build a small test tool to show how phasar may be used -add_executable(myphasartool - myphasartool.cpp -) - -find_package(phasar) -include_directories(${PHASAR_INCLUDE_DIR}) -link_directories(${PHASAR_LIBRARY_DIR}) - -target_link_libraries(myphasartool - LINK_PUBLIC - phasar::phasar_config - phasar::phasar_controller - phasar::phasar_db - phasar::phasar_experimental - phasar::phasar_clang - phasar::phasar_controlflow - phasar::phasar_ifdside - phasar::phasar_mono - phasar::phasar_passes - phasar::phasar_pointer - phasar::phasar_typehierarchy - phasar::phasar_phasarllvm_utils -# phasar::phasar_utils #already introduced through phasar_clang -) - -install(TARGETS myphasartool - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib -) diff --git a/examples/use-phasar-as-library/README.md b/examples/use-phasar-as-library/README.md deleted file mode 100644 index 2a905cb90b..0000000000 --- a/examples/use-phasar-as-library/README.md +++ /dev/null @@ -1 +0,0 @@ -This is a demo tool that uses PhASAR as a library. Currently this is only supported in the f-CMakePackage feature branch of PhASAR. The number of phasar libraries explicitly stated in CMakeLists.txt can be further reduced by stating the non-transitive dependencies of phasar libraries. This is pending work on the PhASAR side. diff --git a/examples/use-phasar-as-library/myphasartool.cpp b/examples/use-phasar-as-library/myphasartool.cpp deleted file mode 100644 index e5b52b04a1..0000000000 --- a/examples/use-phasar-as-library/myphasartool.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2017 Philipp Schubert. - * All rights reserved. This program and the accompanying materials are made - * available under the terms of LICENSE.txt. - * - * Contributors: - * Philipp Schubert and others - *****************************************************************************/ - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace llvm { -class Value; -} // namespace llvm - -using namespace psr; - -int main(int argc, const char **argv) { - initializeLogger(false); - auto &lg = lg::get(); - if (argc < 2 || !boost::filesystem::exists(argv[1]) || - boost::filesystem::is_directory(argv[1])) { - std::cerr << "myphasartool\n" - "A small PhASAR-based example program\n\n" - "Usage: myphasartool \n"; - return 1; - } - initializeLogger(false); - ProjectIRDB DB({argv[1]}); - if (auto F = DB.getFunctionDefinition("main")) { - LLVMTypeHierarchy H(DB); - // print type hierarchy - H.print(); - LLVMPointsToInfo P(DB); - // print points-to information - P.print(); - LLVMBasedICFG I(DB, CallGraphAnalysisType::OTF, {"main"}, &H, &P); - // print inter-procedural control-flow graph - I.print(); - // IFDS template parametrization test - std::cout << "Testing IFDS:\n"; - IFDSLinearConstantAnalysis L(&DB, &H, &I, &P, {"main"}); - IFDSSolver - S(L); - S.solve(); - S.dumpResults(); - // IDE template parametrization test - std::cout << "Testing IDE:\n"; - IDELinearConstantAnalysis M(&DB, &H, &I, &P, {"main"}); - IDESolver - T(M); - T.solve(); - T.dumpResults(); - } else { - std::cerr << "error: file does not contain a 'main' function!\n"; - } - return 0; -} diff --git a/lib/PhasarClang/CMakeLists.txt b/lib/PhasarClang/CMakeLists.txt index 4cef18da2f..1a3901de1d 100644 --- a/lib/PhasarClang/CMakeLists.txt +++ b/lib/PhasarClang/CMakeLists.txt @@ -2,10 +2,6 @@ file(GLOB_RECURSE PHASARCLANG_SRC *.h *.cpp) include_directories(${CLANG_INCLUDE_DIRS}) -set(PHASAR_LINK_LIBS - phasar_utils -) - set(LLVM_LINK_COMPONENTS Support Core diff --git a/lib/Utils/CMakeLists.txt b/lib/Utils/CMakeLists.txt index 40e1d5f78d..89ee4e625e 100644 --- a/lib/Utils/CMakeLists.txt +++ b/lib/Utils/CMakeLists.txt @@ -16,6 +16,7 @@ set(LLVM_LINK_COMPONENTS BitWriter ) + if(BUILD_SHARED_LIBS) add_phasar_library(phasar_utils SHARED @@ -28,40 +29,11 @@ else() ) endif() -set(LLVM_LINK_COMPONENTS - coverage - coroutines - libdriver - lto - support - analysis - bitwriter - core - ipo - irreader - instcombine - instrumentation - linker - objcarcopts - scalaropts - transformutils - codegen - vectorize -) - -llvm_map_components_to_libnames(llvm_libs - ${LLVM_LINK_COMPONENTS} -) - -target_include_directories(phasar_utils PUBLIC ${LLVM_INCLUDE_DIRS}) -target_compile_definitions(phasar_utils PUBLIC -DBOOST_LOG_DYN_LINK) - find_package(Boost COMPONENTS log REQUIRED) target_link_libraries(phasar_utils LINK_PUBLIC ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} - ${llvm_libs} ) set_target_properties(phasar_utils