Browse Source

Reduced dependencies using an essential subset header.

David Piuva 3 years ago
parent
commit
9e3941e570

+ 10 - 0
Source/DFPSR/includeEssentials.h

@@ -0,0 +1,10 @@
+
+// Header for including only the most essential parts of the framework needed for command line applications.
+
+#ifndef DFPSR_INCLUDED_ESSENTIALS
+#define DFPSR_INCLUDED_ESSENTIALS
+	// The essential headers needed for CLI applications
+	#include "api/bufferAPI.h" // Storing binary data
+	#include "api/fileAPI.h" // Saving and loading binary files
+	#include "api/stringAPI.h" // Processing text
+#endif

+ 3 - 5
Source/DFPSR/includeFramework.h

@@ -1,12 +1,13 @@
 
 
-// Header for including the most commonly needed parts of the framework
+// Header for including the most commonly needed parts of the framework.
 
 
 #ifndef DFPSR_INCLUDED_FRAMEWORK
 #ifndef DFPSR_INCLUDED_FRAMEWORK
 #define DFPSR_INCLUDED_FRAMEWORK
 #define DFPSR_INCLUDED_FRAMEWORK
+	// Strings, buffers, files, et cetera.
+	#include "includeEssentials.h"
 
 
 	// Types needed to use the APIs
 	// Types needed to use the APIs
 	#include "math/includeMath.h"
 	#include "math/includeMath.h"
-	#include "api/stringAPI.h"
 
 
 	// Additional functionality for convenience (not to be used in any API)
 	// Additional functionality for convenience (not to be used in any API)
 	#include "collection/includeCollection.h" // Safer and easier to use than std collections
 	#include "collection/includeCollection.h" // Safer and easier to use than std collections
@@ -21,9 +22,6 @@
 	#include "api/guiAPI.h" // Handling windows, interfaces and components
 	#include "api/guiAPI.h" // Handling windows, interfaces and components
 	#include "api/mediaMachineAPI.h" // A machine for running image functions
 	#include "api/mediaMachineAPI.h" // A machine for running image functions
 	#include "api/fontAPI.h" // Printing text to images
 	#include "api/fontAPI.h" // Printing text to images
-	// File API
-	#include "api/bufferAPI.h" // Storing binary data
-	#include "api/fileAPI.h" // Saving and loading binary files
 	// Convenient API
 	// Convenient API
 	#include "api/timeAPI.h" // Methods for time and delays
 	#include "api/timeAPI.h" // Methods for time and delays
 	#include "api/configAPI.h" // Making it easy to load your application's settings from configuration files
 	#include "api/configAPI.h" // Making it easy to load your application's settings from configuration files

+ 1 - 1
Source/SDK/cube/main.DsrProj

@@ -1,6 +1,6 @@
 CompilerFlag "-std=c++14"
 CompilerFlag "-std=c++14"
 Graphics
 Graphics
-Sound
+#Sound
 Crawl "main.cpp"
 Crawl "main.cpp"
 Import "../../DFPSR/DFPSR.DsrHead"
 Import "../../DFPSR/DFPSR.DsrHead"
 ProgramPath = "application"
 ProgramPath = "application"

+ 5 - 4
Source/SDK/fileFinder/main.DsrProj

@@ -1,9 +1,10 @@
-CompilerFlag "-std=c++14"
-Graphics
-Sound
+# No need to import DFPSR.DsrHead with stub backends when only including essential headers.
+CompilerFlag "-std=c++14"
 Crawl "main.cpp"
 Crawl "main.cpp"
-Import "../../DFPSR/DFPSR.DsrHead"
 ProgramPath = "application"
 ProgramPath = "application"
 
 
 # Uncomment to enable debug mode, which is slower
 # Uncomment to enable debug mode, which is slower
 #Debug
 #Debug
+
+# Show how the build system works when finding the library's used subset
+ListDependencies

+ 3 - 1
Source/SDK/fileFinder/main.cpp

@@ -1,7 +1,9 @@
 
 
 // A file finding application showing how to use the filesystem wrapper in the file API using C++ 2014.
 // A file finding application showing how to use the filesystem wrapper in the file API using C++ 2014.
 
 
-#include "../../DFPSR/includeFramework.h"
+// If you can use only the essential headers, compilation will be faster and work even if parts of the library can't be compiled.
+//#include "../../DFPSR/includeFramework.h"
+#include "../../DFPSR/includeEssentials.h"
 
 
 using namespace dsr;
 using namespace dsr;
 
 

+ 1 - 1
Source/SDK/guiExample/main.DsrProj

@@ -1,6 +1,6 @@
 CompilerFlag "-std=c++14"
 CompilerFlag "-std=c++14"
 Graphics
 Graphics
-Sound
+#Sound
 Crawl "main.cpp"
 Crawl "main.cpp"
 Import "../../DFPSR/DFPSR.DsrHead"
 Import "../../DFPSR/DFPSR.DsrHead"
 ProgramPath = "application"
 ProgramPath = "application"

+ 1 - 1
Source/SDK/sandbox/main.DsrProj

@@ -1,6 +1,6 @@
 CompilerFlag "-std=c++14"
 CompilerFlag "-std=c++14"
 Graphics
 Graphics
-Sound
+#Sound
 
 
 # An include using quotation marks will detect the header and its headers recursively.
 # An include using quotation marks will detect the header and its headers recursively.
 # For each detected header, the build system looks for an implementation file of the same name in the same folder.
 # For each detected header, the build system looks for an implementation file of the same name in the same folder.

+ 1 - 1
Source/SDK/terrain/main.DsrProj

@@ -1,6 +1,6 @@
 CompilerFlag "-std=c++14"
 CompilerFlag "-std=c++14"
 Graphics
 Graphics
-Sound
+#Sound
 Crawl "main.cpp"
 Crawl "main.cpp"
 Import "../../DFPSR/DFPSR.DsrHead"
 Import "../../DFPSR/DFPSR.DsrHead"
 ProgramPath = "application"
 ProgramPath = "application"

+ 1 - 1
Source/soundManagers/NoSound.cpp

@@ -1,6 +1,6 @@
 
 
 #include "soundManagers.h"
 #include "soundManagers.h"
 
 
-bool sound_streamToSpeakers_impl(int channels, int sampleRate, std::function<bool(float*, int)> soundOutput) {
+bool sound_streamToSpeakers(int channels, int sampleRate, std::function<bool(float*, int)> soundOutput) {
 	return false;
 	return false;
 }
 }

+ 1 - 0
Source/soundManagers/soundManagers.h

@@ -3,6 +3,7 @@
 #define DFPSR_SOUND_API
 #define DFPSR_SOUND_API
 
 
 #include <functional>
 #include <functional>
+#include <stdint.h>
 
 
 inline float sound_convertI16ToF32(int64_t input) {
 inline float sound_convertI16ToF32(int64_t input) {
 	return input * (1.0f / 32767.0f);
 	return input * (1.0f / 32767.0f);

+ 5 - 4
Source/templates/basicCLI/main.DsrProj

@@ -1,9 +1,10 @@
-CompilerFlag "-std=c++14"
-Graphics
-Sound
+# No need to import DFPSR.DsrHead with stub backends when only including essential headers.
+CompilerFlag "-std=c++14"
 Crawl "main.cpp"
 Crawl "main.cpp"
-Import "../../DFPSR/DFPSR.DsrHead"
 ProgramPath = "application"
 ProgramPath = "application"
 
 
 # Uncomment to enable debug mode, which is slower
 # Uncomment to enable debug mode, which is slower
 #Debug
 #Debug
+
+# Show how the build system works when finding the library's used subset
+ListDependencies

+ 3 - 1
Source/templates/basicCLI/main.cpp

@@ -1,5 +1,7 @@
 
 
-#include "../../DFPSR/includeFramework.h"
+// If you can use only the essential headers, compilation will be faster and work even if parts of the library can't be compiled.
+//#include "../../DFPSR/includeFramework.h"
+#include "../../DFPSR/includeEssentials.h"
 
 
 using namespace dsr;
 using namespace dsr;