Skip to content
Open
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
59 changes: 59 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "Create Conan Package"
on: push

jobs:
build_linux_x86_64:
name: "Linux"
uses: Privatehive/conan-workflows/.github/workflows/createPackage.yml@master
with:
name: "x86_64"
image: "ubuntu-22.04"
conan_remotes: https://conan.privatehive.de/artifactory/api/conan/public-conan
conan_options: "asdcplib/*:shared=False"

build_linux_armv8:
name: "Linux"
uses: Privatehive/conan-workflows/.github/workflows/createPackage.yml@master
with:
name: "armv8"
image: "ubuntu-22.04-arm"
conan_remotes: https://conan.privatehive.de/artifactory/api/conan/public-conan
conan_options: "asdcplib/*:shared=False"

build_windows_x86_64:
name: "Windows"
uses: Privatehive/conan-workflows/.github/workflows/createPackage.yml@master
with:
name: "x86_64"
image: "windows-2022"
conan_host_profile: "windowsMinGW"
conan_remotes: https://conan.privatehive.de/artifactory/api/conan/public-conan
conan_options: "asdcplib/*:shared=False"

build_macos_x86_64:
name: "Macos"
uses: Privatehive/conan-workflows/.github/workflows/createPackage.yml@master
with:
name: "x86_64"
image: "macos-13"
conan_remotes: https://conan.privatehive.de/artifactory/api/conan/public-conan
conan_options: "asdcplib/*:shared=False"

build_macos_armv8:
name: "Macos"
uses: Privatehive/conan-workflows/.github/workflows/createPackage.yml@master
with:
name: "armv8"
image: "macos-14"
conan_remotes: https://conan.privatehive.de/artifactory/api/conan/public-conan
conan_options: "asdcplib/*:shared=False"

upload_recipe:
name: "Finalize"
uses: Privatehive/conan-workflows/.github/workflows/uploadRecipe.yml@master
needs: [ build_linux_x86_64, build_linux_armv8, build_windows_x86_64, build_macos_x86_64, build_macos_armv8 ]
if: ${{ success() }}
secrets: inherit
with:
publish_property: ${{ github.ref == 'refs/heads/master' }}
conan_upload_remote: https://conan.privatehive.de/artifactory/api/conan/public-conan
31 changes: 9 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.21.1)

project(asdcplib)

# The version number.
# Read the version number from configure.ac
file(STRINGS configure.ac VERSION_STRING REGEX "AC_INIT.*")
STRING(REGEX MATCH "[0-9]*[\\.][0-9]*[\\.][0-9]*" VERSION_STRING ${VERSION_STRING})
STRING(REGEX REPLACE "([0-9]+)[.].*" "\\1" VERSION_MAJOR ${VERSION_STRING})
STRING(REGEX REPLACE ".*[.]([0-9]+)[.].*" "\\1" VERSION_MINOR ${VERSION_STRING})
STRING(REGEX REPLACE ".*[.]+([0-9]+)" "\\1" VERSION_PATCH ${VERSION_STRING})
string(REGEX MATCH "[0-9]*[\\.][0-9]*[\\.][0-9]*" VERSION_STRING ${VERSION_STRING})
string(REGEX REPLACE "([0-9]+)[.].*" "\\1" VERSION_MAJOR ${VERSION_STRING})
string(REGEX REPLACE ".*[.]([0-9]+)[.].*" "\\1" VERSION_MINOR ${VERSION_STRING})
string(REGEX REPLACE ".*[.]+([0-9]+)" "\\1" VERSION_PATCH ${VERSION_STRING})
message(STATUS "Version Number is ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

project(asdcplib VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" LANGUAGES CXX)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "Default Targets")
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH OFF)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif("${isSystemDir}" STREQUAL "-1")

# Configure a header file to pass some of the CMake settings to the source code.
configure_file("${PROJECT_SOURCE_DIR}/src/info.in" "${PROJECT_BINARY_DIR}/src/info.h")
Expand Down
19 changes: 0 additions & 19 deletions README.cmake

This file was deleted.

31 changes: 31 additions & 0 deletions README.cmake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# CMake build

As an alternative to configure (autotools), CMake build files are provided that simplifies the build process for all target systems (Linux, Windows, macOS) and architectures (x86_64, armv8)
In order to use them, you will need to install CMake binaries on your system.
Note: CMake 3.21.1 or higher is required.

### Configuration

```bash
$ mkdir build
$ cd build/
$ cmake ..
```

Optionally you can disable some libasdcp features. You can list them by running: `$ cmake -LH`

To apply them provide them to the cmake call:
```bash
$ cmake -DWITHOUT_SSL=ON -DWITHOUT_XML=ON -DUSE_RANDOM_UUID=OFF ..
```

#### Dependencies

By default libasdcp needs two dependencies (if not deactivated): OpenSSL and XercesC
Make sure both are installed before running CMake. If they are not found automatically you have to provide the installation paths of the dependencies to CMake (see `$ cmake -LH`).

### Build/Install

```bash
$ cmake --build . --parallel
```
17 changes: 17 additions & 0 deletions README.conan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Conan package

To simplify the build process even more a `conanfile.py` is provided. This file contains all commands needed to build libasdcp for all different target systems (Linux, Windows, macOS) and architectures (x86_64, armv8) plus its dependencies (OpenSSL and XercesC).
Before you begin make sure [conan package manager](https://conan.io/) is installed.

### Build conan package

```bash
$ conan create . --build missing
```

Optionally you can disable some libasdcp features. You can list them by running `$ conan inspect .` and observing the `options` entry.

To apply them provide them to the conan call:
```bash
$ cmake -o encryption_support=False -o xml_support=False -o jxs_support=False . --build missing
```
98 changes: 98 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
from conan import ConanFile
from conan.tools.apple import fix_apple_shared_install_name
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.cmake import CMake, CMakeToolchain
from conan.tools.layout import basic_layout
from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
import re
import os

required_conan_version = ">=2.0"

def read_version():
with open('configure.ac', 'r') as f:
version = re.search("AC_INIT\(\[asdcplib\],\s?\[([0-9.]*)\]", f.read())
return version.group(1)

class AsdcpLibConan(ConanFile):

# ---Package reference---
name = "asdcplib"
version = read_version()
user = "imftool"
channel = "stable"
# ---Metadata---
description = "The asdcplib library is an API and command-line tool set that offers access to files conforming to the sound and picture track file formats developed by the SMPTE Working Group DC28.20 (now TC 21DC)."
license = "proprietary"
# ---Requirements---
requires = []
tool_requires = ["cmake/[>=3.21.1]", "ninja/[>=1.11.1]"]
# ---Sources---
exports = ["configure.ac", "COPYING"]
exports_sources = ["CMakeLists.txt", "COPYING", "configure.ac", "src/*"]
# ---Binary model---
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False], "encryption_support": [True, False], "xml_support": [True, False], "jxs_support": [True, False]}
default_options = {
"shared": True,
"fPIC": True,
"encryption_support": True,
"xml_support": True,
"jxs_support": False,
}
# ---Build---
generators = []
# ---Folders---
no_copy_source = True

def validate(self):
valid_os = ["Windows", "Linux", "Macos"]
if str(self.settings.os) not in valid_os:
raise ConanInvalidConfiguration(f"{self.name} {self.version} is only supported for the following operating systems: {valid_os}")
valid_arch = ["x86_64", "armv8"]
if str(self.settings.arch) not in valid_arch:
raise ConanInvalidConfiguration(f"{self.name} {self.version} is only supported for the following architectures on {self.settings.os}: {valid_arch}")
if str(self.settings.os) == 'Windows' and self.options.shared:
raise ConanInvalidConfiguration(f"{self.name} {self.version} does not support building shared library on Windows")

def requirements(self):
if self.options.encryption_support:
self.requires("openssl/[~3.0]", options={"no_zlib": True, "no_asm": True, "shared": False})
if self.options.xml_support:
self.requires("xerces-c/[>=3.2.5]", options={"network": False, "shared": False})

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")

def configure(self):
if not self.options.shared:
self.options.rm_safe("fPIC")

def generate(self):
VirtualBuildEnv(self).generate()
tc = CMakeToolchain(self, generator="Ninja")
tc.variables["WITHOUT_SSL"] = self.options.encryption_support == False
tc.variables["WITHOUT_XML"] = self.options.xml_support == False
tc.variables["USE_ASDCP_JXS"] = self.options.jxs_support == True
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = CMake(self)
if self.settings.build_type == 'Release':
cmake.install(cli_args=["--strip"])
else:
cmake.install()

def package_info(self):
self.cpp_info.builddirs = ["lib/cmake"]
self.cpp_info.set_property("cmake_find_mode", "none")
Loading