2019-02-08 06:20:03 +03:00
|
|
|
cmake_minimum_required(VERSION 3.11)
|
2018-06-04 13:54:51 +03:00
|
|
|
project(NHEKO_DEPS)
|
|
|
|
|
|
|
|
# Point CMake at any custom modules we may ship
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|
|
|
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE Release)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr"
|
|
|
|
CACHE PATH "Dependencies install directory.")
|
|
|
|
set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin"
|
|
|
|
CACHE PATH "Dependencies binary install directory.")
|
|
|
|
set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib"
|
|
|
|
CACHE PATH "Dependencies library install directory.")
|
|
|
|
set(DEPS_BUILD_DIR "${CMAKE_BINARY_DIR}/build"
|
|
|
|
CACHE PATH "Dependencies build directory.")
|
|
|
|
set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads"
|
|
|
|
CACHE PATH "Dependencies download directory.")
|
|
|
|
|
|
|
|
option(USE_BUNDLED "Use bundled dependencies." ON)
|
|
|
|
|
|
|
|
option(USE_BUNDLED_BOOST "Use the bundled version of Boost." ${USE_BUNDLED})
|
2018-09-11 19:02:36 +03:00
|
|
|
option(USE_BUNDLED_CMARK "Use the bundled version of cmark." ${USE_BUNDLED})
|
2018-06-04 13:54:51 +03:00
|
|
|
option(USE_BUNDLED_SPDLOG "Use the bundled version of spdlog." ${USE_BUNDLED})
|
|
|
|
option(USE_BUNDLED_OLM "Use the bundled version of libolm." ${USE_BUNDLED})
|
2018-07-04 01:38:54 +03:00
|
|
|
option(USE_BUNDLED_TWEENY "Use the bundled version of Tweeny." ${USE_BUNDLED})
|
|
|
|
option(USE_BUNDLED_LMDBXX "Use the bundled version of lmdbxx." ${USE_BUNDLED})
|
2018-06-04 13:54:51 +03:00
|
|
|
option(USE_BUNDLED_MATRIX_CLIENT "Use the bundled version of mtxclient."
|
|
|
|
${USE_BUNDLED})
|
2019-02-24 22:50:31 +03:00
|
|
|
option(USE_BUNDLED_JSON "Use the bundled version of nlohmann json." ${USE_BUNDLED})
|
2019-05-23 05:06:45 +03:00
|
|
|
option(MTX_STATIC "Compile / link bundled mtx client statically" OFF)
|
2018-06-04 13:54:51 +03:00
|
|
|
|
2019-02-08 06:20:03 +03:00
|
|
|
if(USE_BUNDLED_BOOST)
|
2019-02-08 07:04:07 +03:00
|
|
|
# bundled boost is 1.68, which requires CMake 3.12 or greater.
|
|
|
|
cmake_minimum_required(VERSION 3.12)
|
2019-02-08 06:20:03 +03:00
|
|
|
endif()
|
|
|
|
|
2018-06-04 13:54:51 +03:00
|
|
|
include(ExternalProject)
|
|
|
|
|
|
|
|
set(BOOST_URL
|
2019-05-09 04:52:00 +03:00
|
|
|
https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.bz2)
|
2018-06-04 13:54:51 +03:00
|
|
|
set(BOOST_SHA256
|
2019-05-09 04:52:00 +03:00
|
|
|
8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406)
|
2018-06-04 13:54:51 +03:00
|
|
|
|
2018-08-08 14:15:14 +03:00
|
|
|
set(
|
|
|
|
MTXCLIENT_URL
|
2019-08-06 06:00:07 +03:00
|
|
|
https://github.com/Nheko-Reborn/mtxclient/archive/b56083dfa95848c39d9290efdc5544ac07030028.tar.gz
|
2018-08-08 14:15:14 +03:00
|
|
|
)
|
|
|
|
set(MTXCLIENT_HASH
|
2019-08-06 06:00:07 +03:00
|
|
|
486feb1ee9ad5fe2295fa27baaa6c67c9d90cece2435eed19be2630d59552e20)
|
2018-08-08 14:15:14 +03:00
|
|
|
set(
|
|
|
|
TWEENY_URL
|
|
|
|
https://github.com/mobius3/tweeny/archive/b94ce07cfb02a0eb8ac8aaf66137dabdaea857cf.tar.gz
|
|
|
|
)
|
|
|
|
set(TWEENY_HASH
|
|
|
|
9a632b9da84823fae002ad5d9ba02c8d77c0a3810479974c6b637c5504165475)
|
2018-07-04 01:38:54 +03:00
|
|
|
set(
|
|
|
|
LMDBXX_HEADER_URL
|
|
|
|
https://raw.githubusercontent.com/bendiken/lmdbxx/0b43ca87d8cfabba392dfe884eb1edb83874de02/lmdb%2B%2B.h
|
|
|
|
)
|
2018-08-08 14:15:14 +03:00
|
|
|
set(LMDBXX_HASH
|
|
|
|
c57b501a4e8fa1187fa7fd348da415c7685a50a7cb25b17b3f257b9e9426f73d)
|
2018-07-04 01:38:54 +03:00
|
|
|
|
2019-04-19 05:28:58 +03:00
|
|
|
set(OLM_URL https://gitlab.matrix.org/matrix-org/olm.git)
|
2018-06-04 13:54:51 +03:00
|
|
|
set(OLM_TAG 4065c8e11a33ba41133a086ed3de4da94dcb6bae)
|
|
|
|
|
2018-09-11 19:02:36 +03:00
|
|
|
set(CMARK_URL https://github.com/commonmark/cmark/archive/0.28.3.tar.gz)
|
|
|
|
set(CMARK_HASH acc98685d3c1b515ff787ac7c994188dadaf28a2d700c10c1221da4199bae1fc)
|
|
|
|
|
2018-09-01 13:35:10 +03:00
|
|
|
set(SPDLOG_URL https://github.com/gabime/spdlog/archive/v1.1.0.tar.gz)
|
2018-08-08 14:15:14 +03:00
|
|
|
set(SPDLOG_HASH
|
2018-09-01 13:35:10 +03:00
|
|
|
3dbcbfd8c07e25f5e0d662b194d3a7772ef214358c49ada23c044c4747ce8b19)
|
|
|
|
|
2019-02-25 02:23:08 +03:00
|
|
|
set(JSON_URL
|
|
|
|
https://github.com/nlohmann/json.git)
|
|
|
|
set(JSON_TAG
|
|
|
|
v3.2.0)
|
2018-09-01 13:35:10 +03:00
|
|
|
|
2019-02-24 22:50:31 +03:00
|
|
|
if(USE_BUNDLED_JSON)
|
|
|
|
include(Json)
|
|
|
|
endif()
|
2018-06-04 13:54:51 +03:00
|
|
|
|
|
|
|
if(USE_BUNDLED_BOOST)
|
|
|
|
include(Boost)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_BUNDLED_SPDLOG)
|
|
|
|
include(SpdLog)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_BUNDLED_OLM)
|
|
|
|
include(Olm)
|
|
|
|
endif()
|
|
|
|
|
2018-09-11 19:02:36 +03:00
|
|
|
if(USE_BUNDLED_CMARK)
|
|
|
|
include(cmark)
|
|
|
|
endif()
|
|
|
|
|
2018-07-04 01:38:54 +03:00
|
|
|
if(USE_BUNDLED_TWEENY)
|
|
|
|
include(Tweeny)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_BUNDLED_LMDBXX)
|
|
|
|
file(DOWNLOAD ${LMDBXX_HEADER_URL} ${DEPS_INSTALL_DIR}/include/lmdb++.h
|
2018-08-08 14:15:14 +03:00
|
|
|
EXPECTED_HASH SHA256=${LMDBXX_HASH})
|
2018-07-04 01:38:54 +03:00
|
|
|
endif()
|
|
|
|
|
2018-06-04 13:54:51 +03:00
|
|
|
if(WIN32)
|
|
|
|
if("${TARGET_ARCH}" STREQUAL "X86_64")
|
|
|
|
set(TARGET_ARCH x64)
|
|
|
|
elseif(TARGET_ARCH STREQUAL "X86")
|
|
|
|
set(TARGET_ARCH ia32)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_custom_target(third-party ALL
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E touch .third-party
|
|
|
|
DEPENDS ${THIRD_PARTY_DEPS})
|
|
|
|
|
|
|
|
if(USE_BUNDLED_MATRIX_CLIENT)
|
|
|
|
include(MatrixClient)
|
|
|
|
add_dependencies(MatrixClient third-party)
|
|
|
|
endif()
|