cmake support

This commit is contained in:
Vítor Santos Costa
2014-12-14 12:05:43 +00:00
parent 289a36a0a1
commit 90feb7f9f8
32 changed files with 2309 additions and 2047 deletions

View File

@@ -1,4 +1,8 @@
#CHECK: PythonLibs
set (PYTHON_SOURCES
python.c)
macro_optional_find_package(PythonInterp ON)
macro_optional_find_package (PythonLibs ON)
macro_log_feature (PYTHONLIBS_FOUND "Python"
@@ -30,5 +34,21 @@ if (PYTHONLIBS_FOUND) # PYTHONLIBS_FOUND - have the Python l
# first to get the currently active Python version by default with a consistent
# version of PYTHON_LIBRARIES.
add_library (python SHARED ${PYTHON_SOURCES})
target_link_libraries(python libYap ${PYTHON_LIBRARIES})
set_target_properties (python PROPERTIES PREFIX "")
include_directories (${PYTHON_INCLUDE_DIRS})
install(TARGETS python
LIBRARY DESTINATION ${dlls}
)
install(FILES python.pl
DESTINATION ${libpl}
)
endif (PYTHONLIBS_FOUND)

View File

@@ -83,7 +83,7 @@ fetch_module(M:E, M1, E1, MRef) :-
%
% extend the module as much as we can.
%
module_extend(M0, M:E, MF, EF, MRef0, MRef) :-
module_extend(M0, M:E, MF, EF, _MRef0, MRef) :-
atom(M),
atom_concat([M0,'.',M], MM),
python_import(MM, MRef1), !,
@@ -118,7 +118,7 @@ python_class(Obj) :-
process_obj(Obj, _, S, Obj, NS, Dict) :-
python_callable(Obj), !,
python_check_args(S, NS, Dict).
process_obj(Obj, _, S, Obj, NS, Dict) :-
process_obj(Obj, _, S, FObj, NS, Dict) :-
python_class(Obj),
descend_object(Obj:'__init__', FObj, _, _),
python_check_args(S, NS, Dict).
@@ -133,7 +133,7 @@ python_eval_term([H|T], [NH|NT]) :- !,
python_eval_term(T, NT).
python_eval_term(N, N) :- atomic(N), !.
python_eval_term(Exp, O) :-
descend_exp(Exp, Obj, Old, S), !,
descend_exp(Exp, Obj, _Old, S), !,
(functor(S, _, 0) ->
O = Obj
;
@@ -185,7 +185,7 @@ match_from_anames([_|ArgNames], K, VA, [V|Defaults], [V|NDefaults]) :-
fetch_args(FRef, Args, Kwd, Defaults) :-
FRef = '__obj__'(_), !,
python_mref_cache('inspect', M),
%python_mref_cache('inspect', M),
python_obj_cache(inspect:getargspec(_), F),
python_apply(F, getargspec(FRef), {}, ExtraArgs),
ExtraArgs=t(Args, _, Kwd, Defaults).