2015-04-21 23:12:18 +01:00
|
|
|
SET( CMAKE_FIND_FRAMEWORK LAST)
|
|
|
|
SET( CMAKE_FIND_APPBUNDLE LAST)
|
2014-12-04 07:59:30 +00:00
|
|
|
|
2015-10-28 09:30:36 +00:00
|
|
|
|
|
|
|
# Be sure to also update these in Makefile!
|
|
|
|
set(SO_MAJOR 1)
|
|
|
|
set(SO_MINOR 0)
|
|
|
|
set(SO_PATCH 0)
|
|
|
|
|
|
|
|
|
2014-12-14 12:05:43 +00:00
|
|
|
set( MYDDAS_SOURCES
|
|
|
|
myddas_initialization.c
|
|
|
|
myddas_shared.c
|
|
|
|
myddas_statistics.c
|
|
|
|
myddas_top_level.c
|
2016-01-03 02:06:09 +00:00
|
|
|
)
|
2014-12-14 12:05:43 +00:00
|
|
|
|
2015-10-28 09:30:36 +00:00
|
|
|
set( MYDDAS_HEADERS
|
|
|
|
myddas.h
|
|
|
|
myddas_statistics.h
|
|
|
|
myddas_statistics_structs.h
|
|
|
|
myddas_structs.h
|
|
|
|
myddas_top_level.c
|
2016-01-03 02:06:09 +00:00
|
|
|
myddas_types.h )
|
2015-10-28 09:30:36 +00:00
|
|
|
|
|
|
|
set( MYDDAS_UTIL_SOURCES
|
|
|
|
myddas_util.c
|
|
|
|
myddas_initialization.c )
|
|
|
|
|
|
|
|
add_subdirectory (mysql)
|
|
|
|
add_subdirectory (odbc)
|
|
|
|
add_subdirectory (postgres)
|
|
|
|
add_subdirectory (sqlite3)
|
|
|
|
|
|
|
|
set( MYDDAS_YPP
|
2014-12-14 12:05:43 +00:00
|
|
|
pl/myddas.ypp
|
|
|
|
pl/myddas_assert_predicates.ypp
|
|
|
|
pl/myddas_top_level.ypp
|
|
|
|
pl/myddas_errors.ypp
|
|
|
|
pl/myddas_prolog2sql.ypp
|
2015-01-26 04:02:46 +00:00
|
|
|
pl/myddas_util_predicates.ypp
|
2014-12-14 12:05:43 +00:00
|
|
|
pl/myddas_prolog2sql_optimizer.ypp )
|
|
|
|
|
2015-10-28 09:30:36 +00:00
|
|
|
set( MYDDAS_PROLOG
|
|
|
|
myddas.yap
|
|
|
|
myddas_assert_predicates.yap
|
|
|
|
myddas_top_level.yap
|
|
|
|
myddas_errors.yap
|
|
|
|
myddas_prolog2sql.yap
|
|
|
|
myddas_util_predicates.yap
|
|
|
|
myddas_prolog2sql_optimizer.yap )
|
|
|
|
|
2014-12-14 12:05:43 +00:00
|
|
|
function(cpp_compile filename)
|
|
|
|
get_filename_component(base ${filename} NAME_WE)
|
|
|
|
set(base_abs ${CMAKE_CURRENT_BINARY_DIR}/${base})
|
|
|
|
set(output ${base_abs}.yap)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${output}
|
|
|
|
COMMAND ${CMAKE_C_COMPILER} -E ${CMAKE_C_FLAGS} -P -E -w -o ${CMAKE_CURRENT_BINARY_DIR} ${filename})
|
|
|
|
set_source_files_properties(${output} PROPERTIES GENERATED TRUE)
|
|
|
|
endfunction()
|
|
|
|
|
2015-10-28 09:30:36 +00:00
|
|
|
foreach(file ${MYDDAS_YPP})
|
2014-12-14 12:05:43 +00:00
|
|
|
cpp_compile(GENERATED_SOURCES ${file})
|
|
|
|
endforeach()
|
|
|
|
|
2015-10-28 09:30:36 +00:00
|
|
|
source_group("" FILES ${MYDDAS_YPP})
|
|
|
|
source_group(generated FILES ${MYDDAS_YAP})
|
|
|
|
|
|
|
|
set_property( DIRECTORY ../..
|
|
|
|
APPEND PROPERTY COMPILE_DEFINITIONS USE_MYDDAS=1)
|
|
|
|
|
|
|
|
Add_custom_target (plmyddas ALL DEPENDS ${MYDDAS_YAP} ) # WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
|
|
|
|
|
|
|
|
|
|
|
|
add_library (myddas OBJECT
|
|
|
|
${MYDDAS_SOURCES}
|
|
|
|
${MYDDAS_UTIL_SOURCES}
|
2015-11-05 17:06:15 +00:00
|
|
|
${MYDDAS_HEADERS}
|
2015-10-28 09:30:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set_target_properties (myddas PROPERTIES
|
|
|
|
POSITION_INDEPENDENT_CODE ON
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmake_dependent_option (USE_MYDDAS_Stats
|
2014-12-04 07:59:30 +00:00
|
|
|
"enable the MYDDAS library statistics support" OFF
|
2015-10-28 09:30:36 +00:00
|
|
|
USE_MYDDAS OFF)
|
2014-12-04 07:59:30 +00:00
|
|
|
#TODO:
|
|
|
|
|