Dung Cao | 956cbfc | 2021-06-11 09:24:57 +0000 | [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 | |
| 10 | externalproject_add ( |
| 11 | host-ipmid PREFIX ${CMAKE_BINARY_DIR}/phosphor-host-ipmid GIT_REPOSITORY |
| 12 | https://github.com/openbmc/phosphor-host-ipmid SOURCE_DIR |
| 13 | ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src BINARY_DIR |
| 14 | ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-build CONFIGURE_COMMAND cd |
| 15 | ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src && export |
| 16 | PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH} |
| 17 | && export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH} && export |
| 18 | PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/prefix/lib/pkgconfig && ./bootstrap.sh |
| 19 | && ./configure --prefix=${CMAKE_BINARY_DIR}/prefix |
| 20 | CPPFLAGS=-I${CMAKE_BINARY_DIR}/prefix/include/ |
| 21 | CXXFLAGS=-Wno-error=unused-result LDFLAGS=-L${CMAKE_BINARY_DIR}/prefix/lib/ |
| 22 | BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src && export |
| 23 | PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH} |
| 24 | && export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH} && export |
| 25 | PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/prefix/lib/pkgconfig && make -j |
| 26 | verbose=1 INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src && |
| 27 | make install && mkdir -p |
| 28 | "${CMAKE_BINARY_DIR}/prefix/include/ipmid" && cp include/ipmid/api.h |
| 29 | "${CMAKE_BINARY_DIR}/prefix/include/ipmid/" LOG_DOWNLOAD ON |
| 30 | ) |
| 31 | |