[build] unify naming of Makefile targets

`make foo` just builds
`make run-foo` builds and runs
This commit is contained in:
Konstantin Käfer
2016-07-26 12:30:20 +02:00
parent 2b59061199
commit e46b580c67
6 changed files with 37 additions and 23 deletions

View File

@@ -18,7 +18,7 @@ The mapbox-gl-native build system uses a variety of tools.
## Make
GNU Make and a master `Makefile` serves as the coordinating tool for all other build system tools. Most of your interaction with the build system will be via `make` commands. We aim to have a consistent pattern for make targets across platforms: for a given platform, e.g. `ios`, `make ios` builds a reasonable set of end products (though perhaps not all permutations of build options, which can be prohibitively expensive), and `make test-ios` runs a complete test suite for the platform.
GNU Make and a master `Makefile` serves as the coordinating tool for all other build system tools. Most of your interaction with the build system will be via `make` commands. We aim to have a consistent pattern for make targets across platforms: for a given platform, e.g. `ios`, `make ios` builds a reasonable set of end products (though perhaps not all permutations of build options, which can be prohibitively expensive), and `make ios-test` runs a complete test suite for the platform.
## Git submodules

View File

@@ -39,7 +39,7 @@ else
endif
.PHONY: default
default: test-$(BUILD_PLATFORM)
default: test
ifneq (,$(wildcard .git/.))
.mason/mason:
@@ -109,16 +109,24 @@ macos: $(MACOS_PROJ_PATH)
xproj: $(MACOS_PROJ_PATH)
open $(MACOS_WORK_PATH)
.PHONY: test-macos
test-macos: $(MACOS_PROJ_PATH)
.PHONY: test
test: $(MACOS_PROJ_PATH)
set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'mbgl-test' build $(XCPRETTY)
ulimit -c unlimited && ($(MACOS_OUTPUT_PATH)/$(BUILDTYPE)/mbgl-test & pid=$$! && wait $$pid \
.PHONY: run-test
run-test: run-test-*
run-test-%: test
ulimit -c unlimited && ($(MACOS_OUTPUT_PATH)/$(BUILDTYPE)/mbgl-test --gtest_catch_exceptions=0 --gtest_filter=$* & pid=$$! && wait $$pid \
|| (lldb -c /cores/core.$$pid --batch --one-line 'thread backtrace all' --one-line 'quit' && exit 1))
set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'CI' test $(XCPRETTY)
.PHONY: glfw-app
glfw-app: $(MACOS_PROJ_PATH)
set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'mbgl-glfw' build $(XCPRETTY)
.PHONY: run-glfw-app
run-glfw-app: glfw-app
"$(MACOS_OUTPUT_PATH)/$(BUILDTYPE)/mbgl-glfw"
.PHONY: render
@@ -210,8 +218,8 @@ ios: $(IOS_PROJ_PATH)
iproj: $(IOS_PROJ_PATH)
open $(IOS_WORK_PATH)
.PHONY: test-ios
test-ios: $(IOS_PROJ_PATH)
.PHONY: ios-test
ios-test: $(IOS_PROJ_PATH)
set -o pipefail && $(IOS_XCODEBUILD_SIM) -scheme 'CI' test $(XCPRETTY)
.PHONY: ipackage
@@ -264,13 +272,25 @@ $(LINUX_BUILD): $(BUILD_DEPS)
.PHONY: linux
linux: glfw-app render offline
test-linux: run-test-*
.PHONY: test
test: $(LINUX_BUILD)
$(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-test
.PHONY: linux-render
ifneq (,$(shell which gdb))
GDB = gdb -batch -return-child-result -ex 'set print thread-events off' -ex 'run' -ex 'thread apply all bt' --args
endif
.PHONY: run-test
run-test: run-test-*
run-test-%: test
$(GDB) $(LINUX_OUTPUT_PATH)/mbgl-test --gtest_catch_exceptions=0 --gtest_filter=$*
.PHONY: render
render: $(LINUX_BUILD)
$(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-render
.PHONY: linux-offline
.PHONY: offline
offline: $(LINUX_BUILD)
$(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-offline
@@ -278,10 +298,6 @@ offline: $(LINUX_BUILD)
glfw-app: $(LINUX_BUILD)
$(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-glfw
.PHONY: test
test: $(LINUX_BUILD)
$(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-test
.PHONY: run-glfw-app
run-glfw-app: glfw-app
cd $(LINUX_OUTPUT_PATH) && ./mbgl-glfw
@@ -290,13 +306,6 @@ run-glfw-app: glfw-app
node: $(LINUX_BUILD)
$(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-node
ifneq (,$(shell which gdb))
GDB = gdb -batch -return-child-result -ex 'set print thread-events off' -ex 'run' -ex 'thread apply all bt' --args
endif
run-test-%: test
$(GDB) $(LINUX_OUTPUT_PATH)/mbgl-test --gtest_catch_exceptions=0 --gtest_filter=$*
.PHONY: compdb
compdb: $(LINUX_BUILD)
# Ninja generator already outputs the file at the right location

View File

@@ -108,7 +108,7 @@ To add or update text that the user may see in the iOS SDK:
## Testing
`make test-ios` builds and runs unit tests of cross-platform code as well as the SDK.
`make ios-test` builds and runs unit tests of cross-platform code as well as the SDK.
Before you can run unit tests of the cross-platform code on the command line, install ios-sim version 3.2.0 (not any other version):

View File

@@ -36,7 +36,7 @@ workflows:
gem install jazzy --no-rdoc --no-ri
export BUILDTYPE=Debug
make ios
make test-ios
make ios-test
- is_debug: 'yes'
- slack:
title: Post to Slack

View File

@@ -53,6 +53,10 @@ For macOS desktop, you can install Qt 5 via [Homebrew](http://brew.sh):
brew install qt5
Since Homebrew doesn't add Qt to the path, you'll have to do that manually before running any Make target:
export PATH=/usr/local/opt/qt5:$PATH
We provide the following build targets for our Qt SDK:
### Build instructions

View File

@@ -40,6 +40,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) {
std::string message;
// This host does not respond (== connection error).
// Are you seeing this test fail? Make sure you don't have a server running on port 3001!
map.setStyleJSON(style);
map.renderStill([&](std::exception_ptr err, PremultipliedImage&&) {
ASSERT_TRUE(err.operator bool());