From: <man...@us...> - 2013-06-11 22:49:36
|
Revision: 2339 http://sourceforge.net/p/modplug/code/2339 Author: manxorist Date: 2013-06-11 22:49:30 +0000 (Tue, 11 Jun 2013) Log Message: ----------- [Imp] Actually build the libopenpmt examples (at least on unix). [Ref] Simplify dynamic linking in unix makefile. [Ref] Add basic support for building with unknown compilers without using any compiler-specific extensions. This does not really work yet because we depend on a way to tell the compiler that a specific structure should be tightly packed (for which there is no standard way to do it). Modified Paths: -------------- trunk/OpenMPT/common/CompilerDetect.h trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/libopenmpt/examples/libopenmpt_example_cxx.cpp trunk/OpenMPT/libopenmpt/libopenmpt_internal.h trunk/OpenMPT/openmpt123/Makefile trunk/OpenMPT/openmpt123/openmpt123.cpp Property Changed: ---------------- trunk/OpenMPT/libopenmpt/examples/ Modified: trunk/OpenMPT/common/CompilerDetect.h =================================================================== --- trunk/OpenMPT/common/CompilerDetect.h 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/common/CompilerDetect.h 2013-06-11 22:49:30 UTC (rev 2339) @@ -17,8 +17,13 @@ -#if defined(__clang__) +#if defined(MPT_COMPILER_GENERIC) +#undef MPT_COMPILER_GENERIC +#define MPT_COMPILER_GENERIC 1 + +#elif defined(__clang__) + #define MPT_COMPILER_CLANG 1 #define MPT_COMPILER_CLANG_VERSION MPT_COMPILER_MAKE_VERSION3(__clang_major__,__clang_minor__,__clang_patchlevel__) #define MPT_CLANG_AT_LEAST(major,minor,patch) (MPT_COMPILER_CLANG_VERSION >= MPT_COMPILER_MAKE_VERSION3((major),(minor),(patch))) @@ -64,6 +69,9 @@ +#ifndef MPT_COMPILER_GENERIC +#define MPT_COMPILER_GENERIC 0 +#endif #ifndef MPT_COMPILER_CLANG #define MPT_COMPILER_CLANG 0 #define MPT_CLANG_AT_LEAST(major,minor,patch) 0 Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/common/typedefs.h 2013-06-11 22:49:30 UTC (rev 2339) @@ -60,6 +60,8 @@ #define NEEDS_PRAGMA_PACK #elif MPT_COMPILER_GCC || MPT_COMPILER_CLANG #define PACKED __attribute__((packed)) __attribute__((aligned(1))) +#else +#define PACKED alignas(1) #endif @@ -68,6 +70,8 @@ #define ALIGN(n) __declspec(align(n)) #elif MPT_COMPILER_GCC || MPT_COMPILER_CLANG #define ALIGN(n) __attribute__((aligned(n))) +#else +#define ALIGN(n) alignas(n) #endif Index: trunk/OpenMPT/libopenmpt/examples =================================================================== --- trunk/OpenMPT/libopenmpt/examples 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/libopenmpt/examples 2013-06-11 22:49:30 UTC (rev 2339) Property changes on: trunk/OpenMPT/libopenmpt/examples ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,2 ## +*.d +*.o Modified: trunk/OpenMPT/libopenmpt/examples/libopenmpt_example_cxx.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/examples/libopenmpt_example_cxx.cpp 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/libopenmpt/examples/libopenmpt_example_cxx.cpp 2013-06-11 22:49:30 UTC (rev 2339) @@ -10,6 +10,8 @@ #include <fstream> #include <vector> +#include <cstring> + #include <libopenmpt/libopenmpt.hpp> #include <portaudio.h> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_internal.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_internal.h 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/libopenmpt/libopenmpt_internal.h 2013-06-11 22:49:30 UTC (rev 2339) @@ -11,7 +11,9 @@ #define LIBOPENMPT_INTERNAL_H /* disable alpha version warning in internal builds */ +#ifndef LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING #define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING +#endif #include "libopenmpt_config.h" Modified: trunk/OpenMPT/openmpt123/Makefile =================================================================== --- trunk/OpenMPT/openmpt123/Makefile 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/openmpt123/Makefile 2013-06-11 22:49:30 UTC (rev 2339) @@ -52,8 +52,13 @@ ifeq ($(DYNLINK),1) LDFLAGS += -Wl,-rpath,./bin -Wl,-rpath,../bin +LDFLAGS_LIBOPENMPT += -Lbin +LDLIBS_LIBOPENMPT += -lopenmpt endif +#CPPFLAGS += -DMPT_COMPILER_GENERIC +CPPFLAGS += -DLIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING + #CXXFLAGS += -mtune=generic #CFLAGS += -mtune=generic @@ -147,7 +152,13 @@ ALL_OBJECTS += $(LIBOPENMPT_OBJECTS) ALL_DEPENDS += $(LIBOPENMPT_DEPENDS) +ifeq ($(DYNLINK),1) +OUTPUT_LIBOPENMPT += bin/libopenmpt.so +else +OBJECTS_LIBOPENMPT += $(LIBOPENMPT_OBJECTS) +endif + LIBOPENMPT_MODPLUG_C_SOURCES += \ ../libopenmpt/libopenmpt_modplug.c \ @@ -179,11 +190,14 @@ -include $(ALL_DEPENDS) +OUTPUTS += bin/openmpt.a OUTPUTS += bin/libopenmpt.so -OUTPUTS += bin/openmpt.a OUTPUTS += bin/openmpt123 -#OUTPUTS += bin/libopenmpt_modplug.so -#OUTPUTS += bin/modplug123 +OUTPUTS += bin/libopenmpt_example_c +OUTPUTS += bin/libopenmpt_example_c_mem +OUTPUTS += bin/libopenmpt_example_cxx +OUTPUTS += bin/libopenmpt_modplug.so +OUTPUTS += bin/modplug123 all: $(OUTPUTS) @@ -191,33 +205,33 @@ test: all bin/openmpt123 --runtests +bin/openmpt.a: $(LIBOPENMPT_OBJECTS) + $(INFO) [AR ] $@ + $(SILENT)$(AR) $(ARFLAGS) $@ $^ + bin/libopenmpt.so: $(LIBOPENMPT_OBJECTS) $(INFO) [LD ] $@ $(SILENT)$(LINK.cc) -shared $^ $(LOADLIBES) $(LDLIBS) -o $@ -ifeq ($(DYNLINK),1) -bin/libopenmpt_modplug.so: $(LIBOPENMPT_MODPLUG_OBJECTS) +bin/libopenmpt_modplug.so: $(LIBOPENMPT_MODPLUG_OBJECTS) $(OBJECTS_LIBOPENMPT) $(INFO) [LD ] $@ - $(SILENT)$(LINK.cc) -shared -Lbin $^ $(LOADLIBES) $(LDLIBS) -o $@ -else -bin/libopenmpt_modplug.so: $(LIBOPENMPT_OBJECTS) $(LIBOPENMPT_MODPLUG_OBJECTS) + $(SILENT)$(LINK.cc) -shared $(LDFLAGS_LIBOPENMPT) $^ $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ + +bin/openmpt123: $(OPENMPT123_OBJECTS) $(OUTPUT_LIBOPENMPT) $(INFO) [LD ] $@ - $(SILENT)$(LINK.cc) -shared $^ $(LOADLIBES) $(LDLIBS) -o $@ -endif + $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) $(OPENMPT123_OBJECTS) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ -bin/openmpt.a: $(LIBOPENMPT_OBJECTS) - $(INFO) [AR ] $@ - $(SILENT)$(AR) $(ARFLAGS) $@ $^ +bin/libopenmpt_example_c: ../libopenmpt/examples/libopenmpt_example_c.o $(OUTPUT_LIBOPENMPT) + $(INFO) [LD ] $@ + $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) ../libopenmpt/examples/libopenmpt_example_c.o $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ -ifeq ($(DYNLINK),1) -bin/openmpt123: $(OPENMPT123_OBJECTS) bin/libopenmpt.so +bin/libopenmpt_example_c_mem: ../libopenmpt/examples/libopenmpt_example_c_mem.o $(OUTPUT_LIBOPENMPT) $(INFO) [LD ] $@ - $(SILENT)$(LINK.cc) -Lbin $(OPENMPT123_OBJECTS) $(LOADLIBES) $(LDLIBS) -lopenmpt -o $@ -else -bin/openmpt123: $(OPENMPT123_OBJECTS) + $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) ../libopenmpt/examples/libopenmpt_example_c_mem.o $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ + +bin/libopenmpt_example_cxx: ../libopenmpt/examples/libopenmpt_example_cxx.o $(OUTPUT_LIBOPENMPT) $(INFO) [LD ] $@ - $(SILENT)$(LINK.cc) $(OPENMPT123_OBJECTS) $(LOADLIBES) $(LDLIBS) -o $@ -endif + $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) ../libopenmpt/examples/libopenmpt_example_cxx.o $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ bin/modplug123: bin/openmpt123 cp $^ $@ Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-06-11 22:49:30 UTC (rev 2339) @@ -7,7 +7,9 @@ * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ +#ifndef LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING #define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING +#endif #if defined(_MSC_VER) #define MPT_WITH_PORTAUDIO This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |