Skip to content

Commit

Permalink
Merge pull request #182 from martinweismann/rtti-native-3
Browse files Browse the repository at this point in the history
Native Run-Time Type Information support @anpilog
  • Loading branch information
martinweismann authored Aug 26, 2022
2 parents 1c4a983 + b558b92 commit 70934cc
Show file tree
Hide file tree
Showing 204 changed files with 17,194 additions and 483 deletions.
13 changes: 13 additions & 0 deletions .github/actions/buildWithDocker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# action.yml
name: 'BuildWithDocker'
description: 'Build ACT within a Docker container'
inputs:
command: # id of input
description: 'What command to run'
required: true
default: 'act'
runs:
using: 'docker'
image: '../../../Build/Dockerfile'
args:
- ${{ inputs.command }}
37 changes: 26 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- run: sh build.sh
- run: ./build.sh
working-directory: ./Build
build-macos:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: sh build.sh
- run: ./build.sh
working-directory: ./Build
build-windows:
runs-on: windows-2019
Expand All @@ -25,11 +25,16 @@ jobs:
submodules: true
- run: ./build.bat
working-directory: ./Build
- name: Upload Windows Binary
- name: Upload Windows 64bit Binary
uses: actions/upload-artifact@v2
with:
name: act.exe
path: act.exe
name: act.win64.exe
path: act.win64.exe
- name: Upload Windows 32bit Binary
uses: actions/upload-artifact@v2
with:
name: act.win32.exe
path: act.win32.exe
- name: Upload MacOS Binary
uses: actions/upload-artifact@v2
with:
Expand All @@ -40,14 +45,24 @@ jobs:
with:
name: act.arm.darwin
path: act.arm.darwin
- name: Upload Linux Binary
- name: Upload Linux 32bit Binary
uses: actions/upload-artifact@v2
with:
name: act.linux32
path: act.linux32
- name: Upload Linux ARM 32bit Binary
uses: actions/upload-artifact@v2
with:
name: act.arm.linux32
path: act.arm.linux32
- name: Upload Linux 64bit Binary
uses: actions/upload-artifact@v2
with:
name: act.linux
path: act.linux
- name: Upload Linux ARM Binary
name: act.linux64
path: act.linux64
- name: Upload Linux ARM 64bit Binary
uses: actions/upload-artifact@v2
with:
name: act.arm.linux
path: act.arm.linux
name: act.arm.linux64
path: act.arm.linux64

19 changes: 19 additions & 0 deletions .github/workflows/build_examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on: [push, pull_request]
name: Build ACT examples
jobs:
build_with_docker:
runs-on: ubuntu-latest
name: Build ACT examples with docker
steps:
- name: Checkout
uses: actions/checkout@v3
- name: build act
id: build_act
uses: ./.github/actions/buildWithDocker
with:
command: 'act'
- name: build examples
id: build_examples
uses: ./.github/actions/buildWithDocker
with:
command: 'examples'
24 changes: 15 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
*.cpp
*.hpp
*.h
*.exe
*.linux
*.linux32
*.linux64
*.darwin
*.exe
*.dylib
*.so
*.dll
*.arm
*.c
*.go
*.orig
*.class
*.jar
*.log
*.o
*.ppu
__pycache__

Examples/**/build
Examples/**/build-*
Examples/**/bin
Examples/**/obj

# Visual Studio Code
debug
.vscode

*_headers
*_component

Examples/*.xml
.DS_Store
87 changes: 87 additions & 0 deletions Build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
FROM centos:centos8

ARG USER_ID
ARG GROUP_ID

LABEL maintainer="Andrii Anpilogov ([email protected])"

RUN [ -e /etc/yum.conf ] && sed -i '/tsflags=nodocs/d' /etc/yum.conf || true

# RUN yum install -y icu

RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
RUN yum update -y

RUN dnf -y install dnf-plugins-core
RUN dnf -y install dnf-plugin-config-manager
RUN dnf -y update

RUN dnf -y install epel-release
RUN dnf -y config-manager --set-enabled powertools

# GCC
RUN dnf -y install gcc-toolset-9-gcc
RUN dnf -y install gcc-toolset-9-gcc-c++

# CMake & Ninja
RUN dnf -y install cmake
RUN dnf -y install ninja-build

# Free Pascal
# 3.0.4 should be used for validating compiler base compatibility.
RUN (cd /opt && curl -O -L 'http://downloads.sourceforge.net/project/freepascal/Linux/3.0.4/fpc-3.0.4-1.x86_64.rpm' \
&& rpm -i fpc-3.0.4-1.x86_64.rpm)

# Using 3.2.2 until PolymorphicFactory is reworked to not using generics that are not full functional in 3.0.4.
# RUN (cd /opt && curl -O -L 'http://downloads.sourceforge.net/project/freepascal/Linux/3.2.2/fpc-3.2.2-1.x86_64.rpm' \
# && rpm -i fpc-3.2.2-1.x86_64.rpm)

# Golang
RUN (cd /opt && curl -O -L https://golang.org/dl/go1.17.2.linux-amd64.tar.gz \
&& tar zxvf go1.17.2.linux-amd64.tar.gz)

# Java
RUN dnf -y install \
java-11-openjdk-devel

# Mono
RUN rpm --import https://download.mono-project.com/repo/xamarin.gpg \
&& dnf config-manager --add-repo https://download.mono-project.com/repo/centos8-stable.repo \
&& dnf -y install mono-complete

# General purpose tools
RUN dnf -y install \
glibc-common \
glibc-utils \
less \
passwd \
tar \
vim-minimal \
vim-enhanced \
which \
sudo \
bash-completion \
mc \
yum-utils \
&& yum clean all

# # Initialize Toolkit
RUN echo "source /opt/rh/gcc-toolset-9/enable" >> /etc/bashrc
ENV PATH="${PATH}:/opt/go/bin"

# Initialize Toolkit
# RUN : "${USER_ID:?Build argument needs to be set and non-empty.}" \
# : "${GROUP_ID:?Build argument needs to be set and non-empty.}"

# Create user
RUN if [ $USER_ID != "" ] ; then groupadd docker \
&& useradd -ms /bin/bash --uid $USER_ID -g docker -G wheel user \
&& printf "user:user" | chpasswd \
&& printf "user ALL= NOPASSWD: ALL\\n" >> /etc/sudoers ; fi

# Initialize Toolkit
RUN if [ $USER_ID != "" ] ; then echo "source /opt/rh/gcc-toolset-9/enable" >> /home/user/.bash_profile ; fi
RUN if [ $USER_ID != "" ] ; then echo "export PATH=\$PATH:/opt/go/bin" >> /home/user/.bash_profile ; fi

ENTRYPOINT ["./entrypoint.sh"]
42 changes: 41 additions & 1 deletion Build/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,44 @@ https://github.com/pavel-a/ddverpatch/releases
Call like this
```
verpatch.exe ..\act.exe /high /va 1.5.0 /pv "1.5.0-RC1+buildnumber-5" /s copyright "(c) 2018-2019 ACT Developers" /s desc "ACT is a code generator for software components" /s productName "Automatic Component Toolkit"
```
```

## Docker

Docker image can be used to build ACT and all its example.

**Build Docker image:**
```
./Build/build.sh
```

**Build ACT and all examples**
```
# go into root folder of this repo
docker run -it --rm -v $PWD:/data act-build
```

**Run Docker image interactively:**
```
# go into root folder of this repo
docker run -it --rm -v $PWD:/data --entrypoint bash act-build -l
```
Source code is available in `/data` directory.

**Useful scripts**
| Script | Description|
|--------|------------|
| `./Build/docker.sh build` | build docker image |
| `./Build/docker.sh act` | build ACT binaries |
| `./Build/docker.sh examples` | build and run projects in Examples folder |
| `./Build/docker.sh all` | build ACT binaries and then build and run projects in Examples folder" |
| `./Build/docker.sh cli` | open bash session inside Docker with source code mapped to '/data' directory" |
| Command to run in Docker cli mode (sources are mapped to `/data` directory): |
| `./Build/build.sh` | build ACT binaries |
| `./Examples/build.sh` | build and run projects in Examples folder (including updating Bindings and Interfaces) |
| `./Examples/RTTI/build.sh` | build and run projects in Examples/RTTI folder (including updating Bindings and Interfaces) |
| `./Examples/Injection/build.sh` | build and run projects in Examples/RTTI folder (including updating Bindings and Interfaces) |
| `./Examples/RTTI/RTTI_component/Implementations/Cpp/build.sh` | build RTTI C++ library implementation |
| `./Examples/RTTI/RTTI_component/Implementations/Pascal/build.sh` | build RTTI Pascal library implementation |
| `./Examples/RTTI/RTTI_component/Examples/CppDynamic/build.sh` | build and run RTTI C++ Example (requres C++ and Pascal libraries) |
| `./Examples/RTTI/RTTI_component/Examples/Python/build.sh` | build and run RTTI Python Example (requres C++ and Pascal libraries) |
18 changes: 10 additions & 8 deletions Build/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ set Sources=actutils.go automaticcomponenttoolkit.go buildbindingccpp.go buildbi

set GOOS=windows
set GOARCH=amd64
echo "Build act.exe"
echo "Build act.win64.exe"
go build -o ..\act.win64.exe %Sources%

echo "Patching properties of act.win64.exe"
..\build\verpatch ..\act.win64.exe /high /va 1.7.0 /pv "1.7.0-develop" /s copyright "(c) 2018-2019 ACT Developers" /s desc "ACT is a code generator for software components" /s productName "Automatic Component Toolkit"
..\build\verpatch ..\act.win64.exe /high /va 1.8.0 /pv "1.8.0-develop" /s copyright "(c) 2018-2019 ACT Developers" /s desc "ACT is a code generator for software components" /s productName "Automatic Component Toolkit"

set GOOS=windows
set GOARCH=386
echo "Build act.win32.exe"
go build -o ..\act.win32.exe %Sources%

echo "Patching properties of act_win32.exe"
..\build\verpatch ..\act.win32.exe /high /va 1.7.0 /pv "1.7.0-develop" /s copyright "(c) 2018-2019 ACT Developers" /s desc "ACT is a code generator for software components" /s productName "Automatic Component Toolkit"
echo "Patching properties of act.win32.exe"
..\build\verpatch ..\act.win32.exe /high /va 1.8.0 /pv "1.8.0-develop" /s copyright "(c) 2018-2019 ACT Developers" /s desc "ACT is a code generator for software components" /s productName "Automatic Component Toolkit"

set GOOS=linux
set GOARCH=amd64
Expand All @@ -38,21 +38,23 @@ go build -o ..\act.darwin %Sources%

set GOOS=darwin
set GOARCH=arm
set GOARM=5
echo "Build act.arm.darwin"
go build -o ..\act.arm.darwin %Sources%

set GOOS=linux
set GOARCH=arm
set GOARM=5
echo "Build act.linux32.arm"
go build -o ..\act.linux32.arm %Sources%
go build -o ..\act.arm.linux32 %Sources%

set GOOS=linux
set GOARCH=arm64
set GOARM=5
echo "Build act.linux64.arm"
go build -o ..\act.linux64.arm %Sources%
echo "Build act.arm.linux64"
go build -o ..\act.arm.linux64 %Sources%

copy ..\act.win64.exe ..\act.exe /Y
copy ..\act.linux64 ..\act.linux /Y


cd %startingDir%
54 changes: 54 additions & 0 deletions Build/build.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

set -euxo pipefail

RUN () {
CMD=$1
OS="`uname`"
case $OS in
Linux*)
OSLD_LIBRARY_PATH="LD_LIBRARY_PATH=$2"
for i in "${@:3}"
do
OSLD_LIBRARY_PATH=$OSLD_LIBRARY_PATH:$i
done
eval $OSLD_LIBRARY_PATH $CMD
;;
Darwin*)
OSLD_LIBRARY_PATH="DYLD_LIBRARY_PATH=$2"
for i in "${@:3}"
do
OSLD_LIBRARY_PATH=$OSLD_LIBRARY_PATH:$i
done
eval $OSLD_LIBRARY_PATH $CMD
;;
Windows*) OSLD_LIBRARY_PATH='PATH=%PATH%;' ;;
*) ;;
esac
}

# Common initialization
OS="`uname`"
case $OS in
Linux*)
OSEXT='.linux'
OSLIBEXT='.so'
OSEXEEXT=
FPC_TARGET='linux'
;;
Windows*)
OSEXT='.exe'
OSLIBEXT='.dll'
OSEXEEXT='.exe'
FPC_TARGET='win64'
;;
Darwin*)
OSEXT='.darwin'
OSLIBEXT='.dylib'
OSEXEEXT=
FPC_TARGET='darwin'
;;
*) echo "[Failed] Can't detect OS. Only Windows, Linux and MacOS are supported."; exit 1; ;;
esac

export ACT=act$OSEXT
Loading

0 comments on commit 70934cc

Please sign in to comment.