Skip to content

Commit 880e8a7

Browse files
authored
Merge pull request #2 from Microsoft/pegtl
Replace the GraphQL parser with a PEGTL implementation
2 parents e4dbc06 + be92b75 commit 880e8a7

11 files changed

+2531
-465
lines changed

CMakeLists.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ if(WIN32)
99
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
1010
endif()
1111

12+
add_library(graphqlpeg GraphQLTree.cpp)
1213
add_library(graphqlservice GraphQLService.cpp Introspection.cpp IntrospectionSchema.cpp)
1314
add_executable(schemagen SchemaGenerator.cpp)
1415

15-
find_library(GRAPHQLPARSER graphqlparser)
16+
find_package(pegtl CONFIG REQUIRED)
17+
18+
target_include_directories(graphqlpeg INTERFACE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}> $<INSTALL_INTERFACE:include>)
19+
target_link_libraries(graphqlpeg taocpp::pegtl)
1620

1721
find_package(cpprestsdk REQUIRED)
1822
set(CPPRESTSDK cpprestsdk::cpprest)
@@ -23,8 +27,8 @@ if(UNIX)
2327
endif()
2428

2529
target_include_directories(graphqlservice INTERFACE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}> $<INSTALL_INTERFACE:include>)
26-
target_link_libraries(graphqlservice ${CPPRESTSDK} ${GRAPHQLPARSER})
27-
target_link_libraries(schemagen ${CPPRESTSDK} ${GRAPHQLPARSER})
30+
target_link_libraries(graphqlservice ${CPPRESTSDK} graphqlpeg)
31+
target_link_libraries(schemagen ${CPPRESTSDK} graphqlpeg)
2832

2933
add_custom_command(
3034
OUTPUT IntrospectionSchema.cpp IntrospectionSchema.h
@@ -34,6 +38,7 @@ add_custom_command(
3438
)
3539

3640
if(UNIX)
41+
target_compile_options(graphqlpeg PRIVATE -std=c++11)
3742
target_compile_options(graphqlservice PRIVATE -std=c++11)
3843
target_compile_options(schemagen PRIVATE -std=c++11)
3944
endif()
@@ -56,15 +61,14 @@ if(BUILD_TESTS OR UPDATE_SAMPLES)
5661

5762
target_link_libraries(todaygraphql
5863
${CPPRESTSDK}
59-
${GRAPHQLPARSER}
6064
graphqlservice)
6165
target_include_directories(todaygraphql SYSTEM PUBLIC ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
6266

6367
add_executable(test_today test_today.cpp)
6468

6569
target_link_libraries(test_today
6670
${CPPRESTSDK}
67-
${GRAPHQLPARSER}
71+
graphqlpeg
6872
graphqlservice
6973
todaygraphql)
7074
target_include_directories(test_today SYSTEM PUBLIC ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
@@ -74,7 +78,7 @@ if(BUILD_TESTS OR UPDATE_SAMPLES)
7478
find_package(GTest REQUIRED)
7579
target_link_libraries(tests
7680
${CPPRESTSDK}
77-
${GRAPHQLPARSER}
81+
graphqlpeg
7882
graphqlservice
7983
todaygraphql
8084
GTest::GTest
@@ -96,18 +100,18 @@ if(BUILD_TESTS OR UPDATE_SAMPLES)
96100
endif()
97101
endif()
98102

99-
install(TARGETS graphqlservice schemagen
103+
install(TARGETS graphqlpeg graphqlservice schemagen
100104
EXPORT cppgraphqlgen-config
101105
RUNTIME DESTINATION bin
102106
ARCHIVE DESTINATION lib
103107
LIBRARY DESTINATION lib)
104108

105-
install(FILES GraphQLService.h Introspection.h IntrospectionSchema.h
109+
install(FILES GraphQLService.h GraphQLTree.h Introspection.h IntrospectionSchema.h
106110
DESTINATION include/graphqlservice)
107111

108112
if(WIN32)
109113
set(GRAPHQLSERVICE_DIR $<TARGET_FILE_DIR:graphqlservice>)
110-
install(FILES ${GRAPHQLSERVICE_DIR}/graphqlservice.lib
114+
install(FILES ${GRAPHQLSERVICE_DIR}/graphqlservice.lib ${GRAPHQLSERVICE_DIR}/graphqlpeg.lib
111115
DESTINATION lib)
112116
endif()
113117

0 commit comments

Comments
 (0)