Jia, Chunhui | a835eaa | 2018-09-05 09:00:41 +0800 | [diff] [blame^] | 1 | cmake_minimum_required (VERSION 3.5) |
| 2 | |
| 3 | include (ExternalProject) |
| 4 | |
| 5 | file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/prefix) |
| 6 | file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/prefix/include) |
| 7 | |
| 8 | # requires apt install autoconf-archive and autoconf |
| 9 | externalproject_add ( |
| 10 | sdbusplus-project PREFIX ${CMAKE_BINARY_DIR}/sdbusplus-project |
| 11 | GIT_REPOSITORY https://github.com/openbmc/sdbusplus.git |
| 12 | GIT_TAG 69425eb7d30816c03f88962c44b12b6de5b3cc71 |
| 13 | SOURCE_DIR ${CMAKE_BINARY_DIR}/sdbusplus-src |
| 14 | BINARY_DIR ${CMAKE_BINARY_DIR}/sdbusplus-build CONFIGURE_COMMAND "" |
| 15 | BUILD_COMMAND |
| 16 | cd ${CMAKE_BINARY_DIR}/sdbusplus-src && |
| 17 | ./bootstrap.sh clean && |
| 18 | ./bootstrap.sh && |
| 19 | ./configure --prefix=${CMAKE_BINARY_DIR}/prefix CPPFLAGS=-I${CMAKE_BINARY_DIR}/prefix/include/ |
| 20 | --enable-transaction && |
| 21 | make && make install |
| 22 | INSTALL_COMMAND "" |
| 23 | LOG_DOWNLOAD ON |
| 24 | ) |
| 25 | |
| 26 | externalproject_add ( |
| 27 | dbus-interfaces |
| 28 | PREFIX ${CMAKE_BINARY_DIR}/phosphor-dbus-interfaces |
| 29 | DEPENDS sdbusplus-project |
| 30 | GIT_REPOSITORY https://github.com/openbmc/phosphor-dbus-interfaces |
| 31 | GIT_TAG 4132f4b6b1de57a993af9bd2bcd039957786a227 |
| 32 | SOURCE_DIR ${CMAKE_BINARY_DIR}/phosphor-dbus-interfaces-src |
| 33 | BINARY_DIR ${CMAKE_BINARY_DIR}/phosphor-dbus-interfaces-build |
| 34 | CONFIGURE_COMMAND "" |
| 35 | BUILD_COMMAND |
| 36 | cd ${CMAKE_BINARY_DIR}/phosphor-dbus-interfaces-src && |
| 37 | echo "#!/bin/bash" > build.sh && |
| 38 | echo "export PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH}" >> build.sh && |
| 39 | echo "export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH}" >> build.sh && |
| 40 | echo "export PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/prefix/lib/pkgconfig" >> build.sh && |
| 41 | echo "./bootstrap.sh " >> build.sh && |
| 42 | echo "./configure --prefix=${CMAKE_BINARY_DIR}/prefix CPPFLAGS=-I${CMAKE_BINARY_DIR}/prefix/include/ " >> build.sh && |
| 43 | echo "make verbose=1" >> build.sh && |
| 44 | echo "make install " >> build.sh && |
| 45 | chmod 777 build.sh && |
| 46 | ./build.sh |
| 47 | INSTALL_COMMAND "" |
| 48 | LOG_DOWNLOAD ON |
| 49 | ) |
| 50 | |
| 51 | externalproject_add ( |
| 52 | cereal |
| 53 | GIT_REPOSITORY https://github.com/USCiLab/cereal |
| 54 | GIT_TAG 51cbda5f30e56c801c07fe3d3aba5d7fb9e6cca4 |
| 55 | SOURCE_DIR "${CMAKE_BINARY_DIR}/cereal-src" |
| 56 | BINARY_DIR "${CMAKE_BINARY_DIR}/cereal-build" |
| 57 | CONFIGURE_COMMAND "" |
| 58 | BUILD_COMMAND "" |
| 59 | INSTALL_COMMAND |
| 60 | mkdir -p "${CMAKE_BINARY_DIR}/prefix/include/cereal" && |
| 61 | cp -r "${CMAKE_BINARY_DIR}/cereal-src/include/cereal" |
| 62 | "${CMAKE_BINARY_DIR}/prefix/include" |
| 63 | ) |
| 64 | |
| 65 | |
| 66 | externalproject_add ( |
| 67 | phosphor-logging |
| 68 | PREFIX ${CMAKE_BINARY_DIR}/phosphor-logging |
| 69 | DEPENDS cereal sdbusplus-project dbus-interfaces |
| 70 | GIT_REPOSITORY https://github.com/openbmc/phosphor-logging |
| 71 | GIT_TAG 477b731ad0fd8c116ffcaa8265a508c9fb112479 |
| 72 | SOURCE_DIR ${CMAKE_BINARY_DIR}/phosphor-logging-src |
| 73 | BINARY_DIR ${CMAKE_BINARY_DIR}/phosphor-logging-build |
| 74 | CONFIGURE_COMMAND "" |
| 75 | BUILD_COMMAND |
| 76 | cd ${CMAKE_BINARY_DIR}/phosphor-logging-src && |
| 77 | echo "#!/bin/bash" > build.sh && |
| 78 | echo "export PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH}" >> build.sh && |
| 79 | echo "export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH}" >> build.sh && |
| 80 | echo "export PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/prefix/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}" >> build.sh && |
| 81 | echo "./bootstrap.sh clean" >> build.sh && |
| 82 | echo "./bootstrap.sh" >> build.sh && |
| 83 | echo "./configure --prefix=${CMAKE_BINARY_DIR}/prefix CPPFLAGS=-I${CMAKE_BINARY_DIR}/prefix/include/ \ |
| 84 | YAML_DIR=${CMAKE_BINARY_DIR}/prefix/share/phosphor-dbus-yaml/yaml --enable-metadata-processing" >> build.sh && |
| 85 | echo "make verbose=1" >> build.sh && |
| 86 | echo "make install " >> build.sh && |
| 87 | chmod 777 build.sh && |
| 88 | ./build.sh |
| 89 | INSTALL_COMMAND "" |
| 90 | LOG_DOWNLOAD ON |
| 91 | ) |
| 92 | |
| 93 | externalproject_add ( |
| 94 | nlohmann-json |
| 95 | GIT_REPOSITORY "https://github.com/nlohmann/json.git" |
| 96 | GIT_TAG d2dd27dc3b8472dbaa7d66f83619b3ebcd9185fe |
| 97 | SOURCE_DIR "${CMAKE_BINARY_DIR}/nlohmann-json-src" |
| 98 | BINARY_DIR "${CMAKE_BINARY_DIR}/nlohmann-json-build" |
| 99 | CONFIGURE_COMMAND "" |
| 100 | BUILD_COMMAND "" |
| 101 | INSTALL_COMMAND |
| 102 | mkdir -p "${CMAKE_BINARY_DIR}/prefix/include/nlohmann" && |
| 103 | cp -r "${CMAKE_BINARY_DIR}/nlohmann-json-src/include/nlohmann" |
| 104 | "${CMAKE_BINARY_DIR}/prefix/include" |
| 105 | ) |
| 106 | |
| 107 | externalproject_add ( |
| 108 | host-ipmid |
| 109 | PREFIX ${CMAKE_BINARY_DIR}/phosphor-host-ipmid |
| 110 | DEPENDS sdbusplus-project dbus-interfaces nlohmann-json |
| 111 | GIT_REPOSITORY https://github.com/openbmc/phosphor-host-ipmid |
| 112 | SOURCE_DIR ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-src |
| 113 | BINARY_DIR ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-build |
| 114 | CONFIGURE_COMMAND "" |
| 115 | BUILD_COMMAND "" |
| 116 | INSTALL_COMMAND |
| 117 | mkdir -p "${CMAKE_BINARY_DIR}/prefix/include/host-ipmid" && |
| 118 | cp ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-src/host-ipmid/ipmid-api.h ${CMAKE_BINARY_DIR}/prefix/include/host-ipmid && |
| 119 | cp ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-src/elog-errors.hpp ${CMAKE_BINARY_DIR}/prefix/include/host-ipmid && |
| 120 | cp ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-src/utils.hpp ${CMAKE_BINARY_DIR}/prefix/include/host-ipmid && |
| 121 | cp ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-src/types.hpp ${CMAKE_BINARY_DIR}/prefix/include/host-ipmid |
| 122 | LOG_DOWNLOAD ON |
| 123 | ) |
| 124 | |
| 125 | |
| 126 | |