status-desktop/libs/StatusGoQt/CMakeLists.txt

144 lines
4.0 KiB
CMake
Raw Normal View History

chore(CPP): Basic project configuration setup using Qt6 Considerations - Use versioned files. Versioned Qt CMake APIs are disabled to force explicit calls and say that we don't support older `QT`s - Don't use blobbing. Use `target_sources` and `qt_target_qml_sources` - Distribute `CMake` definitions closer to the context: main folders with their own `CMakeLists.txt` - Everything in libraries under `Status` namespace for cleaner code. - Includes are exposed with Module folder externally and without prefix internally - File/Folders name matches definitions they contain for uniformity that leads to cleaner code - All source files (cpp, qml, js ...) have to be added to one of the CMakeLists.txt files to be tracked by CMake build system. - Use BUILD_DEBUG, BUILD_RELEASE and BUILD_DEVELOPMENT variables from Helpers library - Avoid Include directories. Not needed anymore CMake `target_*` APIs handles this through `INTERFACE`, `PUBLIC` and `PRIVATE` scope identifiers - `StatusQ` is meant to be compiled as an external library, therefore StatusQ tests are kept inside its own directory - Forced CMake version to `3.21` for the latest features and fixes. It is desired to be kept as recent as possible due to its backward compatibility. Following Qt's shipped version might be an option - Depends on status-go changes to allow forcing of arm for apple silicon Found limitations to CMake Qt API with Qt 6.3 - Having `0` as major version when using `qt_add_qml_module` doesn't work. Qml engine reports loading the `qmldir` but won't load the plugin library and no error is reported outside that exposed types are not found. - `qt_target_qml_sources` doesn't work now, it generate a double copy error when deploying qml files in bin-directory. For now we stick with adding files using `qt_add_qml_module` central place - Need to add `OUTPUT_DIRECTORY` to `qt_add_qml_module` to use the workaround - If `MACOSX_BUNDLE` target property is set breaks importing of QML files. Disabled until fixed or workaround found - For an unknown reason application executable tries to include the `QML_ELEMENT` include files, therefore for now I include all the C++ qml elements in INTERFACE
2022-05-10 20:10:34 +00:00
# Light helpers library expected to be used by all other libraries
#
cmake_minimum_required(VERSION 3.21)
project(StatusGoQt
VERSION 0.1.0
LANGUAGES CXX)
set(QT_NO_CREATE_VERSIONLESS_FUNCTIONS true)
find_package(nlohmann_json 3.10.5 REQUIRED)
find_package(Boost)
find_package(Qt6 ${STATUS_QT_VERSION} COMPONENTS Core Concurrent Gui REQUIRED)
chore(CPP): Basic project configuration setup using Qt6 Considerations - Use versioned files. Versioned Qt CMake APIs are disabled to force explicit calls and say that we don't support older `QT`s - Don't use blobbing. Use `target_sources` and `qt_target_qml_sources` - Distribute `CMake` definitions closer to the context: main folders with their own `CMakeLists.txt` - Everything in libraries under `Status` namespace for cleaner code. - Includes are exposed with Module folder externally and without prefix internally - File/Folders name matches definitions they contain for uniformity that leads to cleaner code - All source files (cpp, qml, js ...) have to be added to one of the CMakeLists.txt files to be tracked by CMake build system. - Use BUILD_DEBUG, BUILD_RELEASE and BUILD_DEVELOPMENT variables from Helpers library - Avoid Include directories. Not needed anymore CMake `target_*` APIs handles this through `INTERFACE`, `PUBLIC` and `PRIVATE` scope identifiers - `StatusQ` is meant to be compiled as an external library, therefore StatusQ tests are kept inside its own directory - Forced CMake version to `3.21` for the latest features and fixes. It is desired to be kept as recent as possible due to its backward compatibility. Following Qt's shipped version might be an option - Depends on status-go changes to allow forcing of arm for apple silicon Found limitations to CMake Qt API with Qt 6.3 - Having `0` as major version when using `qt_add_qml_module` doesn't work. Qml engine reports loading the `qmldir` but won't load the plugin library and no error is reported outside that exposed types are not found. - `qt_target_qml_sources` doesn't work now, it generate a double copy error when deploying qml files in bin-directory. For now we stick with adding files using `qt_add_qml_module` central place - Need to add `OUTPUT_DIRECTORY` to `qt_add_qml_module` to use the workaround - If `MACOSX_BUNDLE` target property is set breaks importing of QML files. Disabled until fixed or workaround found - For an unknown reason application executable tries to include the `QML_ELEMENT` include files, therefore for now I include all the C++ qml elements in INTERFACE
2022-05-10 20:10:34 +00:00
qt6_standard_project_setup()
add_library(${PROJECT_NAME} SHARED)
chore(CPP): Basic project configuration setup using Qt6 Considerations - Use versioned files. Versioned Qt CMake APIs are disabled to force explicit calls and say that we don't support older `QT`s - Don't use blobbing. Use `target_sources` and `qt_target_qml_sources` - Distribute `CMake` definitions closer to the context: main folders with their own `CMakeLists.txt` - Everything in libraries under `Status` namespace for cleaner code. - Includes are exposed with Module folder externally and without prefix internally - File/Folders name matches definitions they contain for uniformity that leads to cleaner code - All source files (cpp, qml, js ...) have to be added to one of the CMakeLists.txt files to be tracked by CMake build system. - Use BUILD_DEBUG, BUILD_RELEASE and BUILD_DEVELOPMENT variables from Helpers library - Avoid Include directories. Not needed anymore CMake `target_*` APIs handles this through `INTERFACE`, `PUBLIC` and `PRIVATE` scope identifiers - `StatusQ` is meant to be compiled as an external library, therefore StatusQ tests are kept inside its own directory - Forced CMake version to `3.21` for the latest features and fixes. It is desired to be kept as recent as possible due to its backward compatibility. Following Qt's shipped version might be an option - Depends on status-go changes to allow forcing of arm for apple silicon Found limitations to CMake Qt API with Qt 6.3 - Having `0` as major version when using `qt_add_qml_module` doesn't work. Qml engine reports loading the `qmldir` but won't load the plugin library and no error is reported outside that exposed types are not found. - `qt_target_qml_sources` doesn't work now, it generate a double copy error when deploying qml files in bin-directory. For now we stick with adding files using `qt_add_qml_module` central place - Need to add `OUTPUT_DIRECTORY` to `qt_add_qml_module` to use the workaround - If `MACOSX_BUNDLE` target property is set breaks importing of QML files. Disabled until fixed or workaround found - For an unknown reason application executable tries to include the `QML_ELEMENT` include files, therefore for now I include all the C++ qml elements in INTERFACE
2022-05-10 20:10:34 +00:00
# Use by linker only
set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS Debug)
target_link_libraries(${PROJECT_NAME}
PUBLIC
Status::Helpers
Boost::headers
PRIVATE
Qt6::Gui
chore(CPP): Basic project configuration setup using Qt6 Considerations - Use versioned files. Versioned Qt CMake APIs are disabled to force explicit calls and say that we don't support older `QT`s - Don't use blobbing. Use `target_sources` and `qt_target_qml_sources` - Distribute `CMake` definitions closer to the context: main folders with their own `CMakeLists.txt` - Everything in libraries under `Status` namespace for cleaner code. - Includes are exposed with Module folder externally and without prefix internally - File/Folders name matches definitions they contain for uniformity that leads to cleaner code - All source files (cpp, qml, js ...) have to be added to one of the CMakeLists.txt files to be tracked by CMake build system. - Use BUILD_DEBUG, BUILD_RELEASE and BUILD_DEVELOPMENT variables from Helpers library - Avoid Include directories. Not needed anymore CMake `target_*` APIs handles this through `INTERFACE`, `PUBLIC` and `PRIVATE` scope identifiers - `StatusQ` is meant to be compiled as an external library, therefore StatusQ tests are kept inside its own directory - Forced CMake version to `3.21` for the latest features and fixes. It is desired to be kept as recent as possible due to its backward compatibility. Following Qt's shipped version might be an option - Depends on status-go changes to allow forcing of arm for apple silicon Found limitations to CMake Qt API with Qt 6.3 - Having `0` as major version when using `qt_add_qml_module` doesn't work. Qml engine reports loading the `qmldir` but won't load the plugin library and no error is reported outside that exposed types are not found. - `qt_target_qml_sources` doesn't work now, it generate a double copy error when deploying qml files in bin-directory. For now we stick with adding files using `qt_add_qml_module` central place - Need to add `OUTPUT_DIRECTORY` to `qt_add_qml_module` to use the workaround - If `MACOSX_BUNDLE` target property is set breaks importing of QML files. Disabled until fixed or workaround found - For an unknown reason application executable tries to include the `QML_ELEMENT` include files, therefore for now I include all the C++ qml elements in INTERFACE
2022-05-10 20:10:34 +00:00
Qt6::Core
Qt6::Concurrent
chore(CPP): Basic project configuration setup using Qt6 Considerations - Use versioned files. Versioned Qt CMake APIs are disabled to force explicit calls and say that we don't support older `QT`s - Don't use blobbing. Use `target_sources` and `qt_target_qml_sources` - Distribute `CMake` definitions closer to the context: main folders with their own `CMakeLists.txt` - Everything in libraries under `Status` namespace for cleaner code. - Includes are exposed with Module folder externally and without prefix internally - File/Folders name matches definitions they contain for uniformity that leads to cleaner code - All source files (cpp, qml, js ...) have to be added to one of the CMakeLists.txt files to be tracked by CMake build system. - Use BUILD_DEBUG, BUILD_RELEASE and BUILD_DEVELOPMENT variables from Helpers library - Avoid Include directories. Not needed anymore CMake `target_*` APIs handles this through `INTERFACE`, `PUBLIC` and `PRIVATE` scope identifiers - `StatusQ` is meant to be compiled as an external library, therefore StatusQ tests are kept inside its own directory - Forced CMake version to `3.21` for the latest features and fixes. It is desired to be kept as recent as possible due to its backward compatibility. Following Qt's shipped version might be an option - Depends on status-go changes to allow forcing of arm for apple silicon Found limitations to CMake Qt API with Qt 6.3 - Having `0` as major version when using `qt_add_qml_module` doesn't work. Qml engine reports loading the `qmldir` but won't load the plugin library and no error is reported outside that exposed types are not found. - `qt_target_qml_sources` doesn't work now, it generate a double copy error when deploying qml files in bin-directory. For now we stick with adding files using `qt_add_qml_module` central place - Need to add `OUTPUT_DIRECTORY` to `qt_add_qml_module` to use the workaround - If `MACOSX_BUNDLE` target property is set breaks importing of QML files. Disabled until fixed or workaround found - For an unknown reason application executable tries to include the `QML_ELEMENT` include files, therefore for now I include all the C++ qml elements in INTERFACE
2022-05-10 20:10:34 +00:00
nlohmann_json::nlohmann_json
chore(CPP): Basic project configuration setup using Qt6 Considerations - Use versioned files. Versioned Qt CMake APIs are disabled to force explicit calls and say that we don't support older `QT`s - Don't use blobbing. Use `target_sources` and `qt_target_qml_sources` - Distribute `CMake` definitions closer to the context: main folders with their own `CMakeLists.txt` - Everything in libraries under `Status` namespace for cleaner code. - Includes are exposed with Module folder externally and without prefix internally - File/Folders name matches definitions they contain for uniformity that leads to cleaner code - All source files (cpp, qml, js ...) have to be added to one of the CMakeLists.txt files to be tracked by CMake build system. - Use BUILD_DEBUG, BUILD_RELEASE and BUILD_DEVELOPMENT variables from Helpers library - Avoid Include directories. Not needed anymore CMake `target_*` APIs handles this through `INTERFACE`, `PUBLIC` and `PRIVATE` scope identifiers - `StatusQ` is meant to be compiled as an external library, therefore StatusQ tests are kept inside its own directory - Forced CMake version to `3.21` for the latest features and fixes. It is desired to be kept as recent as possible due to its backward compatibility. Following Qt's shipped version might be an option - Depends on status-go changes to allow forcing of arm for apple silicon Found limitations to CMake Qt API with Qt 6.3 - Having `0` as major version when using `qt_add_qml_module` doesn't work. Qml engine reports loading the `qmldir` but won't load the plugin library and no error is reported outside that exposed types are not found. - `qt_target_qml_sources` doesn't work now, it generate a double copy error when deploying qml files in bin-directory. For now we stick with adding files using `qt_add_qml_module` central place - Need to add `OUTPUT_DIRECTORY` to `qt_add_qml_module` to use the workaround - If `MACOSX_BUNDLE` target property is set breaks importing of QML files. Disabled until fixed or workaround found - For an unknown reason application executable tries to include the `QML_ELEMENT` include files, therefore for now I include all the C++ qml elements in INTERFACE
2022-05-10 20:10:34 +00:00
statusgo_shared
)
add_library(Status::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
chore(CPP): Basic project configuration setup using Qt6 Considerations - Use versioned files. Versioned Qt CMake APIs are disabled to force explicit calls and say that we don't support older `QT`s - Don't use blobbing. Use `target_sources` and `qt_target_qml_sources` - Distribute `CMake` definitions closer to the context: main folders with their own `CMakeLists.txt` - Everything in libraries under `Status` namespace for cleaner code. - Includes are exposed with Module folder externally and without prefix internally - File/Folders name matches definitions they contain for uniformity that leads to cleaner code - All source files (cpp, qml, js ...) have to be added to one of the CMakeLists.txt files to be tracked by CMake build system. - Use BUILD_DEBUG, BUILD_RELEASE and BUILD_DEVELOPMENT variables from Helpers library - Avoid Include directories. Not needed anymore CMake `target_*` APIs handles this through `INTERFACE`, `PUBLIC` and `PRIVATE` scope identifiers - `StatusQ` is meant to be compiled as an external library, therefore StatusQ tests are kept inside its own directory - Forced CMake version to `3.21` for the latest features and fixes. It is desired to be kept as recent as possible due to its backward compatibility. Following Qt's shipped version might be an option - Depends on status-go changes to allow forcing of arm for apple silicon Found limitations to CMake Qt API with Qt 6.3 - Having `0` as major version when using `qt_add_qml_module` doesn't work. Qml engine reports loading the `qmldir` but won't load the plugin library and no error is reported outside that exposed types are not found. - `qt_target_qml_sources` doesn't work now, it generate a double copy error when deploying qml files in bin-directory. For now we stick with adding files using `qt_add_qml_module` central place - Need to add `OUTPUT_DIRECTORY` to `qt_add_qml_module` to use the workaround - If `MACOSX_BUNDLE` target property is set breaks importing of QML files. Disabled until fixed or workaround found - For an unknown reason application executable tries to include the `QML_ELEMENT` include files, therefore for now I include all the C++ qml elements in INTERFACE
2022-05-10 20:10:34 +00:00
target_include_directories(${PROJECT_NAME}
PRIVATE
src/StatusGo
# TODO: Workaround to QML_ELEMENT Qt6
INTERFACE
src/StatusGo
PUBLIC
src
)
add_subdirectory(tests)
chore(CPP): Basic project configuration setup using Qt6 Considerations - Use versioned files. Versioned Qt CMake APIs are disabled to force explicit calls and say that we don't support older `QT`s - Don't use blobbing. Use `target_sources` and `qt_target_qml_sources` - Distribute `CMake` definitions closer to the context: main folders with their own `CMakeLists.txt` - Everything in libraries under `Status` namespace for cleaner code. - Includes are exposed with Module folder externally and without prefix internally - File/Folders name matches definitions they contain for uniformity that leads to cleaner code - All source files (cpp, qml, js ...) have to be added to one of the CMakeLists.txt files to be tracked by CMake build system. - Use BUILD_DEBUG, BUILD_RELEASE and BUILD_DEVELOPMENT variables from Helpers library - Avoid Include directories. Not needed anymore CMake `target_*` APIs handles this through `INTERFACE`, `PUBLIC` and `PRIVATE` scope identifiers - `StatusQ` is meant to be compiled as an external library, therefore StatusQ tests are kept inside its own directory - Forced CMake version to `3.21` for the latest features and fixes. It is desired to be kept as recent as possible due to its backward compatibility. Following Qt's shipped version might be an option - Depends on status-go changes to allow forcing of arm for apple silicon Found limitations to CMake Qt API with Qt 6.3 - Having `0` as major version when using `qt_add_qml_module` doesn't work. Qml engine reports loading the `qmldir` but won't load the plugin library and no error is reported outside that exposed types are not found. - `qt_target_qml_sources` doesn't work now, it generate a double copy error when deploying qml files in bin-directory. For now we stick with adding files using `qt_add_qml_module` central place - Need to add `OUTPUT_DIRECTORY` to `qt_add_qml_module` to use the workaround - If `MACOSX_BUNDLE` target property is set breaks importing of QML files. Disabled until fixed or workaround found - For an unknown reason application executable tries to include the `QML_ELEMENT` include files, therefore for now I include all the C++ qml elements in INTERFACE
2022-05-10 20:10:34 +00:00
# Copy status-go lib close to the executable
# Temporary workaround; TODO: see a better alternative that doesn't depend on target order (dedicated dependencies dir?)
# and current directory (on mac). Use bundle or set rpath relative to executable
chore(CPP): Basic project configuration setup using Qt6 Considerations - Use versioned files. Versioned Qt CMake APIs are disabled to force explicit calls and say that we don't support older `QT`s - Don't use blobbing. Use `target_sources` and `qt_target_qml_sources` - Distribute `CMake` definitions closer to the context: main folders with their own `CMakeLists.txt` - Everything in libraries under `Status` namespace for cleaner code. - Includes are exposed with Module folder externally and without prefix internally - File/Folders name matches definitions they contain for uniformity that leads to cleaner code - All source files (cpp, qml, js ...) have to be added to one of the CMakeLists.txt files to be tracked by CMake build system. - Use BUILD_DEBUG, BUILD_RELEASE and BUILD_DEVELOPMENT variables from Helpers library - Avoid Include directories. Not needed anymore CMake `target_*` APIs handles this through `INTERFACE`, `PUBLIC` and `PRIVATE` scope identifiers - `StatusQ` is meant to be compiled as an external library, therefore StatusQ tests are kept inside its own directory - Forced CMake version to `3.21` for the latest features and fixes. It is desired to be kept as recent as possible due to its backward compatibility. Following Qt's shipped version might be an option - Depends on status-go changes to allow forcing of arm for apple silicon Found limitations to CMake Qt API with Qt 6.3 - Having `0` as major version when using `qt_add_qml_module` doesn't work. Qml engine reports loading the `qmldir` but won't load the plugin library and no error is reported outside that exposed types are not found. - `qt_target_qml_sources` doesn't work now, it generate a double copy error when deploying qml files in bin-directory. For now we stick with adding files using `qt_add_qml_module` central place - Need to add `OUTPUT_DIRECTORY` to `qt_add_qml_module` to use the workaround - If `MACOSX_BUNDLE` target property is set breaks importing of QML files. Disabled until fixed or workaround found - For an unknown reason application executable tries to include the `QML_ELEMENT` include files, therefore for now I include all the C++ qml elements in INTERFACE
2022-05-10 20:10:34 +00:00
get_target_property(STATUSGO_LIBRARY_PATH statusgo_shared IMPORTED_LOCATION)
add_custom_command(
TARGET
${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:statusgo_shared>
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMENT "Copying status-go lib beside project executable"
)
install(
IMPORTED_RUNTIME_ARTIFACTS
statusgo_shared
)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_custom_command(
TARGET
${PROJECT_NAME}
POST_BUILD
# Workaround, status-go CMakeLists.txt should set the correct TARGET_SONAME_FILE
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_SONAME_FILE:statusgo_shared>/libstatus.so.0
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMENT "Copying status-go libstatus.so.0 lib beside project executable"
)
install(
FILES
$<TARGET_SONAME_FILE:statusgo_shared>/libstatus.so.0
TYPE LIB
)
endif()
target_sources(${PROJECT_NAME}
PRIVATE
src/StatusGo/General.h
src/StatusGo/General.cpp
src/StatusGo/Types.h
src/StatusGo/Utils.h
src/StatusGo/Utils.cpp
src/StatusGo/Accounts/Accounts.h
src/StatusGo/Accounts/Accounts.cpp
src/StatusGo/Accounts/accounts_types.h
src/StatusGo/Accounts/AccountsAPI.h
src/StatusGo/Accounts/AccountsAPI.cpp
src/StatusGo/Accounts/ChatOrWalletAccount.h
src/StatusGo/Accounts/ChatOrWalletAccount.cpp
src/StatusGo/Chat/ChatAPI.h
src/StatusGo/Chat/ChatAPI.cpp
src/StatusGo/Chat/ChatDto.h
src/StatusGo/Chat/ChatDto.cpp
src/StatusGo/Messages/InputMessage.h
src/StatusGo/Messages/InputMessage.cpp
src/StatusGo/Messages/MessagesApi.h
src/StatusGo/Messages/MessagesApi.cpp
src/StatusGo/Messages/MessageDto.h
src/StatusGo/Messenger/Service.h
src/StatusGo/Messenger/Service.cpp
src/StatusGo/Metadata/api_response.h
src/StatusGo/Metadata/api_response.cpp
src/StatusGo/SignalsManager.h
src/StatusGo/SignalsManager.cpp
src/StatusGo/StatusGoEvent.h
src/StatusGo/StatusGoEvent.cpp
src/StatusGo/Settings/SettingsAPI.h
src/StatusGo/Settings/SettingsAPI.cpp
src/StatusGo/Settings/SettingsDto.h
src/StatusGo/Settings/SettingsDto.cpp
src/StatusGo/Wallet/BigInt.h
src/StatusGo/Wallet/BigInt.cpp
src/StatusGo/Wallet/DerivedAddress.h
src/StatusGo/Wallet/NetworkConfiguration.h
src/StatusGo/Wallet/Token.h
src/StatusGo/Wallet/SavedAddress.h
src/StatusGo/Wallet/wallet_types.h
src/StatusGo/Wallet/WalletApi.h
src/StatusGo/Wallet/WalletApi.cpp
src/StatusGo/Wallet/Transfer/Event.h
src/StatusGo/Wallet/Transfer/Event.cpp
)