-
-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (79 loc) · 2.57 KB
/
Makefile
File metadata and controls
101 lines (79 loc) · 2.57 KB
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
# Makefile for tinyexr test executable
# Compilers
CC ?= gcc
CXX ?= g++
# Flags
CFLAGS ?= -O2
CXXFLAGS ?= -O2 -std=c++11
CXXFLAGS_V3 ?= -O2 -std=c++17
# Default to use miniz for decompression
BUILD_NANOZLIB ?= 0
# Include paths and defines
INCLUDES = -I./deps/miniz
INCLUDES_V3 = -I. -I./deps/miniz
DEFINES =
# V3 specific defines for compression support
DEFINES_V3 = -DTINYEXR_V3_ENABLE_PIZ=1 -DTINYEXR_V3_ENABLE_PXR24=1 -DTINYEXR_V3_ENABLE_B44=1
# Optional: Address sanitizer (debug builds)
# CFLAGS += -fsanitize=address -g -O0
# CXXFLAGS += -fsanitize=address -Werror -Wall -Wextra -g -O0 -DTINYEXR_USE_MINIZ=0 -DTINYEXR_USE_PIZ=0
# Optional: ZFP compression (experimental)
# DEFINES += -DTINYEXR_USE_ZFP=1
# INCLUDES += -I./deps/ZFP/include
# LDFLAGS += -L./deps/ZFP/lib -lzfp
# Source files
TEST_SRC = test_tinyexr.cc
TEST_V3_SRC = test/unit/tester-v3.cc
C_IMPL_SRC = tinyexr_c_impl.c
MINIZ_SRC = ./deps/miniz/miniz.c
# Object files
ifeq ($(BUILD_NANOZLIB),1)
DEFINES += -DTINYEXR_USE_NANOZLIB=1 -DTINYEXR_USE_MINIZ=0 -I./deps/nanozlib
DEPOBJS =
DEPOBJS_V3 =
else
DEPOBJS = miniz.o
DEPOBJS_V3 = miniz-v3.o tinyexr_c_impl.o
endif
# Target executables
TARGET = test_tinyexr
TARGET_V3 = test_tinyexr_v3
# Default target
.PHONY: all v3 test test-v3 clean help
all: $(TARGET)
v3: $(TARGET_V3)
# Build standard test executable
$(TARGET): $(TEST_SRC) $(DEPOBJS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) -o $@ $< $(DEPOBJS) $(LDFLAGS)
# Build v3 test executable
$(TARGET_V3): $(TEST_V3_SRC) $(DEPOBJS_V3)
$(CXX) $(CXXFLAGS_V3) $(INCLUDES_V3) $(DEFINES) $(DEFINES_V3) -o $@ $< $(DEPOBJS_V3) $(LDFLAGS)
# Build miniz object for standard build
miniz.o: $(MINIZ_SRC)
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
# Build miniz object for v3 build
miniz-v3.o: $(MINIZ_SRC)
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
# Build C implementation as C++ for v3 (required for V2 compression support)
tinyexr_c_impl.o: $(C_IMPL_SRC)
$(CXX) $(CXXFLAGS_V3) -x c++ $(INCLUDES_V3) $(DEFINES_V3) -c -o $@ $<
# Run tests
test: $(TARGET)
./$(TARGET) asakusa.exr
# Run v3 tests
test-v3: $(TARGET_V3)
./$(TARGET_V3)
# Clean build artifacts
clean:
rm -rf $(TARGET) $(TARGET_V3) miniz.o miniz-v3.o tinyexr_c_impl.o
# Print help
help:
@echo "tinyexr Makefile targets:"
@echo " make - Build test_tinyexr executable"
@echo " make v3 - Build test_tinyexr_v3 executable (C++17)"
@echo " make test - Run tests with asakusa.exr"
@echo " make test-v3 - Run v3 tests"
@echo " make clean - Remove build artifacts"
@echo ""
@echo "Options:"
@echo " BUILD_NANOZLIB=1 - Use nanozlib instead of miniz"