Skip to content

Fix build for android #332

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

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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 cmake/modules/DispatchCompilerWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ else()
add_compile_options(-Wno-conversion)
add_compile_options(-Wno-int-conversion)
add_compile_options(-Wno-shorten-64-to-32)
add_compile_options(-Wno-unknown-attributes)
endif()
endmacro()
endif()
8 changes: 6 additions & 2 deletions cmake/modules/SwiftSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function(add_swift_library library)
list(APPEND flags -emit-library)

if(ASL_TARGET)
list(APPEND FLAGS -target;${ASL_TARGET})
list(APPEND flags -target;${ASL_TARGET})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently CMake variable names are case sensitive. This is a typo introduced in an earlier PR

endif()
if(ASL_MODULE_NAME)
list(APPEND flags -module-name;${ASL_MODULE_NAME})
Expand All @@ -38,6 +38,10 @@ function(add_swift_library library)
endforeach()
endif()

if(CMAKE_SYSTEM_NAME STREQUAL Android)
list(APPEND flags -sdk;${CMAKE_SYSROOT})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably makes sense to always add the sysroot?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that we should always add the sysroot here.

endif()

# FIXME: We shouldn't /have/ to build things in a single process.
# <rdar://problem/15972329>
list(APPEND flags -force-single-frontend-invocation)
Expand Down Expand Up @@ -93,7 +97,7 @@ function(get_swift_host_arch result_var_name)
set("${result_var_name}" "s390x" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv6l")
set("${result_var_name}" "armv6" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^armv7")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want the same for armv6l above?

set("${result_var_name}" "armv7" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
set("${result_var_name}" "x86_64" PARENT_SCOPE)
Expand Down
4 changes: 4 additions & 0 deletions dispatch/dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include <os/linux_base.h>
#endif

#ifdef __ANDROID__
#include <string.h>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be wrapped with an #if ANDROID

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this can be done unconditionally.

#endif

#include <sys/types.h>
#include <stddef.h>
#include <stdint.h>
Expand Down
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,3 @@ if(ENABLE_SWIFT)
DESTINATION
"${INSTALL_TARGET_DIR}/${CMAKE_SYSTEM_PROCESSOR}")
endif()

4 changes: 4 additions & 0 deletions src/shims/android_stubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@
#define _Static_assert(...)
#endif

#ifndef TRASHIT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fairly sure this has been moved to internal.h already in a previous PR, please remove.

#define TRASHIT(x) do { (x) = (void *)-1; } while (0)
#endif

#endif /* __DISPATCH__ANDROID__STUBS__INTERNAL */