Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b6c1940
improve windows
gcontini Jul 17, 2026
e3ad22b
Merge branch 'develop' into fix-windows
gcontini Jul 17, 2026
bb153c0
fix build windows
gcontini Jul 17, 2026
a09e0e7
Merge branch 'develop' into fix-windows
gcontini Jul 17, 2026
c5ddc8a
testing new command line
gcontini Jul 17, 2026
7038da7
testing why openssl is found
gcontini Jul 17, 2026
b71fc60
fix openssl
gcontini Jul 17, 2026
1d6048e
fix simpleini compile error (try)
gcontini Jul 17, 2026
035a09d
update ini and inja to resolve warnings
gcontini Jul 18, 2026
02c8ebf
update build to download boost from github
gcontini Jul 18, 2026
13619cc
try to get the error code
gcontini Jul 18, 2026
0c3b852
again download boost
gcontini Jul 18, 2026
4582609
test
gcontini Jul 18, 2026
6759fd3
test
gcontini Jul 18, 2026
8620674
test
gcontini Jul 18, 2026
e3ed37a
test
gcontini Jul 18, 2026
62843ef
test
gcontini Jul 18, 2026
6d15204
new test
gcontini Jul 18, 2026
f4d241e
test again
gcontini Jul 18, 2026
539ea70
fix boost install
gcontini Jul 18, 2026
6a41da7
fix boost install
gcontini Jul 18, 2026
374d7cc
Merge branch 'fix-windows' of https://github.com/open-license-manager…
gcontini Jul 18, 2026
3e9bceb
cmake can't handle new boost
gcontini Jul 18, 2026
6cf93d0
Merge branch 'fix-windows' of https://github.com/open-license-manager…
gcontini Jul 18, 2026
deb96da
test wait for boost installed
gcontini Jul 18, 2026
864eb33
fix boost root
gcontini Jul 18, 2026
2b8340d
fix boost root
gcontini Jul 18, 2026
8771ada
fix to get the test running
gcontini Jul 18, 2026
721fa1f
fix inspector
gcontini Jul 18, 2026
9e8dad2
fix inspector, try static build
gcontini Jul 18, 2026
0ce34fb
add releases and boost versions
gcontini Jul 18, 2026
09e4f20
try static linking
gcontini Jul 18, 2026
574180f
test use openssl
gcontini Jul 18, 2026
a0bca35
test various versions of openssl
gcontini Jul 18, 2026
71d1f99
minor fixes and full matrix
gcontini Jul 18, 2026
e6a0fa4
prepare for merge
gcontini Jul 18, 2026
93ca9a1
fix for older policies
gcontini Jul 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 43 additions & 40 deletions .github/workflows/windows-standard.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,75 @@
name: Windows standard tests
name: Windows build
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
jobs:
build-windows:
name: '${{ matrix.os }}, build: ${{ matrix.build_type }} static ${{ matrix.static }} ssl: ${{ matrix.openssl_version }} boost: ${{ matrix.boost_version }}'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
#build_type: ["Debug", "Release"]
#os: ["windows-2025", "windows-2022"]
#static: ["true","false"]
build_type: ["Debug"]
os: ["windows-2022"]
static: ["FALSE"]
static: ["TRUE", "FALSE"]
build_type: ["Debug", "Release"]
os: ["windows-2025", "windows-2022"]
boost_version: [1.78.0, 1.90.0]
openssl_version: ["None", "1.1.1.2100", "3.1.1", "4.0.1"]
steps:
- uses: actions/checkout@v6
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: install boost boost-msvc-14.2
shell: bash
if: ${{ matrix.os == 'windows-2025' }}
echo "build-output-dir=${{ github.workspace }}\build" >> "$GITHUB_OUTPUT"
if [ "${{ matrix.openssl_version }}" != "None" ]; then
echo "use-openssl=TRUE" >> "$GITHUB_OUTPUT"
else
echo "use-openssl=FALSE" >> "$GITHUB_OUTPUT"
fi
- name: download boost boost-msvc-14.3
working-directory: ${{ steps.strings.outputs.build-output-dir }}
shell: powershell
run: |
choco install -y boost-msvc-14.2 --version 1.74.0
echo "BOOST_ROOT=C:/local/boost_1_74_0" >> $GITHUB_ENV
- name: install boost boost-msvc-14.1
shell: bash
if: ${{ matrix.os == 'windows-2022' }}
${{ github.workspace }}\scripts\windows_download_boost.ps1 ${{ matrix.boost_version }} 14.3 64 "${{ steps.strings.outputs.build-output-dir }}"
- name: install boost
id: install-boost
shell: powershell
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
choco install -y boost-msvc-14.1 --version 1.74.0
echo "BOOST_ROOT=C:/local/boost_1_74_0" >> $GITHUB_ENV
- name: Configure
$Process = Start-Process -Wait -FilePath "${{ steps.strings.outputs.build-output-dir }}\boost.exe" -Argumentlist @( "/VERYSILENT" , "/DIR=${{ steps.strings.outputs.build-output-dir }}/boost") -PassThru
"boost-root=${{ steps.strings.outputs.build-output-dir }}/boost" >> $env:GITHUB_ENV
exit $Process.ExitCode
- name: install openssl
id: install-openssl
if: ${{ matrix.openssl_version != 'None' }}
shell: powershell
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
cd build
cmake .. -A x64 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DSTATIC_RUNTIME:BOOL=${{matrix.static}} -DLCC_PROJECT_NAME:STRING=test
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
shell: bash
choco install -y openssl --version ${{ matrix.openssl_version }}
- name: Configure
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: >
cmake -A x64 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBoost_ROOT=${{ steps.strings.outputs.build-output-dir }}/boost
-DSTATIC_RUNTIME:BOOL=${{matrix.static}} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
-S ${{ github.workspace }} -B ${{ steps.strings.outputs.build-output-dir }}
-DUSE_OPENSSL=${{ steps.strings.outputs.use-openssl }} -DOpenSSL_ROOT_DIR="C:/Program Files/OpenSSL-Win64"
- name: Compile
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
cd build
cmake --build . --target install --config ${{ matrix.build_type }} -S ${{ github.workspace }}
shell: bash
run: >
cmake --build ${{ steps.strings.outputs.build-output-dir }} --target install --config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
cd build
ctest -C ${{ matrix.build_type }}
shell: bash
ctest -C ${{ matrix.build_type }} --test-dir ${{ steps.strings.outputs.build-output-dir }} --output-on-failure
env:
CTEST_OUTPUT_ON_FAILURE: 1
VIRTUAL_ENV: VM
- name: Inspector
run: C:/licensecc/bin/test/lccinspector.exe
shell: bash

- name: On Failure print logs
if: ${{ failure() }}
- name: license generator
run: |
type $env:temp/open-license.log
dir ${{ github.workspace }}\install\bin
${{ github.workspace }}\install\bin\lccgen.exe project list


5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
build/*
!build/.gitkeep
/CMakeSettings.json


out
/install
/scripts/boost.exe
55 changes: 41 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

## configuration variables
## USE_OPENSSL: Enable/Disable OpenSSL support. If disabled, the generator will use Windows Crypto API on Windows and will fail to compile on Linux.
## STATIC_RUNTIME: Enable/Disable static linking of the executable. If enabled, the executable will be statically linked with all libraries, including OpenSSL and Boost. If disabled, the executable will be dynamically linked with all libraries.
## Boost_ROOT: Hint for a path to the Boost installation. If not set, CMake will try to find Boost in the system paths.
## OpenSSL_ROOT: Hint for a path to the Openssl installation.

SET(CMAKE_DISABLE_SOURCE_CHANGES ON)
SET(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
SET(LICENSECC_SHORT_LICENSE "BSD Software License")
Expand All @@ -11,6 +17,10 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")

IF(POLICY CMP0144)
cmake_policy(SET CMP0144 NEW)
ENDIF(POLICY CMP0144)

include(utilities) #import module utilities.cmake

#Not sure about this. My system doesn't support binfmt misc
Expand All @@ -22,16 +32,17 @@ IF(NOT DEFINED STATIC_RUNTIME)
SET(STATIC_RUNTIME FALSE CACHE BOOL "Compile a static executable or a dynamic linked one")
MARK_AS_ADVANCED(STATIC_RUNTIME)
ENDIF(NOT DEFINED STATIC_RUNTIME)
message( STATUS "Static linking : ${STATIC_RUNTIME}")
message( STATUS "Static linking : ${STATIC_RUNTIME}")


SET (OPENSSL_USE_STATIC_LIBS ${STATIC_RUNTIME})

SET (OPENSSL_USE_STATIC_LIBS ${STATIC_RUNTIME})
if(UNIX) #this is true for all the linux systems but not for cross compiling "linux->windows"

IF(STATIC_RUNTIME)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++")
unset(CMAKE_DL_LIBS)
add_definitions(-DBOOST_TEST_STATIC_LINK)
SET (OPENSSL_USE_STATIC_LIBS TRUE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBS OFF)
#set(CMAKE_HAVE_LIBC_PTHREAD TRUE) #strange hack with cmake 4.3, why it's needed with static compile
Expand All @@ -45,7 +56,10 @@ if(UNIX) #this is true for all the linux systems but not for cross compiling "li
list(APPEND EXTERNAL_LIBS "${CMAKE_THREAD_LIBS_INIT}")
endif()
endif(THREADS_HAVE_PTHREAD_ARG)


IF(DEFINED USE_OPENSSL AND NOT USE_OPENSSL) #the user has explicitly disabled openssl, but we are in linux we need to enable it.
message(FATAL_ERROR "USE_OPENSSL is set to OFF, but we are in linux. Please enable it.")
ENDIF(DEFINED USE_OPENSSL AND NOT USE_OPENSSL)
#openssl always required in linux
find_package(OpenSSL REQUIRED COMPONENTS Crypto QUIET)
add_definitions(-DHAS_OPENSSL)
Expand All @@ -62,21 +76,33 @@ if(UNIX) #this is true for all the linux systems but not for cross compiling "li

set(pkg_config_dest "lib/cmake/${PROJECT_NAME}")
else(UNIX) #windows and linux crosscompiling for windows target
SET ( OPENSSL_USE_STATIC_LIBS ON )
find_package(OpenSSL COMPONENTS Crypto QUIET)
IF(OPENSSL_FOUND)

SET (OPENSSL_MSVC_STATIC_RT ${STATIC_RUNTIME})
IF(DEFINED USE_OPENSSL)
if(USE_OPENSSL)
MESSAGE(VERBOSE "Openssl - generator : forced by the user")
find_package(OpenSSL REQUIRED COMPONENTS Crypto QUIET)
else(USE_OPENSSL) #defined but evaluate
MESSAGE(VERBOSE "Openssl - generator : disabled by user.")
set(OpenSSL_FOUND FALSE)
endif(USE_OPENSSL)
else(DEFINED USE_OPENSSL)
SET (OPENSSL_MSVC_STATIC_RT TRUE)
find_package(OpenSSL COMPONENTS Crypto QUIET)
endif(DEFINED USE_OPENSSL)
IF(OpenSSL_FOUND)
add_definitions(-DHAS_OPENSSL)
include_directories(${OPENSSL_INCLUDE_DIR})
MESSAGE(STATUS "Found openssl version ${OPENSSL_VERSION} - generator")
ENDIF(OPENSSL_FOUND)
IF(NOT OPENSSL_FOUND)
MESSAGE(STATUS "Openssl not found - generator - configuring libary without it.")
ENDIF(NOT OPENSSL_FOUND)
MESSAGE(STATUS "Openssl (generator) : ${OPENSSL_VERSION}")
MESSAGE(STATUS "Openssl (lib) : ${OPENSSL_CRYPTO_LIBRARY}")
ELSE(OpenSSL_FOUND)
MESSAGE(STATUS "Openssl - generator : not found - using windows cryptography.")
ENDIF(OpenSSL_FOUND)

if(MSVC)
include(target_arch)
target_architecture( TARGET_ARCHITECTURE )
message(STATUS "architecture detected: ${TARGET_ARCHITECTURE}")
message(STATUS "architecture detected : ${TARGET_ARCHITECTURE}")

#cmake > 3.15 handle the /MD flag more nicely than this
if(STATIC_RUNTIME)
Expand Down Expand Up @@ -108,7 +134,8 @@ if(WIN32 AND "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x")
message(STATUS "Compiler architecture: ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}")
endif()

SET( Boost_USE_STATIC_LIBS ON )
#SET (Boost_USE_STATIC_RUNTIME ${STATIC_RUNTIME}) doesn't work well in Linux...
SET (Boost_USE_STATIC_LIBS ON )
find_package(Boost REQUIRED COMPONENTS date_time filesystem program_options unit_test_framework OPTIONAL_COMPONENTS system)

#set below in case of dynamic linking in debug.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Standard](https://img.shields.io/badge/c%2B%2B-11-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization)
[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Linux build](https://github.com/open-license-manager/lcc-license-generator/actions/workflows/linux.yml/badge.svg)](https://github.com/open-license-manager/lcc-license-generator/actions/workflows/linux.yml)
[![Windows build](https://github.com/open-license-manager/lcc-license-generator/actions/workflows/windows-standard.yml/badge.svg)](https://github.com/open-license-manager/lcc-license-generator/actions/workflows/windows-standard.yml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/00074c0b59164b2880259e9c6ed6a3d2)](https://app.codacy.com/gh/open-license-manager/lcc-license-generator/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[![codecov](https://codecov.io/gh/open-license-manager/lcc-license-generator/branch/develop/graph/badge.svg)](https://codecov.io/gh/open-license-manager/lcc-license-generator)

Expand Down
9 changes: 0 additions & 9 deletions scripts/windows_download_boost.bat

This file was deleted.

57 changes: 57 additions & 0 deletions scripts/windows_download_boost.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env pwsh

# This script downloads boost. It must be invoked with 4 arguments
# windows_download_boost.ps1 <boost_version> <msvc version> <architecture> <output_dir>
# eg. windows_download_boost.ps1 1.91.0 14.3 64 C:\local\boost

if ($args.Count -ne 4) {
Write-Host "Error: This script requires 4 parameters.\n windows_download_boost.ps1 <boost_version> <msvc version> <architecture> <output_dir>"
exit
}
#set Invoke-WebRequest to not show progress bar, as it can cause issues in some CI environments
$ProgressPreference = 'SilentlyContinue'

[string] $version = $args[0]
[string] $msvc_version = $args[1]
[string] $architecture = $args[2]
[string] $output_dir = $args[3]

[string] $outputfile = Join-Path -Path $output_dir -ChildPath "boost.exe"
[int]$maxRetries = 3
[int]$retryCount = 0
[int]$StatusCode = 200


$version_und = $version.Replace('.', '_')
$uri = "https://github.com/userdocs/boost/releases/download/boost-"+$version+"/boost_" + $version_und + "-msvc-" + $msvc_version + "-" + $architecture + ".exe"

if (-not (Test-Path $output_dir)) {
New-Item -ItemType Directory -Path $output_dir
}

if (-not (Test-Path $outputfile)) {
Write-Host "Boost not cached, downloading it: from $uri to $outputfile"
do {
try {
Invoke-WebRequest -Uri "$uri" -Verbose -OutFile "$outputfile"
break
} catch {
$StatusCode = $_.Exception.Response.StatusCode
$errorMessage = $_.Exception.Message
$retryCount++
Write-Host "Attempt $retryCount failed: $StatusCode $errorMessage. Retrying $uri ..."
Start-Sleep -Seconds 2 # Wait before retrying
}
} until ($retryCount -ge $maxRetries)

if ($retryCount -ge $maxRetries) {
Write-Host "Request failed after $retryCount attempts."
exit 1
} else {
Write-Host "Boost downloaded"
dir $output_file
}
} else {
Write-Host "Boost already downloaded"
dir $output_file
}
3 changes: 1 addition & 2 deletions src/base_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
if(UNIX OR OpenSSL_FOUND)

ADD_LIBRARY(
lcc_base OBJECT
base64.cpp
crypto_helper.cpp
openssl/crypto_helper_ssl.cpp
)

else(UNIX OR OpenSSL_FOUND) #windows and zlib not found
else(UNIX OR OpenSSL_FOUND)
ADD_LIBRARY(
lcc_base OBJECT
base64.cpp
Expand Down
Loading