Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Commit

Permalink
Made it get OpenGL DLL dependent on platform
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronAavik committed Jan 5, 2017
1 parent 8c5217b commit 7d6f1ca
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Program.cs
Expand Up @@ -10,9 +10,17 @@ public class Program
private const int GL_FLOAT = 0x1406;
private const int GL_TRIANGLES = 0x0004;
private const int GL_COLOR_BUFFER_BIT = 0x4000;
private const string OPENGL_DLL = "opengl32";

#if WINDOWS
private const string OPENGL_DLL = "opengl32.dll";
#elif OSX
private const string OPENGL_DLL = "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib";
#elif LINUX
private const string OPENGL_DLL = "libGL.so.1";
#endif
private const string GLFW_DLL = "glfw";


// Triangle vertices
private static float[] vertices = {
-0.5f, -0.5f,
Expand Down
5 changes: 4 additions & 1 deletion project.json
@@ -1,7 +1,10 @@
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
"emitEntryPoint": true,
"define": [
"WINDOWS"
]
},
"frameworks": {
"netcoreapp1.0": {
Expand Down
21 changes: 21 additions & 0 deletions publish.bat
@@ -1,6 +1,27 @@
:: Back up the source file
ren Program.cs Program.cs.temp
:: Windows publish
copy Program.cs.temp Program.cs
echo #define WINDOWS > define.txt
type Program.cs >> define.txt
dotnet publish -c Release -r win10-x64
del Program.cs
:: OSX publish
copy Program.cs.temp Program.cs
echo #define OSX > define.txt
type Program.cs >> define.txt
dotnet publish -c Release -r osx.10.10-x64
del Program.cs
:: Linux publish
copy Program.cs.temp Program.cs
echo #define LINUX > define.txt
type Program.cs >> define.txt
dotnet publish -c Release -r ubuntu.14.04-x64
del Program.cs
del define.txt
:: Restore backup
ren Program.cs.temp Program.cs
:: Copy over GLFW
copy ".\glfw.dll" ".\bin\Release\netcoreapp1.0\win10-x64\publish\glfw.dll"
copy ".\libglfw.dylib" ".\bin\Release\netcoreapp1.0\osx.10.10-x64\publish\libglfw.dylib"
copy ".\libglfw.so" ".\bin\Release\netcoreapp1.0\ubuntu.14.04-x64\publish\libglfw.so"
9 changes: 9 additions & 0 deletions publish.sh
@@ -1,6 +1,15 @@
# Back up the source file
mv Program.cs Program.cs.temp
echo "#define WINDOWS" | cat . Program.cs.temp > Program.cs
dotnet publish -c Release -r win10-x64
rm Program.cs
echo "#define OSX" | cat . Program.cs.temp > Program.cs
dotnet publish -c Release -r osx.10.10-x64
rm Program.cs
echo "#define LINUX" | cat . Program.cs.temp > Program.cs
dotnet publish -c Release -r ubuntu.14.04-x64
rm Program.cs
mv Program.cs.temp Program.cs
cp "glfw.dll" "./bin/Release/netcoreapp1.0/win10-x64/publish"
cp "libglfw.dylib" "./bin/Release/netcoreapp1.0/osx.10.10-x64/publish"
cp "libglfw.so" "./bin/Release/netcoreapp1.0/ubuntu.14.04-x64/publish"

0 comments on commit 7d6f1ca

Please sign in to comment.