From 6fd3dadfea0ee94175192c19f222c96ec831b962 Mon Sep 17 00:00:00 2001 From: John Zhao Date: Thu, 3 Jan 2019 17:14:36 +0800 Subject: [PATCH] build(make): add cam_models option --- Makefile | 18 +++++++++++++++++- cmake/Option.cmake | 8 ++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fdb6a0d..dfd2f0f 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,23 @@ MKFILE_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH))) # UNIX: /usr/local # Windows: c:/Program Files/${PROJECT_NAME} +# Options +# +# SUDO: sudo command +# CAM_MODELS: cmake build with -DWITH_CAM_MODELS=ON +# +# e.g. make [TARGET] SUOD= +# e.g. make [TARGET] CAM_MODELS=1 + SUDO ?= sudo +CAM_MODELS ?= + +CMAKE_BUILD_EXTRA_OPTIONS := +ifneq ($(CAM_MODELS),) + CMAKE_BUILD_EXTRA_OPTIONS := $(CMAKE_BUILD_EXTRA_OPTIONS) -DWITH_CAM_MODELS=ON +endif + .DEFAULT_GOAL := all help: @@ -103,7 +118,7 @@ build: ifeq ($(HOST_OS),Win) @$(call cmake_build,./_build,..,-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/_install) else - @$(call cmake_build,./_build,..) + @$(call cmake_build,./_build,..,$(CMAKE_BUILD_EXTRA_OPTIONS)) endif .PHONY: build @@ -308,6 +323,7 @@ host: @echo LDD: $(LDD) @echo CMAKE: $(CMAKE) @echo PKGNAME: $(PKGNAME) + @echo CMAKE_BUILD_EXTRA_OPTIONS: $(CMAKE_BUILD_EXTRA_OPTIONS) .PHONY: host diff --git a/cmake/Option.cmake b/cmake/Option.cmake index 9865c24..dba2465 100644 --- a/cmake/Option.cmake +++ b/cmake/Option.cmake @@ -23,6 +23,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/Utils.cmake) option(WITH_API "Build with API layer, need OpenCV" ON) option(WITH_DEVICE_INFO_REQUIRED "Build with device info required" ON) +option(WITH_CAM_MODELS "Build with more camera models" OFF) + # 3rdparty components option(WITH_BOOST "Include Boost support" ON) @@ -41,6 +43,10 @@ if(WITH_DEVICE_INFO_REQUIRED) add_definitions(-DWITH_DEVICE_INFO_REQUIRED) endif() +if(WITH_CAM_MODELS) + add_definitions(-DWITH_CAM_MODELS) +endif() + if(WITH_BOOST) find_package(Boost COMPONENTS filesystem) if(Boost_FOUND) @@ -120,6 +126,8 @@ endif() status(" WITH_DEVICE_INFO_REQUIRED: ${WITH_DEVICE_INFO_REQUIRED}") +status(" WITH_CAM_MODELS: ${WITH_CAM_MODELS}") + status(" WITH_BOOST: ${WITH_BOOST}") if(WITH_BOOST) if(Boost_FOUND)