mirror of
https://github.com/HandmadeMath/HandmadeMath.git
synced 2025-09-10 12:18:16 +00:00
Add ability to customize HMM_ prefix (#114)
* Add prefix macro and use it everywhere * Add lightweight test for prefix * Add a little doc blurb
This commit is contained in:
604
HandmadeMath.h
604
HandmadeMath.h
File diff suppressed because it is too large
Load Diff
12
test/HandmadeMathDifferentPrefix.cpp
Normal file
12
test/HandmadeMathDifferentPrefix.cpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#define HMM_PREFIX(name) WOW_##name
|
||||||
|
|
||||||
|
#define HANDMADE_MATH_IMPLEMENTATION
|
||||||
|
#define HANDMADE_MATH_NO_INLINE
|
||||||
|
#include "../HandmadeMath.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
hmm_vec4 a = WOW_Vec4(1, 2, 3, 4);
|
||||||
|
hmm_vec4 b = WOW_Vec4(5, 6, 7, 8);
|
||||||
|
|
||||||
|
WOW_Add(a, b);
|
||||||
|
}
|
@@ -2,7 +2,7 @@ BUILD_DIR=./build
|
|||||||
|
|
||||||
CXXFLAGS+=-g -Wall -Wextra -pthread -Wno-missing-braces -Wno-missing-field-initializers -Wfloat-equal
|
CXXFLAGS+=-g -Wall -Wextra -pthread -Wno-missing-braces -Wno-missing-field-initializers -Wfloat-equal
|
||||||
|
|
||||||
all: c c_no_sse cpp cpp_no_sse build_c_without_coverage build_cpp_without_coverage
|
all: c c_no_sse cpp cpp_no_sse build_c_without_coverage build_cpp_without_coverage build_cpp_different_prefix
|
||||||
|
|
||||||
build_all: build_c build_c_no_sse build_cpp build_cpp_no_sse
|
build_all: build_c build_c_no_sse build_cpp build_cpp_no_sse
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ build_cpp_no_sse: HandmadeMath.cpp test_impl
|
|||||||
|
|
||||||
test_impl: hmm_test.cpp hmm_test.c
|
test_impl: hmm_test.cpp hmm_test.c
|
||||||
|
|
||||||
build_c_without_coverage: HandmadeMath.c
|
build_c_without_coverage: HandmadeMath.c test_impl
|
||||||
@echo "\nCompiling in C mode"
|
@echo "\nCompiling in C mode"
|
||||||
mkdir -p $(BUILD_DIR)
|
mkdir -p $(BUILD_DIR)
|
||||||
cd $(BUILD_DIR)\
|
cd $(BUILD_DIR)\
|
||||||
@@ -75,3 +75,11 @@ build_cpp_without_coverage: HandmadeMath.cpp test_impl
|
|||||||
&& $(CXX) $(CPPFLAGS) $(CXXFLAGS) -ohmm_test_cpp_no_sse \
|
&& $(CXX) $(CPPFLAGS) $(CXXFLAGS) -ohmm_test_cpp_no_sse \
|
||||||
-DHANDMADE_MATH_CPP_MODE -DWITHOUT_COVERAGE \
|
-DHANDMADE_MATH_CPP_MODE -DWITHOUT_COVERAGE \
|
||||||
../HandmadeMath.cpp ../hmm_test.cpp
|
../HandmadeMath.cpp ../hmm_test.cpp
|
||||||
|
|
||||||
|
build_cpp_different_prefix: HandmadeMath.cpp
|
||||||
|
@echo "\nCompiling C++ with different prefix"
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
cd $(BUILD_DIR) \
|
||||||
|
&& $(CXX) $(CPPFLAGS) $(CXXFLAGS) -ohmm_test_cpp_different_prefix \
|
||||||
|
-DHANDMADE_MATH_CPP_MODE -DDIFFERENT_PREFIX \
|
||||||
|
../HandmadeMathDifferentPrefix.cpp
|
||||||
|
Reference in New Issue
Block a user