-Smaxx' solution for compiling frontend with static libs in windows
authorkoda
Thu, 02 Jul 2009 00:58:46 +0000
changeset 2218 59a9bebc4988
parent 2217 458c08d74ae6
child 2219 07f5345ecae7
-Smaxx' solution for compiling frontend with static libs in windows -reverted to realloc() for more compatibility
QTfrontend/CMakeLists.txt
openalbridge/wrappers.c
--- a/QTfrontend/CMakeLists.txt	Wed Jul 01 22:50:27 2009 +0000
+++ b/QTfrontend/CMakeLists.txt	Thu Jul 02 00:58:46 2009 +0000
@@ -151,8 +151,7 @@
 	hwconsts.h
 )
 
-set(hwfr_rez
-	hedgewars.qrc)
+set(hwfr_rez hedgewars.qrc)
 
 qt4_add_resources(hwfr_rez_src
 	${hwfr_rez})
@@ -166,27 +165,33 @@
 	${hwfr_hdrs}
 	${hwfr_rez_src})
 
+
 set(HW_LINK_LIBS 
 	${QT_LIBRARIES}
 	${SDL_LIBRARY}
 	openalbridge
 )
 
-#since openalbridge is linked statically with non-m$ compilers we need to explicitly link dependencies 
-if(NOT MSVC)
+#since openalbridge is linked statically with non-m$ compilers we need to explicitly link dependencies
+#moreover in windows they need to be compiled in a particular order
+if(NOT MSVC AND NOT APPLE)
 	set(HW_LINK_LIBS
 		${OPENAL_LIBRARY}
+		${VORBISFILE_LIBRARY}
+		${VORBIS_LIBRARY}
 		${OGG_LIBRARY}
-		${VORBIS_LIBRARY}
 		${HW_LINK_LIBS}
 		)
-if(NOT APPLE)
+endif(NOT MSVC AND NOT APPLE)
+#no vorbisfile required here
+if(APPLE)
 	set(HW_LINK_LIBS
-		${VORBISFILE_LIBRARY}
+		${OPENAL_LIBRARY}
+		${VORBIS_LIBRARY}
+		${OGG_LIBRARY}
 		${HW_LINK_LIBS}
 		)
-endif(NOT APPLE)
-endif(NOT MSVC)
+endif(APPLE)
 
 
 if(WIN32 AND NOT UNIX)
@@ -206,7 +211,9 @@
 		)
 endif(WIN32 AND NOT UNIX)
 
-target_link_libraries(hedgewars
-	${HW_LINK_LIBS})
+
+target_link_libraries(hedgewars	${HW_LINK_LIBS})
+
 
 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
+
--- a/openalbridge/wrappers.c	Wed Jul 01 22:50:27 2009 +0000
+++ b/openalbridge/wrappers.c	Thu Jul 02 00:58:46 2009 +0000
@@ -35,16 +35,11 @@
 	
 	
 	void *Realloc (void *aptr, size_t nbytes) {
-#ifndef _WIN32
-		aptr = reallocf(aptr, nbytes);
-#else
 		aptr = realloc(aptr, nbytes);
-#endif
+
 		if (aptr == NULL) {
 			fprintf(stderr, "ERROR: not enough memory! realloc() failed\n");
-#ifdef _WIN32
 			free(aptr);
-#endif
 			exit(-1);
 		}
 		return aptr;