From 0d5568f7248d489c6081c217f2c21e56fb12e5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 21 Apr 2015 11:57:08 +0200 Subject: merge build targets so we only have one build file per platform previously, we used multiple different projects for various targets (app, test, render) that overwrote each other, so it was impossible to have one project to build them all, one project to compile them, one project to run them all and in the darkness bind them --- Makefile | 119 +++++++++++++++++------------------------------ bin/render.gyp | 60 ------------------------ bin/render.gypi | 60 ++++++++++++++++++++++++ gyp/project.gyp | 19 ++++++++ linux/mapboxgl-app.gyp | 57 ----------------------- linux/mapboxgl-app.gypi | 57 +++++++++++++++++++++++ macosx/mapboxgl-app.gyp | 61 ------------------------ macosx/mapboxgl-app.gypi | 61 ++++++++++++++++++++++++ scripts/package_ios.sh | 2 +- test/test.gyp | 99 --------------------------------------- test/test.gypi | 99 +++++++++++++++++++++++++++++++++++++++ 11 files changed, 340 insertions(+), 354 deletions(-) delete mode 100644 bin/render.gyp create mode 100644 bin/render.gypi create mode 100644 gyp/project.gyp delete mode 100644 linux/mapboxgl-app.gyp create mode 100644 linux/mapboxgl-app.gypi delete mode 100644 macosx/mapboxgl-app.gyp create mode 100644 macosx/mapboxgl-app.gypi delete mode 100644 test/test.gyp create mode 100644 test/test.gypi diff --git a/Makefile b/Makefile index d0cf4407cd..11eb5e530f 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,16 @@ PREFIX ?= /usr/local ANDROID_ABI ?= arm-v7 ifeq ($(shell uname -s), Darwin) -HOST ?= osx -HEADLESS ?= cgl +HOST = osx +HEADLESS = cgl JOBS ?= $(shell sysctl -n hw.ncpu) endif -HOST ?= linux + +ifeq ($(shell uname -s), Linux) +HOST = linux +JOBS ?= $(shell sysctl -n hw.ncpu) +endif + JOBS ?= 1 all: mbgl @@ -32,49 +37,42 @@ SMCalloutView: KIF: git submodule update --init test/ios/KIF -#### Library builds ############################################################ -.PRECIOUS: Makefile/mbgl -Makefile/mbgl: config/$(HOST).gypi styles/styles SMCalloutView - deps/run_gyp mbgl.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make +#### Build files ############################################################### + +.PRECIOUS: Makefile/project +Makefile/project: config/$(HOST).gypi styles/styles SMCalloutView + deps/run_gyp gyp/project.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make + +.PRECIOUS: Xcode/project +Xcode/project: config/$(HOST).gypi styles/styles SMCalloutView + deps/run_gyp gyp/project.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f xcode -mbgl: Makefile/mbgl + +#### Library builds ############################################################ + +mbgl: Makefile/project $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) everything -standalone: Makefile/mbgl +standalone: Makefile/project LINK=`pwd`/gyp/link.py $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) standalone -install: Makefile/mbgl +install: Makefile/project LINK=`pwd`/gyp/link.py $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) install -.PRECIOUS: Xcode/mbgl -Xcode/mbgl: config/$(HOST).gypi styles/styles SMCalloutView - deps/run_gyp mbgl.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f xcode ##### Test builds ############################################################## -.PRECIOUS: Makefile/test -Makefile/test: test/test.gyp config/$(HOST).gypi styles/styles SMCalloutView - deps/run_gyp test/test.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make - .PHONY: test -test: Makefile/test +test: Makefile/project $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) test test-%: test ./scripts/run_tests.sh "build/$(HOST)/$(BUILDTYPE)/test" --gtest_filter=$* - -.PRECIOUS: Xcode/test -Xcode/test: test/test.gyp config/osx.gypi styles/styles SMCalloutView - deps/run_gyp test/test.gyp $(CONFIG_osx) $(LIBS_osx) --generator-output=./build/osx -f xcode - -.PHONY: lproj lbuild run-xlinux -xtest-proj: Xcode/test - open ./build/osx/test/test.xcodeproj - -xtest: Xcode/test - xcodebuild -project ./build/osx/test/test.xcodeproj -configuration $(BUILDTYPE) -target test -jobs $(JOBS) +.PHONY: xtest +xtest: Xcode/project + xcodebuild -project ./build/osx/gyp/project.xcodeproj -configuration $(BUILDTYPE) -target test -jobs $(JOBS) xtest-%: xtest ./scripts/run_tests.sh "build/osx/Build/Products/$(BUILDTYPE)/test" --gtest_filter=$* @@ -82,31 +80,22 @@ xtest-%: xtest #### Mac OS X application builds ############################################### -.PRECIOUS: Makefile/osx -Makefile/osx: macosx/mapboxgl-app.gyp config/osx.gypi styles/styles - deps/run_gyp macosx/mapboxgl-app.gyp $(CONFIG_osx) $(LIBS_osx) --generator-output=./build/osx -f make - .PHONY: osx run-osx -osx: Makefile/osx +osx: Makefile/project $(MAKE) -C build/osx BUILDTYPE=$(BUILDTYPE) osxapp run-osx: osx "build/osx/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" - -.PRECIOUS: Xcode/osx -Xcode/osx: macosx/mapboxgl-app.gyp config/osx.gypi styles/styles - deps/run_gyp macosx/mapboxgl-app.gyp $(CONFIG_osx) $(LIBS_osx) --generator-output=./build/osx -f xcode - .PHONY: xosx-proj xosx run-xosx -xosx-proj: Xcode/osx - open ./build/osx/macosx/mapboxgl-app.xcodeproj +xosx-proj: Xcode/project + open ./build/osx/gyp/project.xcodeproj -xosx: Xcode/osx - xcodebuild -project ./build/osx/macosx/mapboxgl-app.xcodeproj -configuration $(BUILDTYPE) -target osxapp -jobs $(JOBS) +xosx: Xcode/project + xcodebuild -project ./build/osx/gyp/project.xcodeproj -configuration $(BUILDTYPE) -target osxapp -jobs $(JOBS) run-xosx: xosx - "build/osx/Build/Products/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" + "gyp/build/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" # Legacy name xproj: xosx-proj @@ -141,34 +130,19 @@ iproj: ios-proj #### Linux application builds ################################################## -.PRECIOUS: Makefile/linux -Makefile/linux: linux/mapboxgl-app.gyp config/$(HOST).gypi styles/styles - deps/run_gyp linux/mapboxgl-app.gyp $(CONFIG_$(HOST)) $(LIBS_linux) --generator-output=./build/$(HOST) -f make - .PHONY: linux run-linux -linux: Makefile/linux +linux: Makefile/project $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) linuxapp run-linux: linux (cd build/$(HOST)/$(BUILDTYPE) && ./mapbox-gl) - -.PRECIOUS: Xcode/linux -Xcode/linux: linux/mapboxgl-app.gyp config/osx.gypi styles/styles - deps/run_gyp linux/mapboxgl-app.gyp $(CONFIG_osx) $(LIBS_linux) --generator-output=./build/osx -f xcode - -.PHONY: lproj lbuild run-xlinux -xlinux-proj: Xcode/linux - open ./build/osx/linux/mapboxgl-app.xcodeproj - -xlinux: Xcode/linux - xcodebuild -project ./build/osx/linux/mapboxgl-app.xcodeproj -configuration $(BUILDTYPE) -target linuxapp +.PHONY: xlinux run-xlinux +xlinux: Xcode/project + xcodebuild -project ./build/osx/gyp/project.xcodeproj -configuration $(BUILDTYPE) -target linuxapp -jobs $(JOBS) run-xlinux: xlinux - "build/osx/Build/Products/$(BUILDTYPE)/mapbox-gl" - -# Legacy name -lproj: xlinux-proj + "gyp/build/$(BUILDTYPE)/mapbox-gl" #### Android libaries ######################################################### @@ -200,22 +174,15 @@ android-deploy: $(ANDROID_ABIS) android-project: android-lib -##### Render builds ############################################################ -.PRECIOUS: Makefile/render -Makefile/render: bin/render.gyp config/$(HOST).gypi - deps/run_gyp bin/render.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make +##### Render builds ############################################################ -render: Makefile/render +render: Makefile/project $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) mbgl-render -.PRECIOUS: Xcode/render -Xcode/render: bin/render.gyp config/osx.gypi styles/styles - deps/run_gyp bin/render.gyp $(CONFIG_osx) $(LIBS_osx) --generator-output=./build/osx -f xcode - -.PHONY: xrender-proj -xrender-proj: Xcode/render - open ./build/osx/bin/render.xcodeproj +.PHONY: xrender run-xrender +xrender: Xcode/project + xcodebuild -project ./build/osx/gyp/project.xcodeproj -configuration $(BUILDTYPE) -target mbgl-render -jobs $(JOBS) ##### Maintenace operations #################################################### diff --git a/bin/render.gyp b/bin/render.gyp deleted file mode 100644 index b205e7a959..0000000000 --- a/bin/render.gyp +++ /dev/null @@ -1,60 +0,0 @@ -{ - 'includes': [ - '../gyp/common.gypi', - ], - 'targets': [ - { 'target_name': 'mbgl-render', - 'product_name': 'mbgl-render', - 'type': 'executable', - - 'dependencies': [ - '../mbgl.gyp:core', - '../mbgl.gyp:platform-<(platform_lib)', - '../mbgl.gyp:headless-<(headless_lib)', - '../mbgl.gyp:http-<(http_lib)', - '../mbgl.gyp:asset-<(asset_lib)', - '../mbgl.gyp:cache-<(cache_lib)', - '../mbgl.gyp:copy_certificate_bundle', - ], - - 'include_dirs': [ - '../src', - ], - - 'sources': [ - './render.cpp', - ], - - 'variables' : { - 'cflags_cc': [ - '<@(glfw3_cflags)', - '<@(uv_cflags)', - '<@(boost_cflags)', - ], - 'ldflags': [ - '<@(glfw3_ldflags)', - '<@(uv_ldflags)', - '<@(boost_ldflags)', - '-lboost_program_options' - ], - 'libraries': [ - '<@(glfw3_static_libs)', - '<@(uv_static_libs)', - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - } - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - 'libraries': [ '<@(libraries)', '<@(ldflags)' ], - }] - ], - }, - ], -} diff --git a/bin/render.gypi b/bin/render.gypi new file mode 100644 index 0000000000..b205e7a959 --- /dev/null +++ b/bin/render.gypi @@ -0,0 +1,60 @@ +{ + 'includes': [ + '../gyp/common.gypi', + ], + 'targets': [ + { 'target_name': 'mbgl-render', + 'product_name': 'mbgl-render', + 'type': 'executable', + + 'dependencies': [ + '../mbgl.gyp:core', + '../mbgl.gyp:platform-<(platform_lib)', + '../mbgl.gyp:headless-<(headless_lib)', + '../mbgl.gyp:http-<(http_lib)', + '../mbgl.gyp:asset-<(asset_lib)', + '../mbgl.gyp:cache-<(cache_lib)', + '../mbgl.gyp:copy_certificate_bundle', + ], + + 'include_dirs': [ + '../src', + ], + + 'sources': [ + './render.cpp', + ], + + 'variables' : { + 'cflags_cc': [ + '<@(glfw3_cflags)', + '<@(uv_cflags)', + '<@(boost_cflags)', + ], + 'ldflags': [ + '<@(glfw3_ldflags)', + '<@(uv_ldflags)', + '<@(boost_ldflags)', + '-lboost_program_options' + ], + 'libraries': [ + '<@(glfw3_static_libs)', + '<@(uv_static_libs)', + ], + }, + + 'conditions': [ + ['OS == "mac"', { + 'libraries': [ '<@(libraries)' ], + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], + 'OTHER_LDFLAGS': [ '<@(ldflags)' ], + } + }, { + 'cflags_cc': [ '<@(cflags_cc)' ], + 'libraries': [ '<@(libraries)', '<@(ldflags)' ], + }] + ], + }, + ], +} diff --git a/gyp/project.gyp b/gyp/project.gyp new file mode 100644 index 0000000000..9f53eef510 --- /dev/null +++ b/gyp/project.gyp @@ -0,0 +1,19 @@ +{ + 'conditions': [ + ['host == "osx"', { + 'includes': [ + '../macosx/mapboxgl-app.gypi', + '../linux/mapboxgl-app.gypi', + '../test/test.gypi', + '../bin/render.gypi', + ] + }], + ['host == "linux"', { + 'includes': [ + '../linux/mapboxgl-app.gypi', + '../test/test.gypi', + '../bin/render.gypi', + ] + }], + ], +} diff --git a/linux/mapboxgl-app.gyp b/linux/mapboxgl-app.gyp deleted file mode 100644 index 433a061e43..0000000000 --- a/linux/mapboxgl-app.gyp +++ /dev/null @@ -1,57 +0,0 @@ -{ - 'includes': [ - '../gyp/common.gypi', - ], - 'targets': [ - { 'target_name': 'linuxapp', - 'product_name': 'mapbox-gl', - 'type': 'executable', - - 'dependencies': [ - '../mbgl.gyp:core', - '../mbgl.gyp:platform-<(platform_lib)', - '../mbgl.gyp:http-<(http_lib)', - '../mbgl.gyp:asset-<(asset_lib)', - '../mbgl.gyp:cache-<(cache_lib)', - '../mbgl.gyp:bundle_styles', - '../mbgl.gyp:copy_certificate_bundle', - ], - - 'sources': [ - 'main.cpp', - '../platform/default/settings_json.cpp', - '../platform/default/glfw_view.cpp', - '../platform/default/log_stderr.cpp', - ], - - 'variables' : { - 'cflags_cc': [ - '<@(glfw3_cflags)', - ], - 'ldflags': [ - '<@(glfw3_ldflags)', - ], - 'libraries': [ - '<@(glfw3_static_libs)', - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { - 'SDKROOT': 'macosx', - 'SUPPORTED_PLATFORMS':'macosx', - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - 'SDKROOT': 'macosx', - 'MACOSX_DEPLOYMENT_TARGET': '10.9', - } - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - 'libraries': [ '<@(libraries)', '<@(ldflags)' ], - }] - ], - }, - ], -} diff --git a/linux/mapboxgl-app.gypi b/linux/mapboxgl-app.gypi new file mode 100644 index 0000000000..433a061e43 --- /dev/null +++ b/linux/mapboxgl-app.gypi @@ -0,0 +1,57 @@ +{ + 'includes': [ + '../gyp/common.gypi', + ], + 'targets': [ + { 'target_name': 'linuxapp', + 'product_name': 'mapbox-gl', + 'type': 'executable', + + 'dependencies': [ + '../mbgl.gyp:core', + '../mbgl.gyp:platform-<(platform_lib)', + '../mbgl.gyp:http-<(http_lib)', + '../mbgl.gyp:asset-<(asset_lib)', + '../mbgl.gyp:cache-<(cache_lib)', + '../mbgl.gyp:bundle_styles', + '../mbgl.gyp:copy_certificate_bundle', + ], + + 'sources': [ + 'main.cpp', + '../platform/default/settings_json.cpp', + '../platform/default/glfw_view.cpp', + '../platform/default/log_stderr.cpp', + ], + + 'variables' : { + 'cflags_cc': [ + '<@(glfw3_cflags)', + ], + 'ldflags': [ + '<@(glfw3_ldflags)', + ], + 'libraries': [ + '<@(glfw3_static_libs)', + ], + }, + + 'conditions': [ + ['OS == "mac"', { + 'libraries': [ '<@(libraries)' ], + 'xcode_settings': { + 'SDKROOT': 'macosx', + 'SUPPORTED_PLATFORMS':'macosx', + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], + 'OTHER_LDFLAGS': [ '<@(ldflags)' ], + 'SDKROOT': 'macosx', + 'MACOSX_DEPLOYMENT_TARGET': '10.9', + } + }, { + 'cflags_cc': [ '<@(cflags_cc)' ], + 'libraries': [ '<@(libraries)', '<@(ldflags)' ], + }] + ], + }, + ], +} diff --git a/macosx/mapboxgl-app.gyp b/macosx/mapboxgl-app.gyp deleted file mode 100644 index 9817f9d97c..0000000000 --- a/macosx/mapboxgl-app.gyp +++ /dev/null @@ -1,61 +0,0 @@ -{ - 'includes': [ - '../gyp/common.gypi', - ], - 'targets': [ - { 'target_name': 'osxapp', - 'product_name': 'Mapbox GL', - 'type': 'executable', - 'product_extension': 'app', - 'mac_bundle': 1, - 'mac_bundle_resources': [ - 'Icon.icns' - ], - - 'dependencies': [ - '../mbgl.gyp:bundle_styles', - '../mbgl.gyp:core', - '../mbgl.gyp:platform-<(platform_lib)', - '../mbgl.gyp:http-<(http_lib)', - '../mbgl.gyp:asset-<(asset_lib)', - '../mbgl.gyp:cache-<(cache_lib)', - ], - - 'sources': [ - './main.mm', - '../platform/darwin/settings_nsuserdefaults.hpp', - '../platform/darwin/settings_nsuserdefaults.mm', - '../platform/darwin/reachability.m', - '../platform/default/glfw_view.hpp', - '../platform/default/glfw_view.cpp', - ], - - 'variables' : { - 'cflags_cc': [ - '<@(glfw3_cflags)', - ], - 'ldflags': [ - '-framework SystemConfiguration', # For NSUserDefaults and Reachability - '<@(glfw3_ldflags)', - ], - 'libraries': [ - '<@(glfw3_static_libs)', - ], - }, - - 'libraries': [ - '<@(libraries)', - ], - - 'xcode_settings': { - 'SDKROOT': 'macosx', - 'SUPPORTED_PLATFORMS':'macosx', - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - 'SDKROOT': 'macosx', - 'INFOPLIST_FILE': 'Info.plist', - 'CLANG_ENABLE_OBJC_ARC': 'YES' - }, - } - ] -} diff --git a/macosx/mapboxgl-app.gypi b/macosx/mapboxgl-app.gypi new file mode 100644 index 0000000000..3817954042 --- /dev/null +++ b/macosx/mapboxgl-app.gypi @@ -0,0 +1,61 @@ +{ + 'includes': [ + '../gyp/common.gypi', + ], + 'targets': [ + { 'target_name': 'osxapp', + 'product_name': 'Mapbox GL', + 'type': 'executable', + 'product_extension': 'app', + 'mac_bundle': 1, + 'mac_bundle_resources': [ + 'Icon.icns' + ], + + 'dependencies': [ + '../mbgl.gyp:bundle_styles', + '../mbgl.gyp:core', + '../mbgl.gyp:platform-<(platform_lib)', + '../mbgl.gyp:http-<(http_lib)', + '../mbgl.gyp:asset-<(asset_lib)', + '../mbgl.gyp:cache-<(cache_lib)', + ], + + 'sources': [ + './main.mm', + '../platform/darwin/settings_nsuserdefaults.hpp', + '../platform/darwin/settings_nsuserdefaults.mm', + '../platform/darwin/reachability.m', + '../platform/default/glfw_view.hpp', + '../platform/default/glfw_view.cpp', + ], + + 'variables' : { + 'cflags_cc': [ + '<@(glfw3_cflags)', + ], + 'ldflags': [ + '-framework SystemConfiguration', # For NSUserDefaults and Reachability + '<@(glfw3_ldflags)', + ], + 'libraries': [ + '<@(glfw3_static_libs)', + ], + }, + + 'libraries': [ + '<@(libraries)', + ], + + 'xcode_settings': { + 'SDKROOT': 'macosx', + 'SUPPORTED_PLATFORMS':'macosx', + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], + 'OTHER_LDFLAGS': [ '<@(ldflags)' ], + 'SDKROOT': 'macosx', + 'INFOPLIST_FILE': '../macosx/Info.plist', + 'CLANG_ENABLE_OBJC_ARC': 'YES' + }, + } + ] +} diff --git a/scripts/package_ios.sh b/scripts/package_ios.sh index a651d27342..07e568faa1 100755 --- a/scripts/package_ios.sh +++ b/scripts/package_ios.sh @@ -31,7 +31,7 @@ step "Creating build files..." export MASON_PLATFORM=ios export BUILDTYPE=${BUILDTYPE:-Release} export HOST=ios -make Xcode/mbgl +make Xcode/ios step "Building iOS device targets..." xcodebuild -sdk iphoneos${IOS_SDK_VERSION} \ diff --git a/test/test.gyp b/test/test.gyp deleted file mode 100644 index 2e89db58b0..0000000000 --- a/test/test.gyp +++ /dev/null @@ -1,99 +0,0 @@ -{ - 'includes': [ - '../gyp/common.gypi', - ], - 'targets': [ - { 'target_name': 'symlink_TEST_DATA', - 'type': 'none', - 'hard_dependency': 1, - 'actions': [ - { - 'action_name': 'Symlink Fixture Directory', - 'inputs': ['