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

Fix archiving on xcode #232

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ NEXT-RELEASE Release notes (YYYY-MM-DD)
### Fixed
* Using the `==` operator in a type safe query for a nullable string property would return the incorrect result when algined storage was disabled.
* Fix compilation issue when building with Bionic due to use of std::tuple (since 2.1.0).
* Archiving on Xcode would fail due to duplicated alias' when aligned storage was enabled.

### Enhancements
* Add ability to use `managed<std::map<std::string, T>>` in type safe queries when comparing a value for a key. e.g.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__x86_64__)
# define KEY '_','_','x','8','6','_','6','4','_','_'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
Expand All @@ -19,6 +21,20 @@
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
#elif defined(__ARM_ARCH_7S__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
#elif defined(_M_X64)
# define KEY '_','M','_','X','6','4'
#elif defined(__amd64__)
# define KEY '_','_','a','m','d','6','4','_','_'
#elif defined(_M_IX86)
# define KEY '_','M','_','I','X','8','6'
#elif defined(__i386__)
# define KEY '_','_','i','3','8','6','_','_'
#elif defined(_M_ARM)
# define KEY '_','M','_','A','R','M'
#elif defined(_M_ARM64)
# define KEY '_','M','_','A','R','M','6','4'
#elif defined(__arm__)
# define KEY '_','_','a','r','m','_','_'
#endif

int main()
Expand All @@ -44,5 +60,8 @@ int main()

@TYPE_INFO_QUERY_DECLS@

static char arch_key[] = {'a','r','c','h','_','k','e','y','_',KEY, '\0'};
required += arch_key[0];

return required;
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
file(STRINGS ${BRIDGE_TYPE_INFO_BIN} compiled_string_literals REGEX "^REALM_TYPE_INFO")
file(STRINGS ${BRIDGE_TYPE_INFO_BIN} compiled_string_literals REGEX "^(REALM_TYPE_INFO|arch_key_)")

set(regex_realm "REALM_TYPE_INFO:(.+)\\[0*(.*),0*(.*)\\]")
set(regex_arch "^arch_key_(.+)")

set(regex "REALM_TYPE_INFO:(.+)\\[0*(.*),0*(.*)\\]")
set(BRIDGE_TYPE_DECLS "")
set(BRIDGE_TYPE_DECLS_TYPES "")
set(BRIDGE_TYPE_DECLS_REQUIRES_ELSE_IF OFF)

foreach(i ${compiled_string_literals})
if("${i}" MATCHES "${regex}")
set(BRIDGE_TYPE_DECLS "${BRIDGE_TYPE_DECLS} using ${CMAKE_MATCH_1} = std::aligned_storage<${CMAKE_MATCH_2}, ${CMAKE_MATCH_3}>::type;\n")
if("${i}" MATCHES "${regex_realm}")
set(BRIDGE_TYPE_DECLS_TYPES "${BRIDGE_TYPE_DECLS_TYPES} using ${CMAKE_MATCH_1} = std::aligned_storage<${CMAKE_MATCH_2}, ${CMAKE_MATCH_3}>::type;\n")
elseif("${i}" MATCHES "${regex_arch}")
if(BRIDGE_TYPE_DECLS_REQUIRES_ELSE_IF)
set(BRIDGE_TYPE_DECLS "${BRIDGE_TYPE_DECLS}#elif defined(${CMAKE_MATCH_1})\n${BRIDGE_TYPE_DECLS_TYPES}")
else()
set(BRIDGE_TYPE_DECLS "#if defined(${CMAKE_MATCH_1})\n${BRIDGE_TYPE_DECLS_TYPES}")
endif()
set(BRIDGE_TYPE_DECLS_REQUIRES_ELSE_IF ON)
set(BRIDGE_TYPE_DECLS_TYPES "")
else()
message(FATAL_ERROR "Unrecognized type info string: " ${h})
message(FATAL_ERROR "Unrecognized type info string: ${i}")
endif()
endforeach()

set(BRIDGE_TYPE_DECLS "${BRIDGE_TYPE_DECLS}#endif")

configure_file(${SOURCE_DIR}/bridge_types.hpp.in ${BINARY_DIR}/bridge_types.hpp)
Loading