forked from mirror/nheko
parent
70ffa43424
commit
0a9d95dfc9
@ -1,33 +0,0 @@ |
|||||||
include(ExternalProject) |
|
||||||
|
|
||||||
# |
|
||||||
# Build matrix-structs. |
|
||||||
# |
|
||||||
|
|
||||||
set(THIRD_PARTY_ROOT ${CMAKE_SOURCE_DIR}/.third-party) |
|
||||||
set(MATRIX_STRUCTS_ROOT ${THIRD_PARTY_ROOT}/matrix_structs) |
|
||||||
set(MATRIX_STRUCTS_INCLUDE_DIR ${MATRIX_STRUCTS_ROOT}/include) |
|
||||||
set(MATRIX_STRUCTS_LIBRARY matrix_structs) |
|
||||||
|
|
||||||
link_directories(${MATRIX_STRUCTS_ROOT}) |
|
||||||
|
|
||||||
set(WINDOWS_FLAGS "") |
|
||||||
|
|
||||||
if(MSVC) |
|
||||||
set(WINDOWS_FLAGS "-DCMAKE_GENERATOR_PLATFORM=x64") |
|
||||||
endif() |
|
||||||
|
|
||||||
ExternalProject_Add( |
|
||||||
MatrixStructs |
|
||||||
|
|
||||||
GIT_REPOSITORY https://github.com/mujx/matrix-structs |
|
||||||
GIT_TAG 5e57c2385a79b6629d1998fec4a7c0baee23555e |
|
||||||
|
|
||||||
BUILD_IN_SOURCE 1 |
|
||||||
SOURCE_DIR ${MATRIX_STRUCTS_ROOT} |
|
||||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} |
|
||||||
-DCMAKE_BUILD_TYPE=Release ${MATRIX_STRUCTS_ROOT} |
|
||||||
${WINDOWS_FLAGS} |
|
||||||
BUILD_COMMAND ${CMAKE_COMMAND} --build ${MATRIX_STRUCTS_ROOT} --config Release |
|
||||||
INSTALL_COMMAND "" |
|
||||||
) |
|
@ -0,0 +1,82 @@ |
|||||||
|
cmake_minimum_required(VERSION 3.1) |
||||||
|
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}) |
||||||
|
option(USE_BUNDLED_SPDLOG "Use the bundled version of spdlog." ${USE_BUNDLED}) |
||||||
|
option(USE_BUNDLED_OLM "Use the bundled version of libolm." ${USE_BUNDLED}) |
||||||
|
option(USE_BUNDLED_MATRIX_STRUCTS "Use the bundled version of matrix-structs." |
||||||
|
${USE_BUNDLED}) |
||||||
|
option(USE_BUNDLED_MATRIX_CLIENT "Use the bundled version of mtxclient." |
||||||
|
${USE_BUNDLED}) |
||||||
|
|
||||||
|
include(ExternalProject) |
||||||
|
|
||||||
|
set(BOOST_URL |
||||||
|
https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2) |
||||||
|
set(BOOST_SHA256 |
||||||
|
5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9) |
||||||
|
|
||||||
|
set(MATRIX_STRUCTS_URL https://github.com/mujx/matrix-structs) |
||||||
|
set(MATRIX_STRUCTS_TAG eeb7373729a1618e2b3838407863342b88b8a0de) |
||||||
|
|
||||||
|
set(MTXCLIENT_URL https://github.com/mujx/mtxclient) |
||||||
|
set(MTXCLIENT_TAG 219d2a8887376122e76ba0f64c0cc9935f62f308) |
||||||
|
|
||||||
|
set(OLM_URL https://git.matrix.org/git/olm.git) |
||||||
|
set(OLM_TAG 4065c8e11a33ba41133a086ed3de4da94dcb6bae) |
||||||
|
|
||||||
|
set(SPDLOG_URL https://github.com/gabime/spdlog) |
||||||
|
set(SPDLOG_TAG 560df2878ad308b27873b3cc5e810635d69cfad6) |
||||||
|
|
||||||
|
if(USE_BUNDLED_BOOST) |
||||||
|
include(Boost) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(USE_BUNDLED_SPDLOG) |
||||||
|
include(SpdLog) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(USE_BUNDLED_OLM) |
||||||
|
include(Olm) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(USE_BUNDLED_MATRIX_STRUCTS) |
||||||
|
include(MatrixStructs) |
||||||
|
endif() |
||||||
|
|
||||||
|
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() |
@ -0,0 +1,23 @@ |
|||||||
|
if(WIN32) |
||||||
|
message(STATUS "Building Boost in Windows is not supported (skipping)") |
||||||
|
return() |
||||||
|
endif() |
||||||
|
|
||||||
|
ExternalProject_Add( |
||||||
|
Boost |
||||||
|
|
||||||
|
URL ${BOOST_URL} |
||||||
|
URL_HASH SHA256=${BOOST_SHA256} |
||||||
|
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/boost |
||||||
|
DOWNLOAD_NO_PROGRESS 0 |
||||||
|
|
||||||
|
BUILD_IN_SOURCE 1 |
||||||
|
SOURCE_DIR ${DEPS_BUILD_DIR}/boost |
||||||
|
CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/boost/bootstrap.sh |
||||||
|
--with-libraries=random,thread,system,iostreams,atomic,chrono,date_time,regex |
||||||
|
--prefix=${DEPS_INSTALL_DIR} |
||||||
|
BUILD_COMMAND ${DEPS_BUILD_DIR}/boost/b2 -d0 variant=release link=static threading=multi --layout=system |
||||||
|
INSTALL_COMMAND ${DEPS_BUILD_DIR}/boost/b2 -d0 install |
||||||
|
) |
||||||
|
|
||||||
|
list(APPEND THIRD_PARTY_DEPS Boost) |
@ -0,0 +1,30 @@ |
|||||||
|
set(PLATFORM_FLAGS "") |
||||||
|
|
||||||
|
if(MSVC) |
||||||
|
set(PLATFORM_FLAGS "-DCMAKE_GENERATOR_PLATFORM=x64") |
||||||
|
endif() |
||||||
|
|
||||||
|
if(APPLE) |
||||||
|
set(PLATFORM_FLAGS "-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl") |
||||||
|
endif() |
||||||
|
|
||||||
|
ExternalProject_Add( |
||||||
|
MatrixClient |
||||||
|
|
||||||
|
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/mtxclient |
||||||
|
GIT_REPOSITORY ${MTXCLIENT_URL} |
||||||
|
GIT_TAG ${MTXCLIENT_TAG} |
||||||
|
|
||||||
|
BUILD_IN_SOURCE 1 |
||||||
|
SOURCE_DIR ${DEPS_BUILD_DIR}/mtxclient |
||||||
|
CONFIGURE_COMMAND ${CMAKE_COMMAND} |
||||||
|
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} |
||||||
|
-DCMAKE_BUILD_TYPE=Release |
||||||
|
-DBUILD_LIB_TESTS=OFF |
||||||
|
-DBUILD_LIB_EXAMPLES=OFF |
||||||
|
${PLATFORM_FLAGS} |
||||||
|
${DEPS_BUILD_DIR}/mtxclient |
||||||
|
BUILD_COMMAND |
||||||
|
${CMAKE_COMMAND} --build ${DEPS_BUILD_DIR}/mtxclient --config Release) |
||||||
|
|
||||||
|
list(APPEND THIRD_PARTY_DEPS MatrixClient) |
@ -0,0 +1,25 @@ |
|||||||
|
set(WINDOWS_FLAGS "") |
||||||
|
|
||||||
|
if(MSVC) |
||||||
|
set(WINDOWS_FLAGS "-DCMAKE_GENERATOR_PLATFORM=x64") |
||||||
|
endif() |
||||||
|
|
||||||
|
ExternalProject_Add( |
||||||
|
MatrixStructs |
||||||
|
|
||||||
|
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/matrix_structs |
||||||
|
GIT_REPOSITORY ${MATRIX_STRUCTS_URL} |
||||||
|
GIT_TAG ${MATRIX_STRUCTS_TAG} |
||||||
|
|
||||||
|
BUILD_IN_SOURCE 1 |
||||||
|
SOURCE_DIR ${DEPS_BUILD_DIR}/matrix_structs |
||||||
|
CONFIGURE_COMMAND ${CMAKE_COMMAND} |
||||||
|
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} |
||||||
|
-DCMAKE_BUILD_TYPE=Release |
||||||
|
${DEPS_BUILD_DIR}/matrix_structs |
||||||
|
${WINDOWS_FLAGS} |
||||||
|
BUILD_COMMAND ${CMAKE_COMMAND} |
||||||
|
--build ${DEPS_BUILD_DIR}/matrix_structs |
||||||
|
--config Release) |
||||||
|
|
||||||
|
list(APPEND THIRD_PARTY_DEPS MatrixStructs) |
@ -0,0 +1,24 @@ |
|||||||
|
if(MSVC) |
||||||
|
set(MAKE_CMD "mingw32-make.exe") |
||||||
|
else() |
||||||
|
set(MAKE_CMD "make") |
||||||
|
endif() |
||||||
|
|
||||||
|
set(OLM_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}olm${CMAKE_STATIC_LIBRARY_SUFFIX}") |
||||||
|
|
||||||
|
ExternalProject_Add( |
||||||
|
Olm |
||||||
|
|
||||||
|
GIT_REPOSITORY ${OLM_URL} |
||||||
|
GIT_TAG ${OLM_TAG} |
||||||
|
|
||||||
|
BUILD_IN_SOURCE 1 |
||||||
|
SOURCE_DIR ${DEPS_BUILD_DIR}/olm |
||||||
|
CONFIGURE_COMMAND "" |
||||||
|
BUILD_COMMAND ${MAKE_CMD} static |
||||||
|
INSTALL_COMMAND |
||||||
|
cp -R ${DEPS_BUILD_DIR}/olm/include ${DEPS_INSTALL_DIR} && |
||||||
|
cp ${DEPS_BUILD_DIR}/olm/build/libolm.a ${DEPS_INSTALL_DIR}/lib |
||||||
|
) |
||||||
|
|
||||||
|
list(APPEND THIRD_PARTY_DEPS Olm) |
@ -0,0 +1,15 @@ |
|||||||
|
ExternalProject_Add( |
||||||
|
SpdLog |
||||||
|
|
||||||
|
GIT_REPOSITORY ${SPDLOG_URL} |
||||||
|
GIT_TAG ${SPDLOG_TAG} |
||||||
|
|
||||||
|
BUILD_IN_SOURCE 1 |
||||||
|
SOURCE_DIR ${DEPS_BUILD_DIR}/spdlog |
||||||
|
CONFIGURE_COMMAND ${CMAKE_COMMAND} |
||||||
|
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} |
||||||
|
-DCMAKE_BUILD_TYPE=Release |
||||||
|
${DEPS_BUILD_DIR}/spdlog |
||||||
|
) |
||||||
|
|
||||||
|
list(APPEND THIRD_PARTY_DEPS SpdLog) |
Loading…
Reference in new issue