share/hedgewars/Data/Music/CMakeLists.txt
changeset 563 5131c641073f
parent 562 d1a9035175ed
child 564 17fb45c670c1
--- a/share/hedgewars/Data/Music/CMakeLists.txt	Fri Jul 20 12:25:40 2007 +0000
+++ b/share/hedgewars/Data/Music/CMakeLists.txt	Fri Jul 20 13:46:27 2007 +0000
@@ -1,5 +1,30 @@
 file(GLOB BaseMusic *.ogg) 
 
+list(LENGTH BaseMusic PlayListLength)
+
+set(PlayListINCFile ${hedgewars_SOURCE_DIR}/hedgewars/playlist.inc)
+
+file(WRITE ${PlayListINCFile} "const cPlayListLength = " ${PlayListLength} ";")
+file(APPEND ${PlayListINCFile} "playlist = array[0..Pred(cPlayListLength)] of string = (")
+
+set(i ${PlayListLength})
+foreach(musicfile ${BaseMusic})
+	math(EXPR i "${i} - 1")
+	
+	get_filename_component(relfilename ${musicfile} NAME)
+	
+	file(APPEND ${PlayListINCFile} '${relfilename}')
+	
+	if(i GREATER 0)
+		file(APPEND ${PlayListINCFile} ",")
+	endif(i GREATER 0)
+endforeach(musicfile)
+
+file(APPEND ${PlayListINCFile} ");")
+
+file(APPEND ${PlayListINCFile} "var playlistchain = array[0..Pred(cPlayListLength)] of LongWord;")
+
+
 install(FILES
 	${BaseMusic}
 	DESTINATION ${SHAREPATH}Data/Music)