blob: 552b7e26d21ad506f8307437a0f825b0b2ff5594 (
plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# Consider setting `REflex_ROOT` as a hint where reflex has been installed
set(REflex_USE_STATIC_LIBS ON)
find_package(REflex 3.2.3)
find_package(FLEX REQUIRED)
# set(USE_FLEXCPP ON)
# find_package(Flexcpp 2.08.00)
find_package(BISON REQUIRED)
include_directories(
${PROJECT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
BISON_TARGET(InfixCalcParser infix_calc_parser.yy ${CMAKE_CURRENT_BINARY_DIR}/infix_calc_parser.cpp
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/infix_calc_parser.hpp)
if(FLEX_FOUND)
message(STATUS "${PROJECT_NAME} flex found, FLEX_INCLUDE_DIRS ${FLEX_INCLUDE_DIRS}")
FLEX_TARGET(InfixCalcScanner1 infix_calc_scanner1.ll ${CMAKE_CURRENT_BINARY_DIR}/infix_calc_scanner1.cpp
COMPILE_FLAGS "--header-file=${CMAKE_CURRENT_BINARY_DIR}/infix_calc_scanner1.hpp" )
ADD_FLEX_BISON_DEPENDENCY(InfixCalcScanner1 InfixCalcParser)
add_library (infix_calc1 SHARED infix_calc.cpp ${BISON_InfixCalcParser_OUTPUTS} ${FLEX_InfixCalcScanner1_OUTPUTS})
target_include_directories(infix_calc1 SYSTEM PRIVATE ${FLEX_INCLUDE_DIRS})
target_compile_options(infix_calc1 PRIVATE -DSCANNER_FLEX)
#target_link_libraries (
# infix_calc1
# ${FLEX_LIBRARIES}
#
set_target_properties(
infix_calc1
PROPERTIES
SOVERSION ${infix_calc_VERSION_MAJOR}
VERSION ${infix_calc_VERSION_SHORT}
)
if(USE_STRIP)
add_custom_command(TARGET infix_calc1 POST_BUILD
COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}infix_calc1${CMAKE_SHARED_LIBRARY_SUFFIX}.${infix_calc_VERSION_SHORT}
COMMENT "stripping infix_calc1"
VERBATIM
)
endif(USE_STRIP)
install(TARGETS infix_calc1 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(FLEX_FOUND)
if(REflex_FOUND)
message(STATUS "${PROJECT_NAME} REflex found, REflex_INCLUDE_DIRS ${REflex_INCLUDE_DIRS}")
REflex_TARGET(InfixCalcScanner2 infix_calc_scanner2.ll ${CMAKE_CURRENT_BINARY_DIR}/infix_calc_scanner2.cpp
COMPILE_FLAGS "--header-file=${CMAKE_CURRENT_BINARY_DIR}/infix_calc_scanner2.hpp" )
ADD_REFLEX_BISON_DEPENDENCY(InfixCalcScanner2 InfixCalcParser)
add_library (infix_calc2 SHARED infix_calc.cpp ${BISON_InfixCalcParser_OUTPUTS} ${REflex_InfixCalcScanner2_OUTPUTS})
target_include_directories(infix_calc2 SYSTEM PRIVATE ${REflex_INCLUDE_DIRS})
target_compile_options(infix_calc2 PRIVATE -fPIC -DSCANNER_REFLEX)
target_link_options(infix_calc2 PRIVATE -fPIC)
target_link_libraries (
infix_calc2
${REflex_min_LIBRARIES}
)
set_target_properties(
infix_calc2
PROPERTIES
SOVERSION ${infix_calc_VERSION_MAJOR}
VERSION ${infix_calc_VERSION_SHORT}
)
if(USE_STRIP)
add_custom_command(TARGET infix_calc2 POST_BUILD
COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}infix_calc2${CMAKE_SHARED_LIBRARY_SUFFIX}.${infix_calc_VERSION_SHORT}
COMMENT "stripping infix_calc2"
VERBATIM
)
endif(USE_STRIP)
install(TARGETS infix_calc2 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(REflex_FOUND)
if(USE_FLEXCPP)
FLEXCPP_TARGET(InfixCalcScanner3 infix_calc_scanner3.ll ${CMAKE_CURRENT_BINARY_DIR}/infix_calc_scanner3.cpp
COMPILE_FLAGS "--class-header=${CMAKE_CURRENT_BINARY_DIR}/infix_calc_scanner3.hpp --implementation-header=${CMAKE_CURRENT_BINARY_DIR}/infix_calc_scanner3i.hpp --namespace=infix_calc_yy --class-name=scanner" )
ADD_FLEXCPP_BISON_DEPENDENCY(InfixCalcScanner3 InfixCalcParser)
add_library (infix_calc3 SHARED infix_calc.cpp ${BISON_InfixCalcParser_OUTPUTS} ${Flexcpp_InfixCalcScanner3_OUTPUTS})
target_include_directories(infix_calc3 SYSTEM PRIVATE ${Flexcpp_INCLUDE_DIRS})
target_compile_options(infix_calc3 PRIVATE -DSCANNER_FLEXCPP)
set_target_properties(
infix_calc3
PROPERTIES
SOVERSION ${infix_calc_VERSION_MAJOR}
VERSION ${infix_calc_VERSION_SHORT}
)
if(USE_STRIP)
add_custom_command(TARGET infix_calc3 POST_BUILD
COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}infix_calc3${CMAKE_SHARED_LIBRARY_SUFFIX}.${infix_calc_VERSION_SHORT}
COMMENT "stripping infix_calc3"
VERBATIM
)
endif(USE_STRIP)
install(TARGETS infix_calc3 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(USE_FLEXCPP)
install (DIRECTORY ${PROJECT_SOURCE_DIR}/include/infix_calc/ DESTINATION include/infix_calc)
|