diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml new file mode 100644 index 0000000..4268bfd --- /dev/null +++ b/.github/workflows/build-app.yml @@ -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 \ No newline at end of file diff --git a/helper-scripts/project-impl/compile-all-android.sh b/helper-scripts/project-impl/compile-all-android.sh index b375f5f..aa656c6 100644 --- a/helper-scripts/project-impl/compile-all-android.sh +++ b/helper-scripts/project-impl/compile-all-android.sh @@ -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" \ No newline at end of file diff --git a/helper-scripts/project-impl/compile-all-mcu.sh b/helper-scripts/project-impl/compile-all-mcu.sh index ab42f38..a3e294d 100644 --- a/helper-scripts/project-impl/compile-all-mcu.sh +++ b/helper-scripts/project-impl/compile-all-mcu.sh @@ -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" \ No newline at end of file diff --git a/helper-scripts/project-impl/compile-all.sh b/helper-scripts/project-impl/compile-all.sh index abb610a..98a4feb 100644 --- a/helper-scripts/project-impl/compile-all.sh +++ b/helper-scripts/project-impl/compile-all.sh @@ -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 diff --git a/helper-scripts/project-impl/compile-desktop-linux.sh b/helper-scripts/project-impl/compile-desktop-linux.sh new file mode 100644 index 0000000..feefdc0 --- /dev/null +++ b/helper-scripts/project-impl/compile-desktop-linux.sh @@ -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 diff --git a/helper-scripts/project-impl/compile-electrostatic-app.sh b/helper-scripts/project-impl/compile-electrostatic-app.sh index 62c2513..f9d1145 100644 --- a/helper-scripts/project-impl/compile-electrostatic-app.sh +++ b/helper-scripts/project-impl/compile-electrostatic-app.sh @@ -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 @@ -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 \ No newline at end of file diff --git a/libs/linux/x86-64/libelectrostatic.so b/libs/linux/x86-64/libelectrostatic.so deleted file mode 100644 index bdbdcef..0000000 Binary files a/libs/linux/x86-64/libelectrostatic.so and /dev/null differ