diff --git a/.github/workflows/build-and-test-macos.yaml b/.github/workflows/build-and-test-macos.yaml index 259231eb5..5a4e1bd2a 100644 --- a/.github/workflows/build-and-test-macos.yaml +++ b/.github/workflows/build-and-test-macos.yaml @@ -40,6 +40,10 @@ jobs: os: ["macos-13", "macos-14", "macos-15"] otp: ["24", "25", "26", "27"] + include: + - otp: "24" + cmake_opts_other: "-DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=24 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=24" + steps: # Setup - name: "Checkout repo" @@ -83,7 +87,7 @@ jobs: working-directory: build run: | export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:/opt/homebrew/opt/erlang@${{ matrix.otp }}/bin:$PATH" - cmake -DAVM_WARNINGS_ARE_ERRORS=ON -G Ninja .. + cmake -DAVM_WARNINGS_ARE_ERRORS=ON ${{ matrix.cmake_opts_other }} -G Ninja .. - name: "Build: run ninja" working-directory: build diff --git a/.github/workflows/build-and-test-other.yaml b/.github/workflows/build-and-test-other.yaml index 3e76d5c03..e1bb8b7f1 100644 --- a/.github/workflows/build-and-test-other.yaml +++ b/.github/workflows/build-and-test-other.yaml @@ -129,6 +129,16 @@ jobs: name: test-modules path: build_tests + - name: Skip compilation of Erlang code + run: | + sed -e 's|add_subdirectory(libs)|# add_subdirectory(libs)|g' \ + -e 's|add_subdirectory(examples)|# add_subdirectory(examples)|g' \ + -i CMakeLists.txt + sed -e 's|add_subdirectory(erlang_tests)|# add_subdirectory(erlang_tests)|g' \ + -e 's|add_subdirectory(libs/|# add_subdirectory(libs/|g' \ + -e 's|add_dependencies(test-erlang erlang_test_modules)|# add_dependencies(test-erlang erlang_test_modules)|g' \ + -i tests/CMakeLists.txt + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -159,13 +169,17 @@ jobs: mkdir -p build && cd build && cmake .. ${{ matrix.cmake_opts }} && + mkdir -p tests/erlang_tests/code_load/beams/ && cp ../build_tests/tests/erlang_tests/*.beam tests/erlang_tests/ && cp ../build_tests/tests/erlang_tests/code_load/*.{avm,beam,hrl} tests/erlang_tests/code_load/ && - mkdir -p tests/erlang_tests/code_load/beams/ && cp ../build_tests/tests/erlang_tests/code_load/beams/*.beam tests/erlang_tests/code_load/beams/ && + mkdir -p tests/libs/etest/ && cp ../build_tests/tests/libs/etest/*.avm tests/libs/etest/ && - cp ../build_tests/tests/libs/estdlib/*.avm tests/libs/estdlib/ && + mkdir -p tests/libs/estdlib/ && + cp ../build_tests/tests/libs/estdlib/*.avm tests/libs/estdlib/ && + mkdir -p tests/libs/eavmlib/ && cp ../build_tests/tests/libs/eavmlib/*.avm tests/libs/eavmlib/ && + mkdir -p tests/libs/alisp/ && cp ../build_tests/tests/libs/alisp/*.avm tests/libs/alisp/ && make AtomVM && make test-erlang && diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 872abd8ac..3e20be4ee 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -204,6 +204,7 @@ jobs: elixir_version: "1.7" rebar3_version: "3.15.2" compiler_pkgs: "g++" + cmake_opts_other: "-DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=21 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=21" - container: "ubuntu:20.04" cc: "cc" @@ -213,6 +214,7 @@ jobs: elixir_version: "1.8" rebar3_version: "3.18.0" compiler_pkgs: "g++" + cmake_opts_other: "-DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=22 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=22" - container: "ubuntu:20.04" cc: "cc" @@ -222,6 +224,7 @@ jobs: elixir_version: "1.11" rebar3_version: "3.20.0" compiler_pkgs: "g++" + cmake_opts_other: "-DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=23 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=23" - container: "ubuntu:20.04" cc: "cc" @@ -231,6 +234,7 @@ jobs: elixir_version: "1.14" rebar3_version: "3.23.0" compiler_pkgs: "g++" + cmake_opts_other: "-DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=24 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=24" - os: "ubuntu-24.04" cc: "cc" @@ -281,9 +285,9 @@ jobs: cc: "gcc-10" cxx: "g++-10" cflags: "-m32 -O3" - otp: "23" - elixir_version: "1.11" - rebar3_version: "3.20.0" + otp: "27" + elixir_version: "1.17" + rebar3_version: "3.24.0" # Use Werror so we get an error with 32 bit specific warnings cmake_opts_other: "-DAVM_CREATE_STACKTRACES=off -DAVM_WARNINGS_ARE_ERRORS=ON" arch: "i386" diff --git a/.github/workflows/esp32-build.yaml b/.github/workflows/esp32-build.yaml index 238a8a30c..5505d67fb 100644 --- a/.github/workflows/esp32-build.yaml +++ b/.github/workflows/esp32-build.yaml @@ -54,6 +54,19 @@ jobs: idf-version: 'v5.0.7' - esp-idf-target: "esp32c3" idf-version: 'v5.1.5' + + # ESP-IDF 5.0.7 and 5.1.5 containers are based on Ubuntu focal which has Erlang/OTP 22 + # ESP-IDF 5.2.3 and 5.3.2 containers are based on Ubuntu jammy which has Erlang/OTP 24 + include: + - idf-version: 'v5.0.7' + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=22 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=22 + - idf-version: 'v5.1.5' + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=22 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=22 + - idf-version: 'v5.2.3' + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=24 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=24 + - idf-version: 'v5.3.2' + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=24 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=24 + steps: - name: Checkout repo uses: actions/checkout@v4 @@ -170,8 +183,8 @@ jobs: echo "CONFIG_ESP_WIFI_RX_IRAM_OPT=n" >> sdkconfig.defaults . $IDF_PATH/export.sh export IDF_TARGET=${{matrix.esp-idf-target}} - idf.py set-target ${{matrix.esp-idf-target}} - idf.py build + idf.py ${{matrix.cmake_opts}} set-target ${{matrix.esp-idf-target}} + idf.py ${{matrix.cmake_opts}} build - name: Run ESP32 tests using qemu with memory checks build working-directory: ./src/platforms/esp32/test/ @@ -191,8 +204,8 @@ jobs: . $IDF_PATH/export.sh export IDF_TARGET=${{matrix.esp-idf-target}} export PATH=${PATH}:${HOME}/.cache/rebar3/bin - idf.py set-target ${{matrix.esp-idf-target}} - idf.py build + idf.py ${{matrix.cmake_opts}} set-target ${{matrix.esp-idf-target}} + idf.py ${{matrix.cmake_opts}} build - name: Run ESP32 tests using qemu working-directory: ./src/platforms/esp32/test/ diff --git a/.github/workflows/run-tests-with-beam.yaml b/.github/workflows/run-tests-with-beam.yaml index 49fd5e475..6241f82cf 100644 --- a/.github/workflows/run-tests-with-beam.yaml +++ b/.github/workflows/run-tests-with-beam.yaml @@ -43,45 +43,55 @@ jobs: - os: "ubuntu-24.04" test_erlang_opts: "-s prime_smp" container: erlang:21 + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=21 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=21 - os: "ubuntu-24.04" test_erlang_opts: "-s prime_smp" container: erlang:22 + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=22 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=22 - os: "ubuntu-24.04" test_erlang_opts: "-s prime_smp" container: erlang:23 + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=23 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=23 - os: "ubuntu-24.04" test_erlang_opts: "-s prime_smp" container: erlang:24 + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=24 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=24 - os: "ubuntu-24.04" test_erlang_opts: "-s prime_smp" container: erlang:25 + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=25 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=25 - os: "ubuntu-24.04" test_erlang_opts: "-s prime_smp" otp: "26" container: erlang:26 + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=26 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=26 - os: "ubuntu-24.04" test_erlang_opts: "-s prime_smp" otp: "27" container: erlang:27 + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=27 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=27 # This is ARM64 - os: "macos-14" otp: "25" path_prefix: "/opt/homebrew/opt/erlang@25/bin:" + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=25 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=25 - os: "macos-14" otp: "26" path_prefix: "/opt/homebrew/opt/erlang@26/bin:" + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=26 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=26 - os: "macos-14" otp: "27" path_prefix: "/opt/homebrew/opt/erlang@27/bin:" + cmake_opts: -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION=27 -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION=27 steps: # Setup - name: "Checkout repo" diff --git a/CMakeLists.txt b/CMakeLists.txt index b7704e266..78fd07178 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,8 @@ option(AVM_RELEASE "Build an AtomVM release" OFF) option(AVM_CREATE_STACKTRACES "Create stacktraces" ON) option(AVM_BUILD_RUNTIME_ONLY "Only build the AtomVM runtime" OFF) option(COVERAGE "Build for code coverage" OFF) +set(AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION "25" CACHE STRING "Minimum supported OTP Release for Erlang compiler") +set(AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION "28" CACHE STRING "Maximum supported OTP Release for Erlang compiler") if((${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") OR (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") OR diff --git a/CMakeModules/FindElixir.cmake b/CMakeModules/FindElixir.cmake index 46c73e454..90f9db986 100644 --- a/CMakeModules/FindElixir.cmake +++ b/CMakeModules/FindElixir.cmake @@ -18,11 +18,10 @@ # SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later # -find_program(ELIXIRC_PATH elixirc) +find_program(ELIXIRC_EXECUTABLE elixirc) -if (ELIXIRC_PATH) - message("Found Elixir") - set(Elixir_FOUND TRUE) -elseif(Elixir_FIND_REQUIRED) - message(FATAL_ERROR "Elixir compiler not found") -endif() +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Elixir + FOUND_VAR Elixir_FOUND + REQUIRED_VARS ELIXIRC_EXECUTABLE +) diff --git a/CMakeModules/FindErlang.cmake b/CMakeModules/FindErlang.cmake new file mode 100644 index 000000000..eab722e40 --- /dev/null +++ b/CMakeModules/FindErlang.cmake @@ -0,0 +1,72 @@ +# +# This file is part of AtomVM. +# +# Copyright 2025 Paul Guyot +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later +# + +cmake_minimum_required(VERSION 3.13) + +find_program(ERLC_EXECUTABLE erlc) +find_program(ERL_EXECUTABLE erl) + +if (ERLC_EXECUTABLE AND ERL_EXECUTABLE) + execute_process(COMMAND erl -eval "io:put_chars(erlang:system_info(otp_release))." -s init stop -noshell OUTPUT_VARIABLE Erlang_VERSION) +endif() + +include(FindPackageHandleStandardArgs) + +if (CMAKE_VERSION VERSION_LESS 3.19) + # Handle version range ourselves + if (Erlang_FIND_VERSION AND ERL_EXECUTABLE) + string(REPLACE "..." ";" Erlang_FIND_VERSION_LIST ${Erlang_FIND_VERSION}) + list(LENGTH Erlang_FIND_VERSION_LIST Erlang_FIND_VERSION_LIST_LEN) + if (Erlang_FIND_VERSION_LIST_LEN EQUAL 1) + find_package_handle_standard_args(Erlang + FOUND_VAR Erlang_FOUND + REQUIRED_VARS ERLC_EXECUTABLE ERL_EXECUTABLE + VERSION_VAR Erlang_VERSION + ) + elseif(${Erlang_FIND_VERSION_LIST_LEN} EQUAL 2) + list(GET Erlang_FIND_VERSION_LIST 0 Erlang_FIND_VERSION_MIN) + list(GET Erlang_FIND_VERSION_LIST 1 Erlang_FIND_VERSION_MAX) + if (${Erlang_VERSION} LESS Erlang_FIND_VERSION_MIN) + message(FATAL_ERROR "-- Found Erlang: ${ERL_EXECUTABLE} but OTP Release ${Erlang_VERSION} is less than required ${Erlang_FIND_VERSION_MIN}") + endif() + if (${Erlang_VERSION} GREATER Erlang_FIND_VERSION_MAX) + message(FATAL_ERROR "-- Found Erlang: ${ERL_EXECUTABLE} but OTP Release ${Erlang_VERSION} is greater than supported ${Erlang_FIND_VERSION_MAX}") + endif() + find_package_handle_standard_args(Erlang + FOUND_VAR Erlang_FOUND + REQUIRED_VARS ERLC_EXECUTABLE ERL_EXECUTABLE + ) + else() + message(FATAL_ERROR "-- Found Erlang: ${ERL_EXECUTABLE} but version range syntax is incorrect ${Erlang_FIND_VERSION}") + endif() + else() + find_package_handle_standard_args(Erlang + FOUND_VAR Erlang_FOUND + REQUIRED_VARS ERLC_EXECUTABLE ERL_EXECUTABLE + ) + endif() +else() + find_package_handle_standard_args(Erlang + FOUND_VAR Erlang_FOUND + HANDLE_VERSION_RANGE + REQUIRED_VARS ERLC_EXECUTABLE ERL_EXECUTABLE + VERSION_VAR Erlang_VERSION + ) +endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 3c33ea14d..578e7028b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -36,3 +36,6 @@ if (Gleam_FOUND) else() message(WARNING "-- gleam not found, skipping Gleam examples") endif() + +# Ensure erlang version is compatible with VM +find_package(Erlang ${AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION}...${AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION} REQUIRED) diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index 9279db852..df2c993a9 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -18,7 +18,7 @@ # SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later # -cmake_minimum_required (VERSION 3.12) +cmake_minimum_required (VERSION 3.13) project(libs) add_subdirectory(estdlib/src) @@ -65,6 +65,9 @@ else() message("Dialyzer was not found -- skipping PLT build") endif() +# Ensure erlang version is compatible with VM +find_package(Erlang ${AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION}...${AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION} REQUIRED) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/atomvmlib.avm DESTINATION lib/atomvm diff --git a/src/libAtomVM/CMakeLists.txt b/src/libAtomVM/CMakeLists.txt index 3af3819ec..602d50a60 100644 --- a/src/libAtomVM/CMakeLists.txt +++ b/src/libAtomVM/CMakeLists.txt @@ -134,6 +134,12 @@ endif() if (ADVANCED_TRACING) target_compile_definitions(libAtomVM PUBLIC ENABLE_ADVANCED_TRACE) endif() +if (AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION) + target_compile_definitions(libAtomVM PUBLIC MINIMUM_OTP_COMPILER_VERSION=${AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION}) +endif() +if (AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION) + target_compile_definitions(libAtomVM PUBLIC MAXIMUM_OTP_COMPILER_VERSION=${AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION}) +endif() target_link_libraries(libAtomVM PUBLIC m) include(CheckCSourceCompiles) diff --git a/src/libAtomVM/opcodesswitch.h b/src/libAtomVM/opcodesswitch.h index 86c5252d4..3c471857d 100644 --- a/src/libAtomVM/opcodesswitch.h +++ b/src/libAtomVM/opcodesswitch.h @@ -47,8 +47,12 @@ // These constants can be used to reduce the size of the VM for a specific // range of compiler versions -#define MINIMUM_OTP_COMPILER_VERSION 21 -#define MAXIMUM_OTP_COMPILER_VERSION 26 +#ifndef MINIMUM_OTP_COMPILER_VERSION +#define MINIMUM_OTP_COMPILER_VERSION 25 +#endif +#ifndef MAXIMUM_OTP_COMPILER_VERSION +#define MAXIMUM_OTP_COMPILER_VERSION 28 +#endif #ifdef __cplusplus extern "C" { @@ -5071,7 +5075,7 @@ HOT_FUNC int scheduler_entry_point(GlobalContext *glb) break; } -#if MINIMUM_OTP_COMPILER_VERSION <= 24 +#if MINIMUM_OTP_COMPILER_VERSION <= 25 case OP_BS_TEST_UNIT: { uint32_t fail; DECODE_LABEL(fail, pc) diff --git a/src/platforms/emscripten/CMakeLists.txt b/src/platforms/emscripten/CMakeLists.txt index 5fe8b9e97..46a168368 100644 --- a/src/platforms/emscripten/CMakeLists.txt +++ b/src/platforms/emscripten/CMakeLists.txt @@ -32,6 +32,8 @@ endif () option(AVM_DISABLE_SMP "Disable SMP." OFF) option(AVM_USE_32BIT_FLOAT "Use 32 bit floats." OFF) option(AVM_VERBOSE_ABORT "Print module and line number on VM abort" OFF) +set(AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION "25" CACHE STRING "Minimum supported OTP Release for Erlang compiler") +set(AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION "28" CACHE STRING "Maximum supported OTP Release for Erlang compiler") set( PLATFORM_LIB_SUFFIX diff --git a/src/platforms/esp32/test/CMakeLists.txt b/src/platforms/esp32/test/CMakeLists.txt index 66739b33c..54f769105 100644 --- a/src/platforms/esp32/test/CMakeLists.txt +++ b/src/platforms/esp32/test/CMakeLists.txt @@ -59,6 +59,11 @@ set(AVM_SELECT_IN_TASK ON) project(atomvm-esp32-test) +# Ensure erlang version is compatible with VM +set(AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION "25" CACHE STRING "Minimum supported OTP Release for Erlang compiler") +set(AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION "28" CACHE STRING "Maximum supported OTP Release for Erlang compiler") +find_package(Erlang ${AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION}...${AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION} REQUIRED) + # esp-idf does not use compile_feature but instead sets version in # c_compile_options # Ensure project is compiled with at least C11 diff --git a/src/platforms/esp32/test/main/test_erl_sources/CMakeLists.txt b/src/platforms/esp32/test/main/test_erl_sources/CMakeLists.txt index fe93ae418..7921355ac 100644 --- a/src/platforms/esp32/test/main/test_erl_sources/CMakeLists.txt +++ b/src/platforms/esp32/test/main/test_erl_sources/CMakeLists.txt @@ -20,8 +20,16 @@ add_library(esp32_test_modules) +if (AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION) +list(APPEND HOST_CMAKE_CACHE_ARGS -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION:STRING=${AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION}) +endif() +if (AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION) +list(APPEND HOST_CMAKE_CACHE_ARGS ${HOST_CMAKE_CACHE_ARGS} -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION:STRING=${AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION}) +endif() + ExternalProject_Add(HostAtomVM SOURCE_DIR ../../../../../../../../ + CMAKE_CACHE_ARGS ${HOST_CMAKE_CACHE_ARGS} INSTALL_COMMAND cmake -E echo "Skipping install step." ) diff --git a/src/platforms/rp2/CMakeLists.txt b/src/platforms/rp2/CMakeLists.txt index b88f136e1..e6562596f 100644 --- a/src/platforms/rp2/CMakeLists.txt +++ b/src/platforms/rp2/CMakeLists.txt @@ -63,6 +63,8 @@ option(AVM_WAIT_FOR_USB_CONNECT "Wait for USB connection before starting" OFF) option(AVM_WAIT_BOOTSEL_ON_EXIT "Wait in BOOTSEL rather than shutdown on exit" ON) option(AVM_REBOOT_ON_NOT_OK "Reboot Pico if result is not ok" OFF) option(AVM_CREATE_STACKTRACES "Create stacktraces" ON) +set(AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION "25" CACHE STRING "Minimum supported OTP Release for Erlang compiler") +set(AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION "28" CACHE STRING "Maximum supported OTP Release for Erlang compiler") set(AVM_DISABLE_TASK_DRIVER ON FORCE) diff --git a/src/platforms/rp2/tests/test_erl_sources/CMakeLists.txt b/src/platforms/rp2/tests/test_erl_sources/CMakeLists.txt index 773a555dc..236614fe7 100644 --- a/src/platforms/rp2/tests/test_erl_sources/CMakeLists.txt +++ b/src/platforms/rp2/tests/test_erl_sources/CMakeLists.txt @@ -18,9 +18,17 @@ # SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later # +if (AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION) +list(APPEND HOST_CMAKE_CACHE_ARGS -DAVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION:STRING=${AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION}) +endif() +if (AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION) +list(APPEND HOST_CMAKE_CACHE_ARGS ${HOST_CMAKE_CACHE_ARGS} -DAVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION:STRING=${AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION}) +endif() + include(ExternalProject) ExternalProject_Add(HostAtomVM SOURCE_DIR ../../../../../../ + CMAKE_CACHE_ARGS ${HOST_CMAKE_CACHE_ARGS} INSTALL_COMMAND cmake -E echo "Skipping install step." BUILD_COMMAND cmake --build . --target=atomvmlib --target=PackBEAM --target=uf2tool ) diff --git a/src/platforms/stm32/CMakeLists.txt b/src/platforms/stm32/CMakeLists.txt index eb0480c8e..6acaab64c 100644 --- a/src/platforms/stm32/CMakeLists.txt +++ b/src/platforms/stm32/CMakeLists.txt @@ -35,6 +35,8 @@ option(AVM_ENABLE_LOG_LINES "Include source and line info for all enbled levels" option(AVM_CONFIG_REBOOT_ON_NOT_OK "Reboot when application exits with non 'ok' return" OFF) option(AVM_DISABLE_GPIO_NIFS "Disable GPIO nifs (input and output)" OFF) option(AVM_DISABLE_GPIO_PORT_DRIVER "Disable GPIO 'port' driver (input, output, and interrupts)" OFF) +set(AVM_MINIMUM_OTP_RELEASE_COMPILER_VERSION "25" CACHE STRING "Minimum supported OTP Release for Erlang compiler") +set(AVM_MAXIMUM_OTP_RELEASE_COMPILER_VERSION "28" CACHE STRING "Maximum supported OTP Release for Erlang compiler") set(AVM_DISABLE_SMP ON FORCE) set(AVM_DISABLE_TASK_DRIVER ON FORCE)