changeset 7:ee50db043251

Cross-platform fixes.
author Eric Wing <ewing . public |-at-| gmail . com>
date Thu, 28 Oct 2010 02:33:05 -0700
parents 4b1048af7e55
children a71ed111a627
files CMakeLists.txt EXAMPLES/CMakeLists.txt EXAMPLES/playsound.c EXAMPLES/playstream.c
diffstat 4 files changed, 35 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Thu Oct 28 02:32:46 2010 -0700
+++ b/CMakeLists.txt	Thu Oct 28 02:33:05 2010 -0700
@@ -81,16 +81,17 @@
 
 
 IF(WANTS_BUILD_SHARED_LIBRARY)
-	ADD_LIBRARY(ALMIXER_LIBRARY SHARED ${PUBLIC_HEADERS} ${ALMIXER_SOURCE} ${RESOURCE_FILES})
+	#ADD_LIBRARY(ALmixer SHARED ${PUBLIC_HEADERS} ${ALMIXER_SOURCE} ${RESOURCE_FILES})
+	ADD_LIBRARY(ALmixer SHARED ${PUBLIC_HEADERS} ${ALMIXER_SOURCE})
 ELSE(WANTS_BUILD_SHARED_LIBRARY)
-	ADD_LIBRARY(ALMIXER_LIBRARY STATIC ${PUBLIC_HEADERS} ${ALMIXER_SOURCE} ${RESOURCE_FILES})
+	ADD_LIBRARY(ALmixer STATIC ${PUBLIC_HEADERS} ${ALMIXER_SOURCE} ${RESOURCE_FILES})
 ENDIF(WANTS_BUILD_SHARED_LIBRARY)
-SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES OUTPUT_NAME "ALmixer")
+#SET_TARGET_PROPERTIES(ALmixer PROPERTIES OUTPUT_NAME "ALmixer")
 
 # Set Dynamic Library and Framework properties
 IF(WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK)
 
-	SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES
+	SET_TARGET_PROPERTIES(ALmixer PROPERTIES
 		FRAMEWORK TRUE
 		FRAMEWORK_VERSION "${ALMIXER_FRAMEWORK_VERSION_NUMBER}"
 		#  PRIVATE_HEADER "fooPrivate.h;fooBoth.h"
@@ -105,8 +106,8 @@
 	
 	# I moved the INSTALL_NAME_DIR to use SET_PROPERTY instead because
 	# SET_TARGET_PROPERTIES will fail if the variable is empty.
-	SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY INSTALL_NAME_DIR ${CMAKE_FRAMEWORK_INSTALL_NAME_DIR})
-	SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH NO)
+	SET_PROPERTY(TARGET ALmixer PROPERTY INSTALL_NAME_DIR ${CMAKE_FRAMEWORK_INSTALL_NAME_DIR})
+	SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH NO)
 	# If the user deletes the install_name path, use the gcc default
 	# and disable the option completely. But CMake by default places
 	# the name of the library in the install_name if 
@@ -114,11 +115,11 @@
 	# disable the switch.
 	IF(CMAKE_FRAMEWORK_INSTALL_NAME_DIR)
 		#		MESSAGE("got dir ${CMAKE_FRAMEWORK_INSTALL_NAME_DIR}")
-		SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH})
+		SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH})
 
 	ELSE(CMAKE_FRAMEWORK_INSTALL_NAME_DIR)
 		#		MESSAGE("no dir ${CMAKE_FRAMEWORK_INSTALL_NAME_DIR}")
-		SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH NO)
+		SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH NO)
 
 	ENDIF(CMAKE_FRAMEWORK_INSTALL_NAME_DIR)
 
@@ -133,7 +134,7 @@
 
 ELSEIF(WANTS_BUILD_SHARED_LIBRARY)
 	IF(APPLE)
-		SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES
+		SET_TARGET_PROPERTIES(ALmixer PROPERTIES
 			FRAMEWORK FALSE
 			# INSTALL_NAME_DIR ${CMAKE_DYLIB_INSTALL_NAME_DIR}
 			# BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH} 
@@ -143,23 +144,23 @@
 		)
 		# I moved the INSTALL_NAME_DIR to use SET_PROPERTY instead because
 		# SET_TARGET_PROPERTIES will fail if the variable is empty.
-		SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY INSTALL_NAME_DIR ${CMAKE_DYLIB_INSTALL_NAME_DIR})
-		SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH NO)
+		SET_PROPERTY(TARGET ALmixer PROPERTY INSTALL_NAME_DIR ${CMAKE_DYLIB_INSTALL_NAME_DIR})
+		SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH NO)
 		# If the user deletes the install_name path, use the gcc default
 		# and disable the option completely. But CMake by default places
 		# the name of the library in the install_name if 
 		# BUILD_WITH_INSTALL_RPATH is ON. So to avoid this, I need to 
 		# disable the switch.
 		IF(CMAKE_DYLIB_INSTALL_NAME_DIR)
-			SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH})
+			SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH})
 		ELSE(CMAKE_DYLIB_INSTALL_NAME_DIR)
-			SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH OFF)
+			SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH OFF)
 		ENDIF(CMAKE_DYLIB_INSTALL_NAME_DIR)
 
 
 
 	ELSEIF(UNIX)
-		SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES
+		SET_TARGET_PROPERTIES(ALmixer PROPERTIES
 			INSTALL_RPATH ${CMAKE_INSTALL_RPATH}
 			BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH} 
 			VERSION ${ALMIXER_VERSION}
@@ -168,14 +169,14 @@
 		)
 	
 	ELSEIF(WIN32)
-		SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES
-			VERSION ${ALMIXER_VERSION}
-			SOVERSION ${ALMIXER_COMPATIBILITY_VERSION}
-#			COMPILE_FLAGS "${ALMIXER_C_FLAGS} -DALMIXER_BUILD_AS_DLL"
-		)
+		MESSAGE("Win32")
+		#		SET_TARGET_PROPERTIES(ALmixer PROPERTIES
+		#	VERSION ${ALMIXER_VERSION}
+		#	SOVERSION ${ALMIXER_COMPATIBILITY_VERSION}
+		#)
 
 	ELSE(APPLE)
-		SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES
+		SET_TARGET_PROPERTIES(ALmixer PROPERTIES
 			VERSION ${ALMIXER_VERSION}
 			SOVERSION ${ALMIXER_COMPATIBILITY_VERSION}
 #			COMPILE_FLAGS "${ALMIXER_C_FLAGS}"
@@ -187,7 +188,7 @@
 ENDIF(WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK)
 
 INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
-TARGET_LINK_LIBRARIES(ALMIXER_LIBRARY ${OPENAL_LIBRARY} ${SDL_SOUND_LIBRARIES} ${SDL_LIBRARY}) 
+TARGET_LINK_LIBRARIES(ALmixer ${OPENAL_LIBRARY} ${SDL_SOUND_LIBRARIES} ${SDL_LIBRARY}) 
 
 
 
@@ -262,12 +263,12 @@
 IF(APPLE AND WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK)
 	# Will install framework to /Library/Frameworks directory or user specified
 	INSTALL(TARGETS
-		ALMIXER_LIBRARY
+		ALmixer
 		FRAMEWORK DESTINATION ${CMAKE_FRAMEWORK_INSTALL_DIR}
 	)
 ELSE(APPLE AND WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK)
 	INSTALL(TARGETS
-		ALMIXER_LIBRARY
+		ALmixer
 		LIBRARY DESTINATION lib
 		ARCHIVE DESTINATION lib
 		PUBLIC_HEADER DESTINATION include
--- a/EXAMPLES/CMakeLists.txt	Thu Oct 28 02:32:46 2010 -0700
+++ b/EXAMPLES/CMakeLists.txt	Thu Oct 28 02:33:05 2010 -0700
@@ -10,9 +10,9 @@
 
 
 ADD_EXECUTABLE(playstream ${CMAKE_CURRENT_SOURCE_DIR}/playstream.c ${SUPPORT_FILES})
-TARGET_LINK_LIBRARIES(playstream ALMIXER_LIBRARY ${OPENAL_LIBRARY} ${SDL_SOUND_LIBRARIES} ${SDL_LIBRARY})
+TARGET_LINK_LIBRARIES(playstream ALmixer ${OPENAL_LIBRARY} ${SDL_SOUND_LIBRARIES} ${SDL_LIBRARY})
 
 ADD_EXECUTABLE(playsound ${CMAKE_CURRENT_SOURCE_DIR}/playsound.c ${SUPPORT_FILES})
-TARGET_LINK_LIBRARIES(playsound ALMIXER_LIBRARY ${OPENAL_LIBRARY} ${SDL_SOUND_LIBRARIES} ${SDL_LIBRARY})
+TARGET_LINK_LIBRARIES(playsound ALmixer ${OPENAL_LIBRARY} ${SDL_SOUND_LIBRARIES} ${SDL_LIBRARY})
 
 
--- a/EXAMPLES/playsound.c	Thu Oct 28 02:32:46 2010 -0700
+++ b/EXAMPLES/playsound.c	Thu Oct 28 02:33:05 2010 -0700
@@ -33,6 +33,10 @@
 
 int main(int argc, char* argv[])
 {
+	ALint i;
+	ALboolean still_playing = AL_TRUE;
+
+	ALmixer_Data* audio_data[MAX_SOURCES];
 	if(argc < 1)
 	{
 		printf("Pass a sound file (or files) as a parameter\n");
@@ -41,10 +45,7 @@
 	{
 		printf("Maximum supported files is %d\n", MAX_SOURCES);
 	}
-	size_t i;
-	ALboolean still_playing = AL_TRUE;
 
-	ALmixer_Data* audio_data[MAX_SOURCES];
 	ALmixer_Init(22050, 0, 0);
 	
 	for(i=1; i<argc; i++)
--- a/EXAMPLES/playstream.c	Thu Oct 28 02:32:46 2010 -0700
+++ b/EXAMPLES/playstream.c	Thu Oct 28 02:33:05 2010 -0700
@@ -1,5 +1,3 @@
-
-//#include "SDL.h"
 #include "ALmixer.h"
 #include <stdio.h>
 #include <stdlib.h>
@@ -36,6 +34,11 @@
 
 int main(int argc, char* argv[])
 {
+	ALint i;
+	ALboolean still_playing = AL_TRUE;
+
+	ALmixer_Data* audio_data[MAX_SOURCES];
+
 	if(argc < 1)
 	{
 		printf("Pass a sound file (or files) as a parameter\n");
@@ -44,10 +47,6 @@
 	{
 		printf("Maximum supported files is %d\n", MAX_SOURCES);
 	}
-	size_t i;
-	ALboolean still_playing = AL_TRUE;
-
-	ALmixer_Data* audio_data[MAX_SOURCES];
 	ALmixer_Init(ALMIXER_DEFAULT_FREQUENCY, ALMIXER_DEFAULT_NUM_SOURCES, ALMIXER_DEFAULT_REFRESH);
 	
 	for(i=1; i<argc; i++)