|
1 | | -if (WIN32) |
2 | | - # Build option for windows not yet generated |
3 | | - message( FATAL_ERROR "Protobuf on windows not yet supported" ) |
4 | | -endif() |
5 | 1 |
|
6 | | -# Check that python and protobuf versions are compatible |
7 | | -if(fletch_BUILD_WITH_PYTHON AND fletch_ENABLE_Protobuf) |
8 | | - # Note the python protobuf wrapper is not installed here. |
9 | | - # Instead it must be installed via `pip install protobuf` |
10 | | - if (${Protobuf_version} LESS 3.0 AND fletch_PYTHON_MAJOR_VERSION MATCHES "^3.*") |
11 | | - message(ERROR " Must use Protobuf >= 3.x with Python 3.x") |
| 2 | +if (Protobuf_SELECT_VERSION STREQUAL "3.9.0") |
| 3 | + # Check that python and protobuf versions are compatible |
| 4 | + if(fletch_BUILD_WITH_PYTHON) |
| 5 | + # Note the python protobuf wrapper is not installed here. |
| 6 | + # Instead it must be installed via `pip install protobuf` |
| 7 | + if (fletch_PYTHON_MAJOR_VERSION MATCHES "^2.*") |
| 8 | + message(ERROR " Must use Python >= 3.x with Protobuf 3.x") |
| 9 | + endif() |
12 | 10 | endif() |
13 | | -endif() |
14 | 11 |
|
15 | 12 |
|
| 13 | + ExternalProject_Add(Protobuf |
| 14 | +# PREFIX protobuf |
| 15 | + URL ${Protobuf_url} |
| 16 | + URL_MD5 ${Protobuf_md5} |
| 17 | + SOURCE_SUBDIR ./cmake |
| 18 | + ${COMMON_EP_ARGS} |
| 19 | + ${COMMON_CMAKE_EP_ARGS} |
| 20 | +# UPDATE_COMMAND |
| 21 | +# COMMAND ${CMAKE_COMMAND} -DPULSE_IL2CPP_PATCH=${PULSE_IL2CPP_PATCH} -Dprotobuf_source=${protobuf_SRC} -Dprotobuf_patch=${protobuf_Patch} -P ${protobuf_Patch}/Patch.cmake |
| 22 | + CMAKE_ARGS |
| 23 | + ${COMMON_CMAKE_ARGS} |
| 24 | + -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} |
| 25 | + -Dprotobuf_BUILD_TESTS:BOOL=OFF |
| 26 | + -Dprotobuf_BUILD_EXAMPLES:BOOL=OFF |
| 27 | + -Dprotobuf_BUILD_SHARED_LIBS:BOOL=OFF |
| 28 | + -Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF#Don't change MSVC runtime settings (/MD or /MT) |
| 29 | + -Dprotobuf_WITH_ZLIB:BOOL=OFF |
| 30 | + ) |
| 31 | +elseif (NOT WIN32) |
16 | 32 |
|
17 | | -set (Protobuf_PATCH_DIR ${fletch_SOURCE_DIR}/Patches/Protobuf/${Protobuf_SELECT_VERSION}) |
18 | | -if (EXISTS ${Protobuf_PATCH_DIR}) |
19 | | - set(Protobuf_PATCH_COMMAND ${CMAKE_COMMAND} |
20 | | - -DProtobuf_PATCH_DIR=${Protobuf_PATCH_DIR} |
21 | | - -DProtobuf_SOURCE_DIR=${fletch_BUILD_PREFIX}/src/Protobuf |
22 | | - -P ${Protobuf_PATCH_DIR}/Patch.cmake) |
23 | | -else() |
24 | | - set(Protobuf_PATCH_COMMAND "") |
25 | | -endif() |
| 33 | + # Check that python and protobuf versions are compatible |
| 34 | + if(fletch_BUILD_WITH_PYTHON AND fletch_ENABLE_Protobuf) |
| 35 | + # Note the python protobuf wrapper is not installed here. |
| 36 | + # Instead it must be installed via `pip install protobuf` |
| 37 | + if (${Protobuf_version} LESS 3.0 AND fletch_PYTHON_MAJOR_VERSION MATCHES "^3.*") |
| 38 | + message(ERROR " You must use Protobuf >= 3.x with Python 3.x") |
| 39 | + endif() |
| 40 | + endif() |
26 | 41 |
|
| 42 | + set (Protobuf_PATCH_DIR ${fletch_SOURCE_DIR}/Patches/Protobuf/${Protobuf_SELECT_VERSION}) |
| 43 | + if (EXISTS ${Protobuf_PATCH_DIR}) |
| 44 | + set(Protobuf_PATCH_COMMAND ${CMAKE_COMMAND} |
| 45 | + -DProtobuf_PATCH_DIR=${Protobuf_PATCH_DIR} |
| 46 | + -DProtobuf_SOURCE_DIR=${fletch_BUILD_PREFIX}/src/Protobuf |
| 47 | + -P ${Protobuf_PATCH_DIR}/Patch.cmake) |
| 48 | + else() |
| 49 | + set(Protobuf_PATCH_COMMAND "") |
| 50 | + endif() |
27 | 51 |
|
28 | | -Fletch_Require_Make() |
29 | | -ExternalProject_Add(Protobuf |
30 | | - URL ${Protobuf_url} |
31 | | - URL_MD5 ${Protobuf_md5} |
32 | | - ${COMMON_EP_ARGS} |
33 | | - PATCH_COMMAND ${CMAKE_COMMAND} |
| 52 | + Fletch_Require_Make() |
| 53 | + ExternalProject_Add(Protobuf |
| 54 | + URL ${Protobuf_url} |
| 55 | + URL_MD5 ${Protobuf_md5} |
| 56 | + ${COMMON_EP_ARGS} |
| 57 | + PATCH_COMMAND ${CMAKE_COMMAND} |
34 | 58 | ${Protobuf_PATCH_COMMAND} |
35 | | - BUILD_IN_SOURCE 1 |
36 | | - CONFIGURE_COMMAND ./configure |
| 59 | + BUILD_IN_SOURCE 1 |
| 60 | + CONFIGURE_COMMAND ./configure |
37 | 61 | --prefix=${fletch_BUILD_INSTALL_PREFIX} |
38 | | - BUILD_COMMAND ${MAKE_EXECUTABLE} |
39 | | - INSTALL_COMMAND ${MAKE_EXECUTABLE} install |
40 | | -) |
| 62 | + BUILD_COMMAND ${MAKE_EXECUTABLE} |
| 63 | + INSTALL_COMMAND ${MAKE_EXECUTABLE} install |
| 64 | + ) |
| 65 | +else() |
| 66 | + # Build option for windows not yet generated |
| 67 | + message( FATAL_ERROR "Protobuf 2 not yet supported on windows" ) |
| 68 | +endif() |
41 | 69 |
|
42 | 70 | fletch_external_project_force_install(PACKAGE Protobuf) |
43 | 71 |
|
|
0 commit comments