blob: 37a605cdce5c65cd81721004feb8010c700647b4 [file] [log] [blame]
Jia, Chunhuia835eaa2018-09-05 09:00:41 +08001cmake_minimum_required (VERSION 3.5)
2
3include (ExternalProject)
4
5file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/prefix)
6file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/prefix/include)
7
8# requires apt install autoconf-archive and autoconf
Vernon Mauery8b69fae2019-03-20 13:43:11 -07009
Jia, Chunhuia835eaa2018-09-05 09:00:41 +080010externalproject_add (
James Feist13b00392019-08-19 16:16:08 -070011 host-ipmid PREFIX ${CMAKE_BINARY_DIR}/phosphor-host-ipmid GIT_REPOSITORY
Vernon Mauery62072072022-06-15 11:42:33 -070012 https://github.com/openbmc/phosphor-host-ipmid SOURCE_DIR
Vernon Mauery8b69fae2019-03-20 13:43:11 -070013 ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src BINARY_DIR
Hao Jiangd8593952021-02-12 11:27:47 -080014 ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-build CONFIGURE_COMMAND /usr/bin/bash -c
15 "cd ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src && export \
16 PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH} \
Vernon Mauery62072072022-06-15 11:42:33 -070017 && export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH} && \
18 export CPPFLAGS=\'-I${CMAKE_BINARY_DIR}/prefix/include/ \' && \
19 export LDFLAGS=\'-L${CMAKE_BINARY_DIR}/prefix/lib/ \' && \
20 meson --prefix=${CMAKE_BINARY_DIR}/prefix build-ext"
Hao Jiangd8593952021-02-12 11:27:47 -080021 BUILD_COMMAND /usr/bin/bash -c "cd ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src && export \
22 PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH} \
Vernon Mauery62072072022-06-15 11:42:33 -070023 && export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH} && \
24 ninja --verbose -C build-ext"
Hao Jiangd8593952021-02-12 11:27:47 -080025 INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src &&
Vernon Mauery62072072022-06-15 11:42:33 -070026 ninja --verbose -C build-ext install && mkdir -p
James Feist7c00db72019-04-03 10:50:56 -070027 "${CMAKE_BINARY_DIR}/prefix/include/phosphor-ipmi-host" && cp
28 sensorhandler.hpp selutility.hpp
Hao Jiangd8593952021-02-12 11:27:47 -080029 "${CMAKE_BINARY_DIR}/prefix/include/phosphor-ipmi-host/" && echo "ipmid config finish"
30 LOG_BUILD ON LOG_CONFIGURE ON LOG_DOWNLOAD ON
Jason M. Bills3f7c5e42018-10-03 14:00:41 -070031)
James Feistb9683922019-01-02 15:04:45 -080032
James Feist13b00392019-08-19 16:16:08 -070033externalproject_add (gtest GIT_REPOSITORY
34 "https://github.com/google/googletest.git" GIT_TAG
Jason M. Bills24df90f2021-06-15 12:46:13 -070035 7153098229e88295f9655ff1d3b0e2fa9eada5f8 CMAKE_ARGS
James Feist13b00392019-08-19 16:16:08 -070036 -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/googletest-build
37 SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src" BINARY_DIR
38 "${CMAKE_BINARY_DIR}/googletest-build" CMAKE_ARGS
39 -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/prefix)
Vernon Mauery8b69fae2019-03-20 13:43:11 -070040