summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2016-09-19 22:32:41 +0000
committerTuowen Zhao <ztuowen@gmail.com>2016-09-19 22:32:41 +0000
commitcf2eb3dde8d9d49f28b9f91a726c865abe948109 (patch)
treedeff333167b9a132df5903cf629e623f20c9a7e8
parentad802305ebdc4a3956f90382f7d40a104e8c2f73 (diff)
downloadchill-cf2eb3dde8d9d49f28b9f91a726c865abe948109.tar.gz
chill-cf2eb3dde8d9d49f28b9f91a726c865abe948109.tar.bz2
chill-cf2eb3dde8d9d49f28b9f91a726c865abe948109.zip
parseRel as lib
-rw-r--r--CMakeLists.txt11
-rw-r--r--lib/parserel/CMakeLists.txt18
-rw-r--r--lib/parserel/include/parseRel.hh (renamed from include/chill_run_util.hh)0
-rw-r--r--lib/parserel/src/parseRel.cc (renamed from src/chill_run_util.cc)2
-rw-r--r--lib/parserel/src/parseRel.ll (renamed from src/parse_expr.ll)4
-rw-r--r--lib/parserel/src/parseRel.yy (renamed from src/parse_expr.yy)4
-rw-r--r--src/chillmodule.cc2
7 files changed, 29 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 229a99d..4c5773e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ ADD_FLEX_BISON_DEPENDENCY(ExprScanner ExprParser)
string(TIMESTAMP build_date "\\\"%m/%d/%Y\\\"")
set(CORE_LIBS
- m rose rt util omega codegen rosecg dl
+ m rose rt util omega codegen rosecg dl parseRel
boost_date_time boost_filesystem boost_program_options
boost_regex boost_system boost_wave boost_iostreams)
@@ -44,10 +44,7 @@ set(IR_CHILL_SRC
set(PYTHON_SRC
src/chill_run.cc
- src/chill_run_util.cc
src/chillmodule.cc
- ${FLEX_ExprScanner_OUTPUTS}
- ${BISON_ExprParser_OUTPUTS}
)
set(COMMON_FLAGS "-DCHILL_BUILD_DATE=\"${build_date}\" -DCHILL_BUILD_VERSION=\"\\\"${CHILL_VERSION}\\\"\"")
@@ -58,8 +55,9 @@ if (DEFINED OMEGAHOME)
link_directories(${OMEGAHOME}/lib)
set(OMEGA_INC ${OMEGAHOME}/include)
else()
- set(OMEGA_INC
+ set(OMEGA_INC
${CMAKE_CURRENT_SOURCE_DIR}/lib/omega/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib/parserel/include
${CMAKE_CURRENT_SOURCE_DIR}/lib/codegen/include
)
endif()
@@ -78,7 +76,7 @@ include_directories(
add_executable(chill ${CORE_SRC} ${PYTHON_SRC} ${IR_CHILL_SRC})
target_link_libraries(chill ${CORE_LIBS} ${PYTHON_LIBRARY})
-add_dependencies(chill omega codegen rosecg)
+add_dependencies(chill omega codegen rosecg parseRel)
install(TARGETS chill
RUNTIME DESTINATION bin)
@@ -86,5 +84,6 @@ install(TARGETS chill
add_subdirectory(lib/omega)
add_subdirectory(lib/codegen)
add_subdirectory(lib/rosecg)
+add_subdirectory(lib/parserel)
add_subdirectory(doc)
diff --git a/lib/parserel/CMakeLists.txt b/lib/parserel/CMakeLists.txt
new file mode 100644
index 0000000..adc1d88
--- /dev/null
+++ b/lib/parserel/CMakeLists.txt
@@ -0,0 +1,18 @@
+find_package(BISON)
+find_package(FLEX)
+
+FLEX_TARGET(ExprScanner src/parseRel.ll ${CMAKE_CURRENT_BINARY_DIR}/parseRel.yy.cc COMPILE_FLAGS
+ "--header-file=${CMAKE_CURRENT_BINARY_DIR}/parseRel.ll.hh") # Hack to avoid generating header in root
+BISON_TARGET(ExprParser src/parseRel.yy ${CMAKE_CURRENT_BINARY_DIR}/parseRel.tab.cc COMPILE_FLAGS "-t -d")
+ADD_FLEX_BISON_DEPENDENCY(ExprScanner ExprParser)
+
+include_directories(
+ include
+ ${CMAKE_CURRENT_BINARY_DIR}
+ )
+
+add_library(parseRel
+ src/parseRel.cc
+ ${FLEX_ExprScanner_OUTPUTS}
+ ${BISON_ExprParser_OUTPUTS}
+ )
diff --git a/include/chill_run_util.hh b/lib/parserel/include/parseRel.hh
index 8df5871..8df5871 100644
--- a/include/chill_run_util.hh
+++ b/lib/parserel/include/parseRel.hh
diff --git a/src/chill_run_util.cc b/lib/parserel/src/parseRel.cc
index 29568e7..43d7494 100644
--- a/src/chill_run_util.cc
+++ b/lib/parserel/src/parseRel.cc
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <string.h>
-#include "chill_run_util.hh"
+#include "parseRel.hh"
static std::string to_string(int ival) {
char buffer[4];
diff --git a/src/parse_expr.ll b/lib/parserel/src/parseRel.ll
index a9b389f..f0cac81 100644
--- a/src/parse_expr.ll
+++ b/lib/parserel/src/parseRel.ll
@@ -1,7 +1,7 @@
%{
// some C++ code
-#include "chill_run_util.hh"
-#include "parse_expr.tab.hh"
+#include "parseRel.hh"
+#include "parseRel.tab.hh"
%}
%option noyywrap
diff --git a/src/parse_expr.yy b/lib/parserel/src/parseRel.yy
index c2943c2..98c329f 100644
--- a/src/parse_expr.yy
+++ b/lib/parserel/src/parseRel.yy
@@ -1,6 +1,6 @@
%{
-#include "chill_run_util.hh"
-#include "parse_expr.ll.hh"
+#include "parseRel.hh"
+#include "parseRel.ll.hh"
extern int yydebug;
diff --git a/src/chillmodule.cc b/src/chillmodule.cc
index 0e41f88..72f32d4 100644
--- a/src/chillmodule.cc
+++ b/src/chillmodule.cc
@@ -1,6 +1,6 @@
#include "chilldebug.h"
-#include "chill_run_util.hh"
+#include <parseRel.hh>
#include <signal.h>
#include <stdio.h>