Skip to content

Commit

Permalink
Merge pull request #630 from pguyot/w23/fix-c11-compilation-of-esp32-…
Browse files Browse the repository at this point in the history
…test

Compile ESP32 tests with C11

Also fix issues with 5.x sdk by not requiring C11 if IDF selected C11 or higher.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
  • Loading branch information
bettio committed Jun 13, 2023
2 parents fb9eb9e + 0196b8e commit 187e414
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/platforms/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ endif()

project(atomvm-esp32)

# esp-idf does not use compile_feature but instead sets version in
# c_compile_options
# Ensure project is compiled with at least C11
idf_build_get_property(c_compile_options C_COMPILE_OPTIONS)
list(REMOVE_ITEM c_compile_options -std=gnu99)
list(APPEND c_compile_options -std=gnu11)
idf_build_set_property(C_COMPILE_OPTIONS ${c_compile_options})
if (-std=gnu99 IN_LIST c_compile_options )
list(REMOVE_ITEM c_compile_options -std=gnu99)
list(APPEND c_compile_options -std=gnu11)
idf_build_set_property(C_COMPILE_OPTIONS ${c_compile_options})
endif()

# Options that make sense for this platform
option(AVM_DISABLE_SMP "Disable SMP." OFF)
Expand Down
10 changes: 10 additions & 0 deletions src/platforms/esp32/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ set(TEST_COMPONENTS "testable" CACHE STRING "List of components to test")

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(atomvm-esp32-test)

# esp-idf does not use compile_feature but instead sets version in
# c_compile_options
# Ensure project is compiled with at least C11
idf_build_get_property(c_compile_options C_COMPILE_OPTIONS)
if (-std=gnu99 IN_LIST c_compile_options )
list(REMOVE_ITEM c_compile_options -std=gnu99)
list(APPEND c_compile_options -std=gnu11)
idf_build_set_property(C_COMPILE_OPTIONS ${c_compile_options})
endif()

0 comments on commit 187e414

Please sign in to comment.