Some clean-up and preparation for multi-target builds

This commit is contained in:
Sebastian J. Wolf 2020-09-26 15:53:47 +02:00
parent ee5451027a
commit a5c2b34a86
6 changed files with 6 additions and 353 deletions

View file

@ -20,7 +20,7 @@ const char TDLIB_API_HASH[] = "1234567890abcdef1234567890abcdef";
You get the Telegram API ID and hash as soon as you've registered your own application on [https://my.telegram.org](https://my.telegram.org).
Moreover, you need to have a compiled version of [TDLib](https://github.com/tdlib/td) in the subfolder `tdlib/lib` that fits to the target device architecture (e.g. armv7hl) as this repository only includes the header and make files of TDLib.
Moreover, you need to have a compiled version of [TDLib](https://github.com/tdlib/td) in the sub-directory `tdlib`. This sub-directory must contain another sub-directory that fits to the target device architecture (e.g. armv7hl, i486). Within this directory, there needs to be a folder called `lib` that contains at least `libtdjson.so`. For armv7hl the relative path would consequently be `tdlib/armv7hl/lib`. Before compiling the project, be sure to set the target architecture in the project file `harbour-fernschreiber.pro` correctly using the variable `TARGET_ARCHITECTURE`. This can most certainly be automated. Pull requests welcome! ;)
## Credits
This project uses

View file

@ -56,12 +56,13 @@ TRANSLATIONS += translations/harbour-fernschreiber-de.ts \
translations/harbour-fernschreiber-pl.ts \
translations/harbour-fernschreiber-zh_CN.ts
LIBS += -L$$PWD/tdlib/lib/ -ltdjson
# Use armv7hl for most devices and i486 for emulator and Jolla Tablet. Can most certainly be automated... ;)
TARGET_ARCHITECTURE = i486
INCLUDEPATH += $$PWD/tdlib/include
DEPENDPATH += $$PWD/tdlib/include
telegram.files = $$PWD/tdlib/lib
LIBS += -L$$PWD/tdlib/$${TARGET_ARCHITECTURE}/lib/ -ltdjson
telegram.files = $$PWD/tdlib/$${TARGET_ARCHITECTURE}/lib
telegram.path = /usr/share/$${TARGET}
gui.files = qml
@ -102,3 +103,4 @@ HEADERS += \
src/tdlibreceiver.h \
src/tdlibsecrets.h \
src/tdlibwrapper.h

View file

@ -1,3 +0,0 @@
include(CMakeFindDependencyMacro)
#TODO: write all external dependencies
include("${CMAKE_CURRENT_LIST_DIR}/TdTargets.cmake")

View file

@ -1,47 +0,0 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is equal to the requested version.
# The tweak version component is ignored.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "1.6.0")
if("1.6.0" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(CVF_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_NO_TWEAK "1.6.0")
endif()
if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}")
endif()
if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "4" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "4")
math(EXPR installedBits "4 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View file

@ -1,109 +0,0 @@
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Release".
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "Td::tdutils" for configuration "Release"
set_property(TARGET Td::tdutils APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdutils PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdutils.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdutils )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdutils "${_IMPORT_PREFIX}/lib/libtdutils.a" )
# Import target "Td::tdactor" for configuration "Release"
set_property(TARGET Td::tdactor APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdactor PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdactor.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdactor )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdactor "${_IMPORT_PREFIX}/lib/libtdactor.a" )
# Import target "Td::tdnet" for configuration "Release"
set_property(TARGET Td::tdnet APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdnet PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdnet.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdnet )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdnet "${_IMPORT_PREFIX}/lib/libtdnet.a" )
# Import target "Td::tdsqlite" for configuration "Release"
set_property(TARGET Td::tdsqlite APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdsqlite PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdsqlite.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdsqlite )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdsqlite "${_IMPORT_PREFIX}/lib/libtdsqlite.a" )
# Import target "Td::tddb" for configuration "Release"
set_property(TARGET Td::tddb APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tddb PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtddb.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tddb )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tddb "${_IMPORT_PREFIX}/lib/libtddb.a" )
# Import target "Td::tdjson" for configuration "Release"
set_property(TARGET Td::tdjson APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdjson PROPERTIES
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdjson.so.1.6.0"
IMPORTED_SONAME_RELEASE "libtdjson.so.1.6.0"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdjson )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdjson "${_IMPORT_PREFIX}/lib/libtdjson.so.1.6.0" )
# Import target "Td::tdjson_static" for configuration "Release"
set_property(TARGET Td::tdjson_static APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdjson_static PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdjson_static.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdjson_static )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdjson_static "${_IMPORT_PREFIX}/lib/libtdjson_static.a" )
# Import target "Td::tdjson_private" for configuration "Release"
set_property(TARGET Td::tdjson_private APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdjson_private PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdjson_private.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdjson_private )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdjson_private "${_IMPORT_PREFIX}/lib/libtdjson_private.a" )
# Import target "Td::tdclient" for configuration "Release"
set_property(TARGET Td::tdclient APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdclient PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdclient.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdclient )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdclient "${_IMPORT_PREFIX}/lib/libtdclient.a" )
# Import target "Td::tdcore" for configuration "Release"
set_property(TARGET Td::tdcore APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdcore PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdcore.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdcore )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdcore "${_IMPORT_PREFIX}/lib/libtdcore.a" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

View file

@ -1,190 +0,0 @@
# Generated by CMake
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget Td::tdutils Td::tdactor Td::tdnet Td::tdsqlite Td::tddb Td::tdjson Td::TdJson Td::tdjson_static Td::TdJsonStatic Td::tdjson_private Td::tdclient Td::tdcore Td::TdStatic)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
endif()
if(TARGET ${_expectedTarget})
list(APPEND _targetsDefined ${_expectedTarget})
endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
# Create imported target Td::tdutils
add_library(Td::tdutils STATIC IMPORTED)
set_target_properties(Td::tdutils PROPERTIES
INTERFACE_LINK_LIBRARIES "-pthread;/usr/lib/libcrypto.so;\$<LINK_ONLY:dl>;/usr/lib/libz.so;/usr/lib/libz.so"
)
# Create imported target Td::tdactor
add_library(Td::tdactor STATIC IMPORTED)
set_target_properties(Td::tdactor PROPERTIES
INTERFACE_LINK_LIBRARIES "Td::tdutils"
)
# Create imported target Td::tdnet
add_library(Td::tdnet STATIC IMPORTED)
set_target_properties(Td::tdnet PROPERTIES
INTERFACE_LINK_LIBRARIES "Td::tdutils;Td::tdactor;\$<LINK_ONLY:dl>;/usr/lib/libz.so;/usr/lib/libssl.so;/usr/lib/libcrypto.so"
)
# Create imported target Td::tdsqlite
add_library(Td::tdsqlite STATIC IMPORTED)
set_target_properties(Td::tdsqlite PROPERTIES
INTERFACE_LINK_LIBRARIES "/usr/lib/libcrypto.so;\$<LINK_ONLY:dl>;/usr/lib/libz.so"
)
# Create imported target Td::tddb
add_library(Td::tddb STATIC IMPORTED)
set_target_properties(Td::tddb PROPERTIES
INTERFACE_LINK_LIBRARIES "Td::tdactor;Td::tdutils;\$<LINK_ONLY:Td::tdsqlite>"
)
# Create imported target Td::tdjson
add_library(Td::tdjson SHARED IMPORTED)
set_target_properties(Td::tdjson PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)
# Create imported target Td::TdJson
add_library(Td::TdJson INTERFACE IMPORTED)
set_target_properties(Td::TdJson PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "Td::tdjson"
)
# Create imported target Td::tdjson_static
add_library(Td::tdjson_static STATIC IMPORTED)
set_target_properties(Td::tdjson_static PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "TDJSON_STATIC_DEFINE"
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Td::tdjson_private>"
)
# Create imported target Td::TdJsonStatic
add_library(Td::TdJsonStatic INTERFACE IMPORTED)
set_target_properties(Td::TdJsonStatic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "Td::tdjson_static"
)
# Create imported target Td::tdjson_private
add_library(Td::tdjson_private STATIC IMPORTED)
set_target_properties(Td::tdjson_private PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "Td::tdclient;Td::tdutils"
)
# Create imported target Td::tdclient
add_library(Td::tdclient STATIC IMPORTED)
set_target_properties(Td::tdclient PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Td::tdcore>"
)
# Create imported target Td::tdcore
add_library(Td::tdcore STATIC IMPORTED)
set_target_properties(Td::tdcore PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "Td::tdactor;Td::tdutils;Td::tdnet;Td::tddb;/usr/lib/libcrypto.so;\$<LINK_ONLY:dl>;/usr/lib/libz.so"
)
# Create imported target Td::TdStatic
add_library(Td::TdStatic INTERFACE IMPORTED)
set_target_properties(Td::TdStatic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "Td::tdclient"
)
if(CMAKE_VERSION VERSION_LESS 3.0.0)
message(FATAL_ERROR "This file relies on consumers using CMake 3.0.0 or greater.")
endif()
# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/TdTargets-*.cmake")
foreach(f ${CONFIG_FILES})
include(${f})
endforeach()
# Cleanup temporary variables.
set(_IMPORT_PREFIX)
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
if(NOT EXISTS "${file}" )
message(FATAL_ERROR "The imported target \"${target}\" references the file
\"${file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)
# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)