Set a DLL define when building a DLL
This commit is contained in:
		
							parent
							
								
									4c34f1f702
								
							
						
					
					
						commit
						5cc1fc31ff
					
				
							
								
								
									
										13
									
								
								generate.jai
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								generate.jai
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
 | 
			
		||||
libs_to_build :: Libs.WAV | .FLAC | .MP3; // @consider making this a metaprogram/command line arg. Can then use this as a git submodule in a project and a script/build file generate bindings for what the project requires.
 | 
			
		||||
LIBS_TO_BUILD: Libs : .WAV | .FLAC | .MP3; // @consider making this a metaprogram/command line arg. Can then use this as a git submodule in a project and a script/build file can generate bindings for what the project requires.
 | 
			
		||||
 | 
			
		||||
Libs :: enum_flags {
 | 
			
		||||
    WAV;
 | 
			
		||||
| 
						 | 
				
			
			@ -39,26 +38,28 @@ else {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
generate_bindings :: () -> bool {
 | 
			
		||||
    if libs_to_build == 0 {
 | 
			
		||||
    if LIBS_TO_BUILD == 0 {
 | 
			
		||||
        log_error("You need to specify at least one library for binding generation!\n");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Prepare the source for our needs.
 | 
			
		||||
    {
 | 
			
		||||
    copy_file(tprint("%/dr_wav.h",  SOURCE_PATH), tprint("%/dr_wav.c",  SOURCE_PATH));
 | 
			
		||||
    copy_file(tprint("%/dr_flac.h", SOURCE_PATH), tprint("%/dr_flac.c", SOURCE_PATH));
 | 
			
		||||
    copy_file(tprint("%/dr_mp3.h",  SOURCE_PATH), tprint("%/dr_mp3.c",  SOURCE_PATH));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    src_files: [..] string;
 | 
			
		||||
    extra: [..] string;
 | 
			
		||||
 | 
			
		||||
    libs := type_info(Libs);
 | 
			
		||||
    for libs.names {
 | 
			
		||||
        if libs_to_build & (xx libs.values[it_index]) {
 | 
			
		||||
        if LIBS_TO_BUILD & (xx libs.values[it_index]) {
 | 
			
		||||
            array_add(*src_files, tprint("%/dr_%.c", SOURCE_PATH, to_lower_copy(it)));
 | 
			
		||||
            array_add(*extra, tprint("/DDR_%_IMPLEMENTATION", it));
 | 
			
		||||
 | 
			
		||||
            #if MAKE_DYNAMIC_LIB {
 | 
			
		||||
                array_add(*extra, tprint("/DDR%_DLL", it));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user