Skip to content

Commit

Permalink
Update build scripts and documentation (#614)
Browse files Browse the repository at this point in the history
IB-8160, IB-7900

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored Aug 21, 2024
1 parent 36168c9 commit 36cad6d
Show file tree
Hide file tree
Showing 18 changed files with 308 additions and 294 deletions.
45 changes: 25 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
target: [osx, ios, iossimulator, androidarm, androidarm64, androidx86_64]
target: [macos, iphoneos, iphonesimulator, androidarm, androidarm64, androidx86_64]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Install dependencies
run: |
brew update
brew install --formula swig doxygen boost
brew install --formula ninja swig doxygen boost
brew unlink [email protected] || true
brew unlink [email protected] || true
brew unlink xz
Expand All @@ -48,22 +48,27 @@ jobs:
- name: Setup cache
run: sudo ln -s $PWD/cache/* /Library/
- name: Build macOS
if: matrix.target == 'osx'
run: ./build-library.sh test pkcs11sign zipdebug embedlibs pkgbuild
if: matrix.target == 'macos'
run: |
cmake --preset ${{ matrix.target }} -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build --preset ${{ matrix.target }}
cmake --build --preset ${{ matrix.target }} --target test pkcs11sign zipdebug embedlibs pkgbuild
- name: Build ${{ matrix.target }}
if: matrix.target != 'osx'
if: matrix.target != 'macos'
run: |
./build-library.sh ${{ matrix.target }} install/strip
cmake --preset ${{ matrix.target }} -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build --preset ${{ matrix.target }}
sudo cmake --build --preset ${{ matrix.target }} --target install/strip
cd /Library
zip -q -r ${OLDPWD}/libdigidocpp.${{ matrix.target }}.zip libdigidocpp.*
- name: Archive artifacts
if: matrix.target == 'osx'
if: matrix.target == 'macos'
uses: actions/upload-artifact@v4
with:
name: macOS
path: macOS/libdigidocpp*.*
path: build/macos/libdigidocpp*.*
- name: Archive artifacts
if: matrix.target != 'osx'
if: matrix.target != 'macos'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
Expand Down Expand Up @@ -151,6 +156,7 @@ jobs:
env:
VER_SUFFIX: .VS${{ matrix.toolset }}
CXXFLAGS: '/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR' # https://github.com/actions/runner-images/issues/10004
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -159,27 +165,27 @@ jobs:
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 4065f37d0a6628ef17cf6ee15385f9091f1075bc
vcpkgGitCommitId: 0f8b6ddf49fa8ae66a7826234e9ba3fda5f46d3c
vcpkgJsonGlob: ./vcpkg.json
runVcpkgInstall: true
runVcpkgFormatString: "[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`, `--x-feature`, `tests`]"
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.platform }}-windows
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed
- name: Install dependencies
run: choco install doxygen.install -y > $null
- uses: actions/setup-python@v5
if: matrix.platform == 'x86'
with:
python-version: 3.11
architecture: ${{ matrix.platform }}
python-version: 3.12
architecture: x86
- name: Install WiX
run: |
dotnet tool install -g wix --version 5.0.0
wix extension -g add WixToolset.UI.wixext/5.0.0
dotnet tool install -g wix --version 5.0.1
wix extension -g add WixToolset.UI.wixext/5.0.1
- name: Build
run: |
& .\build.ps1 `
-vcpkg_installed ${{ github.workspace }}/vcpkg_installed `
-vcpkg_installed ${{ env.VCPKG_INSTALLED_DIR }} `
-vcvars "${{ matrix.vcvars }}" `
-platform ${{ matrix.platform }} `
-swig C:/ProgramData/chocolatey/bin/swig.exe `
Expand Down Expand Up @@ -269,9 +275,9 @@ jobs:
- name: Build
run: |
cmake -B build -S . \
-DSWIG_EXECUTABLE=NOTFOUND \
-DBoost_INCLUDE_DIR=NOTFOUND \
-DDOXYGEN_EXECUTABLE=NOTFOUND \
-DCMAKE_DISABLE_FIND_PACKAGE_SWIG=YES \
-DCMAKE_DISABLE_FIND_PACKAGE_Boost=YES \
-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=YES \
-DBUILD_TOOLS=NO
cmake --build build
- name: Perform CodeQL Analysis
Expand All @@ -285,7 +291,6 @@ jobs:
patterns: |
-src/json.hpp
-src/minizip/*
-build/src/xml/*
-**:cpp/poorly-documented-function
-**:cpp/loop-variable-changed
input: sarif-results/cpp.sarif
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ endif()
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
project(libdigidocpp VERSION 3.18.0)
project(libdigidocpp VERSION 4.0.0)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})

Expand Down
153 changes: 153 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"version": 6,
"configurePresets": [
{
"name": "default",
"displayName": "Default config",
"description": "Default build using Ninja generator",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}"
},
{
"name": "base",
"displayName": "macOS base build config",
"hidden": true,
"inherits": "default",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"environment": {
"DEST": "/Library/libdigidocpp$env{DEST_SUFFIX}"
},
"installDir": "$env{DEST}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_FIND_ROOT_PATH": "$env{DEST};/usr/local;/opt/homebrew"
}
},
{
"name": "macos",
"inherits": "base",
"description": "This macos build is only available on macOS",
"cacheVariables": {
"CMAKE_OSX_ARCHITECTURES": "arm64;x86_64",
"CMAKE_OSX_DEPLOYMENT_TARGET": "12.0"
}
},
{
"name": "mobile",
"hidden": true,
"inherits": "base",
"environment": {
"DEST_SUFFIX": ".${presetName}"
},
"cacheVariables": {
"CMAKE_DISABLE_FIND_PACKAGE_Boost": "YES",
"CMAKE_DISABLE_FIND_PACKAGE_Doxygen": "YES",
"BUILD_TOOLS": "NO"
}
},
{
"name": "ios",
"hidden": true,
"inherits": "mobile",
"cacheVariables": {
"CMAKE_SYSTEM_NAME": "iOS",
"CMAKE_OSX_SYSROOT": "${presetName}",
"CMAKE_OSX_DEPLOYMENT_TARGET": "15.0",
"CMAKE_OSX_ARCHITECTURES": "arm64;x86_64",
"CMAKE_DISABLE_FIND_PACKAGE_SWIG": "YES",
"FRAMEWORK_DESTINATION": "$env{DEST}/lib"
}
},
{
"name": "iphoneos",
"inherits": "ios",
"description": "This iphoneos build is only available on macOS",
"cacheVariables": {
"CMAKE_OSX_ARCHITECTURES": "arm64"
}
},
{
"name": "iphonesimulator",
"inherits": "ios",
"description": "This iphonesimulator build is only available on macOS"
},
{
"name": "iphonecatalyst",
"inherits": "ios",
"description": "This iphonecatalyst build is only available on macOS",
"cacheVariables": {
"CMAKE_OSX_SYSROOT": "macosx"
}
},
{
"name": "android",
"hidden": true,
"inherits": "mobile",
"cacheVariables": {
"CMAKE_SYSTEM_NAME": "Android",
"CMAKE_SYSTEM_VERSION": "30",
"CMAKE_DISABLE_FIND_PACKAGE_Python3": "YES",
"BUILD_SHARED_LIBS": "NO"
}
},
{
"name": "androidarm",
"inherits": "android",
"description": "androidarm build is only available on macOS",
"cacheVariables": {
"CMAKE_ANDROID_ARCH_ABI": "armeabi-v7a"
}
},
{
"name": "androidarm64",
"inherits": "android",
"description": "androidarm64 build is only available on macOS",
"cacheVariables": {
"CMAKE_ANDROID_ARCH_ABI": "arm64-v8a"
}
},
{
"name": "androidx86_64",
"inherits": "android",
"description": "androidx86_64 build is only available on macOS",
"cacheVariables": {
"CMAKE_ANDROID_ARCH_ABI": "x86_64"
}
}
],
"buildPresets":
[
{
"name": "macos",
"configurePreset": "macos"
},
{
"name": "iphoneos",
"configurePreset": "iphoneos"
},
{
"name": "iphonesimulator",
"configurePreset": "iphonesimulator"
},
{
"name": "iphonecatalyst",
"configurePreset": "iphonecatalyst"
},
{
"name": "androidarm",
"configurePreset": "androidarm"
},
{
"name": "androidarm64",
"configurePreset": "androidarm64"
},
{
"name": "androidx86_64",
"configurePreset": "androidx86_64"
}
]
}
35 changes: 0 additions & 35 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -86,41 +86,6 @@ src/crypto/signer/pkcs11.h
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

_______________________________________________________________________________
src/xml/ generated files from xsd schemas

Copyright (C) 2005-2010 Code Synthesis Tools CC

This program was generated by CodeSynthesis XSD, an XML Schema to
C++ data binding compiler.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

In addition, as a special exception, Code Synthesis Tools CC gives
permission to link this program with the Xerces-C++ library (or with
modified versions of Xerces-C++ that use the same license as Xerces-C++),
and distribute linked combinations including the two. You must obey
the GNU General Public License version 2 in all respects for all of
the code used other than Xerces-C++. If you modify this copy of the
program, you may extend this exception to your version of the program,
but you are not obligated to do so. If you do not wish to do so, delete
this exception statement from your version.

Furthermore, Code Synthesis Tools CC makes a special exception for
the Free/Libre and Open Source Software (FLOSS) which is described
in the accompanying FLOSSE file.

_______________________________________________________________________________
examples/DigiDocCSharp

Expand Down
Loading

0 comments on commit 36cad6d

Please sign in to comment.