swig.conf 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. _SWIG_TOOL=${tool:"contrib/tools/swig"}
  2. _SWIG_LIBRARY=contrib/tools/swig/Lib
  3. _SWIG_LIBRARY_ABS=$ARCADIA_ROOT/$_SWIG_LIBRARY
  4. SWIG_IMPLICIT_INCLUDES = swig.swg go.swg java.swg perl5.swg python.swg
  5. _SWIG_CMD=$_SWIG_PYTHON_CMD
  6. _SWIG_SEM_TO_MODULE_LINK=${hide;output;suf=.o:SRC}
  7. _SWIG_PYTHON_CMD=${_SWIG_TOOL} -module ${REALPRJNAME} -cpperraswarn -c++ -python -interface ${MODULE_PREFIX}${REALPRJNAME} -o ${output;noext;main;suf=_wrap.swg.cpp:SRC} ${noauto;output;add_to_outs;hide;tobindir;suf=.py:REALPRJNAME} -outdir ${BINDIR} ${pre=-I:_SWIG__INCLUDE} ${input:SRC} ${hide;kv:"p SW"} ${hide;kv:"pc yellow"}
  8. _SWIG_PERL_CMD=${_SWIG_TOOL} -c++ -cpperraswarn -module ${REALPRJNAME} -shadow -perl -o ${output;noext;main;suf=_wrap.swg.cpp:SRC} ${noauto;output;add_to_outs;hide;tobindir;suf=.pm:REALPRJNAME} -outdir ${ARCADIA_BUILD_ROOT}/${MODDIR} ${pre=-I:_SWIG__INCLUDE} ${input:SRC} ${hide;kv:"p SW"} ${hide;kv:"pc yellow"}
  9. _SWIG_JNI_CPP_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --out-header ${output;main;noext;suf=_wrap.swg.h:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${output;noext;suf=_wrap.swg.cpp:SRC} ${hide;kv:"p SW"} ${hide;kv:"pc yellow"}
  10. _SWIG_JNI_JAVA_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} --jsrc ${output;main;suf=.jsrc:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${BINDIR}/unused.cpp ${hide;kv:"p SW"} ${hide;kv:"pc yellow"}
  11. _SWIG_JNI_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/jni_swig.py"} --swig ${_SWIG_TOOL} --default-module ${nopath;noext:SRC} --src ${input:SRC} --out-header ${output;main;noext;suf=_wrap.swg.h:SRC} --package-by-file ru/yandex/${input;rootrel:SRC} --jsrc ${output;suf=.jsrc:SRC} -- ${pre=-I:_SWIG__INCLUDE} -o ${output;noext;suf=_wrap.swg.cpp:SRC} ${hide;kv:"p SW"} ${hide;kv:"pc yellow"}
  12. _SWIG_JNI_PEERDIR=contrib/libs/jdk
  13. REAL_SWIG_DLL_JAR_CMD=$GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/build_dll_and_java.py"} $JAVA_SWIG_DELIM $REAL_LINK_DYN_LIB $JAVA_SWIG_DELIM $COMPILE_JAVA $JAVA_SWIG_DELIM $AUTO_INPUT $JAVA_SWIG_DELIM $TARGET $JAVA_SWIG_DELIM ${output;suf=.jar:REALPRJNAME} $JAVA_SWIG_DELIM ${output;suf=-sources.jar:REALPRJNAME} $JAVA_SWIG_DELIM $ARCADIA_BUILD_ROOT $ARCADIA_ROOT
  14. when ($USE_SYSTEM_JDK == "yes" || $OS_ANDROID == "yes") {
  15. _SWIG_JNI_PEERDIR=
  16. }
  17. # tag:python-processing tag:internal
  18. ### @usage: _SWIG_PYTHON_CPP(Src, DstSubPrefix) # internal
  19. ###
  20. ### Run swig on Src to produce DstSubPrefix.py and DstSubPrefix_swg.cpp that
  21. ### provides DstSubPrefix_swg python module.
  22. macro _SWIG_PYTHON_CPP(Src, DstSubPrefix) {
  23. .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -c++ -python -module ${nopath:DstSubPrefix} -interface ${nopath;suf=_swg:DstSubPrefix} -o ${output;suf=.swg.cpp:DstSubPrefix} ${input:Src} ${hide;noauto;output;suf=.py:DstSubPrefix} ${hide;kv:"p SW"} ${hide;kv:"pc yellow"}
  24. .PEERDIR=contrib/tools/swig/Lib/python
  25. }
  26. # tag:python-processing tag:internal
  27. ### @usage: _SWIG_PYTHON_C(Src, DstSubPrefix) # internal
  28. ###
  29. ### Like _SWIG_PYTHON_CPP but generate DstSubPrefix_swg.c.
  30. macro _SWIG_PYTHON_C(Src, DstSubPrefix) {
  31. .CMD=$_SWIG_TOOL -I$ARCADIA_BUILD_ROOT -I$ARCADIA_ROOT -I$_SWIG_LIBRARY_ABS/python -I$_SWIG_LIBRARY_ABS -python -module ${nopath:DstSubPrefix} -interface ${nopath;suf=_swg:DstSubPrefix} -o ${output;suf=.swg.c:DstSubPrefix} ${input:Src} ${hide;noauto;output;suf=.py:DstSubPrefix} ${hide;kv:"p SW"} ${hide;kv:"pc yellow"}
  32. .PEERDIR=contrib/tools/swig/Lib/python
  33. }
  34. _EXPLICIT_SWIG_JAVA_SOURCES=
  35. _EXPLICIT_SWIG_IFACE_SOURCES=
  36. macro _EXPORT_JAVA_BINDINGS(JavaSrcs...) {
  37. SET_APPEND(_EXPLICIT_SWIG_JAVA_SOURCES ${input:JavaSrcs})
  38. .SEM=find_package SWIG COMPONENTS java && find_package Java && packages-ITEM && packages-name SWIG && packages-components java && mpackages-ITEM && mpackages-name SWIG && mpackages-components java && packages-ITEM && packages-name Java && mpackages-ITEM && mpackages-name Java && include UseSWIG && include UseJava && dir_includes UseSWIG && dir_includes UseJava ${hide;input:JavaSrcs} ${hide;output;pre=$_HASH_HELPER($Args):".o"}
  39. }
  40. macro _EXPORT_SWIG_SOURCES(SwigSrcs...) {
  41. SET_APPEND(_EXPLICIT_SWIG_IFACE_SOURCES ${input:SwigSrcs})
  42. }
  43. macro _JNI_CPP_SWIG_SRCS(Srcs...) {
  44. SRCS(${ext=.cpp:Srcs} ${ext=.swg:Srcs})
  45. _EXPORT_JAVA_BINDINGS(${ext=.java:Srcs})
  46. _EXPORT_SWIG_SOURCES(${ext=.swg:Srcs})
  47. .PEERDIR=contrib/tools/swig/Lib/java
  48. }
  49. macro _JNI_JAVA_SWIG_SRCS(Srcs...) {
  50. SRCS(${ext=.java:Srcs} ${ext=.swg:Srcs})
  51. }
  52. SWIG_JNI_BINDINGS_SEM= \
  53. add_swig_jni_library ${MODDIR} ${REALPRJNAME}-cpp GEN_JAVA_FILES_LIST ${"$"}{CMAKE_CURRENT_BINARY_DIR}/swig_gen_java.lst SOURCES ${_EXPLICIT_SWIG_IFACE_SOURCES} && \
  54. set_target_property OUTPUT_NAME $REALPRJNAME && \
  55. target_properties-ITEM && target_properties-name OUTPUT_NAME && target_properties-value $REALPRJNAME && \
  56. ${VCS_INFO_SEM} && \
  57. target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && \
  58. target_options-publics-ITEM && target_options-publics-option target_include_directories && target_options-publics-args $_C__INCLUDE_GLOBAL && \
  59. target_include_directories PRIVATE $_C__INCLUDE_OWNED && \
  60. target_options-privates-ITEM && target_options-privates-option target_include_directories && target_options-privates-args $_C__INCLUDE_OWNED && \
  61. target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && \
  62. target_options-privates-ITEM && target_options-privates-option target_compile_options && target_options-privates-args $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && \
  63. target_options-publics-ITEM && target_options-publics-option target_compile_options && target_options-publics-args $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && \
  64. target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE_LIB_GLOBAL $OBJADDE && \
  65. target_options-privates-ITEM && target_options-privates-option target_link_options && target_options-privates-args $LDFLAGS $OBJADDE_LIB $OBJADDE_LIB_GLOBAL $OBJADDE && \
  66. add_jar ${REALPRJNAME} SOURCES $_EXPLICIT_SWIG_JAVA_SOURCES @${"$"}{CMAKE_CURRENT_BINARY_DIR}/swig_gen_java.lst ${hide:TARGET} && \
  67. target_commands-ITEM && target_commands-macro add_jar && target_commands-args ${REALPRJNAME} SOURCES $_EXPLICIT_SWIG_JAVA_SOURCES @${"$"}{CMAKE_CURRENT_BINARY_DIR}/swig_gen_java.lst ${hide:TARGET}
  68. ### @usage: DLL_JAVA()
  69. ###
  70. ### DLL built using swig for Java. Produces dynamic library and a .jar.
  71. ### Dynamic library is treated the same as in the case of PEERDIR from Java to DLL.
  72. ### .jar goes on the classpath.
  73. ###
  74. ### Documentation: https://wiki.yandex-team.ru/yatool/java/#integracijascpp/pythonsborkojj
  75. multimodule DLL_JAVA {
  76. module JNI_DLL: DLL {
  77. .ALIASES=SRCS=_JNI_CPP_SWIG_SRCS
  78. .FINAL_TARGET=no
  79. .SEM=SWIG_JNI_BINDINGS_SEM
  80. SWIG_LANG=jni_cpp
  81. }
  82. module JAR_COMPILATION: EXTERNAL_JAVA_LIBRARY {
  83. .ARGS_PARSER=DLL
  84. .ALIASES=SRCS=_JNI_JAVA_SWIG_SRCS PEERDIR=_NOOP_MACRO
  85. .PEERDIRSELF=JNI_DLL
  86. PEERDIR+=build/platform/java/jdk
  87. PEERDIR+=$JDK_RESOURCE_PEERDIR
  88. SET(DONT_RESOLVE_INCLUDES yes)
  89. .FINAL_TARGET=yes
  90. SWIG_LANG=jni_java
  91. _SWIG_CMD=$_SWIG_JNI_JAVA_CMD
  92. _SWIG_PEERDIR=contrib/tools/swig/Lib/java $_SWIG_JNI_PEERDIR
  93. _SWIG_SEM_TO_MODULE_LINK=${hide;output;suf=.jsrc:SRC}
  94. }
  95. }