1 # External dependencies for the emscripten/wasm32 build. 2 # 3 # The emscripten sysroot ships neither json-c nor libmd, so both are 4 # fetched and built here (included from CMakeLists.txt when UCODE_WASM 5 # is on; toolchain files cannot host this because they are re-included 6 # by every try_compile() probe build). 7 # 8 # json-c uses its own CMake build with two overrides: 9 # -Wno-macro-redefined its math_compat.h redefines NAN/INFINITY/isnan/ 10 # isinf, which emscripten's clang already provides 11 # (a warning with plain emcc, an error under its 12 # -Werror) 13 # -DHAVE_SNPRINTF=1 its snprintf feature check is gated on 14 # "UNIX OR MINGW OR CYGWIN", which the Generic 15 # (wasm32) system does not match 16 # 17 # libmd is autotools-only, so the cmake/deps/libmd wrapper CMakeLists 18 # compiles its sources directly. 19 20 include(ExternalProject) 21 22 set(UCODE_DEPS_PREFIX ${CMAKE_BINARY_DIR}/deps) 23 24 # The imported targets below reference these include directories, which 25 # only get their contents when the external projects build; create them 26 # now so CMake's generate-time path validation passes. 27 file(MAKE_DIRECTORY ${UCODE_DEPS_PREFIX}/json-c/dist/include) 28 file(MAKE_DIRECTORY ${UCODE_DEPS_PREFIX}/libmd/dist/include) 29 30 set(_ucode_toolchain_args "") 31 if(CMAKE_TOOLCHAIN_FILE) 32 list(APPEND _ucode_toolchain_args -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}) 33 endif() 34 35 # --------------------------------------------------------------------------- 36 # json-c 37 # --------------------------------------------------------------------------- 38 ExternalProject_Add(json-c-build 39 PREFIX ${UCODE_DEPS_PREFIX}/json-c 40 GIT_REPOSITORY https://github.com/json-c/json-c.git 41 GIT_TAG json-c-0.18-20240915 42 GIT_SHALLOW 1 43 CMAKE_ARGS 44 -DCMAKE_POLICY_VERSION_MINIMUM=3.5 45 ${_ucode_toolchain_args} 46 -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} 47 -DCMAKE_C_FLAGS:STRING=-Wno-macro-redefined 48 CMAKE_CACHE_ARGS 49 -DCMAKE_INSTALL_PREFIX:STRING=${UCODE_DEPS_PREFIX}/json-c/dist 50 -DCMAKE_INSTALL_LIBDIR:STRING=lib 51 -DBUILD_SHARED_LIBS:STRING=OFF 52 -DBUILD_TESTING:STRING=OFF 53 -DDISABLE_EXTRA_LIBS:STRING=ON 54 -DHAVE_SNPRINTF:STRING=1 55 UPDATE_COMMAND "" 56 ) 57 58 add_library(libjson-c STATIC IMPORTED GLOBAL) 59 set_property(TARGET libjson-c PROPERTY IMPORTED_LOCATION ${UCODE_DEPS_PREFIX}/json-c/dist/lib/libjson-c.a) 60 set_property(TARGET libjson-c PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${UCODE_DEPS_PREFIX}/json-c/dist/include) 61 add_dependencies(libjson-c json-c-build) 62 63 # --------------------------------------------------------------------------- 64 # libmd 65 # --------------------------------------------------------------------------- 66 ExternalProject_Add(libmd-build 67 PREFIX ${UCODE_DEPS_PREFIX}/libmd 68 GIT_REPOSITORY https://git.hadrons.org/git/libmd.git 69 GIT_TAG 1.0.4 70 GIT_SHALLOW 1 71 CONFIGURE_COMMAND ${CMAKE_COMMAND} 72 -S ${CMAKE_CURRENT_SOURCE_DIR}/cmake/deps/libmd 73 -B ${UCODE_DEPS_PREFIX}/libmd/build 74 ${_ucode_toolchain_args} 75 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} 76 -DLIBMD_SRC_DIR=${UCODE_DEPS_PREFIX}/libmd/src/libmd-build 77 -DCMAKE_INSTALL_PREFIX=${UCODE_DEPS_PREFIX}/libmd/dist 78 BUILD_COMMAND ${CMAKE_COMMAND} --build ${UCODE_DEPS_PREFIX}/libmd/build 79 INSTALL_COMMAND ${CMAKE_COMMAND} --install ${UCODE_DEPS_PREFIX}/libmd/build 80 UPDATE_COMMAND "" 81 ) 82 83 add_library(libmd STATIC IMPORTED GLOBAL) 84 set_property(TARGET libmd PROPERTY IMPORTED_LOCATION ${UCODE_DEPS_PREFIX}/libmd/dist/lib/libmd.a) 85 set_property(TARGET libmd PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${UCODE_DEPS_PREFIX}/libmd/dist/include) 86 add_dependencies(libmd libmd-build)
This page was automatically generated by LXR 0.3.1. • OpenWrt