# This file was generated by the YaTool build system (https://github.com/yandex/yatool),
# from a source YaTool build configuration provided in ya.make files.
#
# If the repository supports both CMake and ya build configurations, please modify both of them.
#
# If only CMake build configuration is supported then modify only CMake files and note that only
# simple modifications are allowed like adding source-files to targets or adding simple properties
# like target_include_directories. These modifications will be ported to original ya.make files
# by maintainers. Any complex modifications which can't be easily ported back to the ya build
# system may be rejected.
#
# Please refer to the build instructions in the repository for more information about manual
# changes in this file.

# Unfortunately, standard FindPython3 CMake module does not support Interpreter and NumPy COMPONENTS
# from different Python installations that prevents CI building for multiple Python versions and
# Cross-compilation, so we'll handle these special cases by setting ${Python3_NumPy_INCLUDE_DIRS} explicitly
if(Python3_NumPy_INCLUDE_DIR)
  if(EXISTS "${Python3_NumPy_INCLUDE_DIR}" AND IS_DIRECTORY "${Python3_NumPy_INCLUDE_DIR}")
    set(Python3_NumPy_INCLUDE_DIRS ${Python3_NumPy_INCLUDE_DIR})
  else()
    message(FATAL_ERROR "Python3_NumPy_INCLUDE_DIR=\"${Python3_NumPy_INCLUDE_DIR}\" does not exist.")
  endif()
else()
  find_package(Python3 REQUIRED COMPONENTS
    Development NumPy
  )
endif()

find_package(Python3 REQUIRED COMPONENTS
  Development
)

add_shared_library(_catboost_no_cuda)


set_property(TARGET _catboost_no_cuda PROPERTY OUTPUT_NAME
  _catboost
)

target_compile_options(_catboost_no_cuda PRIVATE
  $<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>
)

target_link_libraries(_catboost_no_cuda PUBLIC
  contrib-libs-cxxsupp
  yutil
  build-cow-on
  Python3::Module
  libs-gpu_config-force_no_cuda
  catboost-libs-carry_model
  catboost-libs-cat_feature
  catboost-libs-data
  catboost-libs-eval_result
  catboost-libs-features_selection
  catboost-libs-fstr
  catboost-libs-helpers
  catboost-libs-loggers
  catboost-libs-logging
  catboost-libs-metrics
  catboost-libs-model
  catboost-libs-monoforest
  catboost-libs-train_lib
  private-libs-algo
  private-libs-algo_helpers
  private-libs-data_types
  private-libs-data_util
  private-libs-documents_importance
  private-libs-init
  private-libs-hyperparameter_tuning
  private-libs-options
  private-libs-quantized_pool_analysis
  private-libs-target
  library-cpp-float16
  library-cpp-grid_creator
  cpp-json-writer
  cpp-text_processing-tokenizer
  cpp-text_processing-app_helpers
)

target_allocator(_catboost_no_cuda
  cpp-malloc-mimalloc
)

target_link_options(_catboost_no_cuda PRIVATE
  -headerpad_max_install_names
  -Wl,-platform_version,macos,11.0,11.0
  -fPIC
  -undefined
  dynamic_lookup
  -fPIC
  -framework
  CoreFoundation
)

target_cython_sources(_catboost_no_cuda PRIVATE
  ${PROJECT_SOURCE_DIR}/catboost/python-package/catboost/_catboost.pyx
)

target_sources(_catboost_no_cuda PRIVATE
  ${PROJECT_SOURCE_DIR}/catboost/python-package/catboost/helpers.cpp
  ${PROJECT_SOURCE_DIR}/catboost/python-package/catboost/monoforest_helpers.cpp
  ${PROJECT_SOURCE_DIR}/catboost/python-package/catboost/arrow.cpp
)


use_export_script(_catboost_no_cuda
  ${PROJECT_SOURCE_DIR}/catboost/python-package/catboost/catboost3.exports
)

target_cython_options(_catboost_no_cuda
  -X
  legacy_implicit_noexcept=True
  -E
  UNAME_SYSNAME=Darwin
  --module-name
  _catboost
  --cplus
)

target_cython_include_directories(_catboost_no_cuda
  ${PROJECT_BINARY_DIR}
  ${PROJECT_SOURCE_DIR}
)

set_python_type_for_cython(_catboost_no_cuda
  PY3
)

vcs_info(_catboost_no_cuda)

# for compatibility between Cython 0.29.x and Cython 3.0.x
# TODO: remove after final switch to Cython 3.x+
target_compile_options(_catboost_no_cuda PRIVATE
  "-DCYTHON_EXTERN_C=extern \"C\""
)

target_include_directories(_catboost_no_cuda PRIVATE
  ${Python3_NumPy_INCLUDE_DIRS}
)

target_cython_include_directories(_catboost_no_cuda
  ${Python3_NumPy_INCLUDE_DIRS}
)
