Skip to content

Commit 22ae62a

Browse files
committed
Merge pull request #1679 from pguyot/w22/fix-mbedtls-compilation-with-emscripten
Use -Wno-unterminated-string-initialization to fix mbedtls compilation 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
2 parents 4c11bb3 + 44e6393 commit 22ae62a

11 files changed

+55
-17
lines changed

.github/workflows/build-docs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
paths:
2121
- '.github/workflows/**'
2222
- 'CMakeLists.txt'
23+
- 'CMakeModules/**'
2324
- 'doc/**'
2425
- 'libs/**'
2526
- 'src/libAtomVM/**'
@@ -33,6 +34,7 @@ on:
3334
paths:
3435
- '.github/workflows/**'
3536
- 'CMakeLists.txt'
37+
- 'CMakeModules/**'
3638
- 'doc/**'
3739
- 'libs/**'
3840
- 'src/libAtomVM/**'

.github/workflows/check-formatting.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ on:
1111
paths:
1212
- '.github/workflows/**'
1313
- 'CMakeLists.txt'
14+
- 'CMakeModules/**'
1415
- 'src/**'
1516
- 'tests/**'
1617
- '**/*.erl'
1718
pull_request:
1819
paths:
1920
- '.github/workflows/**'
2021
- 'CMakeLists.txt'
22+
- 'CMakeModules/**'
2123
- 'src/**'
2224
- 'tests/**'
2325
- '**/*.erl'

.github/workflows/esp32-build.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
paths:
1212
- '.github/workflows/esp32-build.yaml'
1313
- 'CMakeLists.txt'
14+
- 'CMakeModules/**'
1415
- 'libs/**'
1516
- 'src/platforms/esp32/**'
1617
- 'src/platforms/esp32/**/**'
@@ -19,9 +20,13 @@ on:
1920
pull_request:
2021
paths:
2122
- '.github/workflows/esp32-build.yaml'
23+
- 'CMakeLists.txt'
24+
- 'CMakeModules/**'
25+
- 'libs/**'
2226
- 'src/platforms/esp32/**'
2327
- 'src/platforms/esp32/**/**'
2428
- 'src/libAtomVM/**'
29+
- 'tools/packbeam/**'
2530

2631
concurrency:
2732
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}

.github/workflows/esp32-mkimage.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
paths:
1212
- '.github/workflows/esp32-mkimage.yaml'
1313
- 'CMakeLists.txt'
14+
- 'CMakeModules/**'
1415
- 'libs/**'
1516
- 'src/platforms/esp32/**'
1617
- 'src/platforms/esp32/**/**'
@@ -19,9 +20,13 @@ on:
1920
pull_request:
2021
paths:
2122
- '.github/workflows/esp32-mkimage.yaml'
23+
- 'CMakeLists.txt'
24+
- 'CMakeModules/**'
25+
- 'libs/**'
2226
- 'src/platforms/esp32/**'
2327
- 'src/platforms/esp32/**/**'
2428
- 'src/libAtomVM/**'
29+
- 'tools/packbeam/**'
2530

2631
permissions:
2732
contents: write

.github/workflows/esp32-simtest.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
paths:
1313
- ".github/workflows/esp32-simtest.yaml"
1414
- "CMakeLists.txt"
15+
- 'CMakeModules/**'
1516
- "libs/**"
1617
- "src/platforms/esp32/**"
1718
- "src/platforms/esp32/**/**"
@@ -20,9 +21,13 @@ on:
2021
pull_request:
2122
paths:
2223
- ".github/workflows/esp32-simtest.yaml"
24+
- "CMakeLists.txt"
25+
- 'CMakeModules/**'
26+
- "libs/**"
2327
- "src/platforms/esp32/**"
2428
- "src/platforms/esp32/**/**"
2529
- "src/libAtomVM/**"
30+
- "tools/packbeam/**"
2631

2732
concurrency:
2833
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}

.github/workflows/pico-build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
paths:
1212
- '.github/workflows/pico-build.yaml'
1313
- 'CMakeLists.txt'
14+
- 'CMakeModules/**'
1415
- 'libs/**'
1516
- 'src/platforms/rp2/**'
1617
- 'src/platforms/esp32/test/main/test_erl_sources/test_crypto.erl'
@@ -19,6 +20,7 @@ on:
1920
paths:
2021
- '.github/workflows/pico-build.yaml'
2122
- 'CMakeLists.txt'
23+
- 'CMakeModules/**'
2224
- 'libs/**'
2325
- 'src/platforms/rp2/**'
2426
- 'src/platforms/esp32/test/main/test_erl_sources/test_crypto.erl'

.github/workflows/publish-docs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
paths:
2121
- '.github/workflows/publish-docs.yaml'
2222
- 'CMakeLists.txt'
23+
- 'CMakeModules/**'
2324
- 'doc/**'
2425
- 'libs/**'
2526
- 'src/libAtomVM/**'

.github/workflows/stm32-build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ on:
1111
paths:
1212
- '.github/workflows/stm32-build.yaml'
1313
- 'CMakeLists.txt'
14+
- 'CMakeModules/**'
1415
- 'src/platforms/stm32/**'
1516
- 'src/libAtomVM/**'
1617
pull_request:
1718
paths:
1819
- '.github/workflows/stm32-build.yaml'
1920
- 'CMakeLists.txt'
21+
- 'CMakeModules/**'
2022
- 'src/platforms/stm32/**'
2123
- 'src/libAtomVM/**'
2224

.github/workflows/wasm-build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ on:
1111
paths:
1212
- '.github/workflows/wasm-build.yaml'
1313
- 'CMakeLists.txt'
14+
- 'CMakeModules/**'
1415
- 'libs/**'
1516
- 'src/platforms/emscripten/**'
1617
- 'src/libAtomVM/**'
1718
pull_request:
1819
paths:
1920
- '.github/workflows/wasm-build.yaml'
2021
- 'CMakeLists.txt'
22+
- 'CMakeModules/**'
2123
- 'libs/**'
2224
- 'src/platforms/emscripten/**'
2325
- 'src/libAtomVM/**'

CMakeModules/FetchMbedTLS.cmake

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,37 @@ include(FetchContent)
2222

2323
FetchContent_Declare(
2424
mbedtls
25-
PATCH_COMMAND git apply "${CMAKE_CURRENT_LIST_DIR}/mbedtls.patch"
2625
GIT_REPOSITORY http://github.com/mbed-TLS/mbedtls.git
2726
GIT_TAG v3.6.3.1
2827
GIT_SHALLOW 1
2928
)
3029

31-
FetchContent_MakeAvailable(mbedtls)
30+
include(CheckCompilerFlag)
31+
check_compiler_flag(C -Wno-unterminated-string-initialization compiler_supports_unterminated_string_initialization)
32+
33+
if (${compiler_supports_unterminated_string_initialization})
34+
get_property(
35+
compile_options
36+
DIRECTORY
37+
PROPERTY COMPILE_OPTIONS
38+
)
39+
40+
set_property(
41+
DIRECTORY
42+
APPEND
43+
PROPERTY COMPILE_OPTIONS -Wno-unterminated-string-initialization
44+
)
45+
46+
FetchContent_MakeAvailable(mbedtls)
47+
48+
set_property(
49+
DIRECTORY
50+
PROPERTY COMPILE_OPTIONS ${compile_options}
51+
)
52+
53+
unset(compile_options)
54+
else()
55+
FetchContent_MakeAvailable(mbedtls)
56+
endif ()
57+
58+
unset(compiler_supports_unterminated_string_initialization)

0 commit comments

Comments
 (0)