Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 37 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
target: [macos, iphoneos, iphonesimulator, androidarm, androidarm64, androidx86_64]
target: [macos, iphoneos, iphonesimulator]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -35,9 +35,6 @@ jobs:
- name: Build openssl
if: steps.cache.outputs.cache-hit != 'true'
run: ./prepare_osx_build_environment.sh openssl ${{ matrix.target }}
- name: Build libxml2
if: steps.cache.outputs.cache-hit != 'true'
run: ./prepare_osx_build_environment.sh libxml2 ${{ matrix.target }}
- name: Build xmlsec
if: steps.cache.outputs.cache-hit != 'true'
run: ./prepare_osx_build_environment.sh xmlsec ${{ matrix.target }}
Expand Down Expand Up @@ -69,6 +66,42 @@ jobs:
path: |
build/*/libdigidocpp*.*
libdigidocpp*.zip
android:
name: Build on Ubuntu for ${{ matrix.target }}
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- target: androidarm
triplet: arm-neon-android
- target: androidarm64
triplet: arm64-android
- target: androidx86_64
triplet: x64-android
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: e2edf52610d2c94d2038fe30b247ea5a26964e1b
vcpkgJsonGlob: ./vcpkg.json
runVcpkgInstall: true
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
- name: Build
run: |
cmake --preset ${{ matrix.target }} "-GUnix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=libdigidocpp.${{ matrix.target }}
cmake --build --preset ${{ matrix.target }}
cmake --build --preset ${{ matrix.target }} --target install/strip
zip -q -r libdigidocpp.${{ matrix.target }}.zip libdigidocpp.${{ matrix.target }}
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: |
build/macos/libdigidocpp*.*
libdigidocpp*.zip
fedora:
name: Build on Fedora ${{ matrix.container }}
runs-on: ubuntu-latest
Expand Down
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ find_package(MiniZip 1 QUIET)
add_library(xmlsec INTERFACE)
if(UNIX)
find_package(PkgConfig)
pkg_check_modules(XMLSEC1_OPENSSL xmlsec1-openssl REQUIRED IMPORTED_TARGET)
target_link_libraries(xmlsec INTERFACE PkgConfig::XMLSEC1_OPENSSL)
find_package(unofficial-xmlsec QUIET)
if(TARGET unofficial::xmlsec::xmlsec1-openssl)
target_link_libraries(xmlsec INTERFACE unofficial::xmlsec::xmlsec1-openssl)
else()
pkg_check_modules(XMLSEC1_OPENSSL xmlsec1-openssl REQUIRED IMPORTED_TARGET)
target_link_libraries(xmlsec INTERFACE PkgConfig::XMLSEC1_OPENSSL)
endif()
if(NOT APPLE)
pkg_check_modules(MINIZIP minizip IMPORTED_TARGET)
endif()
Expand Down
49 changes: 26 additions & 23 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,34 @@
"displayName": "Default config",
"description": "Default build using Ninja generator",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}"
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "base",
"displayName": "macOS base build config",
"displayName": "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"
}
"installDir": "$env{DEST}"
},
{
"name": "macos",
"inherits": "base",
"description": "This macos build is only available on macOS",
"inherits": "base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"cacheVariables": {
"CMAKE_OSX_ARCHITECTURES": "arm64;x86_64",
"CMAKE_OSX_DEPLOYMENT_TARGET": "12.0"
"CMAKE_OSX_DEPLOYMENT_TARGET": "12.0",
"CMAKE_FIND_ROOT_PATH": "$env{DEST}"
}
},
{
Expand All @@ -52,12 +52,11 @@
{
"name": "ios",
"hidden": true,
"inherits": "mobile",
"inherits": ["mobile", "macos"],
"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"
}
Expand Down Expand Up @@ -91,31 +90,35 @@
"CMAKE_SYSTEM_NAME": "Android",
"CMAKE_SYSTEM_VERSION": "30",
"CMAKE_DISABLE_FIND_PACKAGE_Python3": "YES",
"BUILD_SHARED_LIBS": "NO"
"BUILD_SHARED_LIBS": "NO",
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "androidarm",
"inherits": "android",
"description": "androidarm build is only available on macOS",
"description": "androidarm build",
"cacheVariables": {
"CMAKE_ANDROID_ARCH_ABI": "armeabi-v7a"
"CMAKE_ANDROID_ARCH_ABI": "armeabi-v7a",
"VCPKG_TARGET_TRIPLET": "arm-neon-android"
}
},
{
"name": "androidarm64",
"inherits": "android",
"description": "androidarm64 build is only available on macOS",
"description": "androidarm64 build",
"cacheVariables": {
"CMAKE_ANDROID_ARCH_ABI": "arm64-v8a"
"CMAKE_ANDROID_ARCH_ABI": "arm64-v8a",
"VCPKG_TARGET_TRIPLET": "arm64-android"
}
},
{
"name": "androidx86_64",
"inherits": "android",
"description": "androidx86_64 build is only available on macOS",
"description": "androidx86_64 build",
"cacheVariables": {
"CMAKE_ANDROID_ARCH_ABI": "x86_64"
"CMAKE_ANDROID_ARCH_ABI": "x86_64",
"VCPKG_TARGET_TRIPLET": "x64-android"
}
}
],
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,18 @@
### macOS

1. Install dependencies from
* [XCode](https://itunes.apple.com/en/app/xcode/id497799835?mt=12)
* [XCode](https://itunes.apple.com/en/app/xcode/id497799835?mt=12) - For macOS/iOS development
* [CMake](http://www.cmake.org)
* [Homebrew](https://brew.sh)
* [vcpkg](https://vcpkg.io/) - For Android development (VCPKG_ROOT)
* [Android NDK](https://developer.android.com/ndk/downloads) - For Android development (ANDROID_NDK_ROOT)

2. Fetch the source

git clone https://github.com/open-eid/libdigidocpp
cd libdigidocpp

3. Prepare dependencies (available targets: macos, iphoneos, iphonesimulator, androidarm, androidarm64, androidx86_64)
3. Prepare dependencies (available targets: macos, iphoneos, iphonesimulator)

sh prepare_osx_build_environment.sh macos all

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.security.cert.X509Certificate;
import java.sql.Timestamp;
import java.util.Objects;
Expand Down Expand Up @@ -59,14 +60,14 @@ protected void onCreate(Bundle savedInstanceState) {
try (ZipInputStream zis = new ZipInputStream(getResources().openRawResource(R.raw.schema))) {
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
Files.copy(zis, Paths.get(cache, ze.getName()));
Files.copy(zis, Paths.get(cache, ze.getName()), StandardCopyOption.REPLACE_EXISTING);
}
}
try (InputStream in = getResources().openRawResource(R.raw.test)) {
Files.copy(in, Paths.get(cache, "test.bdoc"));
Files.copy(in, Paths.get(cache, "test.bdoc"), StandardCopyOption.REPLACE_EXISTING);
}
try (ByteArrayInputStream bin = new ByteArrayInputStream(new byte[] {})) {
Files.copy(bin, Paths.get(cache, "EE_T.xml"));
Files.copy(bin, Paths.get(cache, "EE_T.xml"), StandardCopyOption.REPLACE_EXISTING);
}
} catch (IOException e) {
e.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion examples/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.5.2'
classpath 'com.android.tools.build:gradle:8.7.3'
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
Loading
Loading