From eca87f145d69affa0f733d678087e71bad34374d Mon Sep 17 00:00:00 2001 From: Cameron Aavik Date: Fri, 6 Jan 2017 19:32:38 +1000 Subject: [PATCH] Switched to platform app instead Uses multiple project.json's instead Haven't tested the shell script again --- .gitignore | 1 + build_jsons/project.linux.json | 22 +++++++++++++++++ build_jsons/project.osx.json | 22 +++++++++++++++++ build_jsons/project.windows.json | 22 +++++++++++++++++ project.json | 12 ++++------ publish.bat | 27 --------------------- publish.cmd | 27 +++++++++++++++++++++ publish.sh | 41 +++++++++++++++++++++----------- 8 files changed, 125 insertions(+), 49 deletions(-) create mode 100644 build_jsons/project.linux.json create mode 100644 build_jsons/project.osx.json create mode 100644 build_jsons/project.windows.json delete mode 100644 publish.bat create mode 100644 publish.cmd diff --git a/.gitignore b/.gitignore index 3978316..517f1cc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.*~ bin/ obj/ +out/ project.lock.json .DS_Store *.pyc diff --git a/build_jsons/project.linux.json b/build_jsons/project.linux.json new file mode 100644 index 0000000..ca29a03 --- /dev/null +++ b/build_jsons/project.linux.json @@ -0,0 +1,22 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true, + "define": [ + "LINUX" + ] + }, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + } + } + }, + "publishOptions": { + "includeFiles": "libglfw.so" + } +} \ No newline at end of file diff --git a/build_jsons/project.osx.json b/build_jsons/project.osx.json new file mode 100644 index 0000000..4d85cf4 --- /dev/null +++ b/build_jsons/project.osx.json @@ -0,0 +1,22 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true, + "define": [ + "OSX" + ] + }, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + } + } + }, + "publishOptions": { + "includeFiles": "libglfw.dylib" + } +} \ No newline at end of file diff --git a/build_jsons/project.windows.json b/build_jsons/project.windows.json new file mode 100644 index 0000000..7fce6ce --- /dev/null +++ b/build_jsons/project.windows.json @@ -0,0 +1,22 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true, + "define": [ + "WINDOWS" + ] + }, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + } + } + }, + "publishOptions": { + "includeFiles": "glfw.dll" + } +} \ No newline at end of file diff --git a/project.json b/project.json index cb62925..0171b60 100644 --- a/project.json +++ b/project.json @@ -9,15 +9,11 @@ "frameworks": { "netcoreapp1.0": { "dependencies": { - "System.Runtime.InteropServices": "4.1.0", - "Microsoft.NETCore.DotNetHostPolicy": "1.0.1", - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.4" + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } } } - }, - "runtimes": { - "win10-x64": {}, - "osx.10.10-x64": {}, - "ubuntu.14.04-x64": {} } } \ No newline at end of file diff --git a/publish.bat b/publish.bat deleted file mode 100644 index 1607279..0000000 --- a/publish.bat +++ /dev/null @@ -1,27 +0,0 @@ -:: 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" \ No newline at end of file diff --git a/publish.cmd b/publish.cmd new file mode 100644 index 0000000..9cc5694 --- /dev/null +++ b/publish.cmd @@ -0,0 +1,27 @@ +:: Clean output directory +rmdir /s /q out + +:: Back up the current project.json +ren project.json project.json.bak + +:: Windows +copy "build_jsons\project.windows.json" "project.json" +dotnet restore +dotnet publish -c Release -o "out\windows" +del project.json + +:: OSX +copy "build_jsons\project.osx.json" "project.json" +dotnet restore +dotnet publish -c Release -o "out\osx" +del project.json + +:: Linux +copy "build_jsons\project.linux.json" "project.json" +dotnet restore +dotnet publish -c Release -o "out\linux" +del project.json + +:: Restore backup +ren project.json.bak project.json +dotnet restore \ No newline at end of file diff --git a/publish.sh b/publish.sh index a90613b..d92a0c1 100644 --- a/publish.sh +++ b/publish.sh @@ -1,14 +1,27 @@ -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" \ No newline at end of file +# Clean output directory +rm -rf out + +# Back up the current project.json +mv project.json project.json.bak + +# Windows +cp "/build_jsons/project.windows.json" "project.json" +dotnet restore +dotnet publish -c Release -o "out/windows" +rm project.json + +# OSX +cp "/build_jsons/project.osx.json" "project.json" +dotnet restore +dotnet publish -c Release -o "out/osx" +rm project.json + +# Linux +cp "/build_jsons/project.linux.json" "project.json" +dotnet restore +dotnet publish -c Release -o "out/linux" +rm project.json + +# Restore backup +mv project.json.bak project.json +dotnet restore \ No newline at end of file