Skip to content

Commit

Permalink
Added macos arm64 workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Mar 24, 2022
1 parent a1d2f15 commit e71e2b9
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/alpine-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ on:
branches: [ master ]
paths-ignore:
- '.github/workflows/macos-build.yml'
- '.github/workflows/macos-arm64.yml'
- '.github/workflows/ubuntu-build.yml'
- '.github/workflows/ubuntu-aarch64.yml'
- '.github/workflows/ubuntu-arm64.yml'
- '.github/workflows/windows-build.yml'
pull_request:
workflow_dispatch:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/macos-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: MacOS-arm64 build

on:
push:
branches: [ master ]
paths-ignore:
- '.github/workflows/alpine-build.yml'
- '.github/workflows/ubuntu-build.yml'
- '.github/workflows/ubuntu-arm64.yml'
- '.github/workflows/windows-build.yml'
- '.github/workflows/macos-build.yml'
pull_request:
workflow_dispatch:

env:
BUILD_TYPE: Release
VCPKG_DEFAULT_BINARY_CACHE: ${{github.workspace}}/cache

jobs:
MacOS-build:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Create cache storage and cache key
run: |
mkdir ${{env.VCPKG_DEFAULT_BINARY_CACHE}}
git submodule status > sm.txt
- uses: actions/cache@v2
with:
path: ${{env.VCPKG_DEFAULT_BINARY_CACHE}}
key: ${{runner.os}}-vcpkg-${{ hashFiles('sm.txt') }}

- name: Configure CMake
run: |
cmake -B ${{github.workspace}} \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=arm64-osx
- name: Build
run: cmake --build ${{github.workspace}} --config ${{env.BUILD_TYPE}}
5 changes: 2 additions & 3 deletions .github/workflows/macos-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ on:
paths-ignore:
- '.github/workflows/alpine-build.yml'
- '.github/workflows/ubuntu-build.yml'
- '.github/workflows/ubuntu-aarch64.yml'
- '.github/workflows/ubuntu-arm64.yml'
- '.github/workflows/windows-build.yml'
- '.github/workflows/macos-arm64.yml'
pull_request:
workflow_dispatch:

Expand All @@ -33,5 +34,3 @@ jobs:

- name: Build
run: cmake --build ${{github.workspace}} --config ${{env.BUILD_TYPE}}


Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Ubuntu-aarch64 build
name: Ubuntu-arm64 build

on:
push:
Expand All @@ -7,6 +7,7 @@ on:
- '.github/workflows/alpine-build.yml'
- '.github/workflows/ubuntu-build.yml'
- '.github/workflows/macos-build.yml'
- '.github/workflows/macos-arm64.yml'
- '.github/workflows/windows-build.yml'
pull_request:
workflow_dispatch:
Expand Down Expand Up @@ -55,4 +56,3 @@ jobs:
qemu-aarch64 -L /usr/aarch64-linux-gnu ${{github.workspace}}/emf2svg-conv \
-i ${{github.workspace}}/tests/resources/emf/test-000.emf -o test-000.svg
ls | grep test-000.svg
5 changes: 2 additions & 3 deletions .github/workflows/ubuntu-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
paths-ignore:
- '.github/workflows/alpine-build.yml'
- '.github/workflows/macos-build.yml'
- '.github/workflows/ubuntu-aarch64.yml'
- '.github/workflows/macos-arm64.yml'
- '.github/workflows/ubuntu-arm64.yml'
- '.github/workflows/windows-build.yml'
pull_request:
workflow_dispatch:
Expand Down Expand Up @@ -75,5 +76,3 @@ jobs:
-E '.*goodies.*' \
-E '.*tests.*' \
--gcov-options '\-lp'
4 changes: 2 additions & 2 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
paths-ignore:
- '.github/workflows/alpine-build.yml'
- '.github/workflows/macos-build.yml'
- '.github/workflows/ubuntu-aarch64.yml'
- '.github/workflows/macos-arm64.yml'
- '.github/workflows/ubuntu-arm64.yml'
- '.github/workflows/ubuntu-build.yml'
pull_request:
workflow_dispatch:
Expand Down Expand Up @@ -45,4 +46,3 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}} --config ${{env.BUILD_TYPE}}

47 changes: 29 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include(ExternalProject)
project (emf2svg)

set(emf2svg_VERSION_MAJOR 1)
set(emf2svg_VERSION_MINOR 5)
set(emf2svg_VERSION_MINOR 6)
set(emf2svg_VERSION_PATCH 0)
set(emf2svg_VERSION ${emf2svg_VERSION_MAJOR}.${emf2svg_VERSION_MINOR}.${emf2svg_VERSION_PATCH})

Expand Down Expand Up @@ -56,7 +56,11 @@ ExternalProject_Add(${FMEM_NAME}
PREFIX ${DEPS}
GIT_REPOSITORY https://github.com/tamatebako/fmem.git
GIT_TAG bdce2760f0190253600f11984220fc0a007742c8
CMAKE_ARGS -DBUILD_TESTING=FALSE -DCMAKE_INSTALL_PREFIX=${DEPS} ${PLATFORM_TOOLCHAIN_OPTION}
CMAKE_ARGS -DBUILD_TESTING=FALSE
-DCMAKE_INSTALL_PREFIX=${DEPS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
${PLATFORM_TOOLCHAIN_OPTION}
${CMAKE_OSX_ARCHITECTURES_OPTION}
)
set(EXTERNAL_FMEM "fmem")

Expand All @@ -78,7 +82,10 @@ option(INDEX "print record indexes" OFF)
option(STATIC "compile statically" OFF)
option(FORCELE "force little endian architecture" OFF)

CHECK_FUNCTION_EXISTS(argp_parse HAVE_ARGP_PARSE_FUNCTION)
CHECK_FUNCTION_EXISTS(argp_parse HAVE_BUNDLED_ARGP_PARSE_FUNCTION)

set(CMAKE_REQUIRED_LIBRARIES argp)
CHECK_FUNCTION_EXISTS(argp_parse HAVE_EXTERNAL_ARGP_PARSE_FUNCTION)

if(GCOV)
SET(UNITTEST ON)
Expand Down Expand Up @@ -144,28 +151,32 @@ if(MSVC)
set(EXTERNAL_ICONV ${Iconv_LIBRARY})
endif(MSVC)

if(MSVC)
if(HAVE_BUNDLED_ARGP_PARSE_FUNCTION)
message(STATUS "Using bundled argp")
elseif(HAVE_EXTERNAL_ARGP_PARSE_FUNCTION)
message(STATUS "Using stand-alone argp")
set(EXTERNAL_ARGP "argp")
else()
message(STATUS "Building argp")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# https://www.gnu.org/software/gnulib/manual/html_node/argp_005fprogram_005fversion_005fhook.html
set(EXTERNAL_ARGP "-Wl,-force_load,${DEPS}/lib/libargp-standalone.a")
else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(EXTERNAL_ARGP "argp-standalone")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

set(ARGP_NAME argp${EXTERNAL_LIB_DIR_SUFFIX})
ExternalProject_Add(${ARGP_NAME}
PREFIX ${DEPS}
GIT_REPOSITORY https://github.com/tom42/argp-standalone.git
GIT_TAG 238d83d6fb4fbdbb3e0893f51698d8d54696bfb0
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DEPS}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DEPS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
${PLATFORM_TOOLCHAIN_OPTION}
${CMAKE_OSX_ARCHITECTURES_OPTION}
PATCH_COMMAND cd ${DEPS}/src/${ARGP_NAME} && git restore CMakeLists.txt && git apply ${PATCHES}/argp/CMakeLists.txt.patch
)
endif(MSVC)

if(HAVE_ARGP_PARSE_FUNCTION)
message(STATUS "Using bundled argp")
else(HAVE_ARGP_PARSE_FUNCTION)
if(MSVC)
message(STATUS "Building argp")
set(EXTERNAL_ARGP "argp-standalone")
else(MSVC)
message(STATUS "Using stand-alone argp")
set(EXTERNAL_ARGP "argp")
endif(MSVC)
endif(HAVE_ARGP_PARSE_FUNCTION)
endif(HAVE_BUNDLED_ARGP_PARSE_FUNCTION)

# headers & library directories
if(MSVC)
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ libemf2svg
![Build status](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-build.yml/badge.svg)
![Build status](https://github.com/metanorma/libemf2svg/actions/workflows/macos-build.yml/badge.svg)
![Build status](https://github.com/metanorma/libemf2svg/actions/workflows/windows-build.yml/badge.svg)
[![Ubuntu-aarch64 build](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-aarch64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-aarch64.yml)
[![Alpine build](https://github.com/metanorma/libemf2svg/actions/workflows/alpine-build.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/alpine-build.yml)

[![Ubuntu-arm64 build](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-arm64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-arm64.yml)
[![MacOS-arm64 build](https://github.com/metanorma/libemf2svg/actions/workflows/macos-arm64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/macos-arm64.yml)

[![Coverage Status](https://coveralls.io/repos/github/metanorma/libemf2svg/badge.svg?branch=master)](https://coveralls.io/github/metanorma/libemf2svg?branch=master)

MS EMF (Enhanced Metafile) to SVG conversion library.
Expand Down Expand Up @@ -233,13 +236,17 @@ EMF+ RECORDS:
ChangeLogs
----------

1.6.0:

* add arm64 MacOS support (cross-compilation only, no tests)

1.5.0:

* add alpine linux support
* add Alpine Linux support

1.4.0:

* add aarch64 debian linux support
* add arm64 Debian Linux support (cross-compilation only, no tests)

1.3.1:

Expand Down
2 changes: 1 addition & 1 deletion cmake/arm64-linux.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CMake Toolchain file for crosscompiling on ARM.
# CMake Toolchain file for crosscompiling on arm64(aks aarch64) linux.
# Assumed:
# sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu

Expand Down
11 changes: 11 additions & 0 deletions cmake/arm64-osx.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# CMake Toolchain file for crosscompiling on arm64(aks aarch64) macos.

# Target operating system name
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR arm64)

# Names of compilers
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_OSX_ARCHITECTURES arm64)
set(CMAKE_OSX_ARCHITECTURES_OPTION -DCMAKE_OSX_ARCHITECTURES=arm64)
14 changes: 8 additions & 6 deletions patches/argp/CMakeLists.txt.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cee4a7a..c12e439 100644
index 94b10d5..81a33b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -129,3 +129,14 @@ add_subdirectory(src)
if((IS_MAIN_PROJECT OR argp-standalone_BUILD_TESTING) AND BUILD_TESTING)
add_subdirectory(test)
endif()
+
@@ -126,6 +126,13 @@ endif()

add_subdirectory(src)

-if((IS_MAIN_PROJECT OR argp-standalone_BUILD_TESTING) AND BUILD_TESTING)
- add_subdirectory(test)
-endif()
+include(GNUInstallDirs)
+
+install(TARGETS argp-standalone
Expand Down
1 change: 1 addition & 0 deletions src/conv/emf2svg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ int main(int argc, char *argv[]) {
arguments.input = NULL;
arguments.output = NULL;
arguments.emfplus = 0;

argp_parse(&argp, argc, argv, 0, 0, &arguments);

if (arguments.version) {
Expand Down

0 comments on commit e71e2b9

Please sign in to comment.