Skip to content

Commit 731ae9f

Browse files
authored
Fix windows compilation & add test (#28)
1 parent 57245b4 commit 731ae9f

4 files changed

Lines changed: 85 additions & 15 deletions

File tree

.github/workflows/linux.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ jobs:
1111

1212
strategy:
1313
fail-fast: false
14-
15-
# Set up a matrix to run the following 3 configurations:
16-
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
17-
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
18-
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
19-
#
20-
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
2114
matrix:
2215
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-26.04]
2316
build_type: [Debug,Release]
@@ -36,11 +29,11 @@ jobs:
3629
run: >
3730
sudo apt-get -y install cmake valgrind libssl-dev zlib1g-dev libboost-test-dev libboost-filesystem-dev
3831
libboost-iostreams-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev
39-
32+
#Install extra deps for ubuntu 26-04 (and add valgrind and coverage tests)
4033
- name: Extra Dependecies Ubuntu 26.04
4134
if: ${{ matrix.os == 'ubuntu-26.04' }}
4235
run: >
43-
sudo apt-get install -y libjitterentropy3-dev
36+
sudo apt-get install -y libjitterentropy3-dev valgrind lcov
4437
#- name: Install cmake 4
4538
# run: |
4639
# test -f /usr/share/doc/kitware-archive-keyring/copyright || wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
@@ -72,6 +65,10 @@ jobs:
7265
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
7366
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
7467
run: ctest --build-config ${{ matrix.build_type }}
68+
- name: Memory_checks ubuntu_26.04
69+
if: ${{ matrix.os == 'ubuntu-26.04' }}
70+
run: >
71+
ctest -T memcheck
7572
- name: On_Failure_print_logs
7673
if: ${{ failure() }}
7774
run: |
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Windows standard tests
2+
on:
3+
push:
4+
branches: [ "develop" ]
5+
pull_request:
6+
branches: [ "develop" ]
7+
jobs:
8+
build-windows:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
#build_type: ["Debug", "Release"]
14+
#os: ["windows-2025", "windows-2022"]
15+
#static: ["true","false"]
16+
build_type: ["Debug"]
17+
os: ["windows-2022"]
18+
static: ["FALSE"]
19+
steps:
20+
- uses: actions/checkout@v6
21+
- name: Setup
22+
shell: bash
23+
run: env
24+
- name: Set reusable strings
25+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
26+
id: strings
27+
shell: bash
28+
run: |
29+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
30+
- name: install boost boost-msvc-14.2
31+
shell: bash
32+
if: ${{ matrix.os == 'windows-2025' }}
33+
run: |
34+
choco install -y boost-msvc-14.2 --version 1.74.0
35+
echo "BOOST_ROOT=C:/local/boost_1_74_0" >> $GITHUB_ENV
36+
- name: install boost boost-msvc-14.1
37+
shell: bash
38+
if: ${{ matrix.os == 'windows-2022' }}
39+
run: |
40+
choco install -y boost-msvc-14.1 --version 1.74.0
41+
echo "BOOST_ROOT=C:/local/boost_1_74_0" >> $GITHUB_ENV
42+
- name: Configure
43+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
44+
run: |
45+
cd build
46+
cmake .. -A x64 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
47+
-DSTATIC_RUNTIME:BOOL=${{matrix.static}} -DLCC_PROJECT_NAME:STRING=test
48+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
49+
-S ${{ github.workspace }}
50+
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
51+
shell: bash
52+
- name: Compile
53+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
54+
run: |
55+
cd build
56+
cmake --build . --target install --config ${{ matrix.build_type }} -S ${{ github.workspace }}
57+
shell: bash
58+
- name: Test
59+
run: |
60+
cd build
61+
ctest -C ${{ matrix.build_type }}
62+
shell: bash
63+
env:
64+
CTEST_OUTPUT_ON_FAILURE: 1
65+
VIRTUAL_ENV: VM
66+
- name: Inspector
67+
run: C:/licensecc/bin/test/lccinspector.exe
68+
shell: bash
69+
70+
- name: On Failure print logs
71+
if: ${{ failure() }}
72+
run: |
73+
type $env:temp/open-license.log
74+
75+

CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ SET(CMAKE_DISABLE_SOURCE_CHANGES ON)
44
SET(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
55
SET(LICENSECC_SHORT_LICENSE "BSD Software License")
66

7-
project (lccgen
8-
VERSION 2.1.0
9-
DESCRIPTION "License generator for licensecc"
10-
LANGUAGES CXX)
7+
project (lccgen VERSION 2.1.0 LANGUAGES CXX)
8+
set(PROJECT_DESCRIPTION "License generator for licensecc")
119

1210
set(CMAKE_CXX_STANDARD 11)
1311
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -66,7 +64,7 @@ else(UNIX) #windows and linux crosscompiling for windows target
6664
target_architecture( TARGET_ARCHITECTURE )
6765
message(STATUS "architecture detected: ${TARGET_ARCHITECTURE}")
6866

69-
#Boost > 3.15 handle the /MD flag more nicely than this
67+
#cmake > 3.15 handle the /MD flag more nicely than this
7068
if(${STATIC_RUNTIME})
7169
string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
7270
string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")

test/license_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ BOOST_AUTO_TEST_CASE(extend_license) {
147147
}
148148

149149
#else
150-
BOOST_AUTO_TEST_CASE(mock) { BOOST_CHECKPOINT("Mock test for older boost versions"); }
150+
BOOST_AUTO_TEST_CASE(mock) { BOOST_TEST_CHECKPOINT("Mock test for older boost versions"); }
151151
#endif
152152
} // namespace test
153153
} // namespace license

0 commit comments

Comments
 (0)