Skip to content

Commit

Permalink
JIRA: CXX-11900
Browse files Browse the repository at this point in the history
  • Loading branch information
gouriano committed Jan 7, 2022
1 parent a6b6f16 commit 0f3ece1
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 48 deletions.
17 changes: 15 additions & 2 deletions src/build-system/cmake/CMake.NCBIComponentsXCODE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ set(NCBI_ThirdParty_VDB_ARCH x86_64)
set(NCBI_ThirdParty_FTGL ${NCBI_TOOLS_ROOT}/ftgl-2.1.3-rc5 CACHE PATH "FTGL root")
set(NCBI_ThirdParty_GLEW ${NCBI_TOOLS_ROOT}/glew-1.5.8 CACHE PATH "GLEW root")
set(NCBI_ThirdParty_GRPC ${NCBI_TOOLS_ROOT}/grpc-1.36.4-ncbi1 CACHE PATH "GRPC root")
set(NCBI_ThirdParty_Boring ${NCBI_ThirdParty_GRPC})
set(NCBI_ThirdParty_PROTOBUF ${NCBI_TOOLS_ROOT}/grpc-1.36.4-ncbi1 CACHE PATH "PROTOBUF root")
set(NCBI_ThirdParty_wxWidgets ${NCBI_TOOLS_ROOT}/wxWidgets-3.1.4-ncbi2 CACHE PATH "wxWidgets root")
set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.35.0 CACHE PATH "UV root")
Expand Down Expand Up @@ -451,11 +452,23 @@ endif()

if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
NCBI_define_Xcomponent(NAME PROTOBUF LIB protobufd)
else()
endif()
if(NOT NCBI_COMPONENT_PROTOBUF_FOUND)
NCBI_define_Xcomponent(NAME PROTOBUF MODULE protobuf PACKAGE Protobuf LIB protobuf)
endif()
NCBI_define_Xcomponent(NAME GRPC MODULE grpc++)
NCBI_define_Xcomponent(NAME Boring LIB boringssl boringcrypto)
NCBI_define_Xcomponent(NAME GRPC MODULE grpc++ LIB
grpc++ grpc address_sorting upb cares gpr re2
absl_raw_hash_set absl_hashtablez_sampler absl_exponential_biased absl_hash
absl_city absl_statusor absl_bad_variant_access absl_status absl_cord
absl_str_format_internal absl_synchronization absl_graphcycles_internal
absl_symbolize absl_demangle_internal absl_stacktrace absl_debugging_internal
absl_malloc_internal absl_time absl_time_zone absl_civil_time absl_strings
absl_strings_internal absl_throw_delegate absl_int128 absl_base absl_spinlock_wait
absl_bad_optional_access absl_raw_logging_internal absl_log_severity
)
if(NCBI_COMPONENT_GRPC_FOUND)
set(NCBI_COMPONENT_GRPC_LIBS ${NCBI_COMPONENT_GRPC_LIBS} ${NCBI_COMPONENT_Boring_LIBS})
set(NCBI_COMPONENT_GRPC_LIBS ${NCBI_COMPONENT_GRPC_LIBS} ${COREFOUNDATION_LIBS})
endif()

Expand Down
118 changes: 72 additions & 46 deletions src/build-system/cmake/CMake.NCBIptb.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#############################################################################
# $Id$
# $Id: CMake.NCBIptb.cmake 643192 2022-01-06 13:49:42Z gouriano $
#############################################################################
#############################################################################
##
Expand Down Expand Up @@ -241,16 +241,31 @@ function(NCBI_add_target)
endfunction()

#############################################################################
macro(NCBI_begin_lib _name)
macro(NCBI_begin_lib _aname)
if( NOT NCBI_PTBMODE_PARTS AND NOT "${NCBI_PROJECT_expected}" STREQUAL "" AND NOT "${NCBI_PROJECT_expected}" STREQUAL "library")
message(SEND_ERROR "${NCBI_CURRENT_SOURCE_DIR}/${NCBI_PROJECT}: Unexpected NCBI_begin_lib call")
endif()
set(_name ${_aname})
set(_general_target NO)
if(NCBI_PTBCFG_PACKAGING OR NCBI_PTBCFG_PACKAGED)
if(${_name} STREQUAL "general" OR ${_name} STREQUAL "generalasn")
set(_name "generalasn")
if (DEFINED NCBI_EXTERNAL_TREE_ROOT)
if(TARGET general)
set(_name "general")
set(_general_target YES)
elseif(TARGET generalasn)
set(_general_target YES)
endif()
endif()
endif()
endif()
if(NCBI_PTBMODE_PARTS)
set(_libname ${_name}.part)
else()
set(_libname ${_name})
endif()
if (DEFINED NCBI_EXTERNAL_TREE_ROOT AND TARGET ${_name})
if (DEFINED NCBI_EXTERNAL_TREE_ROOT AND (TARGET ${_name} OR _general_target))
set(_libname ${_libname}.local)
if (NCBI_PTBMODE_COLLECT_DEPS)
set_property(GLOBAL PROPERTY NCBI_PTBPROP_LOCAL_${_name} "${_libname}")
Expand Down Expand Up @@ -778,7 +793,7 @@ macro(NCBI_internal_analyze_tree)
NCBI_internal_collect_dependencies(${_prj})
get_property(_prjdeps GLOBAL PROPERTY NCBI_PTBPROP_DEPS_${_prj})
get_property(_host GLOBAL PROPERTY NCBI_PTBPROP_HOST_${_prj})
set(NCBI_PTB_ALLOWED_PROJECTS ${NCBI_PTB_ALLOWED_PROJECTS} ${_host} ${_prj} ${_prjdeps})
list(APPEND NCBI_PTB_ALLOWED_PROJECTS ${_host} ${_prj} ${_prjdeps})
endforeach()
list(SORT NCBI_PTB_ALLOWED_PROJECTS)
list(REMOVE_DUPLICATES NCBI_PTB_ALLOWED_PROJECTS)
Expand All @@ -789,7 +804,7 @@ macro(NCBI_internal_analyze_tree)
NCBI_internal_collect_dependencies(${_prj})
get_property(_prjdeps GLOBAL PROPERTY NCBI_PTBPROP_DEPS_${_prj})
get_property(_host GLOBAL PROPERTY NCBI_PTBPROP_HOST_${_prj})
set(NCBI_PTB_ALLOWED_PROJECTS ${NCBI_PTB_ALLOWED_PROJECTS} ${_host} ${_prj} ${_prjdeps})
list(APPEND NCBI_PTB_ALLOWED_PROJECTS ${_host} ${_prj} ${_prjdeps})
endforeach()
list(SORT NCBI_PTB_ALLOWED_PROJECTS)
list(REMOVE_DUPLICATES NCBI_PTB_ALLOWED_PROJECTS)
Expand Down Expand Up @@ -936,7 +951,7 @@ function(NCBI_internal_recur_collect_dependencies _project _dep)
foreach( _value IN LISTS _dep _depdeps)
NCBI_internal_collect_dependencies(${_value})
get_property(_valuedeps GLOBAL PROPERTY NCBI_PTBPROP_DEPS_${_value})
set(_prjdeps ${_prjdeps} ${_value} ${_valuedeps})
list(APPEND _prjdeps ${_value} ${_valuedeps})
endforeach()
if (NOT "${_prjdeps}" STREQUAL "")
list(SORT _prjdeps)
Expand Down Expand Up @@ -1118,14 +1133,14 @@ function(NCBI_internal_collect_headers)
if ( NOT "${_headers}" STREQUAL "")
foreach(_mask IN LISTS _headers)
file(GLOB _files LIST_DIRECTORIES false "${NCBI_CURRENT_SOURCE_DIR}/${_mask}")
set(_priv ${_priv} ${_files})
list(APPEND _priv ${_files})
if (NOT "${_inc_dir}" STREQUAL "")
if (${_mask} MATCHES "[.]inl$")
file(GLOB _files LIST_DIRECTORIES false "${_inc_dir}/${_mask}")
set(_inl ${_inl} ${_files})
list(APPEND _inl ${_files})
else()
file(GLOB _files LIST_DIRECTORIES false "${_inc_dir}/${_mask}")
set(_pub ${_pub} ${_files})
list(APPEND _pub ${_files})
endif()
endif()
endforeach()
Expand Down Expand Up @@ -1192,9 +1207,9 @@ function(NCBI_internal_collect_dataspec)
string(TOLOWER ${_ext} _ext)
set( NCBI_PTB_CALLBACK_DATASPEC${_ext} ${_input})
cmake_parse_arguments(DT "" "DATASPEC" "SOURCES;HEADERS;INCLUDE" ${_output})
set(_specfiles ${_specfiles} ${DT_DATASPEC})
set(_srcfiles ${_srcfiles} ${DT_SOURCES})
set(_incfiles ${_incfiles} ${DT_HEADERS})
list(APPEND _specfiles ${DT_DATASPEC})
list(APPEND _srcfiles ${DT_SOURCES})
list(APPEND _incfiles ${DT_HEADERS})
else()
message(SEND_ERROR "file not found: ${NCBI_CURRENT_SOURCE_DIR}/${_dataspec}")
endif()
Expand Down Expand Up @@ -1358,13 +1373,12 @@ macro(NCBI_internal_process_project_requires)
if (_negate)
set(NCBITMP_REQUIRE_NOTFOUND ${NCBITMP_REQUIRE_NOTFOUND} ${_req})
else()
# set(NCBITMP_INCLUDES ${NCBITMP_INCLUDES} ${NCBI_COMPONENT_${_value}_INCLUDE})
set(NCBITMP_INCLUDES_SYSTEM ${NCBITMP_INCLUDES_SYSTEM} ${NCBI_COMPONENT_${_value}_INCLUDE})
set(NCBITMP_DEFINES ${NCBITMP_DEFINES} ${NCBI_COMPONENT_${_value}_DEFINES})
set(NCBITMP_EXTLIB ${NCBITMP_EXTLIB} ${NCBI_COMPONENT_${_value}_LIBS})
list(APPEND NCBITMP_INCLUDES_SYSTEM ${NCBI_COMPONENT_${_value}_INCLUDE})
list(APPEND NCBITMP_DEFINES ${NCBI_COMPONENT_${_value}_DEFINES})
list(APPEND NCBITMP_EXTLIB ${NCBI_COMPONENT_${_value}_LIBS})
foreach(_lib IN LISTS NCBI_COMPONENT_${_value}_NCBILIB)
if(NOT ${_lib} STREQUAL ${NCBI_${NCBI_PROJECT}_OUTPUT})
set(NCBITMP_NCBILIB ${NCBITMP_NCBILIB} ${_lib})
list(APPEND NCBITMP_NCBILIB ${_lib})
endif()
endforeach()
if (NOT NCBI_PTBMODE_COLLECT_DEPS)
Expand All @@ -1378,7 +1392,7 @@ macro(NCBI_internal_process_project_requires)
# set(NCBITMP_DEFINES ${NCBITMP_DEFINES} ${NCBI_COMPONENT_${_value}_DEFINES})
# set(NCBITMP_EXTLIB ${NCBITMP_EXTLIB} ${NCBI_COMPONENT_${_value}_LIBS})
else()
set(NCBITMP_REQUIRE_NOTFOUND ${NCBITMP_REQUIRE_NOTFOUND} ${_req})
list(APPEND NCBITMP_REQUIRE_NOTFOUND ${_req})
endif()
endif()
endforeach()
Expand All @@ -1390,11 +1404,11 @@ macro(NCBI_internal_process_project_requires)
NCBI_util_parse_sign(${_req} _value _negate)
if (${_value} OR NCBI_REQUIRE_${_value}_FOUND OR NCBI_COMPONENT_${_value}_FOUND)
if (_negate)
set(NCBITMP_REQUIRE_NOTFOUND ${NCBITMP_REQUIRE_NOTFOUND} ${_req})
list(APPEND NCBITMP_REQUIRE_NOTFOUND ${_req})
endif()
else()
if (NOT _negate)
set(NCBITMP_REQUIRE_NOTFOUND ${NCBITMP_REQUIRE_NOTFOUND} ${_req})
list(APPEND NCBITMP_REQUIRE_NOTFOUND ${_req})
endif()
endif()
endforeach()
Expand Down Expand Up @@ -1430,20 +1444,19 @@ macro(NCBI_internal_process_project_components)
set(_value ${NCBI_COMPONENT_${_value}_FOUND})
endif()
if (${_value} OR NCBI_REQUIRE_${_value}_FOUND OR NCBI_COMPONENT_${_value}_FOUND)
# set(NCBITMP_INCLUDES ${NCBITMP_INCLUDES} ${NCBI_COMPONENT_${_value}_INCLUDE})
set(NCBITMP_INCLUDES_SYSTEM ${NCBITMP_INCLUDES_SYSTEM} ${NCBI_COMPONENT_${_value}_INCLUDE})
set(NCBITMP_DEFINES ${NCBITMP_DEFINES} ${NCBI_COMPONENT_${_value}_DEFINES})
set(NCBITMP_EXTLIB ${NCBITMP_EXTLIB} ${NCBI_COMPONENT_${_value}_LIBS})
list(APPEND NCBITMP_INCLUDES_SYSTEM ${NCBI_COMPONENT_${_value}_INCLUDE})
list(APPEND NCBITMP_DEFINES ${NCBI_COMPONENT_${_value}_DEFINES})
list(APPEND NCBITMP_EXTLIB ${NCBI_COMPONENT_${_value}_LIBS})
foreach(_lib IN LISTS NCBI_COMPONENT_${_value}_NCBILIB)
if(NOT ${_lib} STREQUAL ${NCBI_${NCBI_PROJECT}_OUTPUT})
set(NCBITMP_NCBILIB ${NCBITMP_NCBILIB} ${_lib})
list(APPEND NCBITMP_NCBILIB ${_lib})
endif()
endforeach()
if (NOT NCBI_PTBMODE_COLLECT_DEPS)
NCBI_internal_install_component_files(${_value})
endif()
else()
set(NCBITMP_COMPONENT_NOTFOUND ${NCBITMP_COMPONENT_NOTFOUND} ${_value})
list(APPEND NCBITMP_COMPONENT_NOTFOUND ${_value})
endif()
endforeach()
endmacro()
Expand All @@ -1466,6 +1479,9 @@ function(NCBI_internal_collect_parts _result)
endforeach()

set(NCBI_PTBMODE_PARTS ON)
if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT})
message("${NCBI_PROJECT} parts: ${NCBI_${_hostproject}_PARTS}")
endif()
foreach(_part IN LISTS NCBI_${_hostproject}_PARTS)
set(_filepath ${NCBI_SRC_ROOT}/${_part})
get_filename_component(_path ${_filepath} DIRECTORY)
Expand Down Expand Up @@ -1526,9 +1542,9 @@ macro(NCBI_internal_process_parts _result)

set(NCBITMP_PROJECT_PART_IDS "")
set(NCBITMP_PROJECT_PARTS "")
NCBI_internal_collect_parts(_result)
NCBI_internal_collect_parts(${_result})

if(_result)
if(${_result})
if (NCBI_PTBMODE_COLLECT_DEPS OR NOT NCBI_PTBCFG_ENABLE_COLLECTOR)
#set_property(GLOBAL PROPERTY NCBI_PTBPROP_PARTS_${NCBI_PROJECT_ID} ${NCBITMP_PROJECT_PART_IDS})
foreach(_part IN LISTS NCBITMP_PROJECT_PART_IDS)
Expand All @@ -1539,6 +1555,13 @@ macro(NCBI_internal_process_parts _result)
set_property(GLOBAL PROPERTY NCBI_PTBPROP_HOST_${_part} ${NCBI_PROJECT})
endif()
endforeach()
if(NCBI_PTBCFG_PACKAGING OR NCBI_PTBCFG_PACKAGED)
if("general" IN_LIST NCBITMP_PROJECT_PARTS)
set_property(GLOBAL PROPERTY NCBI_PTBPROP_HOST_generalasn ${NCBI_PROJECT})
elseif("generalasn" IN_LIST NCBITMP_PROJECT_PARTS)
set_property(GLOBAL PROPERTY NCBI_PTBPROP_HOST_general ${NCBI_PROJECT})
endif()
endif()
endif()
endif()
endmacro()
Expand All @@ -1554,10 +1577,10 @@ function(NCBI_internal_process_interface_libraries _lib)
foreach(_prj IN LISTS _deps)
get_property(_local GLOBAL PROPERTY NCBI_PTBPROP_LOCAL_${_prj})
if ("${_local}" STREQUAL "" OR NOT ${_local} IN_LIST NCBI_PTB_ALLOWED_PROJECTS)
set(_value ${_value} ${_prj})
list(APPEND _value ${_prj})
NCBI_internal_process_interface_libraries("${_prj}")
else()
set(_value ${_value} ${_local})
list(APPEND _value ${_local})
endif()
endforeach()
set_target_properties(${_lib} PROPERTIES INTERFACE_LINK_LIBRARIES "${_value}")
Expand All @@ -1570,6 +1593,16 @@ function(NCBI_internal_verify_ncbilibs)
set(_exclude "")
foreach(_prj IN LISTS NCBITMP_NCBILIB)
NCBI_util_parse_sign(${_prj} _value _negate)
if(NCBI_PTBCFG_PACKAGING OR NCBI_PTBCFG_PACKAGED)
if(${_value} STREQUAL "general" OR ${_value} STREQUAL "generalasn")
set(_value "generalasn")
if (DEFINED NCBI_EXTERNAL_TREE_ROOT)
if(TARGET general)
set(_value "general")
endif()
endif()
endif()
endif()
list(APPEND _res ${_value})
if (_negate)
list(APPEND _exclude ${_value})
Expand Down Expand Up @@ -1613,13 +1646,13 @@ function(NCBI_internal_verify_libs)
if (_optimize)
get_property(_hasspec GLOBAL PROPERTY NCBI_PTBPROP_DATASPEC_${_prj})
if (_hasspec)
set(_value ${_value} ${_prj})
list(APPEND _value ${_prj})
endif()
else()
set(_value ${_value} ${_prj})
list(APPEND _value ${_prj})
endif()
else()
set(_value ${_value} ${_host})
list(APPEND _value ${_host})
endif()
endforeach()
endif()
Expand All @@ -1634,10 +1667,10 @@ function(NCBI_internal_verify_libs)
foreach(_prj IN LISTS _ncbilib)
get_property(_local GLOBAL PROPERTY NCBI_PTBPROP_LOCAL_${_prj})
if ("${_local}" STREQUAL "" OR NOT ${_local} IN_LIST NCBI_PTB_ALLOWED_PROJECTS)
set(_value ${_value} ${_prj})
list(APPEND _value ${_prj})
NCBI_internal_process_interface_libraries("${_prj}")
else()
set(_value ${_value} ${_local})
list(APPEND _value ${_local})
endif()
endforeach()
endif()
Expand All @@ -1647,9 +1680,9 @@ function(NCBI_internal_verify_libs)
set(_value "")
foreach(_tk_lib IN LISTS _tk_libs)
if(${_tk_lib} STREQUAL "general")
set(_value ${_value} \$<1:general>)
list(APPEND _value \$<1:general>)
else()
set(_value ${_value} ${_tk_lib})
list(APPEND _value ${_tk_lib})
endif()
endforeach()

Expand Down Expand Up @@ -2150,18 +2183,11 @@ endif()
endif()

if(NOT NCBI_PTBMODE_PARTS)
get_property(_allprojects GLOBAL PROPERTY NCBI_PTBPROP_ALL_PROJECTS)
set(_allprojects ${_allprojects} ${NCBI_PROJECT})
set_property(GLOBAL PROPERTY NCBI_PTBPROP_ALL_PROJECTS ${_allprojects})
set_property(GLOBAL APPEND PROPERTY NCBI_PTBPROP_ALL_PROJECTS ${NCBI_PROJECT})

NCBI_internal_process_project_filters(_allowed)
if (_allowed)
get_property(_allowedprojects GLOBAL PROPERTY NCBI_PTBPROP_ALLOWED_PROJECTS)
set(_allowedprojects ${_allowedprojects} ${NCBI_PROJECT})
set_property(GLOBAL PROPERTY NCBI_PTBPROP_ALLOWED_PROJECTS ${_allowedprojects})
# if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT})
# message("${NCBI_PROJECT} (${NCBI_CURRENT_SOURCE_DIR}): allowed: ${_allowedprojects}")
# endif()
set_property(GLOBAL APPEND PROPERTY NCBI_PTBPROP_ALLOWED_PROJECTS ${NCBI_PROJECT})
else()
if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT})
message("${NCBI_PROJECT} (${NCBI_CURRENT_SOURCE_DIR}): is excluded by project filters")
Expand Down

0 comments on commit 0f3ece1

Please sign in to comment.