Skip to content

Commit

Permalink
compile upstream cpp example as test
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Sep 4, 2022
1 parent 2975860 commit d3ca353
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
3 changes: 0 additions & 3 deletions recipe/cf_test/CMakeLists.txt

This file was deleted.

10 changes: 4 additions & 6 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,11 @@ outputs:
# https://discourse.cmake.org/t/questions-about-find-package-cli-msvc/6194
- {{ compiler('c') }}
- cmake
- make # [linux]
files:
- cf_test/
- ninja
source_files:
- examples/
commands:
- cd cf_test
- cmake $CMAKE_ARGS . # [unix and (build_platform == target_platform)]
- cmake %CMAKE_ARGS% . # [win]
# this section will also run run_test.{sh,bat}

# libraries
{% for each_lib in libraries %}
Expand Down
17 changes: 17 additions & 0 deletions recipe/run_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,20 @@ if %ERRORLEVEL% neq 0 exit 1

if not exist hello.grpc.pb.h exit 1
if not exist hello.grpc.pb.cc exit 1

:: taken from cd examples/cpp/helloworld
cd examples/cpp/helloworld

mkdir build
cd build

cmake -G "Ninja" ^
-DCMAKE_CXX_STANDARD="14" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
-DCMAKE_MODULE_PATH="%LIBRARY_PREFIX%/lib/cmake" ^
..
if %ERRORLEVEL% neq 0 exit 1

cmake --build . --config Release
if %ERRORLEVEL% neq 0 exit 1
15 changes: 15 additions & 0 deletions recipe/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,18 @@ if [[ "${build_platform}" == "${target_platform}" ]]; then
test -f hello.grpc.pb.h
test -f hello.grpc.pb.cc
fi

# taken from cd examples/cpp/helloworld
cd examples/cpp/helloworld

# folder already contains a file called BUILD
mkdir build-cpp
cd build-cpp

cmake -G "Ninja" \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_PREFIX_PATH="$PREFIX" \
-DCMAKE_MODULE_PATH="$PREFIX/lib/cmake" \
..

cmake --build .

0 comments on commit d3ca353

Please sign in to comment.