diff --git a/CMakeLists.txt b/CMakeLists.txt index cba04c9..3b748b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,9 +129,10 @@ endif() include_directories(include) add_subdirectory(src) +add_dependencies(Parsodus ext-optparse) enable_testing() add_subdirectory(tests) -add_dependencies(Parsodus ext-optparse) +add_subdirectory(examples) install(DIRECTORY templates DESTINATION share/Parsodus diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..7a340d5 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(json) diff --git a/examples/json/CMakeLists.txt b/examples/json/CMakeLists.txt new file mode 100644 index 0000000..38ff40f --- /dev/null +++ b/examples/json/CMakeLists.txt @@ -0,0 +1,19 @@ +add_custom_command(DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/JSONLexer.lxs" + COMMAND "${LEXESIS_EXE}" ARGS -d "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/JSONLexer.lxs" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/JSONLexer.h" "${CMAKE_CURRENT_BINARY_DIR}/JSONLexer.cpp") + +find_program(PARSODUS_EXE Parsodus PATH "${CMAKE_CURRENT_BINARY_DIR}/../../bin") + +add_custom_command(DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/JSONParser.pds" + COMMAND "${PARSODUS_EXE}" ARGS -d "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/JSONParser.pds" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/JSONParser.h" "${CMAKE_CURRENT_BINARY_DIR}/JSONParser.cpp") + +include_directories("${CMAKE_CURRENT_BINARY_DIR}") + +add_executable(json + EXCLUDE_FROM_ALL + json.cpp + main.cpp + parser.cpp + "${CMAKE_CURRENT_BINARY_DIR}/JSONLexer.cpp" + "${CMAKE_CURRENT_BINARY_DIR}/JSONParser.cpp")