Merge pull request #2248 from uvguy/master

Add support c++ target on android
This commit is contained in:
Terence Parr 2018-11-11 09:26:09 -08:00 committed by GitHub
commit 2159d15da7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -182,6 +182,7 @@ YYYY/MM/DD, github id, Full name, email
2017/12/13, enessoylu, Enes Soylu, enessoylutr@gmail.com 2017/12/13, enessoylu, Enes Soylu, enessoylutr@gmail.com
2017/12/20, kbsletten, Kyle Sletten, kbsletten@gmail.com 2017/12/20, kbsletten, Kyle Sletten, kbsletten@gmail.com
2017/12/27, jkmar, Jakub Marciniszyn, marciniszyn.jk@gmail.com 2017/12/27, jkmar, Jakub Marciniszyn, marciniszyn.jk@gmail.com
2018/03/10, uvguy, kangjoni76@gmail.com
2018/01/06, kasbah, Kaspar Emanuel, kaspar@monostable.co.uk 2018/01/06, kasbah, Kaspar Emanuel, kaspar@monostable.co.uk
2018/01/15, xgcssch, Sönke Schau, xgcssch@users.noreply.github.com 2018/01/15, xgcssch, Sönke Schau, xgcssch@users.noreply.github.com
2018/02/08, razfriman, Raz Friman, raz@razfriman.com 2018/02/08, razfriman, Raz Friman, raz@razfriman.com
@ -201,4 +202,4 @@ YYYY/MM/DD, github id, Full name, email
2018/07/27, Maksim Novikov, mnovikov.work@gmail.com 2018/07/27, Maksim Novikov, mnovikov.work@gmail.com
2018/07/31 Lucas Henrqiue, lucashenrique580@gmail.com 2018/07/31 Lucas Henrqiue, lucashenrique580@gmail.com
2018/08/03, ENDOH takanao, djmchl@gmail.com 2018/08/03, ENDOH takanao, djmchl@gmail.com
2018/10/29, chrisaycock, Christopher Aycock, chris[at]chrisaycock[dot]com 2018/10/29, chrisaycock, Christopher Aycock, chris[at]chrisaycock[dot]com

View File

@ -104,6 +104,10 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHE
if(NOT (GCC_VERSION VERSION_GREATER 5.0 OR GCC_VERSION VERSION_EQUAL 5.0)) if(NOT (GCC_VERSION VERSION_GREATER 5.0 OR GCC_VERSION VERSION_EQUAL 5.0))
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 5.0 or greater.") message(FATAL_ERROR "${PROJECT_NAME} requires g++ 5.0 or greater.")
endif () endif ()
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND ANDROID)
# Need -Os cflag and cxxflags here to work with exception handling on armeabi.
# see https://github.com/android-ndk/ndk/issues/573
# and without -stdlib=libc++ cxxflags
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND APPLE) elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND ( CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") ) elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND ( CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") )

View File

@ -25,7 +25,7 @@ The C++ target has been the work of the following people:
## Project Status ## Project Status
* Building on OS X, Windows, and Linux * Building on OS X, Windows, Android and Linux
* No errors and warnings * No errors and warnings
* Library linking * Library linking
* Some unit tests in the OSX project, for important base classes with almost 100% code coverage. * Some unit tests in the OSX project, for important base classes with almost 100% code coverage.
@ -51,6 +51,9 @@ It will automatically use the CMake description to open up a Visual Studio Solut
#### Compiling on OSX #### Compiling on OSX
Either open the included XCode project and build that or use the cmake compilation as described for linux. Either open the included XCode project and build that or use the cmake compilation as described for linux.
#### Compiling on Android
Try run cmake -DCMAKE_ANDROID_NDK=/folder/of/android_ndkr17_and_above -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_API=14 -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_BUILD_TYPE=Release /folder/antlr4_src_dir -G Ninja.
#### Compiling on Linux #### Compiling on Linux
- cd <antlr4-dir>/runtime/Cpp (this is where this readme is located) - cd <antlr4-dir>/runtime/Cpp (this is where this readme is located)
- mkdir build && mkdir run && cd build - mkdir build && mkdir run && cd build