-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (27 loc) · 957 Bytes
/
Makefile
File metadata and controls
37 lines (27 loc) · 957 Bytes
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
# Compiler and flags
CXX = g++
CXXFLAGS = -std=c++17 -Wall
# Vcpkg configuration
VCPKG_ROOT ?= $(error VCPKG_ROOT is not set. Please set the VCPKG_ROOT environment variable)
ARCH = $(shell uname -m | sed 's/x86_64/x64/;s/i.86/x86/;s/aarch64/arm64/')
PLATFORM = $(shell uname | tr '[:upper:]' '[:lower:]')
TRIPLET = $(ARCH)-$(PLATFORM)
# Source and object files
SRCS = main.cpp
OBJS = $(SRCS:.cpp=.o)
# Include and library paths
CPPFLAGS += -I$(VCPKG_ROOT)/installed/$(TRIPLET)/include
LDFLAGS += -L$(VCPKG_ROOT)/installed/$(TRIPLET)/lib
# Library flags
LDLIBS += -lconfigcat -lcurl -lz -lssl -lcrypto -lpthread -lhash-library -ldl
# Build target
TARGET = example
# Rules
all: install-vcpkg-packages $(TARGET)
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
install-vcpkg-packages:
(cd $(VCPKG_ROOT) && ./vcpkg install configcat:$(TRIPLET))
clean:
rm -f $(OBJS) $(TARGET)
.PHONY: all install-vcpkg-packages clean