| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- # External dependencies via FetchContent
- include(FetchContent)
- cmake_policy(SET CMP0135 NEW)
- # cpp-httplib v0.18.3 (header-only)
- FetchContent_Declare(
- httplib
- URL https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.18.3.tar.gz
- DOWNLOAD_EXTRACT_TIMESTAMP TRUE
- )
- FetchContent_MakeAvailable(httplib)
- # QuickJS - using bellard's official release
- FetchContent_Declare(
- quickjs
- URL https://bellard.org/quickjs/quickjs-2024-01-13.tar.xz
- DOWNLOAD_EXTRACT_TIMESTAMP TRUE
- )
- FetchContent_MakeAvailable(quickjs)
- # Build QuickJS as a static library
- add_library(quickjs_lib STATIC
- ${quickjs_SOURCE_DIR}/quickjs.c
- ${quickjs_SOURCE_DIR}/libbf.c
- ${quickjs_SOURCE_DIR}/libregexp.c
- ${quickjs_SOURCE_DIR}/libunicode.c
- ${quickjs_SOURCE_DIR}/cutils.c
- )
- target_include_directories(quickjs_lib PUBLIC ${quickjs_SOURCE_DIR})
- target_compile_definitions(quickjs_lib PRIVATE
- CONFIG_VERSION="2024-01-13"
- CONFIG_BIGNUM
- )
- # Disable some warnings for QuickJS C code
- if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
- target_compile_options(quickjs_lib PRIVATE
- -Wno-sign-compare
- -Wno-unused-variable
- -Wno-implicit-fallthrough
- -Wno-missing-field-initializers
- )
- endif()
- # libbcrypt for password hashing - download only, don't use their CMakeLists
- FetchContent_Declare(
- bcrypt
- URL https://github.com/trusch/libbcrypt/archive/refs/heads/master.tar.gz
- DOWNLOAD_EXTRACT_TIMESTAMP TRUE
- )
- FetchContent_GetProperties(bcrypt)
- if(NOT bcrypt_POPULATED)
- FetchContent_Populate(bcrypt)
- endif()
- add_library(bcrypt_lib STATIC
- ${bcrypt_SOURCE_DIR}/src/bcrypt.c
- ${bcrypt_SOURCE_DIR}/src/crypt_blowfish.c
- ${bcrypt_SOURCE_DIR}/src/crypt_gensalt.c
- ${bcrypt_SOURCE_DIR}/src/wrapper.c
- )
- target_include_directories(bcrypt_lib PUBLIC
- ${bcrypt_SOURCE_DIR}/include
- ${bcrypt_SOURCE_DIR}/include/bcrypt
- )
|