Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cmake.yml « workflows « .github - github.com/nanopb/nanopb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f8f3838e49b9f2dfb08494f8e33e9b24071b38e7 (plain)
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
70
71
name: Test CMake-based installation and compilation

on:
  workflow_dispatch:
  workflow_call:
  push:
    paths:
      - '**CMakeLists**'
      - '**cmake**'
  pull_request:
    paths:
      - '**CMakeLists**'
      - '**cmake**'

jobs:
  build_cmake_linux:
    name: CMake on Ubuntu 22.04
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2

      - name: Install dependencies
        run: |
          python3 -m pip install protobuf grpcio-tools

      - name: Build with CMake
        run: |
          mkdir build
          cd build
          cmake ..
          cmake --build .
          sudo cmake --install .
      
      - name: Compile example against installed library
        run: |
          cd examples/simple
          nanopb_generator simple.proto
          gcc -Wall -Werror -osimple simple.pb.c simple.c -lprotobuf-nanopb -I/usr/local/include/nanopb
          ./simple

  build_cmake_windows:
    name: CMake on Windows 2022
    runs-on: windows-2022
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-python@v4
        with:
          python-version: '3.12'

      - name: Install dependencies
        run: |
          pip install protobuf grpcio-tools

      - name: Build with CMake
        run: |
          mkdir build
          cd build
          cmake ..
          cmake --build . --config Release
          cmake --install . --config Release --prefix C:/nanopb-test
      
      - name: Compile example against installed library
        shell: cmd
        run: |
          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
          cd examples/simple
          call C:\nanopb-test\bin\nanopb_generator simple.proto
          cl simple.pb.c simple.c /IC:\nanopb-test\include\nanopb C:\nanopb-test\lib\protobuf-nanopb.lib /link /out:simple.exe
          simple.exe