CMake changes, related to Lexesis

This commit is contained in:
Thomas Avé 2017-01-26 16:14:00 +01:00
parent 7ec7b78abf
commit 9a974d5672
2 changed files with 12 additions and 8 deletions

View File

@ -39,17 +39,18 @@ ExternalProject_Add(ext-optparse
ExternalProject_Get_Property(ext-optparse source_dir) ExternalProject_Get_Property(ext-optparse source_dir)
include_directories(${source_dir}) include_directories(${source_dir})
find_program(LEXESIS_EXE Lexesis) find_package(Lexesis QUIET)
if (NOT LEXESIS_EXE_FOUND) if (NOT LEXESIS_FOUND)
#Lexesis #Lexesis
ExternalProject_Add(ext-lexesis ExternalProject_Add(ext-lexesis
GIT_REPOSITORY git@gitlab.com:Robin_Jadoul/Lexesis.git GIT_REPOSITORY git@gitlab.com:Robin_Jadoul/Lexesis.git
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=.
) )
add_library(templ IMPORTED STATIC GLOBAL) add_library(templ IMPORTED STATIC GLOBAL)
add_dependencies(templ ext-lexesis) add_dependencies(templ ext-lexesis)
ExternalProject_Get_Property(ext-lexesis binary_dir source_dir) ExternalProject_Get_Property(ext-lexesis binary_dir source_dir)
set_target_properties(templ PROPERTIES "IMPORTED_LOCATION" "${binary_dir}/src/${CMAKE_STATIC_LIBRARY_PREFIX}templ${CMAKE_STATIC_LIBRARY_SUFFIX}") set_target_properties(templ PROPERTIES "IMPORTED_LOCATION" "${binary_dir}/src/${CMAKE_STATIC_LIBRARY_PREFIX}templ${CMAKE_STATIC_LIBRARY_SUFFIX}")
include_directories(${source_dir}/include) include_directories(${binary_dir}/include)
set(LEXESIS_EXE "${binary_dir}/bin/Lexesis") set(LEXESIS_EXE "${binary_dir}/bin/Lexesis")
endif() endif()
@ -138,4 +139,7 @@ install(DIRECTORY templates
DESTINATION share/Parsodus DESTINATION share/Parsodus
) )
install(DIRECTORY include/Parsodus
DESTINATION include)
# add_subdirectory(examples) # add_subdirectory(examples)

View File

@ -1,7 +1,7 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
if (NOT LEXESIS_EXE_FOUND) if (NOT LEXESIS_FOUND)
add_custom_command(DEPENDS ext-lexesis "${CMAKE_CURRENT_SOURCE_DIR}/parsodusLexer.lxs" add_custom_command(DEPENDS ext-lexesis "${CMAKE_CURRENT_SOURCE_DIR}/parsodusLexer.lxs"
COMMAND ${LEXESIS_EXE} ARGS -d "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/parsodusLexer.lxs" COMMAND ${LEXESIS_EXE} ARGS -d "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/parsodusLexer.lxs"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ParsodusLexer.h" "${CMAKE_CURRENT_BINARY_DIR}/ParsodusLexer.cpp" OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ParsodusLexer.h" "${CMAKE_CURRENT_BINARY_DIR}/ParsodusLexer.cpp"
@ -28,9 +28,6 @@ add_library(Parsodus-tables
lrtables/LALR1Itemset.cpp lrtables/LALR1Itemset.cpp
) )
# add_library(Parsodus-backends
# )
add_library(pds add_library(pds
backend.cpp backend.cpp
driver.cpp driver.cpp
@ -38,6 +35,7 @@ add_library(pds
backendmanager.cpp backendmanager.cpp
"${CMAKE_CURRENT_BINARY_DIR}/ParsodusLexer.cpp" "${CMAKE_CURRENT_BINARY_DIR}/ParsodusLexer.cpp"
) )
add_dependencies(pds mstch::mstch)
add_executable(Parsodus add_executable(Parsodus
@ -52,7 +50,9 @@ target_link_libraries(Parsodus
mstch::mstch mstch::mstch
) )
install(TARGETS Parsodus install(TARGETS Parsodus pds Parsodus-util Parsodus-tables
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
) )