-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
120 lines (103 loc) · 3.25 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
.PHONY: check_os clean setup build rebuild test
# Variables defining build paths
BUILD_DIR_ROOT=build
BUILD_DIR_MODULES=modules
BUILD_TYPE=Release
BUILD_DIR_CMAKE=cmake
BUILD_PATH=$(BUILD_DIR_ROOT)/$(BUILD_TYPE)/$(BUILD_DIR_CMAKE)
# Users can optionally define paths to third party and test data dirs
# if it's not placed within this repo
ifndef THIRD_PARTY_DIR
THIRD_PARTY_DIR=third_party
endif
ifndef TEST_DATA_DIR
TEST_DATA_DIR=test_data
endif
# Variables for unit tests
BIN_DIR=bin
MOSTEST_EXE=mostest
MOSTEST_BIN_DIR=$(BUILD_DIR_ROOT)/$(BUILD_TYPE)/$(BIN_DIR)
MOSTEST_COMMAND=$(MOSTEST_BIN_DIR)/$(MOSTEST_EXE) -p $(TEST_DATA_DIR) $*
# Detect OS from env variables or uname
ifeq ($(OS), Windows_NT)
DETECTED_OS = windows
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S), Linux)
DETECTED_OS = linux
else ifeq ($(UNAME_S), Darwin)
DETECTED_OS = mac
endif
endif
# Environment variables to pass to cmake for compilation
# Configures the lib version
ISX_VERSION_MAJOR=2
ISX_VERSION_MINOR=0
ISX_VERSION_PATCH=0
ISX_VERSION_BUILD=0
ISX_IS_BETA=1
# Configure whether to use async ops for file io (movies only supported currently)
# Disable async api if you don't want to create a QT event loop in order to use the api for read/write ops
ifndef ISX_ASYNC_API
ISX_ASYNC_API=1
endif
# Configures building with algos module from IDPS
ISX_WITH_ALGOS=0
CMAKE_OPTIONS=\
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)\
-DISX_VERSION_MAJOR=${ISX_VERSION_MAJOR}\
-DISX_VERSION_MINOR=${ISX_VERSION_MINOR}\
-DISX_VERSION_PATCH=${ISX_VERSION_PATCH}\
-DISX_VERSION_BUILD=${ISX_VERSION_BUILD}\
-DISX_IS_BETA=${ISX_IS_BETA}\
-DISX_WITH_ALGOS=${ISX_WITH_ALGOS}\
-DISX_ASYNC_API=${ISX_ASYNC_API}
ifeq ($(DETECTED_OS), windows)
CMAKE_GENERATOR = Visual Studio 14 2015 Win64
else ifeq ($(DETECTED_OS), linux)
CMAKE_GENERATOR = Unix Makefiles
ifndef CMAKE_C_COMPILER
CMAKE_C_COMPILER=gcc
endif
ifndef CMAKE_CXX_COMPILER
CMAKE_CXX_COMPILER=g++
endif
CMAKE_OPTIONS += -DCMAKE_C_COMPILER=$(CMAKE_C_COMPILER) -DCMAKE_CXX_COMPILER=$(CMAKE_CXX_COMPILER)
else ifeq ($(DETECTED_OS), mac)
CMAKE_GENERATOR = Xcode
endif
check_os:
@echo "Verifying detected OS"
ifndef DETECTED_OS
@echo "Failed to detect supported OS"; exit 1
else
@echo "Detected OS: ${DETECTED_OS}"
endif
clean:
@rm -rf build
setup:
./scripts/setup -v --src ${REMOTE_DIR} --dst ${REMOTE_LOCAL_DIR} --remote-copy
./scripts/setup --src ${REMOTE_LOCAL_DIR}
build: check_os
@mkdir -p $(BUILD_PATH) && \
cd $(BUILD_PATH) && \
THIRD_PARTY_DIR=$(THIRD_PARTY_DIR) cmake $(CMAKE_OPTIONS) -G "$(CMAKE_GENERATOR)" ../../../
ifeq ($(DETECTED_OS), windows)
@cd $(BUILD_PATH) && \
"/c/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe" isxcore.sln //p:Configuration=$(BUILD_TYPE) //maxcpucount:8
else ifeq ($(DETECTED_OS), linux)
@cd $(BUILD_PATH) && \
make -j2
else ifeq ($(DETECTED_OS), mac)
@cd $(BUILD_PATH) && \
xcodebuild -alltargets -configuration $(BUILD_TYPE) -project isxcore.xcodeproj CODE_SIGN_IDENTITY=""
endif
rebuild: clean build
test: build
ifeq ($(DETECTED_OS), windows)
@$(MOSTEST_COMMAND)
else ifeq ($(DETECTED_OS), mac)
@DYLD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(MOSTEST_BIN_DIR) $(MOSTEST_COMMAND)
else ifeq ($(DETECTED_OS), linux)
@LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(MOSTEST_BIN_DIR) ${MOSTEST_COMMAND}
endif