Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework build process to allow integration of LLVM tools #94

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion src/Automaton/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ set(SOURCE_FILES
)

add_library(GazerAutomaton SHARED ${SOURCE_FILES})
target_link_libraries(GazerAutomaton GazerCore)
target_link_libraries(GazerAutomaton GazerCore)

set_target_properties(GazerAutomaton PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib"
)
4 changes: 4 additions & 0 deletions src/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ set(SOURCE_FILES

add_library(GazerCore SHARED ${SOURCE_FILES})
target_link_libraries(GazerCore GazerSupport)

set_target_properties(GazerCore PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib"
)
18 changes: 16 additions & 2 deletions src/LLVM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,22 @@ set(SOURCE_FILES
Instrumentation/Checks/DivisionByZeroCheck.cpp
Instrumentation/Checks/SignedIntegerOverflowCheck.cpp Transform/LoopExitCanonizationPass.cpp)

find_package(LLVM REQUIRED CONFIG)
add_definitions(${LLVM_DEFINITIONS})
include_directories(${LLVM_INCLUDE_DIRS})
include(AddLLVM)

llvm_map_components_to_libnames(GAZER_LLVM_LIBS core irreader transformutils scalaropts ipo)
message(STATUS "Using LLVM libraries: ${GAZER_LLVM_LIBS}")

add_library(GazerLLVM SHARED ${SOURCE_FILES})
target_link_libraries(GazerLLVM ${GAZER_LLVM_LIBS} GazerCore GazerTrace GazerZ3Solver GazerAutomaton)
add_llvm_library(GazerLLVMBase SHARED ${SOURCE_FILES})
target_link_libraries(GazerLLVMBase GazerCore GazerTrace GazerZ3Solver GazerAutomaton)

# CMake needs a file to link against for a library.
# This is, however, unnecessary when creating a shared lib from an (LLVM) module.
# This is a dirty workaround.
# file(CONFIGURE TOUCH ${DESTPATH}/empty.cpp)
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/empty.cpp CONTENT \ )

add_library(GazerLLVM SHARED ${CMAKE_CURRENT_BINARY_DIR}/empty.cpp)
target_link_libraries(GazerLLVM GazerLLVMBase ${GAZER_LLVM_LIBS})
4 changes: 4 additions & 0 deletions src/SolverZ3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ add_dependencies(z3 z3_download)

add_library(GazerZ3Solver SHARED ${SOURCE_FILES})
target_link_libraries(GazerZ3Solver GazerCore z3)

set_target_properties(GazerZ3Solver PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib"
)
4 changes: 4 additions & 0 deletions src/Support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ llvm_map_components_to_libnames(LLVM_LIBS support)

add_library(GazerSupport ${SOURCE_FILES})
target_link_libraries(GazerSupport ${LLVM_LIBS})

set_target_properties(GazerSupport PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib"
)
4 changes: 4 additions & 0 deletions src/Trace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ set(SOURCE_FILES

add_library(GazerTrace SHARED ${SOURCE_FILES})
target_link_libraries(GazerTrace GazerCore)

set_target_properties(GazerTrace PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib"
)