Skip to content

Commit

Permalink
(#9044) grpc: fix cross-build + provide all CMake executable imported…
Browse files Browse the repository at this point in the history
… targets + add shared option + modernize

* modernize

* provide all CMake executables targets

* fix cross-build & patch in build() instead of source()

* fix test package

link of targets was broken. It was working only due to global injection of many stuff through conan_basic_setup()

* simplify test package

* add shared option

* do not test shared if cross-building

this a limitation of current conan model. Could be enabled again with CMakeToolchain + VirtualBuildEnv.

* fix cross-build to iOS

* handle codegen option in package_info()

* secure option doesn't affect package_id

this option doesn't exist upstream. It's a hack to hide unsecure components in global target generated by conan.

* drop shared with libstdc++/libstdc++11 for the moment

* test package: help gprc_cpp_plugin to find grpc_plugin_support if shared at build time

* handle cross-build in test package

* typo

* gRPC shared buils fine with clang on Linux

* fix install of plugins if cross-building

this bug exists in all versions of the range [1.39.0;1.42.0[

* with gcc allow grpc shared if abseil shared

it allows folks to create grpc shared, but we should find a way to compile with gcc grpc shared against abseil static

* really use @relative_path@
  • Loading branch information
SpaceIm authored and SSE4 committed Feb 21, 2022
1 parent 5acb508 commit 6a8c9b5
Show file tree
Hide file tree
Showing 7 changed files with 337 additions and 217 deletions.
2 changes: 1 addition & 1 deletion recipes/grpc/all/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 2.8.12)
project(cmake_wrapper)

include(conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(KEEP_RPATHS)

add_subdirectory("source_subfolder")
18 changes: 0 additions & 18 deletions recipes/grpc/all/cmake/grpc_cpp_plugin.cmake

This file was deleted.

31 changes: 31 additions & 0 deletions recipes/grpc/all/cmake/grpc_plugin_template.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
if(NOT TARGET @target_name@)
if(CMAKE_CROSSCOMPILING)
find_program(@find_program_variable@
NAMES @executable_name@
PATHS ENV PATH
NO_DEFAULT_PATH
)
else()
find_program(@find_program_variable@
NAMES @executable_name@
PATHS "${CMAKE_CURRENT_LIST_DIR}/@relative_path@bin/"
NO_DEFAULT_PATH
)
endif()
# TODO: In conan v2 with CMakeToolchain, can be replaced by:
# find_program(@find_program_variable@ NAMES @executable_name@))
# # Nice enough to handle grpc not in build_requires for native build
# if(NOT @find_program_variable@ AND NOT CMAKE_CROSSCOMPILING)
# find_program(@find_program_variable@
# NAMES @executable_name@
# PATHS "${CMAKE_CURRENT_LIST_DIR}/@relative_path@bin/"
# NO_DEFAULT_PATH
# )
# endif()

if(@find_program_variable@)
get_filename_component(@find_program_variable@ "${@find_program_variable@}" ABSOLUTE)
add_executable(@target_name@ IMPORTED)
set_property(TARGET @target_name@ PROPERTY IMPORTED_LOCATION ${@find_program_variable@})
endif()
endif()
Loading

0 comments on commit 6a8c9b5

Please sign in to comment.