Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Make internal includes work independent of the include search path(s) #625

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ set(${PROJECT_NAME}_INSTALL_INCLUDEDIR
"${CMAKE_INSTALL_INCLUDEDIR}/${INCLUDEDIR_INIT}" CACHE PATH
"directory to install ${PROJECT_NAME} include files to")

if (${PROJECT_NAME}_INSTALL_INCLUDEDIR STREQUAL ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
set(LEGACY_INCLUDE_SEARCH_PATH ${${PROJECT_NAME}_INSTALL_INCLUDEDIR})
else()
message("Not using namespaced include install layout, this is deprecated")
endif()

# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
Expand Down Expand Up @@ -305,7 +311,8 @@ endif ()

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib>
$<INSTALL_INTERFACE:${${PROJECT_NAME}_INSTALL_INCLUDEDIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<INSTALL_INTERFACE:${LEGACY_INCLUDE_SEARCH_PATH}> # TODO this should be added manually in the cmake config file, behind a consumer-controlled switch
)

target_link_libraries(${PROJECT_NAME} PUBLIC ${Qt}::Core ${Qt}::Network ${Qt}::Gui qt${${Qt}Core_VERSION_MAJOR}keychain)
Expand Down Expand Up @@ -343,7 +350,6 @@ endif()
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets
LIBRARY RUNTIME
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${${PROJECT_NAME}_INSTALL_INCLUDEDIR}
)
install(DIRECTORY lib/ DESTINATION ${${PROJECT_NAME}_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h")
Expand Down
11 changes: 6 additions & 5 deletions gtad/gtad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,17 @@ analyzer:
+on:
- /state_event.yaml$/:
type: StateEventPtr
imports: '"events/stateevent.h"'
imports: '"../events/stateevent.h"'
- /(room|client)_event.yaml$/:
type: RoomEventPtr
imports: '"events/roomevent.h"'
imports: '"../events/roomevent.h"'
- /event(_without_room_id)?.yaml$/:
type: EventPtr
imports: '"events/event.h"'
imports: '"../events/event.h"'
- +set:
# This renderer applies to everything actually $ref'ed
# (not substituted)
# TODO this would need to go up as many levels first as we are currently nested (for the file we are generating, not for $ref!)
_importRenderer: '"{{#segments}}{{_}}{{#_join}}/{{/_join}}{{/segments}}.h"'
+on:
- '/^(\./)?definitions/request_email_validation.yaml$/':
Expand Down Expand Up @@ -130,7 +131,7 @@ analyzer:
- RoomFilter: # A structure inside Filter, same story as with *_filter.yaml
- OneTimeKeys:
type: OneTimeKeys
imports: '"e2ee/e2ee_common.h"'
imports: '"../e2ee/e2ee_common.h"'
- //: *UseOmittable
- array:
- string: QStringList
Expand All @@ -139,7 +140,7 @@ analyzer:
- /^Notification|Result|ChildRoomsChunk$/: "std::vector<{{1}}>"
- /^StrippedChildStateEvent$|state_event.yaml$/:
type: StateEvents
imports: '"events/stateevent.h"' # For StrippedChildStateEvent
imports: '"../events/stateevent.h"' # For StrippedChildStateEvent
- /(room|client)_event.yaml$/: RoomEvents
- /event(_without_room_id)?.yaml$/: Events
- //: "QVector<{{1}}>"
Expand Down
2 changes: 1 addition & 1 deletion gtad/operation.h.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
}}{{>preamble}}
#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"
{{#imports}}
#include {{_}}{{/imports}}
{{#operations.producesNonJson?}}
Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/account-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/administrative_contact.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

#pragma once

#include "../jobs/basejob.h"

#include "csapi/definitions/auth_data.h"
#include "csapi/definitions/request_email_validation.h"
#include "csapi/definitions/request_msisdn_validation.h"
#include "csapi/definitions/request_token_response.h"

#include "jobs/basejob.h"

namespace Quotient {

/*! \brief Gets a list of a user's third party identifiers.
Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/appservice_room_directory.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/banning.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/capabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/content-repo.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

#include <QtCore/QIODevice>
#include <QtNetwork/QNetworkReply>
Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/create_room.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/cross_signing.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#pragma once

#include "../jobs/basejob.h"

#include "csapi/definitions/auth_data.h"
#include "csapi/definitions/cross_signing_key.h"

#include "jobs/basejob.h"

namespace Quotient {

/*! \brief Upload cross-signing keys.
Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/device_management.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#pragma once

#include "../jobs/basejob.h"

#include "csapi/definitions/auth_data.h"
#include "csapi/definitions/client_device.h"

#include "jobs/basejob.h"

namespace Quotient {

/*! \brief List registered devices for the current user
Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/directory.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
6 changes: 3 additions & 3 deletions lib/csapi/event_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#pragma once

#include "events/roomevent.h"
#include "events/stateevent.h"
#include "jobs/basejob.h"
#include "../events/roomevent.h"
#include "../events/stateevent.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#pragma once

#include "csapi/definitions/sync_filter.h"
#include "../jobs/basejob.h"

#include "jobs/basejob.h"
#include "csapi/definitions/sync_filter.h"

namespace Quotient {

Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/inviting.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/joining.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#pragma once

#include "csapi/definitions/third_party_signed.h"
#include "../jobs/basejob.h"

#include "jobs/basejob.h"
#include "csapi/definitions/third_party_signed.h"

namespace Quotient {

Expand Down
7 changes: 3 additions & 4 deletions lib/csapi/keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

#pragma once

#include "../e2ee/e2ee_common.h"
#include "../jobs/basejob.h"

#include "csapi/definitions/cross_signing_key.h"
#include "csapi/definitions/device_keys.h"

#include "e2ee/e2ee_common.h"

#include "jobs/basejob.h"

namespace Quotient {

/*! \brief Upload end-to-end encryption keys.
Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/kicking.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/knocking.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/leaving.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/list_joined_rooms.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/list_public_rooms.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#pragma once

#include "csapi/definitions/public_rooms_response.h"
#include "../jobs/basejob.h"

#include "jobs/basejob.h"
#include "csapi/definitions/public_rooms_response.h"

namespace Quotient {

Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/login.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#pragma once

#include "../jobs/basejob.h"

#include "csapi/definitions/user_identifier.h"
#include "csapi/definitions/wellknown/full.h"

#include "jobs/basejob.h"

namespace Quotient {

/*! \brief Get the supported login types to authenticate users
Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/logout.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/message_pagination.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#pragma once

#include "events/roomevent.h"
#include "jobs/basejob.h"
#include "../events/roomevent.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/notifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#pragma once

#include "events/event.h"
#include "jobs/basejob.h"
#include "../events/event.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/openid.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#pragma once

#include "csapi/definitions/openid_token.h"
#include "../jobs/basejob.h"

#include "jobs/basejob.h"
#include "csapi/definitions/openid_token.h"

namespace Quotient {

Expand Down
4 changes: 2 additions & 2 deletions lib/csapi/peeking_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#pragma once

#include "events/roomevent.h"
#include "jobs/basejob.h"
#include "../events/roomevent.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/presence.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
2 changes: 1 addition & 1 deletion lib/csapi/profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "jobs/basejob.h"
#include "../jobs/basejob.h"

namespace Quotient {

Expand Down
Loading