2016-07-31 16:02:06 +01:00
|
|
|
set(MYDDAS_YPP
|
|
|
|
myddas.ypp
|
|
|
|
myddas_assert_predicates.ypp
|
|
|
|
myddas_top_level.ypp
|
|
|
|
myddas_errors.ypp
|
|
|
|
myddas_prolog2sql.ypp
|
|
|
|
myddas_mysql.ypp
|
|
|
|
myddas_util_predicates.ypp
|
|
|
|
myddas_prolog2sql_optimizer.ypp)
|
|
|
|
|
|
|
|
set(MYDDAS_DRIVERS
|
2018-12-07 16:22:17 +00:00
|
|
|
myddas_driver.ypp
|
2016-07-31 16:02:06 +01:00
|
|
|
)
|
2018-12-07 16:22:17 +00:00
|
|
|
set(MYDDAS_DBMS sqlite3 postgres odbc)
|
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()
|
2016-07-31 16:02:06 +01:00
|
|
|
get_property(MYDDAS_FLAGS GLOBAL PROPERTY COMPILE_DEFINITIONS)
|
2018-12-14 14:53:39 +00:00
|
|
|
foreach (filename ${MYDDAS_YPP})
|
2016-07-31 16:02:06 +01:00
|
|
|
get_filename_component(base ${filename} NAME_WE)
|
2018-12-07 16:22:17 +00:00
|
|
|
set(base_abs ${MYDDAS_PL_OUTDIR}/${base})
|
2016-07-31 16:02:06 +01:00
|
|
|
set(outfile ${base_abs}.yap)
|
2019-01-09 09:32:09 +00:00
|
|
|
list(APPEND MYDDAS_YAP_FILES ${outfile})
|
2018-12-07 16:22:17 +00:00
|
|
|
execute_process(
|
2016-07-31 16:02:06 +01:00
|
|
|
COMMAND ${CMAKE_C_COMPILER} ${MYDDAS_FLAGS} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/${filename} -o ${outfile}
|
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})
|
2018-12-07 16:22:17 +00:00
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_C_COMPILER} -D${dbms} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/myddas_driver.ypp -o ${outfile}
|
|
|
|
)
|
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})
|