This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/myddas/pl/CMakeLists.txt

71 lines
2.5 KiB
CMake
Raw Normal View History

set(MYDDAS_YPP
2019-04-07 00:25:10 +01:00
myddas_core.ypp
myddas_assert_predicates.ypp
myddas_top_level.ypp
myddas_errors.ypp
myddas_prolog2sql.ypp
myddas_util_predicates.ypp
myddas_prolog2sql_optimizer.ypp)
2019-04-07 00:25:10 +01:00
if (FOUND_MYSQL)
list(APPEND MYDDAS_YPP myddas_assert_predicates.ypp)
endif()
get_property(MYDDAS_FLAGS GLOBAL PROPERTY COMPILE_DEFINITIONS)
set(MYDDAS_DRIVERS
2018-12-07 16:22:17 +00:00
myddas_driver.ypp
)
2019-04-07 00:25:10 +01:00
set(MYDDAS_DBMS sqlite3)
set(MYDDAS_FLAGS ${MYDDAS_FLAGS};-DMYDDAS_SQLITE3=1)
if (POSTGRES_FOUND)
list(APPEND MYDDAS_DBMS postgres)
set(MYDDAS_FLAGS ${MYDDAS_FLAGS};-DMYDDAS_POSTGRES=1)
endif()
if (ODBC_FOUND)
set(MYDDAS_FLAGS ${MYDDAS_FLAGS};-DMYDDAS_ODBC=1)
list(APPEND MYDDAS_DBMS odbc)
endif()
if (MYSQL_FOUND)
set(MYDDAS_FLAGS ${MYDDAS_FLAGS};-DMYDDAS_MYSQL=1)
list(APPEND MYDDAS_DBMS mysql)
endif()
2017-11-21 15:44:43 +00:00
2018-12-14 14:53:39 +00:00
if (ANDROID)
2019-04-05 18:31:45 +01:00
set (MYDDAS_PL_OUTDIR ${CMAKE_SOURCE_DIR}/../yaplib/src/generated/assets/Yap/myddas )
file(MAKE_DIRECTORY ${MYDDAS_PL_OUTDIR})
file( COPY myddas.yap DESTINATION ${YAP_INSTALL_DATADIR} )
else()
2018-12-14 14:53:39 +00:00
set (MYDDAS_PL_OUTDIR ${CMAKE_CURRENT_BINARY_DIR})
endif()
foreach (filename ${MYDDAS_YPP})
get_filename_component(base ${filename} NAME_WE)
2018-12-07 16:22:17 +00:00
set(base_abs ${MYDDAS_PL_OUTDIR}/${base})
set(outfile ${base_abs}.yap)
2019-01-09 09:32:09 +00:00
list(APPEND MYDDAS_YAP_FILES ${outfile})
2019-04-07 00:25:10 +01:00
add_custom_command(OUTPUT ${outfile}
COMMAND ${CMAKE_C_COMPILER} ${MYDDAS_FLAGS} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/${filename} -o ${outfile}
2019-04-07 00:25:10 +01:00
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${filename}
)
2018-12-07 16:22:17 +00:00
set_source_files_properties(outfile PROPERTIES GENERATED TRUE)
endforeach ()
2018-12-14 14:53:39 +00:00
foreach (dbms ${MYDDAS_DBMS} )
2017-11-21 15:44:43 +00:00
set(outfile ${MYDDAS_PL_OUTDIR}/myddas_${dbms}.yap)
2019-01-09 09:32:09 +00:00
list(APPEND MYDDAS_YAP_FILES ${outfile})
2019-04-07 00:25:10 +01:00
add_custom_command(OUTPUT ${outfile}
2018-12-07 16:22:17 +00:00
COMMAND ${CMAKE_C_COMPILER} -D${dbms} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/myddas_driver.ypp -o ${outfile}
2019-04-07 00:25:10 +01:00
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/myddas_driver.ypp
)
2016-04-05 08:18:09 +01:00
2018-12-07 16:22:17 +00:00
set_source_files_properties(outfile PROPERTIES GENERATED TRUE)
2016-04-05 08:18:09 +01:00
2019-04-05 18:31:45 +01:00
2018-12-07 16:22:17 +00:00
endforeach()
2019-01-09 09:32:09 +00:00
list(APPEND MYDDAS_YAP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/sqlitest.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
2017-10-11 02:24:15 +01:00
2019-04-05 18:31:45 +01:00
install(FILES ${MYDDAS_YAP_FILES} DESTINATION ${YAP_INSTALL_DATADIR}/myddas)
install(FILES myddas.yap DESTINATION ${YAP_INSTALL_DATADIR})
2019-04-07 00:25:10 +01:00
add_custom_target(MYDDAS_PL
ALL
DEPENDS ${MYDDAS_YAP_FILES})