Skip to content

Commit

Permalink
Merge branch 'master' into tile-management, with a few changes
Browse files Browse the repository at this point in the history
- rename core/include/json to core/include/jsoncpp and update references in CMake files
- add libtess2 linking to OS X and iOS builds

Note: Android build still not working through CMake, may need to modify the toolchain ourselves :\

Conflicts:
	Makefile
	core/src/sceneDirector/sceneDirector.h
	core/src/tangramNativeApp.cpp
	core/src/viewModule/viewModule.h
	ios/TangramiOS/TangramiOS.xcodeproj/project.pbxproj
	ios/resources/Main_iPhone.storyboard
  • Loading branch information
matteblair committed Oct 23, 2014
2 parents 5c31fc9 + a4008f8 commit bf68c7b
Show file tree
Hide file tree
Showing 75 changed files with 2,386 additions and 801 deletions.
14 changes: 9 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ gen/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties
Expand All @@ -55,7 +54,6 @@ proguard/


### Xcode ###
build/
*.pbxuser
!default.pbxuser
*.mode1v3
Expand Down Expand Up @@ -101,7 +99,13 @@ DerivedData
!**/precompiled/**/*.a
!**/precompiled/**/*.dylib

#Ignore vim temp files
*~
# CMake files
CMakeCache.txt
CMakeScripts
CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt

# vim
*.swp
*.swo
Empty file added .gitmodules
Empty file.
50 changes: 50 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 2.8)
project(tangram)

# cmake output configuration
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# platform lookup
set(SUPPORTED_TARGETS darwin ios android)

if(NOT PLATFORM_TARGET)
string(TOLOWER "${CMAKE_SYSTEM_NAME}" varplatform)
string(TOUPPER "${CMAKE_SYSTEM_NAME}" VARPLATFORM)

message(STATUS "No target defined (give as parameter -DPLATFORM_TARGET=platform_name).")
message(STATUS "Targets available: ${SUPPORTED_TARGETS}.")
message(STATUS "Will use your OS: ${varplatform}.")

set(PLATFORM_TARGET ${varplatform})
else()
string(TOLOWER "${PLATFORM_TARGET}" varplatform)
string(TOUPPER "${PLATFORM_TARGET}" VARPLATFORM)

message(STATUS "Platform chosen : ${VARPLATFORM}")
endif()

list(FIND SUPPORTED_TARGETS ${varplatform} target_in_list)

if(target_in_list EQUAL -1)
message(SEND_ERROR "${varplatform} not in supported targets: ${SUPPORTED_TARGETS}")
return()
endif()

# setting up cache variable platform
set(PLATFORM ${varplatform} CACHE INTERNAL "platform" FORCE)

# cmake inclusions and definitions
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/build/modules)
set(CMAKE_TARGET_FILE ${PROJECT_SOURCE_DIR}/build/toolchains/${PLATFORM_TARGET}.cmake)

include(${PROJECT_SOURCE_DIR}/build/utils/utils.cmake)

message(STATUS "Including ${varplatform} dependent cmake file : ${CMAKE_TARGET_FILE}")
include(${CMAKE_TARGET_FILE})

# dependent platform build
build()

link_libraries()
99 changes: 0 additions & 99 deletions Makefile

This file was deleted.

57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,60 @@ tangram-es
OpenGL ES version of Tangram for mobile devices - EARLY work-in-progress!

tangram-es is a library for rendering 2D and 3D maps using OpenGL ES 2 with custom styling and interactions. We also maintain sample client applications that use the library to render on Android, iOS, and Mac OS X.

build
=====
This project uses _CMake_ (minimum version **2.8**), you can download it [here](http://www.cmake.org/download/) or use your favorite installation package tool like [homebrew](http://brew.sh/).

```bash
brew install cmake
```

Currently we are targetting three platforms (OS X, iOS and Android). Once CMake installed, you can build the project for the platform of your choice. If you are planning to test more than one platform we advise you to create subfolders inside the **build/** folder and run `cmake ../.. [OPTIONS]` from each of them.

## platforms ##

### OS X ###
To build for OS X, you will need to install [GLFW](http://www.glfw.org/):

```bash
brew tap homebrew/versions
brew install glfw3
```

Then build using GNU Make by calling these commands from `build` folder:

```bash
cmake .. -DPLATFORM_TARGET=darwin
make
bin/tangram.out
```

You can also generate an xcodeproj file for working with the project in XCode:

```bash
cmake .. -DPLATFORM_TARGET=darwin -G Xcode
open tangram.xcodeproj
```

### iOS ###
For iOS, you can generate an XCode project by running the following from the `build` folder:

```bash
cmake .. -DPLATFORM_TARGET=ios -DIOS_PLATFORM=SIMULATOR -DCMAKE_TOOLCHAIN_FILE=toolchains/iOS.toolchain.cmake -G Xcode
open tangram.xcodeproject
```

Then just use Xcode as usual. Note that any Xcode configuration change you make to the project won't be preserved when Cmake runs again. Build configuration is defined only in the CMakeLists file(s).

### Android ###
To build for Android, ensure you have your `$NDK_ROOT` environment variable set and pointing to your [NDK](https://developer.android.com/tools/sdk/ndk/index.html) toolset.

```bash
cmake .. -DPLATFORM_TARGET=android -DCMAKE_TOOLCHAIN_FILE=toolchains/android.toolchain.cmake -DMAKE_BUILD_TOOL=$NDK_ROOT/prebuilt/[YOUR_OS]/bin/make [-DANDROID_ABI=[x86|armeabi-v7a|armeabi]]
make
make install
cd ..
ant -f android/build.xml debug
adb install [GENERATED_APK]
```
60 changes: 60 additions & 0 deletions build/toolchains/android.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
if(NOT DEFINED ANDROID_ABI)
set(ANDROID_ABI "armeabi-v7a")
message(STATUS "Possible ABI values : armeabi-v7a (default), armeabi, x86")
endif()
message(STATUS "Android ABI : ${ANDROID_ABI}")

if(NOT DEFINED ANDROID_TARGET)
set(ANDROID_TARGET "android-19")
endif()
message(STATUS "Android target : ${ANDROID_TARGET}")

set(ANDROID_STL gnustl_shared)

include(${CMAKE_SOURCE_DIR}/build/toolchains/android.toolchain.cmake)

add_definitions(-DPLATFORM_ANDROID)

if(NOT MAKE_BUILD_TOOL)
message(SEND_ERROR "Provide ndk make, located in <NDK_ROOT>/prebuilt/<OS>/bin/, -DMAKE_BUILD_TOOL=<NDK_PREBUILT_BIN>/make")
return()
else()
set(CMAKE_BUILD_TOOL ${MAKE_BUILD_TOOL})
message(STATUS "Will use make prebuilt tool located at : ${CMAKE_BUILD_TOOL}")
endif()

# configurations
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pedantic -llog -lz")
set(CXX_FLAGS_DEBUG "${CXX_FLAGS_DEBUG} -g -O0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -fPIC")
set(LIBCURL_PRECOMPILED_LIB ${CMAKE_SOURCE_DIR}/android/jni/precompiled/${ANDROID_ABI}/libcurl.a)

# include dependency headers
include_directories(${PROJECT_SOURCE_DIR}/android/jni/include)

message(STATUS "Using curl precompiled static library : ${LIBCURL_PRECOMPILED_LIB}")

# adding manually the two jni c++ files
set(ADDITIONNAL_TARGET_DEPENDENT_SRC_FILES
${CMAKE_SOURCE_DIR}/android/jni/jniExports.cpp
${CMAKE_SOURCE_DIR}/android/jni/platform_android.cpp)

# load core library
set(INSTALL_CORE_LIBRARY "ON")
set(CORE_LIB_TYPE SHARED)
set(CORE_INSTALLATION_PATH ${CMAKE_SOURCE_DIR}/android/libs/${ANDROID_ABI})
set(CORE_LIB_DEPS GLESv2 ${LIBCURL_PRECOMPILED_LIB})
set(CORE_LIB_NAME tangram) # in order to have libtangram.so

include_directories(${PROJECT_SOURCE_DIR}/core/include/)
add_subdirectory(${PROJECT_SOURCE_DIR}/core)
include_recursive_dirs(${PROJECT_SOURCE_DIR}/core/*.h)

# link and build functions
function(link_libraries)
# nothing to do
endfunction()

function(build)
# nothing to do
endfunction()
Loading

0 comments on commit bf68c7b

Please sign in to comment.