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

83 lines
2.8 KiB
CMake
Raw Normal View History

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
2016-11-11 07:23:34 +00:00
"myddas_driver.ypp"
)
2017-11-21 15:44:43 +00:00
if (ANDROID)
set (MYDDAS_PREFIX ${libpl} )
2016-08-30 14:29:40 +01:00
else()
2017-11-21 15:44:43 +00:00
set (MYDDAS_PREFIX ${CMAKE_CURRENT_BINARY_DIR} )
2016-08-30 14:29:40 +01:00
endif()
get_property(MYDDAS_FLAGS GLOBAL PROPERTY COMPILE_DEFINITIONS)
2016-04-10 14:21:17 +01:00
2016-04-05 08:18:09 +01:00
function(cpp_compile output filename)
get_filename_component(base ${filename} NAME_WE)
2017-11-21 15:44:43 +00:00
set(base_abs ${MYDDAS_PREFIX}/${base})
set(outfile ${base_abs}.yap)
set(${output} ${${output}} ${outfile} PARENT_SCOPE)
IF (MSVC)
add_custom_command(
OUTPUT ${outfile}
COMMAND ${CMAKE_C_COMPILER} ${MYDDAS_FLAGS} /EP /P ${outfile} ${CMAKE_CURRENT_SOURCE_DIR}/${filename}
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
2016-11-11 07:23:34 +00:00
ELSE (MSVC)
add_custom_command(
OUTPUT ${outfile}
COMMAND ${CMAKE_C_COMPILER} ${MYDDAS_FLAGS} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/${filename} -o ${outfile}
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
ENDIF (MSVC)
2016-04-10 14:21:17 +01:00
set_source_files_properties(${outfile} PROPERTIES GENERATED TRUE)
2016-04-05 08:18:09 +01:00
endfunction()
2017-07-25 01:10:44 +01:00
if (ANDROID)
2017-11-21 15:44:43 +00:00
set (MYDDAS_PL_OUTDIR ${YAP_APP_DIR}/src/generated/assets/Yap )
2017-07-25 01:10:44 +01:00
else()
set (MYDDAS_PL_OUTDIR ${CMAKE_CURRENT_BINARY_DIR} )
endif()
function(cpp_driver output dbms filename)
2017-11-21 15:44:43 +00:00
set(outfile ${MYDDAS_PL_OUTDIR}/myddas_${dbms}.yap)
set(${output} ${${output}} ${outfile} PARENT_SCOPE)
IF (MSVC)
add_custom_command(
OUTPUT ${outfile}
COMMAND ${CMAKE_C_COMPILER} -D${dbms} /EP /P ${outfile} ${CMAKE_CURRENT_SOURCE_DIR}/${filename}
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
else ()
add_custom_command(
OUTPUT ${outfile}
COMMAND ${CMAKE_C_COMPILER} -D${dbms} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/${filename} -o ${outfile}
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
ENDIF (MSVC)
set_source_files_properties(${outfile} PROPERTIES GENERATED TRUE)
endfunction()
set(MYDDAS_DBMS sqlite3 postgres odbc)
2016-04-05 08:18:09 +01:00
foreach (file ${MYDDAS_YPP})
cpp_compile(MYDDAS_YAP ${file})
endforeach ()
foreach (driver ${MYDDAS_DBMS})
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
endforeach ()
2016-04-05 08:18:09 +01:00
2018-06-26 15:35:47 +01:00
list (APPEND MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/sqlitest.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
2017-10-11 02:24:15 +01:00
add_to_group(MYDDAS_YAP pl_library )
2016-11-24 04:35:39 +00:00
add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )
2016-04-12 16:22:53 +01:00
2016-11-24 04:35:39 +00:00
install(FILES ${MYDDAS_YAP}
DESTINATION ${libpl}
)