Skip to content

Commit

Permalink
Add project-nuget-SDL
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarod42 committed Mar 21, 2024
1 parent 555ea28 commit 53fc002
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 0 deletions.
3 changes: 3 additions & 0 deletions projects/project-nuget-SDL/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Project-nuget-SDL:

Project to test [nuget](https://premake.github.io/docs/nuget) (premake5)
24 changes: 24 additions & 0 deletions projects/project-nuget-SDL/premake5.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local Root = path.getabsolute(".")

if (_ACTION == nil) then
return
end

local LocationDir = path.join(Root, "solution/", _ACTION)

workspace "Project"
location(LocationDir)
configurations {"Debug", "Release"}

objdir(path.join(LocationDir, "obj")) -- premake adds $(configName)/$(AppName)
targetdir(path.join(LocationDir, "bin/%{cfg.buildcfg}"))
startproject "app"

filter { "action:vs*" }
nuget { "sdl2.nuget:2.28.0", "sdl2.nuget.redist:2.28.0" }

project "app"
kind "ConsoleApp"
targetname("app")

files "src/main.cpp"
13 changes: 13 additions & 0 deletions projects/project-nuget-SDL/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <SDL.h> // From nuget

#include <iostream>

int main(int argc, char**argv)
{
if (SDL_Init (0) == -1) {
std::cerr << "Cannot initialize SDL" << std::endl;
return -1;
}
SDL_Quit();
return 0;
}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ def run_qmake():
return subprocess.run(['make', 'sub-app-all']).returncode

def run_vs():
if os.path.isfile('packages.config'): # visual studio calls nuget, but not msbuild
nuget_cmd = ['nuget', 'install', 'packages.config', '-OutputDirectory', 'packages']
print(nuget_cmd)
ret = subprocess.run(nuget_cmd)
if ret.returncode != 0:
print(ret.stdout.decode())
print(ret.stderr.decode(), flush=True)
return 1

return subprocess.run(['msbuild.exe', '/property:Configuration=Release', 'Project.sln']).returncode

def run_xcode4():
Expand Down

0 comments on commit 53fc002

Please sign in to comment.