-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.win
67 lines (56 loc) · 2.04 KB
/
Makefile.win
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
!IFNDEF MIX_APP_PATH
MIX_APP_PATH=$(MAKEDIR)
!ENDIF
PRIV_DIR = $(MIX_APP_PATH)/priv
NIF_SO = $(PRIV_DIR)/expty.dll
C_SRC = $(MAKEDIR)\c_src
LIB_SRC = $(MAKEDIR)\lib
LIBUV_SRC = $(MAKEDIR)\3rd_party\libuv-1.44.2
LIBUV_BUILD_DIR = $(MIX_APP_PATH)/cmake_libuv-1.44.2
LIBUV_INSTALL_DIR = $(MIX_APP_PATH)/libuv
LIBUV_A = $(LIBUV_INSTALL_DIR)/lib/uv_a.lib
NIF_BUILD_DIR = $(MIX_APP_PATH)/cmake_expty
!IFNDEF CMAKE_BUILD_TYPE
CMAKE_BUILD_TYPE=Release
!ENDIF
!IF "$(HAVE_NINJA)" == "true"
CMAKE_GENERATOR_TYPE=Ninja
!ELSE
CMAKE_GENERATOR_TYPE=NMake Makefiles
!ENDIF
build: $(NIF_SO)
$(PRIV_DIR):
@ if not exist "$(PRIV_DIR)" mkdir "$(PRIV_DIR)"
$(LIBUV_BUILD_DIR):
@ if not exist "$(LIBUV_BUILD_DIR)" mkdir "$(LIBUV_BUILD_DIR)"
$(NIF_BUILD_DIR):
@ if not exist "$(NIF_BUILD_DIR)" mkdir "$(NIF_BUILD_DIR)"
$(LIBUV_A): $(PRIV_DIR) $(LIBUV_BUILD_DIR)
@ if not exist "$(LIBUV_A)" ( \
cd "$(LIBUV_BUILD_DIR)" && \
cmake "$(LIBUV_SRC)" -G "$(CMAKE_GENERATOR_TYPE)" \
-D CMAKE_INSTALL_PREFIX="$(LIBUV_INSTALL_DIR)" \
-D BUILD_TESTING=OFF && \
cmake --build . $(MAKE_BUILD_FLAGS) --config "$(CMAKE_BUILD_TYPE)" && \
cmake --install . --config "$(CMAKE_BUILD_TYPE)" \
)
$(NIF_SO): $(PRIV_DIR) $(NIF_BUILD_DIR) $(LIBUV_A)
@ if not exist "$(NIF_SO)" ( \
cd "$(NIF_BUILD_DIR)" && \
cmake "$(MAKEDIR)" -G "$(CMAKE_GENERATOR_TYPE)" \
-D CMAKE_INSTALL_PREFIX="$(PRIV_DIR)" \
-D LIBUV_INCLUDE_DIR="$(LIBUV_INSTALL_DIR)/include" \
-D LIBUV_LIBRARIES_DIR="$(LIBUV_INSTALL_DIR)/lib" \
-D C_SRC="$(C_SRC)" \
-D CMAKE_TOOLCHAIN_FILE="$(TOOLCHAIN_FILE)" \
-D MIX_APP_PATH="$(MIX_APP_PATH)" \
-D PRIV_DIR="$(PRIV_DIR)" \
-D ERTS_INCLUDE_DIR="$(ERTS_INCLUDE_DIR)" && \
cmake --build . $(MAKE_BUILD_FLAGS) --config "$(CMAKE_BUILD_TYPE)" && \
cmake --install . --config "$(CMAKE_BUILD_TYPE)" \
)
cleanup:
@ if exist "$(PRIV_DIR)" rmdir /s /q "$(PRIV_DIR)"
@ if exist "$(LIBUV_BUILD_DIR)" rmdir /s /q "$(LIBUV_BUILD_DIR)"
@ if exist "$(LIBUV_INSTALL_DIR)" rmdir /s /q "$(LIBUV_INSTALL_DIR)"
@ if exist "$(NIF_BUILD_DIR)" rmdir /s /q "$(NIF_BUILD_DIR)"