2018-05-10 09:46:34 +03:00
|
|
|
# Copyright 2018 Slightech Co., Ltd. All rights reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2018-03-08 09:54:14 +02:00
|
|
|
include CommonDefs.mk
|
|
|
|
|
2018-05-20 04:25:30 +03:00
|
|
|
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
|
|
|
|
MKFILE_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
|
|
|
|
|
2018-08-14 05:45:13 +03:00
|
|
|
# CMAKE_INSTALL_PREFIX:
|
|
|
|
# https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html
|
|
|
|
#
|
|
|
|
# UNIX: /usr/local
|
|
|
|
# Windows: c:/Program Files/${PROJECT_NAME}
|
|
|
|
|
2019-01-03 11:14:36 +02:00
|
|
|
# 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
|
|
|
|
|
2018-10-24 06:06:31 +03:00
|
|
|
SUDO ?= sudo
|
|
|
|
|
2019-01-03 11:14:36 +02:00
|
|
|
CAM_MODELS ?=
|
|
|
|
|
|
|
|
CMAKE_BUILD_EXTRA_OPTIONS :=
|
|
|
|
ifneq ($(CAM_MODELS),)
|
|
|
|
CMAKE_BUILD_EXTRA_OPTIONS := $(CMAKE_BUILD_EXTRA_OPTIONS) -DWITH_CAM_MODELS=ON
|
|
|
|
endif
|
|
|
|
|
2018-11-18 16:17:54 +02:00
|
|
|
.DEFAULT_GOAL := all
|
2018-03-08 09:54:14 +02:00
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "Usage:"
|
2018-03-09 04:51:09 +02:00
|
|
|
@echo " make help show help message"
|
|
|
|
@echo " make apidoc make api doc"
|
|
|
|
@echo " make opendoc open api doc (html)"
|
|
|
|
@echo " make init init project"
|
2018-03-11 18:15:30 +02:00
|
|
|
@echo " make build build project"
|
2018-03-22 06:57:35 +02:00
|
|
|
@echo " make install install project"
|
2018-09-04 09:35:27 +03:00
|
|
|
@echo " make test build test and run"
|
2018-03-22 07:03:08 +02:00
|
|
|
@echo " make samples build samples"
|
2018-04-15 09:59:51 +03:00
|
|
|
@echo " make tools build tools"
|
2018-11-01 14:03:23 +02:00
|
|
|
@echo " make pkg package sdk"
|
2018-04-14 05:33:08 +03:00
|
|
|
@echo " make ros build ros wrapper"
|
2018-05-17 12:28:43 +03:00
|
|
|
@echo " make py build python wrapper"
|
2018-03-09 04:51:09 +02:00
|
|
|
@echo " make clean|cleanall clean generated or useless things"
|
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
|
2018-11-19 08:15:47 +02:00
|
|
|
all: init samples tools ros
|
2018-05-11 11:15:26 +03:00
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
|
2018-03-09 04:51:09 +02:00
|
|
|
# doc
|
2018-03-08 09:54:14 +02:00
|
|
|
|
|
|
|
apidoc:
|
|
|
|
@$(call echo,Make $@)
|
2018-09-27 04:31:42 +03:00
|
|
|
@# @[ -e ./_install/include ] || $(MAKE) install
|
|
|
|
@[ -e /usr/local/include/mynteye ] || $(MAKE) install
|
2018-03-09 05:42:45 +02:00
|
|
|
@$(SH) ./doc/build.sh
|
2018-03-08 09:54:14 +02:00
|
|
|
|
|
|
|
opendoc: apidoc
|
|
|
|
@$(call echo,Make $@)
|
2018-03-09 05:42:45 +02:00
|
|
|
@$(shell $(SH) ./doc/langs.sh 1); \
|
2018-03-08 09:54:14 +02:00
|
|
|
for lang in "$${LANGS[@]}"; do \
|
2018-03-26 08:50:13 +03:00
|
|
|
html=./doc/_output/$$lang/html/index.html; \
|
2018-03-09 05:42:45 +02:00
|
|
|
[ -f "$$html" ] && $(SH) ./scripts/open.sh $$html; \
|
2018-03-08 09:54:14 +02:00
|
|
|
done
|
2018-03-08 11:33:41 +02:00
|
|
|
|
2018-07-08 08:04:41 +03:00
|
|
|
cleandoc:
|
|
|
|
@$(call rm,./doc/_output/)
|
|
|
|
|
|
|
|
.PHONY: apidoc opendoc cleandoc
|
2018-03-09 04:51:09 +02:00
|
|
|
|
|
|
|
# deps
|
|
|
|
|
|
|
|
submodules:
|
|
|
|
@git submodule update --init
|
|
|
|
|
2018-09-04 12:11:39 +03:00
|
|
|
.PHONY: submodules
|
2018-03-09 04:51:09 +02:00
|
|
|
|
2019-01-03 10:25:18 +02:00
|
|
|
# 3rdparty
|
|
|
|
|
|
|
|
ceres:
|
|
|
|
@$(call echo,Make $@)
|
|
|
|
@$(call cmake_build,./3rdparty/ceres-solver-1.11.0/_build,.., \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/3rdparty/ceres \
|
|
|
|
-DGFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION=OFF \
|
|
|
|
-DMINIGLOG=ON)
|
|
|
|
@cd ./3rdparty/ceres-solver-1.11.0/_build; make install
|
|
|
|
|
|
|
|
.PHONY: ceres
|
|
|
|
|
2018-03-22 06:57:35 +02:00
|
|
|
# init
|
|
|
|
|
2018-11-18 16:17:54 +02:00
|
|
|
init:
|
2018-03-22 06:57:35 +02:00
|
|
|
@$(call echo,Make $@)
|
2018-10-24 06:06:31 +03:00
|
|
|
@$(SH) ./scripts/init.sh $(INIT_OPTIONS)
|
2018-03-22 06:57:35 +02:00
|
|
|
|
|
|
|
.PHONY: init
|
|
|
|
|
2018-03-11 18:15:30 +02:00
|
|
|
# build
|
|
|
|
|
2018-11-19 08:15:47 +02:00
|
|
|
build:
|
2018-03-11 18:15:30 +02:00
|
|
|
@$(call echo,Make $@)
|
2018-08-14 08:46:18 +03:00
|
|
|
ifeq ($(HOST_OS),Win)
|
|
|
|
@$(call cmake_build,./_build,..,-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/_install)
|
|
|
|
else
|
2019-01-03 11:14:36 +02:00
|
|
|
@$(call cmake_build,./_build,..,$(CMAKE_BUILD_EXTRA_OPTIONS))
|
2018-08-14 08:46:18 +03:00
|
|
|
endif
|
2018-03-11 18:15:30 +02:00
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
|
2018-03-09 04:51:09 +02:00
|
|
|
# test
|
|
|
|
|
2018-11-18 16:17:54 +02:00
|
|
|
test: submodules install
|
2018-03-09 04:51:09 +02:00
|
|
|
@$(call echo,Make $@)
|
|
|
|
@$(call echo,Make gtest,33)
|
2018-04-25 06:32:54 +03:00
|
|
|
ifeq ($(HOST_OS),Win)
|
|
|
|
@$(call cmake_build,./test/gtest/_build,..,-Dgtest_force_shared_crt=ON)
|
|
|
|
else
|
2018-04-03 05:27:28 +03:00
|
|
|
@$(call cmake_build,./test/gtest/_build)
|
2018-04-25 06:32:54 +03:00
|
|
|
endif
|
2018-04-03 05:27:28 +03:00
|
|
|
@$(call echo,Make test,33)
|
|
|
|
@$(call cmake_build,./test/_build)
|
2018-04-25 06:32:54 +03:00
|
|
|
ifeq ($(HOST_OS),Win)
|
|
|
|
@.\\\test\\\_output\\\bin\\\mynteye_test.bat
|
|
|
|
else
|
2018-04-03 05:27:28 +03:00
|
|
|
@./test/_output/bin/mynteye_test
|
2018-04-25 06:32:54 +03:00
|
|
|
endif
|
2018-03-09 04:51:09 +02:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
|
2018-03-22 06:57:35 +02:00
|
|
|
# install
|
|
|
|
|
|
|
|
install: build
|
|
|
|
@$(call echo,Make $@)
|
2018-04-23 18:11:11 +03:00
|
|
|
ifeq ($(HOST_OS),Win)
|
|
|
|
ifneq ($(HOST_NAME),MinGW)
|
|
|
|
@cd ./_build; msbuild.exe INSTALL.vcxproj /property:Configuration=Release
|
|
|
|
else
|
2018-08-14 08:46:18 +03:00
|
|
|
@cd ./_build; make install
|
2018-04-23 18:11:11 +03:00
|
|
|
endif
|
|
|
|
else
|
2018-09-11 05:58:42 +03:00
|
|
|
ifeq ($(HOST_OS),Linux)
|
2018-10-24 06:06:31 +03:00
|
|
|
@cd ./_build; $(SUDO) make install
|
2018-09-11 05:58:42 +03:00
|
|
|
else
|
|
|
|
@cd ./_build; make install
|
|
|
|
endif
|
2018-04-23 18:11:11 +03:00
|
|
|
endif
|
2018-03-22 06:57:35 +02:00
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
|
2018-10-26 10:39:34 +03:00
|
|
|
uninstall:
|
|
|
|
@$(call echo,Make $@)
|
|
|
|
ifeq ($(HOST_OS),Linux)
|
|
|
|
$(SUDO) rm -rf /usr/local/include/mynteye/
|
2018-12-04 09:46:54 +02:00
|
|
|
$(SUDO) rm -rf /usr/local/lib/libmynteye.so*
|
2018-10-26 10:39:34 +03:00
|
|
|
$(SUDO) rm -rf /usr/local/lib/cmake/mynteye/
|
|
|
|
$(SUDO) rm -rf /usr/local/share/mynteye/
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: uninstall
|
|
|
|
|
2018-03-22 07:03:08 +02:00
|
|
|
# samples
|
|
|
|
|
|
|
|
samples: install
|
|
|
|
@$(call echo,Make $@)
|
|
|
|
@$(call cmake_build,./samples/_build)
|
|
|
|
|
|
|
|
.PHONY: samples
|
|
|
|
|
2018-04-15 09:59:51 +03:00
|
|
|
# tools
|
|
|
|
|
|
|
|
tools: install
|
|
|
|
@$(call echo,Make $@)
|
|
|
|
@$(call cmake_build,./tools/_build)
|
|
|
|
|
|
|
|
.PHONY: tools
|
|
|
|
|
2018-11-01 14:03:23 +02:00
|
|
|
# pkg
|
2018-04-14 05:33:08 +03:00
|
|
|
|
2018-11-01 14:03:23 +02:00
|
|
|
pkg: clean
|
2018-04-14 05:33:08 +03:00
|
|
|
@$(call echo,Make $@)
|
2018-04-23 18:11:11 +03:00
|
|
|
ifeq ($(HOST_OS),Win)
|
2018-11-01 17:12:36 +02:00
|
|
|
@$(SH) ./scripts/win/winpack.sh "$(PKGNAME)"
|
2018-04-23 18:11:11 +03:00
|
|
|
else
|
2018-11-01 14:03:23 +02:00
|
|
|
$(error "Can't make pkg on $(HOST_OS)")
|
|
|
|
endif
|
|
|
|
|
|
|
|
cleanpkg:
|
|
|
|
@$(call echo,Make $@)
|
|
|
|
@$(call rm_f,$(PKGNAME)*)
|
|
|
|
|
|
|
|
.PHONY: pkg cleanpkg
|
|
|
|
|
|
|
|
# ros
|
|
|
|
|
|
|
|
ros: install
|
|
|
|
@$(call echo,Make $@)
|
|
|
|
ifeq ($(HOST_OS),Linux)
|
2018-11-07 08:37:03 +02:00
|
|
|
@cd ./wrappers/ros && catkin_make -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
|
2018-11-01 14:03:23 +02:00
|
|
|
else
|
|
|
|
$(error "Can't make ros on $(HOST_OS)")
|
2018-04-23 18:11:11 +03:00
|
|
|
endif
|
2018-04-14 05:33:08 +03:00
|
|
|
|
|
|
|
.PHONY: ros
|
|
|
|
|
|
|
|
cleanros:
|
|
|
|
@$(call echo,Make $@)
|
|
|
|
@$(call rm,./wrappers/ros/build/)
|
|
|
|
@$(call rm,./wrappers/ros/devel/)
|
|
|
|
@$(call rm,./wrappers/ros/install/)
|
|
|
|
@$(call rm,./wrappers/ros/.catkin_workspace)
|
|
|
|
@$(call rm,./wrappers/ros/src/CMakeLists.txt)
|
2018-04-14 16:27:40 +03:00
|
|
|
@$(call rm_f,*INFO*,$(HOME)/.ros/)
|
|
|
|
@$(call rm_f,*WARNING*,$(HOME)/.ros/)
|
|
|
|
@$(call rm_f,*ERROR*,$(HOME)/.ros/)
|
|
|
|
@$(call rm_f,*FATAL*,$(HOME)/.ros/)
|
2018-04-14 05:33:08 +03:00
|
|
|
|
|
|
|
.PHONY: cleanros
|
|
|
|
|
2018-05-17 12:28:43 +03:00
|
|
|
# python
|
|
|
|
|
2018-05-20 04:25:30 +03:00
|
|
|
PBCVT_DIR := wrappers/python/third_party/pyboostcvconverter
|
|
|
|
|
|
|
|
$(PBCVT_DIR):
|
|
|
|
@git clone https://github.com/Algomorph/pyboostcvconverter.git $@
|
|
|
|
|
|
|
|
pbcvt: $(PBCVT_DIR)
|
|
|
|
@$(call cmake_build,$(PBCVT_DIR)/_build,.., \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/wrappers/python/_install \
|
|
|
|
-DPYTHON_DESIRED_VERSION=2.X)
|
|
|
|
@cd $(PBCVT_DIR)/_build; make install
|
|
|
|
|
|
|
|
.PHONY: pbcvt
|
|
|
|
|
|
|
|
NPCV_DIR := wrappers/python/third_party/numpy-opencv-converter
|
|
|
|
|
|
|
|
$(NPCV_DIR):
|
|
|
|
@git clone https://github.com/GarrickLin/numpy-opencv-converter.git $@
|
|
|
|
|
2018-05-17 12:28:43 +03:00
|
|
|
py: python
|
|
|
|
|
2018-05-20 04:25:30 +03:00
|
|
|
python: install $(NPCV_DIR)
|
2018-05-17 12:28:43 +03:00
|
|
|
@$(call echo,Make $@)
|
|
|
|
@$(call cmake_build,./wrappers/python/_build)
|
2018-05-20 04:25:30 +03:00
|
|
|
@cd ./wrappers/python/_build; make install
|
2018-05-17 12:28:43 +03:00
|
|
|
|
|
|
|
.PHONY: py python
|
|
|
|
|
|
|
|
cleanpy:
|
|
|
|
@$(call echo,Make $@)
|
|
|
|
@$(call rm,./wrappers/python/_build/)
|
|
|
|
@$(call rm,./wrappers/python/_output/)
|
2018-05-20 04:25:30 +03:00
|
|
|
@$(call rm,./wrappers/python/_install/)
|
|
|
|
@$(call rm,./$(PBCVT_DIR)/_build/)
|
2018-05-17 12:28:43 +03:00
|
|
|
|
|
|
|
.PHONY: cleanpy
|
|
|
|
|
2018-03-09 04:51:09 +02:00
|
|
|
# clean
|
|
|
|
|
2018-04-14 16:27:40 +03:00
|
|
|
clean:
|
2018-03-09 04:51:09 +02:00
|
|
|
@$(call echo,Make $@)
|
2018-03-11 18:15:30 +02:00
|
|
|
@$(call rm,./_build/)
|
|
|
|
@$(call rm,./_output/)
|
2018-03-22 06:57:35 +02:00
|
|
|
@$(call rm,./_install/)
|
2018-03-23 07:05:17 +03:00
|
|
|
@$(call rm,./samples/_build/)
|
|
|
|
@$(call rm,./samples/_output/)
|
2018-04-15 09:59:51 +03:00
|
|
|
@$(call rm,./tools/_build/)
|
|
|
|
@$(call rm,./tools/_output/)
|
2018-04-03 05:27:28 +03:00
|
|
|
@$(call rm,./test/_build/)
|
|
|
|
@$(call rm,./test/_output/)
|
2018-03-11 18:15:30 +02:00
|
|
|
@$(MAKE) cleanlog
|
2018-04-14 16:27:40 +03:00
|
|
|
ifeq ($(HOST_OS),Linux)
|
|
|
|
@$(MAKE) cleanros
|
|
|
|
endif
|
2018-05-17 12:28:43 +03:00
|
|
|
@$(MAKE) cleanpy
|
2018-03-09 04:51:09 +02:00
|
|
|
|
2018-03-11 18:15:30 +02:00
|
|
|
cleanlog:
|
|
|
|
@$(call rm_f,*INFO*)
|
|
|
|
@$(call rm_f,*WARNING*)
|
|
|
|
@$(call rm_f,*ERROR*)
|
2018-03-22 07:03:08 +02:00
|
|
|
@$(call rm_f,*FATAL*)
|
2018-03-11 18:15:30 +02:00
|
|
|
|
2018-07-08 08:04:41 +03:00
|
|
|
cleanall: clean cleandoc
|
2019-01-03 10:25:18 +02:00
|
|
|
@$(call rm,./3rdparty/ceres-solver-1.11.0/_build/)
|
2018-04-14 05:33:08 +03:00
|
|
|
@$(call rm,./test/gtest/_build/)
|
|
|
|
@$(FIND) . -type f -name ".DS_Store" -print0 | xargs -0 rm -f
|
2018-05-20 04:25:30 +03:00
|
|
|
@$(call rm,./$(PBCVT_DIR)/)
|
|
|
|
@$(call rm,./$(NPCV_DIR)/)
|
2018-04-14 05:33:08 +03:00
|
|
|
|
|
|
|
.PHONY: clean cleanlog cleanall
|
2018-03-09 04:51:09 +02:00
|
|
|
|
|
|
|
# others
|
|
|
|
|
2018-03-08 11:33:41 +02:00
|
|
|
host:
|
|
|
|
@$(call echo,Make $@)
|
2018-05-20 04:25:30 +03:00
|
|
|
@echo MKFILE_PATH: $(MKFILE_PATH)
|
|
|
|
@echo MKFILE_DIR: $(MKFILE_DIR)
|
2018-03-08 11:33:41 +02:00
|
|
|
@echo HOST_OS: $(HOST_OS)
|
|
|
|
@echo HOST_ARCH: $(HOST_ARCH)
|
2018-03-09 08:10:42 +02:00
|
|
|
@echo HOST_NAME: $(HOST_NAME)
|
2018-03-09 05:42:45 +02:00
|
|
|
@echo SH: $(SH)
|
2018-03-08 11:33:41 +02:00
|
|
|
@echo ECHO: $(ECHO)
|
2018-03-09 05:42:45 +02:00
|
|
|
@echo FIND: $(FIND)
|
2018-03-08 11:33:41 +02:00
|
|
|
@echo CC: $(CC)
|
|
|
|
@echo CXX: $(CXX)
|
|
|
|
@echo MAKE: $(MAKE)
|
|
|
|
@echo BUILD: $(BUILD)
|
|
|
|
@echo LDD: $(LDD)
|
|
|
|
@echo CMAKE: $(CMAKE)
|
2018-11-01 14:03:23 +02:00
|
|
|
@echo PKGNAME: $(PKGNAME)
|
2019-01-03 11:14:36 +02:00
|
|
|
@echo CMAKE_BUILD_EXTRA_OPTIONS: $(CMAKE_BUILD_EXTRA_OPTIONS)
|
2018-03-09 04:51:09 +02:00
|
|
|
|
|
|
|
.PHONY: host
|
2018-03-11 18:15:30 +02:00
|
|
|
|
2018-03-22 06:57:35 +02:00
|
|
|
cpplint: submodules
|
2018-03-11 18:15:30 +02:00
|
|
|
@$(call echo,Make $@)
|
|
|
|
@$(SH) ./scripts/$@.sh
|
|
|
|
|
|
|
|
.PHONY: cpplint
|