This repository has been archived by the owner on Nov 20, 2021. It is now read-only.
forked from NathanFrench/buildem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotobuf.cmake
69 lines (57 loc) · 2 KB
/
protobuf.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#
# Install protobuf from source
#
if (NOT protobuf_NAME)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
include (ExternalProject)
include (ExternalSource)
include (BuildSupport)
include (python)
external_source (protobuf
2.5.0
protobuf-2.5.0.tar.gz
b751f772bdeb2812a2a8e7202bf1dae8
https://protobuf.googlecode.com/files)
message ("Installing ${protobuf_NAME} into build area: ${BUILDEM_DIR} ...")
ExternalProject_Add(${protobuf_NAME}
PREFIX ${BUILDEM_DIR}
URL ${protobuf_URL}
URL_MD5 ${protobuf_MD5}
UPDATE_COMMAND ""
PATCH_COMMAND ""
CONFIGURE_COMMAND ${BUILDEM_ENV_STRING} ./configure
--prefix=${BUILDEM_DIR}
--enable-shared
--enable-static
LDFLAGS=${BUILDEM_LDFLAGS}
CPPFLAGS=-I${BUILDEM_DIR}/include
BUILD_COMMAND ${BUILDEM_ENV_STRING} $(MAKE)
BUILD_IN_SOURCE 1
TEST_COMMAND ${BUILDEM_ENV_STRING} $(MAKE) check
INSTALL_COMMAND ${BUILDEM_ENV_STRING} $(MAKE) install
)
set (protobuf_LIBRARIES ${BUILDEM_LIB_DIR}/libprotobuf.${BUILDEM_PLATFORM_DYLIB_EXTENSION})
##
## Add custom steps for the protobuf python bindings (build, test, install)
##
ExternalProject_Add_Step(${protobuf_NAME} python-build
COMMENT "Building protobuf python bindings."
COMMAND ${BUILDEM_ENV_STRING} ${PYTHON_EXE} setup.py build
WORKING_DIRECTORY ${protobuf_SRC_DIR}/python
DEPENDEES build
)
ExternalProject_Add_Step(${protobuf_NAME} python-test
COMMENT "Testing protobuf python bindings."
COMMAND ${BUILDEM_ENV_STRING} ${PYTHON_EXE} setup.py test
WORKING_DIRECTORY ${protobuf_SRC_DIR}/python
DEPENDEES python-build
)
ExternalProject_Add_Step(${protobuf_NAME} python-install
COMMENT "Installing protobuf python bindings."
COMMAND ${BUILDEM_ENV_STRING} ${PYTHON_EXE} setup.py install
WORKING_DIRECTORY ${protobuf_SRC_DIR}/python
DEPENDEES python-test
DEPENDERS install
)
set_target_properties(${protobuf_NAME} PROPERTIES EXCLUDE_FROM_ALL ON)
endif (NOT protobuf_NAME)