Skip to content

Extend CI setup to make it suitable for ReactUnity #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e48846e
add CI build config
KurtGokhan Apr 7, 2024
03fcfe5
adding execute permissions
KurtGokhan Apr 7, 2024
ad8f308
temporarily change copy command
KurtGokhan Apr 7, 2024
b535c4d
add fallback when ninja fails
KurtGokhan Apr 7, 2024
b4f2374
add fallback for ninja and win32
KurtGokhan Apr 7, 2024
d87cbb9
add apple setup
KurtGokhan Apr 7, 2024
93d4b02
make macos build on macos-13
KurtGokhan Apr 7, 2024
cd5f4f6
fix build file paths
KurtGokhan Apr 7, 2024
4181c51
remove build dir copy
KurtGokhan Apr 7, 2024
da1b605
fix for windows
KurtGokhan Apr 7, 2024
b1fb78c
disable ninja in windows builds
KurtGokhan Apr 7, 2024
d0a7138
separate build steps
KurtGokhan Apr 7, 2024
5c49920
add js build script
KurtGokhan Apr 8, 2024
2f32dfb
remove strict=1 parameter
KurtGokhan Apr 8, 2024
103e767
add emsdk cache
KurtGokhan Apr 8, 2024
aa455c9
add emcmake
KurtGokhan Apr 8, 2024
44b3349
add emsdk activation
KurtGokhan Apr 8, 2024
37f5322
add yarn install
KurtGokhan Apr 8, 2024
9866848
copy binaries
KurtGokhan Apr 8, 2024
7779635
build JS as static lib
KurtGokhan Apr 8, 2024
714470d
add ios build
KurtGokhan Apr 8, 2024
6914ef6
fix ios output path
KurtGokhan Apr 8, 2024
ae68460
add macos universal build
KurtGokhan Apr 8, 2024
89b37ba
use gcc in ubuntu
KurtGokhan Apr 9, 2024
ed3e709
Merge branch 'facebook:main' into extended_main
KurtGokhan Jul 15, 2024
049febd
remove private flag
KurtGokhan Jul 15, 2024
68765af
Merge branch 'main' into extended_main
KurtGokhan Jun 29, 2025
7e9fdf4
update upload-artifact action
KurtGokhan Jun 29, 2025
283049f
use macos latest
KurtGokhan Jun 29, 2025
f5282ce
setup apple
KurtGokhan Jun 29, 2025
f3ce108
update uploaded artifact names
KurtGokhan Jun 29, 2025
45986d1
revert macos version
KurtGokhan Jun 29, 2025
e6e9ede
use clang
KurtGokhan Jun 29, 2025
bff049b
revert msvc
KurtGokhan Jun 29, 2025
477f5fb
update bitset constant
KurtGokhan Jun 29, 2025
fb8f8a8
potential fix for build failure
KurtGokhan Jun 29, 2025
07eacef
update according to copilot suggestion
KurtGokhan Jun 29, 2025
9b64921
remove /WX
KurtGokhan Jun 29, 2025
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
124 changes: 124 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Build Binaries

on:
- push
- pull_request
- workflow_dispatch

defaults:
run:
shell: bash

jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup-cpp
with:
toolchain: GCC

- name: Setup JS
uses: ./.github/actions/setup-js

- name: Restore emsdk
uses: ./.github/actions/cache-emsdk

- name: Build
run: |
cmake -B build -S yoga -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -G Ninja
cmake --build build --config Release
mkdir -p dist/linux
cp build/libyogacore.so dist/linux/libyoga.so

- name: Build JS
working-directory: javascript
run: |
yarn build
mkdir -p ../dist/webgl
cp build/libyogaObjLib.a ../dist/webgl/libyoga.a

- name: Upload Binaries
uses: actions/upload-artifact@v4
if: github.event_name == 'push'
with:
path: dist/**
name: prebuilt_yoga_binaries_linux

build-macos:
runs-on: macos-13
steps:
- uses: actions/checkout@v3

- name: Setup Apple
uses: ./.github/actions/setup-apple

- name: Build
run: |
cmake -B build -S yoga -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
cmake --build build --config Release
mkdir -p dist/osx
cp build/libyogacore.dylib dist/osx/libyoga.dylib

- name: Build IOS
run: |
rm -rf build
cmake -B build -S yoga -D CMAKE_BUILD_TYPE=Release -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_Swift_COMPILER_FORCED=true -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
cmake --build build --config Release
mkdir -p dist/iOS
cp build/Release-iphoneos/libyogacore.a dist/iOS/libyoga.a

- name: Upload Binaries
uses: actions/upload-artifact@v4
if: github.event_name == 'push'
with:
path: dist/**
name: prebuilt_yoga_binaries_macos

build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup-cpp
with:
toolchain: MSVC

- name: Build
run: |
cmake -B build -S yoga -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON
cmake -B build32 -S yoga -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -A Win32
cmake --build build --config Release
cmake --build build32 --config Release
mkdir -p dist/win-x64 dist/win-x86
cp build/Release/yogacore.dll dist/win-x64/yoga.dll
cp build32/Release/yogacore.dll dist/win-x86/yoga.dll

- name: Upload Binaries
uses: actions/upload-artifact@v4
if: github.event_name == 'push'
with:
path: dist/**
name: prebuilt_yoga_binaries_windows

build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-android

- name: Build
run: |
./gradlew :yoga:assembleRelease
mkdir -p dist/android
cp java/build/outputs/aar/yoga-release.aar dist/android/yoga.aar

- name: Upload Binaries
uses: actions/upload-artifact@v4
if: github.event_name == 'push'
with:
path: dist/**
name: prebuilt_yoga_binaries_android
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ node_modules
# Xcode
## Build generated
build/
build32/
DerivedData/

## Various settings
Expand Down
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"eslint.format.enable": true,
"eslint.packageManager": "yarn",
"eslint.enable": true,
"eslint.validate": [
"javascript",
Expand Down
2 changes: 1 addition & 1 deletion cmake/project-defaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)

add_compile_definitions($<$<CONFIG:DEBUG>:DEBUG>)

Expand All @@ -18,7 +19,6 @@ add_compile_options(
/EHsc
# Enable warnings and warnings as errors
/W4
/WX
# Enable RTTI
$<$<COMPILE_LANGUAGE:CXX>:/GR>
# Use /O2 (Maximize Speed)
Expand Down
1 change: 1 addition & 0 deletions java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
cmake_minimum_required(VERSION 3.13...3.26)
project(yogajni)
set(CMAKE_VERBOSE_MAKEFILE on)
set(BUILD_SHARED_LIBS on)

set(YOGA_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..)
include(${YOGA_ROOT}/cmake/project-defaults.cmake)
Expand Down
11 changes: 8 additions & 3 deletions javascript/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

option(BUILD_STATIC_LIBS "Build static library (.a) instead of object library" OFF)

cmake_minimum_required(VERSION 3.13...3.26)
set(CMAKE_VERBOSE_MAKEFILE on)
project(yoga)
Expand All @@ -24,8 +26,7 @@ set(COMPILE_OPTIONS
-fno-exceptions
-fno-rtti
-g0
-Os
"SHELL:-s STRICT=1")
-Os)

add_compile_options(${COMPILE_OPTIONS})

Expand All @@ -52,7 +53,11 @@ add_link_options(

link_libraries(embind)

add_library(yogaObjLib OBJECT ${SOURCES})
if(BUILD_STATIC_LIBS)
add_library(yogaObjLib STATIC ${SOURCES})
else()
add_library(yogaObjLib OBJECT ${SOURCES})
endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/binaries)

Expand Down
1 change: 1 addition & 0 deletions javascript/just.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ function emcmakeGenerateTask() {
'-B',
'build',
...(process.platform === 'win32' ? [] : ['-G', 'Ninja']),
'-D BUILD_STATIC_LIBS=ON',
];
logger.info(['emcmake', ...args].join(' '));

Expand Down
11 changes: 10 additions & 1 deletion yoga/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

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

cmake_minimum_required(VERSION 3.13...3.26)
project(yogacore)
Expand All @@ -22,7 +23,15 @@ file(GLOB SOURCES CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/**/*.cpp)

add_library(yogacore STATIC ${SOURCES})
if(BUILD_SHARED_LIBS)
if(WIN32)
add_library(yogacore MODULE ${SOURCES})
else()
add_library(yogacore SHARED ${SOURCES})
endif()
else()
add_library(yogacore STATIC ${SOURCES})
endif()

# Yoga conditionally uses <android/log> when building for Android
if (ANDROID)
Expand Down
4 changes: 3 additions & 1 deletion yoga/config/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ namespace facebook::yoga {
class Config;
class Node;

using ExperimentalFeatureSet = std::bitset<ordinalCount<ExperimentalFeature>()>;
constexpr size_t ExperimentalFeatureCount = 1;
using ExperimentalFeatureSet = std::bitset<ExperimentalFeatureCount>;

// Whether moving a node from an old to new config should dirty previously
// calculated layout results.
Expand Down Expand Up @@ -76,6 +77,7 @@ class YG_EXPORT Config : public ::YGConfig {

uint32_t version_ = 0;
ExperimentalFeatureSet experimentalFeatures_{};

Errata errata_ = Errata::None;
float pointScaleFactor_ = 1.0f;
void* context_ = nullptr;
Expand Down
Loading