Skip to content

Commit e48846e

Browse files
committed
add CI build config
1 parent 194f83d commit e48846e

File tree

5 files changed

+105
-5
lines changed

5 files changed

+105
-5
lines changed

.github/workflows/build.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Build Binaries
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
name: Build ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
defaults:
10+
run:
11+
shell: bash
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [macOS-latest, ubuntu-latest, windows-latest]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Setup
21+
uses: ./.github/actions/setup-cpp
22+
with:
23+
toolchain: ${{ startsWith(matrix.os, 'windows') && 'MSVC' || 'Clang' }}
24+
25+
- name: Build
26+
run: ./generate_build
27+
28+
- name: Move Windows files
29+
if: startsWith(matrix.os, 'windows')
30+
run: |
31+
mkdir -p dist/win-x64
32+
cp build/Release/yogacore.dll dist/win-x64/yoga.dll
33+
34+
- name: Build (x86)
35+
if: startsWith(matrix.os, 'windows')
36+
run: ./generate_build -A Win32
37+
38+
- name: Move Windows files (x86)
39+
if: startsWith(matrix.os, 'windows')
40+
run: |
41+
mkdir -p dist/win-x86
42+
cp build/Release/yogacore.dll dist/win-x86/yoga.dll
43+
44+
- name: Move MacOS files
45+
if: startsWith(matrix.os, 'macOS')
46+
run: |
47+
mkdir -p dist/osx
48+
cp build/Release/libyogacore.dylib dist/osx/libyoga.dylib
49+
50+
- name: Move Ubuntu files
51+
if: startsWith(matrix.os, 'ubuntu')
52+
run: |
53+
mkdir -p dist/linux
54+
cp build/Release/libyogacore.so dist/linux/libyoga.so
55+
56+
- name: Upload Binaries
57+
uses: actions/upload-artifact@v3
58+
if: github.event_name == 'push'
59+
with:
60+
path: dist/**
61+
name: prebuilt_yoga_binaries
62+
63+
build-android:
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v3
67+
- uses: ./.github/actions/setup-android
68+
69+
- name: Build
70+
run: |
71+
./gradlew :yoga:assembleRelease
72+
mkdir -p dist/android
73+
cp java/build/outputs/aar/yoga-release.aar dist/android/yoga.aar
74+
75+
- name: Upload Binaries
76+
uses: actions/upload-artifact@v3
77+
if: github.event_name == 'push'
78+
with:
79+
path: dist/**
80+
name: prebuilt_yoga_binaries
81+

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
22
"editor.formatOnSave": true,
33
"editor.codeActionsOnSave": {
4-
"source.fixAll.eslint": true
4+
"source.fixAll.eslint": "explicit"
55
},
66
"eslint.format.enable": true,
7-
"eslint.packageManager": "yarn",
87
"eslint.enable": true,
98
"eslint.validate": [
109
"javascript",

cmake/project-defaults.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ add_compile_options(
1818
/EHsc
1919
# Enable warnings and warnings as errors
2020
/W4
21-
/WX
2221
# Disable RTTI
2322
$<$<COMPILE_LANGUAGE:CXX>:/GR->
2423
# Use /O2 (Maximize Speed)
@@ -33,7 +32,6 @@ add_compile_options(
3332
-fexceptions
3433
# Enable warnings and warnings as errors
3534
-Wall
36-
-Werror
3735
# Disable RTTI
3836
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
3937
# Use -O2 (prioritize speed)

generate_build

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
#
4+
# This source code is licensed under the MIT license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
rm -rf build
8+
9+
if which ninja; then
10+
set -e
11+
cmake -B build -S yoga -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -G Ninja "$@"
12+
else
13+
set -e
14+
cmake -B build -S yoga -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON "$@"
15+
fi
16+
17+
cmake --build build --config Release

yoga/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6+
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs) instead of static libraries" OFF)
67

78
cmake_minimum_required(VERSION 3.13...3.26)
89
project(yogacore)
@@ -22,7 +23,11 @@ file(GLOB SOURCES CONFIGURE_DEPENDS
2223
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
2324
${CMAKE_CURRENT_SOURCE_DIR}/**/*.cpp)
2425

25-
add_library(yogacore STATIC ${SOURCES})
26+
if(BUILD_SHARED_LIBS)
27+
add_library(yogacore SHARED ${SOURCES})
28+
else()
29+
add_library(yogacore STATIC ${SOURCES})
30+
endif()
2631

2732
# Yoga conditionally uses <android/log> when building for Android
2833
if (ANDROID)

0 commit comments

Comments
 (0)