diff options
author | svidyuk <svidyuk@yandex-team.ru> | 2022-02-14 13:05:37 +0300 |
---|---|---|
committer | svidyuk <svidyuk@yandex-team.ru> | 2022-02-14 13:05:37 +0300 |
commit | c493463b4ba40d6f21effad2b5405bc1804b02f3 (patch) | |
tree | 65abe126fad23867c23eea52822020743ba43506 | |
parent | 45fd996f054b866273c44f7dc345703befda4c84 (diff) | |
download | ydb-c493463b4ba40d6f21effad2b5405bc1804b02f3.tar.gz |
PYTHON and PYTHON3 in cmake export
Generates the following `ydb/library/yql/dq/expr_nodes/CMakeLists.txt`:
```
find_package(Python3)
add_library(yql-dq-expr_nodes INTERFACE)
target_link_libraries(yql-dq-expr_nodes INTERFACE
yutil
yql-core-expr_nodes
)
add_custom_command(
OUTPUT
${CMAKE_BINARY_DIR}/ydb/library/yql/dq/expr_nodes/dq_expr_nodes.gen.h
${CMAKE_BINARY_DIR}/ydb/library/yql/dq/expr_nodes/dq_expr_nodes.decl.inl.h
${CMAKE_BINARY_DIR}/ydb/library/yql/dq/expr_nodes/dq_expr_nodes.defs.inl.h
DEPENDS
${CMAKE_SOURCE_DIR}/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.jnj
${CMAKE_SOURCE_DIR}/ydb/library/yql/dq/expr_nodes/dq_expr_nodes.json
${CMAKE_SOURCE_DIR}/ydb/library/yql/core/expr_nodes_gen/gen/__main__.py
COMMAND
Python3::Interpreter
${CMAKE_SOURCE_DIR}/ydb/library/yql/core/expr_nodes_gen/gen/__main__.py
${CMAKE_SOURCE_DIR}/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.jnj
${CMAKE_SOURCE_DIR}/ydb/library/yql/dq/expr_nodes/dq_expr_nodes.json
${CMAKE_BINARY_DIR}/ydb/library/yql/dq/expr_nodes/dq_expr_nodes.gen.h
${CMAKE_BINARY_DIR}/ydb/library/yql/dq/expr_nodes/dq_expr_nodes.decl.inl.h
${CMAKE_BINARY_DIR}/ydb/library/yql/dq/expr_nodes/dq_expr_nodes.defs.inl.h
)
```
ref:845858c868ca9262a974ad49179a9b5489ec2870
-rw-r--r-- | build/conf/opensource.conf | 2 | ||||
-rw-r--r-- | build/ymake.core.conf | 27 | ||||
-rw-r--r-- | ydb/library/yql/dq/expr_nodes/ya.make | 51 |
3 files changed, 64 insertions, 16 deletions
diff --git a/build/conf/opensource.conf b/build/conf/opensource.conf index 027f6a3e42..0902d187aa 100644 --- a/build/conf/opensource.conf +++ b/build/conf/opensource.conf @@ -1,3 +1,5 @@ +EXPORT_CMAKE=no
+
when ($CATBOOST_OPENSOURCE == "yes") {
OPENSOURCE=yes
}
diff --git a/build/ymake.core.conf b/build/ymake.core.conf index d43991debe..8971da68b8 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -7040,6 +7040,33 @@ macro LUA(ScriptPath, IN{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{too ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used. macro PYTHON(ScriptPath, IN{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], REQUIREMENTS[], Args...) { .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input:ScriptPath} $Args ${input;hide:IN} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${requirements;hide:REQUIREMENTS} ${requirements;hide:"network:restricted"} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} + .SEM=find_package Python2 && add_custom_command OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python2::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} +} + +# tag:python-specific +### @usage: PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [REQUIREMENTS reqs]) +### +### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3. +### These macros are similar: RUN_PROGRAM, LUA, PYTHON. +### +### Parameters: +### - script_path - Path to the script. +### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute. +### - CWD dir - Absolute path of the working directory. +### - ENV key=value... - Environment variables. +### - TOOL tools... - Auxiliary tool directories. +### - IN inputs... - Input files. +### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process. +### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file. +### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them. +### - REQUIREMENTS - Override default requirements for CPU and RAM +### +### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or +### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used. +macro PYTHON3(ScriptPath, IN{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], REQUIREMENTS[], Args...) { + .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${input;hide:IN} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${requirements;hide:REQUIREMENTS} ${requirements;hide:"network:restricted"} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} + .PEERDIR=$YMAKE_PYTHON3_PEER + .SEM=find_package Python3 && add_custom_command OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python3::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} } # tag:java-specific diff --git a/ydb/library/yql/dq/expr_nodes/ya.make b/ydb/library/yql/dq/expr_nodes/ya.make index 96cfd43f86..ae86d4e4e8 100644 --- a/ydb/library/yql/dq/expr_nodes/ya.make +++ b/ydb/library/yql/dq/expr_nodes/ya.make @@ -16,21 +16,40 @@ SRCDIR( ydb/library/yql/core/expr_nodes_gen ) -RUN_PROGRAM( - ydb/library/yql/core/expr_nodes_gen/gen - yql_expr_nodes_gen.jnj - dq_expr_nodes.json - dq_expr_nodes.gen.h - dq_expr_nodes.decl.inl.h - dq_expr_nodes.defs.inl.h - IN yql_expr_nodes_gen.jnj - IN dq_expr_nodes.json - OUT dq_expr_nodes.gen.h - OUT dq_expr_nodes.decl.inl.h - OUT dq_expr_nodes.defs.inl.h - OUTPUT_INCLUDES - ${ARCADIA_ROOT}/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.h - ${ARCADIA_ROOT}/util/generic/hash_set.h -) +IF(EXPORT_CMAKE) + PYTHON3( + ${ARCADIA_ROOT}/ydb/library/yql/core/expr_nodes_gen/gen/__main__.py + yql_expr_nodes_gen.jnj + dq_expr_nodes.json + dq_expr_nodes.gen.h + dq_expr_nodes.decl.inl.h + dq_expr_nodes.defs.inl.h + IN yql_expr_nodes_gen.jnj + IN dq_expr_nodes.json + OUT dq_expr_nodes.gen.h + OUT dq_expr_nodes.decl.inl.h + OUT dq_expr_nodes.defs.inl.h + OUTPUT_INCLUDES + ${ARCADIA_ROOT}/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.h + ${ARCADIA_ROOT}/util/generic/hash_set.h + ) +ELSE() + RUN_PROGRAM( + ydb/library/yql/core/expr_nodes_gen/gen + yql_expr_nodes_gen.jnj + dq_expr_nodes.json + dq_expr_nodes.gen.h + dq_expr_nodes.decl.inl.h + dq_expr_nodes.defs.inl.h + IN yql_expr_nodes_gen.jnj + IN dq_expr_nodes.json + OUT dq_expr_nodes.gen.h + OUT dq_expr_nodes.decl.inl.h + OUT dq_expr_nodes.defs.inl.h + OUTPUT_INCLUDES + ${ARCADIA_ROOT}/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.h + ${ARCADIA_ROOT}/util/generic/hash_set.h + ) +ENDIF() END() |