forked from elixir-explorer/adbc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.win
85 lines (73 loc) · 2.48 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
!IFNDEF MIX_APP_PATH
MIX_APP_PATH=$(MAKEDIR)
!ENDIF
PRIV_DIR = $(MIX_APP_PATH)/priv
NIF_SO = $(PRIV_DIR)/adbc_nif.dll
THIRD_PARTY_DIR = $(MAKEDIR)\3rd_party
ADBC_SRC = $(THIRD_PARTY_DIR)\apache-arrow-adbc
ADBC_C_SRC = $(ADBC_SRC)\c
C_SRC = $(MAKEDIR)\c_src
!IFDEF CMAKE_TOOLCHAIN_FILE
CMAKE_CONFIGURE_FLAGS=-D CMAKE_TOOLCHAIN_FILE="$(CMAKE_TOOLCHAIN_FILE)"
!ENDIF
!IFNDEF CMAKE_BUILD_TYPE
CMAKE_BUILD_TYPE = Release
!ENDIF
!IFNDEF CMAKE_GENERATOR_TYPE
!IFNDEF MSBUILD_PLATFORM
!IF "$(HAVE_NINJA)" == "true"
CMAKE_GENERATOR_TYPE=Ninja
!ELSE
CMAKE_GENERATOR_TYPE=NMake Makefiles
!ENDIF
!ENDIF
!ENDIF
CMAKE_ADBC_BUILD_DIR = $(MIX_APP_PATH)/cmake_adbc
!IFNDEF CMAKE_ADBC_OPTIONS
CMAKE_ADBC_OPTIONS = ""
!ENDIF
CMAKE_ADBC_NIF_BUILD_DIR = $(MIX_APP_PATH)/cmake_adbc_nif
!IFNDEF CMAKE_ADBC_NIF_OPTIONS
CMAKE_ADBC_NIF_OPTIONS = ""
!ENDIF
CMAKE_BUILD_PARAMETER= --config "$(CMAKE_BUILD_TYPE)"
build: $(NIF_SO)
priv_dir:
@ if not exist "$(PRIV_DIR)" mkdir "$(PRIV_DIR)"
clean:
@ if exist "$(PRIV_DIR)" rmdir "$(PRIV_DIR)" /s /q
adbc: priv_dir
@ if not exist "$(ADBC_DRIVER_COMMON_LIB)" ( \
if not exist "$(CMAKE_ADBC_BUILD_DIR)" mkdir "$(CMAKE_ADBC_BUILD_DIR)" && \
cd "$(CMAKE_ADBC_BUILD_DIR)" && \
cmake -G "$(CMAKE_GENERATOR_TYPE)" \
--no-warn-unused-cli \
-DADBC_BUILD_SHARED="ON" \
-DADBC_DRIVER_MANAGER="ON" \
-DADBC_DRIVER_POSTGRESQL="OFF" \
-DADBC_DRIVER_SQLITE="OFF" \
-DADBC_DRIVER_FLIGHTSQL="OFF" \
-DADBC_DRIVER_SNOWFLAKE="OFF" \
-DADBC_BUILD_STATIC="OFF" \
-DADBC_BUILD_TESTS="OFF" \
-DADBC_USE_ASAN="OFF" \
-DADBC_USE_UBSAN="OFF" \
-DCMAKE_BUILD_TYPE="$(CMAKE_BUILD_TYPE)" \
-DCMAKE_INSTALL_PREFIX="$(PRIV_DIR)" \
-DADBC_DEPENDENCY_SOURCE=BUNDLED \
$(CMAKE_CONFIGURE_FLAGS) $(CMAKE_ADBC_OPTIONS) "$(ADBC_C_SRC)" && \
cmake --build . --target install -j \
)
$(NIF_SO): adbc priv_dir c_src\adbc_nif_resource.hpp c_src\adbc_nif.cpp c_src\nif_utils.cpp c_src\nif_utils.hpp
@ if not exist "$(CMAKE_ADBC_NIF_BUILD_DIR)" mkdir "$(CMAKE_ADBC_NIF_BUILD_DIR)" && \
cd "$(CMAKE_ADBC_NIF_BUILD_DIR)" && \
cmake -G "$(CMAKE_GENERATOR_TYPE)" \
--no-warn-unused-cli \
-D C_SRC="$(C_SRC)" \
-D ADBC_SRC="$(ADBC_SRC)" \
-D MIX_APP_PATH="$(MIX_APP_PATH)" \
-D PRIV_DIR="$(PRIV_DIR)" \
-D ERTS_INCLUDE_DIR="$(ERTS_INCLUDE_DIR)" \
$(CMAKE_CONFIGURE_FLAGS) $(CMAKE_ADBC_NIF_OPTIONS) "$(MAKEDIR)" && \
cmake --build . $(CMAKE_BUILD_PARAMETER) && \
cmake --install . $(CMAKE_BUILD_PARAMETER)