Skip to content
Merged
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
40 changes: 40 additions & 0 deletions .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This is a basic workflow to help you get started with Actions

name: Build Electrostatic-Application

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-electrostatic-app:
# runner images with architectures (variants)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'ubuntu-latest' ]
name: Build Electrostatic App

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout Job
uses: actions/checkout@v3

- name: Setup Electrostatic-Sandbox Workstation
run: chmod +rwx ./helper-scripts/setup-environment/setup-sandbox.sh && ./helper-scripts/setup-environment/setup-sandbox.sh

- name: User's Permissions Granting
run: chmod +rwx ./helper-scripts/project-impl/*.sh

- name: Building Electrostatic-application Executable Binaries
run: sudo ./helper-scripts/project-impl/compile-all.sh

- name: Testing Electrostatic-app ELF
run: sudo ./build/linux/x86-64/electrostatic-app.elf
68 changes: 31 additions & 37 deletions helper-scripts/project-impl/compile-all-android.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
#!/bin/bash

# pre-compilation automata
source "./helper-scripts/project-impl/variables.sh"

PRIMER_SUFFIX="${1}"

##
# define source modules
# The suffix 'primer' swaps binaries with
# the original project for testing purposes!
##
electronetsoft="$(pwd)/electrostatic-sandbox-framework/${source_dir}/src/libs/electrostatic${PRIMER_SUFFIX}/electronetsoft"

platform_module="${electronetsoft}/platform/linux/"
comm_module="${electronetsoft}/comm/"
algorithm_module="${electronetsoft}/algorithm/"
util_module="${electronetsoft}/util/"

./helper-scripts/project-impl/compile-electrostatic.sh \
"${COMMISSION_LIB}" "${CLANG_BIN}" "${CLANGPP_BIN}" "ON" "ON" "OFF" "-O3 -fPIC" \
"--target=${ARM_64}" \
"${electrostatic_core_headers}" "${platform_module} ${comm_module} \
${algorithm_module} ${util_module}" "${NULL}" "m;c;dl" "${source_dir}" "android" "${ARM_64}" "${POST_COMPILE_TRUE}"

./helper-scripts/project-impl/compile-electrostatic.sh \
"${COMMISSION_LIB}" "${CLANG_BIN}" "${CLANGPP_BIN}" "ON" "ON" "OFF" "-O3 -fPIC" \
"--target=${ARM_32}" \
"${electrostatic_core_headers}" "${platform_module} ${comm_module} \
${algorithm_module} ${util_module}" "${NULL}" "m;c;dl" "${source_dir}" "android" "${ARM_32}" "${POST_COMPILE_TRUE}"

./helper-scripts/project-impl/compile-electrostatic.sh \
"${COMMISSION_LIB}" "${CLANG_BIN}" "${CLANGPP_BIN}" "ON" "ON" "OFF" "-O3 -fPIC" \
"--target=${ANDROID_x86}" \
"${electrostatic_core_headers}" "${platform_module} ${comm_module} \
${algorithm_module} ${util_module}" "${NULL}" "m;c;dl" "${source_dir}" "android" "${ANDROID_x86}" "${POST_COMPILE_TRUE}"

./helper-scripts/project-impl/compile-electrostatic.sh \
"${COMMISSION_LIB}" "${CLANG_BIN}" "${CLANGPP_BIN}" "ON" "ON" "OFF" "-O3 -fPIC" \
"--target=${ANDROID_x86_64}" \
"${electrostatic_core_headers}" "${platform_module} ${comm_module} \
${algorithm_module} ${util_module}" "${NULL}" "m;c;dl" "${source_dir}" "android" "${ANDROID_x86_64}" "${POST_COMPILE_TRUE}"
source_module="${app_src}/"
electrostatic_sdk="${app_libs}"

# compilation automata

./helper-scripts/project-impl/compile-electrostatic-app.sh \
"${COMMISSION_EXE}" "${CLANG_BIN}" "${CLANGPP_BIN}" "-O3 -fPIC" \
"--target=${ARM_64}" "${NDK_TOOLCHAIN_INCLUDES};${app_headers}" "${source_module}" \
"${electrostatic_sdk}/android/${ARM_64}" "m;c;dl" "." \
"android" "${ARM_64}" "false" "true"

./helper-scripts/project-impl/compile-electrostatic-app.sh \
"${COMMISSION_EXE}" "${CLANG_BIN}" "${CLANGPP_BIN}" "-O3 -fPIC" \
"--target=${ARM_32}" "${NDK_TOOLCHAIN_INCLUDES};${app_headers}" "${source_module}" \
"${electrostatic_sdk}/android/${ARM_32}" "m;c;dl" "." \
"android" "${ARM_32}" "false" "true"

./helper-scripts/project-impl/compile-electrostatic-app.sh \
"${COMMISSION_EXE}" "${CLANG_BIN}" "${CLANGPP_BIN}" "-O3 -fPIC" \
"--target=${ANDROID_x86}" "${NDK_TOOLCHAIN_INCLUDES};${app_headers}" "${source_module}" \
"${electrostatic_sdk}/android/${ANDROID_x86}" "m;c;dl" "." \
"android" "${ANDROID_x86}" "false" "true"


./helper-scripts/project-impl/compile-electrostatic-app.sh \
"${COMMISSION_EXE}" "${CLANG_BIN}" "${CLANGPP_BIN}" "-O3 -fPIC" \
"--target=${ANDROID_x86_64}" "${NDK_TOOLCHAIN_INCLUDES};${app_headers}" "${source_module}" \
"${electrostatic_sdk}/android/${ANDROID_x86_64}" "m;c;dl" "." \
"android" "${ANDROID_x86_64}" "false" "true"
36 changes: 13 additions & 23 deletions helper-scripts/project-impl/compile-all-mcu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,18 @@

source "./helper-scripts/project-impl/variables.sh"

PRIMER_SUFFIX="${1}"
source_module="${app_src}/"
electrostatic_sdk="${app_libs}"

##
# define source modules
# The suffix 'primer' swaps binaries with
# the original project for testing purposes!
##
electronetsoft="$(pwd)/electrostatic-sandbox-framework/${source_dir}/src/libs/electrostatic${PRIMER_SUFFIX}/electronetsoft"
electroio="$(pwd)/electrostatic-sandbox-framework/${source_dir}/src/libs/electrostatic${PRIMER_SUFFIX}/electroio"
# compilation automata
./helper-scripts/project-impl/compile-electrostatic-app.sh \
"${COMMISSION_EXE}" "${AVR_GCC_BIN}" "${AVR_GPP_BIN}" "-O2" \
"-mmcu=atmega32 -D_ELECTRO_MIO" "${AVR_TOOLCHAIN_INCLUDES};${app_headers}" "${source_module}" \
"${electrostatic_sdk}/avr-mcu/atmega32/" "m" "." \
"avr-mcu" "atmega32" "false" "true"

platform_module="${electronetsoft}/platform/linux/"
comm_module="${electronetsoft}/comm/"
algorithm_module="${electronetsoft}/algorithm/"
util_module="${electronetsoft}/util/"
electromio_module="${electroio}/electromio/"

./helper-scripts/project-impl/compile-electrostatic.sh \
"${COMMISSION_LIB}" "${AVR_GCC_BIN}" "${AVR_GPP_BIN}" "ON" "OFF" "OFF" "-O2" \
"-mmcu=atmega32 -D_ELECTRO_MIO" "${AVR_TOOLCHAIN_INCLUDES};${electrostatic_core_headers}" "${platform_module} \
${comm_module} ${algorithm_module} ${util_module} ${electromio_module}" "${NULL}" "m" "${source_dir}" "avr-mcu" "atmega32" "${POST_COMPILE_TRUE}"

./helper-scripts/project-impl/compile-electrostatic.sh \
"${COMMISSION_LIB}" "${AVR_GCC_BIN}" "${AVR_GPP_BIN}" "ON" "OFF" "OFF" "-O2" \
"-mmcu=atmega328p -D_ELECTRO_MIO" "${AVR_TOOLCHAIN_INCLUDES};${electrostatic_core_headers}" "${platform_module} \
${comm_module} ${algorithm_module} ${util_module} ${electromio_module}" "${NULL}" "m" "${source_dir}" "avr-mcu" "atmega328p" "${POST_COMPILE_TRUE}"
./helper-scripts/project-impl/compile-electrostatic-app.sh \
"${COMMISSION_EXE}" "${AVR_GCC_BIN}" "${AVR_GPP_BIN}" "-O2" \
"-mmcu=atmega328p -D_ELECTRO_MIO" "${AVR_TOOLCHAIN_INCLUDES};${app_headers}" "${source_module}" \
"${electrostatic_sdk}/avr-mcu/atmega328p/" "m" "." \
"avr-mcu" "atmega328p" "false" "true"
25 changes: 2 additions & 23 deletions helper-scripts/project-impl/compile-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,5 @@
# pre-compilation automata
source "./helper-scripts/project-impl/variables.sh"

source_module="${app_src}/"
electrostatic_sdk="${app_libs}"

# compilation automata
./helper-scripts/project-impl/compile-electrostatic-app.sh \
"${COMMISSION_EXE}" "${GCC_BIN_x86}" "${GPP_BIN_x86}" "-O3 -fPIC" \
"${TARGET_x86_64}" "${TOOLCHAIN_INCLUDES_x86};${app_headers}" "${source_module}" \
"${electrostatic_sdk}/linux/x86-64/" "m;pthread;dl" "." \
"linux" "${x86_64}"


./helper-scripts/project-impl/compile-electrostatic-app.sh \
"${COMMISSION_EXE}" "${GCC_BIN_x86}" "${GPP_BIN_x86}" "-O3 -fPIC" \
"${TARGET_x86}" "${TOOLCHAIN_INCLUDES_x86};${app_headers}" "${source_module}" \
"${electrostatic_sdk}/linux/x86/" "m;pthread;dl" "." \
"linux" "${x86}"

# post-compilation automata
mkdir --parents "$(pwd)/build/linux/x86"
mkdir --parents "$(pwd)/build/linux/x86-64"

mv --update "$(pwd)/cmake-build/linux/x86/${COMMISSION_EXE}.elf" "$(pwd)/build/linux/x86"
mv --update "$(pwd)/cmake-build/linux/x86-64/${COMMISSION_EXE}.elf" "$(pwd)/build/linux/x86-64"
./helper-scripts/project-impl/compile-desktop-linux.sh
./helper-scripts/project-impl/compile-all-android.sh
24 changes: 24 additions & 0 deletions helper-scripts/project-impl/compile-desktop-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# pre-compilation automata
source "./helper-scripts/project-impl/variables.sh"

source_module="${app_src}/"
electrostatic_sdk="${app_libs}"

# compilation automata
./helper-scripts/project-impl/compile-electrostatic-app.sh \
"${COMMISSION_EXE}" "${GCC_BIN_x86}" "${GPP_BIN_x86}" "-O3 -fPIC" \
"${TARGET_x86_64}" "${TOOLCHAIN_INCLUDES_x86};${app_headers}" "${source_module}" \
"${electrostatic_sdk}/linux/x86-64/" "m;pthread;dl" "." \
"linux" "${x86_64}" "false" "true"


./helper-scripts/project-impl/compile-electrostatic-app.sh \
"${COMMISSION_EXE}" "${GCC_BIN_x86}" "${GPP_BIN_x86}" "-O3 -fPIC" \
"${TARGET_x86}" "${TOOLCHAIN_INCLUDES_x86};${app_headers}" "${source_module}" \
"${electrostatic_sdk}/linux/x86/" "m;pthread;dl" "." \
"linux" "${x86}" "false" "true"

# post-compilation automata
# true, See, the compile-electrostatic-app.sh
20 changes: 20 additions & 0 deletions helper-scripts/project-impl/compile-electrostatic-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,20 @@ BUILTIN_LIBS="${9}"
SOURCE_DIR="${10}"
SYSTEM_DIR="${11}"
BUILD_DIR="${12}"
DYNAMIC_LINKING="${13}"
POST_PROCESSING="${14}"

# precompile scripts
sources=$(find ${CODEBASE_MODULES[*]} -name *.c -o -name *.cpp -o -name *.cxx | tr '\n' ';')

if [ "${DEPENDENCIES_MODULES[*]}" != "${NULL}" ]; then
if [ "${DYNAMIC_LINKING}" == "true" ]; then
echo -e "--------- Deferring Linking to runtime ---------"
dependencies=$(find ${DEPENDENCIES_MODULES[*]} -name *.so | tr '\n' ';')
else
echo -e "--------- Performing Static Linking ---------"
dependencies=$(find ${DEPENDENCIES_MODULES[*]} -name *.a -o -name *.ar | tr '\n' ';')
fi
fi

# compile scripts
Expand All @@ -32,3 +40,15 @@ compile "${COMMISSION_OUTPUT}" "${GCC_BIN}" "${GPP_BIN}" \
"${TARGET_MACHINE}" "${HEADERS}" \
"${SOURCE_DIR}" "${sources}" "${dependencies};${BUILTIN_LIBS}" \
"${SYSTEM_DIR}/${BUILD_DIR}" "." "${SOURCE_DIR}"

# post-compilation automata
if [ "${POST_PROCESSING}" == "true" ]; then
mkdir --parents "$(pwd)/build/${SYSTEM_DIR}/${BUILD_DIR}"
mkdir --parents "$(pwd)/build/${SYSTEM_DIR}/${BUILD_DIR}"

mv --update "$(pwd)/cmake-build/${SYSTEM_DIR}/${BUILD_DIR}/${COMMISSION_EXE}.elf" \
"$(pwd)/build/${SYSTEM_DIR}/${BUILD_DIR}"

mv --update "$(pwd)/cmake-build/${SYSTEM_DIR}/${BUILD_DIR}/${COMMISSION_EXE}.elf" \
"$(pwd)/build/${SYSTEM_DIR}/${BUILD_DIR}"
fi
Binary file removed libs/linux/x86-64/libelectrostatic.so
Binary file not shown.
Loading