Skip to content

Commit

Permalink
Add an actual source for build test, makefile for VC and static build…
Browse files Browse the repository at this point in the history
… test targets (see GH-4).
  • Loading branch information
yak1ex committed Aug 1, 2017
1 parent 9700b63 commit fe6c890
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
all: libodstream.a

clean:
-rm -rf *.o *.a
-rm -rf *.o *.a *.exe

libodstream.a: odstream.o
$(AR) r $@ $^

buildtest:
buildtest: libodstream.a
$(CXX) -o test_nd_who test.cpp
$(CXX) -o test_nd_nho -D YAK_DEBUG_NO_HEADER_ONLY test.cpp -L. -lodstream
$(CXX) -o test_wd_who -D DEBUG test.cpp
$(CXX) -o test_wd_nho -D DEBUG -D YAK_DEBUG_NO_HEADER_ONLY test.cpp -L. -lodstream

buildstatictest: libodstream.a
$(CXX) -static -o test_nd_who_s test.cpp
$(CXX) -static -o test_nd_nho_s -D YAK_DEBUG_NO_HEADER_ONLY test.cpp -L. -lodstream
$(CXX) -static -o test_wd_who_s -D DEBUG test.cpp
$(CXX) -static -o test_wd_nho_s -D DEBUG -D YAK_DEBUG_NO_HEADER_ONLY test.cpp -L. -lodstream
28 changes: 28 additions & 0 deletions Makefile.vc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
all: odstream.lib

clean:
del *.obj *.lib *.exe

odstream.lib: odstream_md.obj
lib /out:$@ $**

odstream_s.lib: odstream_mt.obj
lib /out:$@ $**

odstream_md.obj: odstream.cpp
$(CXX) -MD -c -Fo$@ $**

odstream_mt.obj: odstream.cpp
$(CXX) -MT -c -Fo$@ $**

buildtest: odstream.lib
$(CXX) -MD -Fetest_nd_who test.cpp
$(CXX) -MD -Fetest_nd_nho -D YAK_DEBUG_NO_HEADER_ONLY test.cpp odstream.lib
$(CXX) -MD -Fetest_wd_who -D DEBUG test.cpp
$(CXX) -MD -Fetest_wd_nho -D DEBUG -D YAK_DEBUG_NO_HEADER_ONLY test.cpp odstream.lib

buildstatictest: odstream_s.lib
$(CXX) -MT -Fetest_nd_who_s test.cpp
$(CXX) -MT -Fetest_nd_nho_s -D YAK_DEBUG_NO_HEADER_ONLY test.cpp odstream_s.lib
$(CXX) -MT -Fetest_wd_who_s -D DEBUG test.cpp
$(CXX) -MT -Fetest_wd_nho_s -D DEBUG -D YAK_DEBUG_NO_HEADER_ONLY test.cpp odstream_s.lib
9 changes: 9 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "odstream.hpp"

int main(void)
{
ODS_NOFLUSH(<< "Test1");
ODS(<< "Test2");
yak::debug::ods() << "Test3"; yak::debug::ods().flush();
return 0;
}

0 comments on commit fe6c890

Please sign in to comment.