source: icGREP/icgrep-devel/icgrep/CMakeLists.txt @ 4129

Last change on this file since 4129 was 4128, checked in by linmengl, 5 years ago

modify perf.py; add an interactive perf data viewer; add make target 'perf_icgrep' and 'viewer';

File size: 3.1 KB
Line 
1cmake_minimum_required (VERSION 2.8)
2
3project (icgrep)
4
5enable_testing()
6# The version number.
7set (icgrep_VERSION_MAJOR 0)
8set (icgrep_VERSION_MINOR 8)
9
10# configure a header file to pass some of the CMake settings
11# to the source code
12#configure_file (
13#  "${PROJECT_SOURCE_DIR}/icgrepconfig.h.in"
14#  "${PROJECT_BINARY_DIR}/icgrepconfig.h"
15#  )
16
17# LLVM set up
18#
19# A convenience variable:
20set(LLVM_ROOT "../libllvm" CACHE PATH "Root of LLVM install.")
21
22# A bit of a sanity check:
23if( NOT EXISTS ${LLVM_ROOT}/include/llvm )
24message(FATAL_ERROR "LLVM_ROOT (${LLVM_ROOT}) is not a valid LLVM install")
25endif()
26
27# We incorporate the CMake features provided by LLVM:
28set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LLVM_ROOT}/share/llvm/cmake")
29include(LLVMConfig)
30
31# Now set the header and library paths:
32include_directories( ${LLVM_INCLUDE_DIRS} )
33link_directories( ${LLVM_LIBRARY_DIRS} )
34add_definitions( ${LLVM_DEFINITIONS} )
35
36# Let's suppose we want to build a JIT compiler with support for
37# binary code (no interpreter):
38llvm_map_components_to_libraries(REQ_LLVM_LIBRARIES mcjit native)
39
40message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
41
42add_library(PabloADT pe_advance.cpp  pe_all.cpp  pe_and.cpp pe_call.cpp pe_charclass.cpp  pe_matchstar.cpp pe_scanthru.cpp pe_not.cpp  pe_or.cpp  pe_pabloe.cpp  pe_sel.cpp  pe_var.cpp  pe_xor.cpp ps_assign.cpp  ps_if.cpp  ps_pablos.cpp  ps_while.cpp printer_pablos.cpp)
43
44add_library(RegExpADT re_alt.cpp  re_cc.cpp  re_end.cpp  re_name.cpp re_parser.cpp  re_re.cpp  re_rep.cpp  re_seq.cpp  re_start.cpp parsefailure.cpp  parseresult.cpp  parsesuccess.cpp printer_re.cpp)
45
46
47
48#include_directories("${PROJECT_BINARY_DIR}")
49include_directories("${PROJECT_SOURCE_DIR}")
50include_directories("${PROJECT_SOURCE_DIR}/include")
51include_directories("${PROJECT_SOURCE_DIR}/include/simd-lib")
52include_directories("${PROJECT_SOURCE_DIR}/include/simd-lib/idisa_cpp")
53
54# add the executable
55add_executable(icgrep icgrep.cpp llvm_gen.cpp llvm_gen_helper.cpp utf_encoding.cpp cc_codegenobject.cpp  cc_compiler.cpp  cc_compiler_helper.cpp re_simplifier.cpp re_reducer.cpp re_nullable.cpp re_compiler.cpp pbix_compiler.cpp  symbol_generator.cpp utf8_encoder.cpp unicode_categories.h unicode_categories-flat.h unicode_categories-simple.h)
56
57target_link_libraries (icgrep PabloADT RegExpADT ${REQ_LLVM_LIBRARIES})
58
59set(CMAKE_CXX_FLAGS_RELEASE "-std=gnu++0x -O3 -msse2")
60
61# detect LLVM version and add compiler flags.
62if (${LLVM_PACKAGE_VERSION} MATCHES "3.4")
63  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DUSE_LLVM_3_4")
64elseif (${LLVM_PACKAGE_VERSION} MATCHES "3.5")
65  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DUSE_LLVM_3_5")
66endif(${LLVM_PACKAGE_VERSION} MATCHES "3.4")
67
68add_test(
69  NAME greptest
70  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA
71  COMMAND python greptest.py ${CMAKE_BINARY_DIR}/icgrep)
72
73add_custom_target (check
74  COMMAND ${CMAKE_CTEST_COMMAND}
75  DEPENDS icgrep)
76
77add_custom_target (perf_icgrep
78  COMMAND python perf.py icgrep
79  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../performance
80  DEPENDS icgrep)
81
82add_custom_target (viewer
83  COMMAND python viewer.py
84  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../performance)
85
Note: See TracBrowser for help on using the repository browser.