allows multiple include dirs in cython command
parent
3e547c89bb
commit
b4aee31b76
|
@ -51,10 +51,14 @@ endfunction()
|
||||||
# - generated_cpp: The output cpp file in full absolute path
|
# - generated_cpp: The output cpp file in full absolute path
|
||||||
# - include_dirs: Directories to include when executing cython
|
# - include_dirs: Directories to include when executing cython
|
||||||
function(pyx_to_cpp target pyx_file generated_cpp include_dirs)
|
function(pyx_to_cpp target pyx_file generated_cpp include_dirs)
|
||||||
|
foreach(dir ${include_dirs})
|
||||||
|
set(includes_for_cython ${includes_for_cython} -I ${dir})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${generated_cpp}
|
OUTPUT ${generated_cpp}
|
||||||
COMMAND
|
COMMAND
|
||||||
cython --cplus -I ${include_dirs} ${pyx_file} -o ${generated_cpp}
|
cython --cplus ${includes_for_cython} ${pyx_file} -o ${generated_cpp}
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
add_custom_target(${target} ALL DEPENDS ${generated_cpp})
|
add_custom_target(${target} ALL DEPENDS ${generated_cpp})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -77,19 +81,20 @@ endfunction()
|
||||||
# Cythonize a pyx from the command line as described at
|
# Cythonize a pyx from the command line as described at
|
||||||
# http://cython.readthedocs.io/en/latest/src/reference/compilation.html
|
# http://cython.readthedocs.io/en/latest/src/reference/compilation.html
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# - target: The specified target
|
# - target: The specified target
|
||||||
# - pyx_file: The input pyx_file in full *absolute* path
|
# - pyx_file: The input pyx_file in full *absolute* path
|
||||||
# - output_lib_we: The output lib filename only (without extension)
|
# - output_lib_we: The output lib filename only (without extension)
|
||||||
# - output_dir: The output directory
|
# - output_dir: The output directory
|
||||||
# - include_dirs: Directories to include when executing cython
|
# - include_dirs: Directories to include when executing cython
|
||||||
# - libs: libraries to link with
|
# - libs: Libraries to link with
|
||||||
# - dependencies: other target dependencies
|
# - dependencies: Other target dependencies
|
||||||
function(cythonize target pyx_file output_lib_we output_dir include_dirs libs dependencies)
|
function(cythonize target pyx_file output_lib_we output_dir include_dirs libs dependencies)
|
||||||
get_filename_component(pyx_path "${pyx_file}" DIRECTORY)
|
get_filename_component(pyx_path "${pyx_file}" DIRECTORY)
|
||||||
get_filename_component(pyx_name "${pyx_file}" NAME_WE)
|
get_filename_component(pyx_name "${pyx_file}" NAME_WE)
|
||||||
set(generated_cpp "${output_dir}/${pyx_name}.cpp")
|
set(generated_cpp "${output_dir}/${pyx_name}.cpp")
|
||||||
message("generated_cpp:" ${generated_cpp})
|
|
||||||
pyx_to_cpp(${target}_pyx2cpp ${pyx_file} ${generated_cpp} ${include_dirs})
|
set_up_required_cython_packages()
|
||||||
|
pyx_to_cpp(${target}_pyx2cpp ${pyx_file} ${generated_cpp} "${include_dirs}")
|
||||||
if (NOT "${dependencies}" STREQUAL "")
|
if (NOT "${dependencies}" STREQUAL "")
|
||||||
add_dependencies(${target}_pyx2cpp "${dependencies}")
|
add_dependencies(${target}_pyx2cpp "${dependencies}")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue