-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
79 lines (65 loc) · 2.78 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cmake_minimum_required(VERSION 2.9)
project(debop)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
file(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
file(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/wrappers)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(LLVM REQUIRED)
find_package(Clang REQUIRED)
set(CMAKE_CXX_FLAGS "${LLVM_COMPILE_FLAGS} ${CMAKE_CXX_FLAGS} -std=c++11 -lstdc++ -w -Os -march=native -fexceptions -pthread")
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address")
endif(CMAKE_BUILD_TYPE MATCHES DEBUG)
message(STATUS "CXX flags: " ${CMAKE_CXX_FLAGS})
include_directories(${LLVM_INCLUDE_DIRS})
include_directories(${CLANG_INCLUDE_DIRS})
include_directories(include)
include_directories(/home/qxin6/llvm-project/clang/include) #Change to your own path!
include_directories(/home/qxin6/llvm-project/build/tools/clang/include) #Change to your own path!
add_executable(reducer
src/cpp/reducer/Main.cpp
src/cpp/reducer/core/Frontend.cpp
src/cpp/reducer/core/SourceManager.cpp
src/cpp/reducer/core/Transformation.cpp
src/cpp/reducer/core/Reduction.cpp
src/cpp/reducer/core/GlobalReduction.cpp
src/cpp/reducer/core/LocalReduction.cpp
src/cpp/reducer/core/DeadcodeElimination.cpp
src/cpp/reducer/core/Reformat.cpp
src/cpp/reducer/core/ProbabilisticModel.cpp
src/cpp/reducer/utils/FileManager.cpp
src/cpp/reducer/utils/IntegrationManager.cpp
src/cpp/reducer/utils/OptionManager.cpp
src/cpp/reducer/utils/Report.cpp
src/cpp/reducer/utils/Profiler.cpp
src/cpp/reducer/utils/StatsManager.cpp
)
add_custom_target(lib ALL
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/lib/wrappers/* ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/wrappers/
)
target_link_libraries(reducer ${CLANG_LIBS} ${LLVM_LIBS_CORE} ${LLVM_LDFLAGS})
# for make test
enable_testing()
add_subdirectory(test)
# for documents
option(BUILD_DOCS "Build and Install Documents (Requires Doxygen)")
if (BUILD_DOCS)
find_package(Doxygen)
if (DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
# note the option ALL which allows to build the docs together with the application
add_custom_target(doc ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
else (DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
endif(BUILD_DOCS)