Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Switch build system to CMake #5359

Merged
merged 29 commits into from
Aug 5, 2016
Merged

Switch build system to CMake #5359

merged 29 commits into from
Aug 5, 2016

Conversation

kkaefer
Copy link
Contributor

@kkaefer kkaefer commented Jun 14, 2016

revert #28

We want to switch to CMake from gyp because:

  • gyp isn't maintained
  • Android Studio has explicit CMake integration
  • Qt Creator has explicit CMake integration
  • CMake automatically rebuilds the project if CMake files changed
  • Less complicated build system, fewer bash files

@jfirebaugh
Copy link
Contributor

revert #28

Hahah, wow.

@brunoabinader
Copy link
Member

screen shot 2016-06-15 at 9 23 45 am = ❤️

@kkaefer kkaefer force-pushed the cmake branch 2 times, most recently from 0fb7f03 to 370c611 Compare June 15, 2016 11:15
@tmpsantos
Copy link
Contributor

Kudos.

@tmpsantos
Copy link
Contributor

Made progress with Qt today. All the configurations, tests, etc work just fine on Linux.

https://github.com/mapbox/mapbox-gl-native/tree/tmpsantos-cmake

@ivovandongen
Copy link
Contributor

Got most of the android build sorted out on: https://github.com/mapbox/mapbox-gl-native/tree/ivovandongen-cmake

Links and runs on arm-v5 and arm-v7, but results in linker errors on others still:

[100%] Linking CXX shared library libmapbox-gl.so
/Users/ivo/git/mapbox-gl-native/mason_packages/osx-x86_64/android-ndk/arm64-21-r12b/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /Users/ivo/git/mapbox-gl-native/mason_packages/android-arm-v7-9/zlib/system/lib/libz.so when searching for -lz
../../../mason_packages/android-arm-v7-9/geojson/0.1.4/lib/libgeojson.a: error adding symbols: File in wrong format

@ivovandongen
Copy link
Contributor

All ABIs are building now. Also added the copy targets. The libraries are insanely big though, 122MB instead of ~13MB.

After reading mason.cmake I have a better idea how to get rid of toolchain.sh, if we want.

ivovandongen added a commit that referenced this pull request Jul 24, 2016
@ivovandongen
Copy link
Contributor

@kkaefer I've squashed the android part into one commit. Need to test it a bit to be sure there are no regressions on Monday. @tobrun Mind taking a look ? Branch is here.

@tobrun
Copy link
Member

tobrun commented Jul 25, 2016

I have been testing with make apackage -j4and verified that following abi were build:

  • arm-v5 (armeabi configuration)
  • arm-v7
  • arm-v8 (64 bit arm)
  • x86
  • x86-64
  • mips

I did some runs with this on multi devices as:

  • arm-v7 emulator
  • genymotion virtual x86 device
  • arm-v7 device

I also tested out backwards compatibility issues with for arm-v7 on armabi (v5-v6):

  • make android-lib-arm-v5 on arm-v7 emulator
  • make android-lib-arm-v7 on arm-v7 emulator

Everything is looking 👍 @ivovandongen,
can't wait to get this merged and make this part of our IDE workflow in #1753.

@ivovandongen
Copy link
Contributor

@tobrun Thanks for the extensive testing! I would also love to have this in one IDE eventually. Need to check out the new experimental gradle plugin. Seems like that is going to be preferred over the "classic" Android.mk.

ivovandongen added a commit that referenced this pull request Jul 25, 2016
ivovandongen added a commit that referenced this pull request Jul 25, 2016
@ivovandongen
Copy link
Contributor

@kkaefer @tmpsantos Changes from #5656 got lost in translation, added them back in. I've added them in the android toolchain.sh file, where it was in the general mbgl.gyp before. If this is not the preferred place let me know.

Also, could either of you go over my changes to see if I haven't missed other subtle settings?

@incanus
Copy link
Contributor

incanus commented Aug 5, 2016

Docs need updated.

$ make iproj
mkdir -p build/ios
(cd build/ios && cmake -G Xcode ../.. \
        -DCMAKE_TOOLCHAIN_FILE=../../platform/ios/toolchain.cmake \
        -DMBGL_PLATFORM=ios)
/bin/sh: cmake: command not found
make: *** [build/ios/mbgl.xcodeproj] Error 127

@bleege
Copy link
Contributor

bleege commented Aug 16, 2016

I just updated the install docs to list CMake for all binding flavors.

@nitrag
Copy link
Contributor

nitrag commented Sep 24, 2016

@bleege Where are we supposed to install CMake? I'm getting this error:

Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build=false --module=/Users/ryan/Documents/github/mapbox-gl-native/lib/mapbox-gl-native.node --module_name=mapbox-gl-native --module_path=/Users/ryan/Documents/github/mapbox-gl-native/lib' (1)
mkdir -p build/macos
(cd build/macos && cmake -G Xcode ../..)
Re-run cmake no build system arguments
-- The CXX compiler identification is AppleClang 8.0.0.8000038
-- The C compiler identification is AppleClang 8.0.0.8000038
-- Check for working CXX compiler using: Xcode
-- Check for working CXX compiler using: Xcode -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler using: Xcode
-- Check for working C compiler using: Xcode -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at cmake/mbgl.cmake:16 (message):
  Can't find node-cmake
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)


-- Configuring incomplete, errors occurred!
See also "/Users/ryan/Documents/github/mapbox-gl-native/build/macos/CMakeFiles/CMakeOutput.log".
make: *** [build/macos/mbgl.xcodeproj] Error 1

I've tried install globally too.

Well I hacked mbgl.cmake to use /usr/local/lib/node_modules path but now I'm getting this error:

target specifies product type 'com.apple.product-type.tool', but there's no such product type for the 'iphoneos' platform

Alternatively if someone could just zip the latests docs for alpha for me plz :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.