1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-28 17:09:10 +00:00

Fix 021c45c: [CMake] detection and use of nlohmann-json for emscripten (#11113)

This commit is contained in:
Loïc Guilloux
2023-07-06 11:49:06 +02:00
committed by GitHub
parent 9f28da4e33
commit 5f2246eabf
3 changed files with 6 additions and 4 deletions

View File

@@ -32,10 +32,11 @@ jobs:
path: /emsdk/upstream/emscripten/cache
key: 3.1.37-${{ runner.os }}
- name: Patch Emscripten to support LZMA
- name: Patch Emscripten to support LZMA and nlohmann-json
run: |
cd /emsdk/upstream/emscripten
patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-liblzma.patch
patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-nlohmann-json.patch
- name: Build (host tools)
run: |

View File

@@ -47,10 +47,11 @@ jobs:
path: /emsdk/upstream/emscripten/cache
key: 3.1.37-${{ runner.os }}
- name: Patch Emscripten to support LZMA
- name: Patch Emscripten to support LZMA and nlohmann_json
run: |
cd /emsdk/upstream/emscripten
patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-liblzma.patch
patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-nlohmann-json.patch
- name: Build (host tools)
run: |

View File

@@ -6,10 +6,10 @@ set(CMAKE_REQUIRED_FLAGS "-sUSE_NLOHMANN_JSON=1")
check_cxx_source_compiles("
#include <nlohmann/json.hpp>
int main() { return 0; }"
NLOHMANN_JSON_FOUND
nlohmann_json_FOUND
)
if (NLOHMANN_JSON_FOUND)
if (nlohmann_json_FOUND)
add_library(nlohmann_json INTERFACE IMPORTED)
set_target_properties(nlohmann_json PROPERTIES
INTERFACE_COMPILE_OPTIONS "-sUSE_NLOHMANN_JSON=1"