Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Modularize premake script for easier external usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaztin committed Feb 18, 2019
1 parent 883591a commit 74cbc95
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 208 deletions.
2 changes: 1 addition & 1 deletion src/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ fi


# Generate project files
../bin/premake5 "--file=premake/main.lua" "$action"
../bin/premake5 "--file=premake/all.lua" "$action"
18 changes: 18 additions & 0 deletions src/premake/all.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'extensions/premake-qt/qt'

QTDIR_X86 = io.readfile('../../tmp/.qtdir_x86')
QTDIR_X64 = io.readfile('../../tmp/.qtdir_x64')

workspace ('QDiscord')
location ('../')
configurations {
'Debug',
'Release',
}
platforms {
'x86',
'x64',
}

dofile 'libs.lua'
dofile 'demos.lua'
57 changes: 57 additions & 0 deletions src/premake/demos.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
local function demo(prettyname, dirname)
project (prettyname)
premake.extensions.qt.enable()
debugdir ('../../bin/%{cfg.platform}/')
kind ('ConsoleApp')
location ('../projects/demos/')
objdir ('../../bin/%{cfg.platform}/obj/')
qtgenerateddir ('../demos/' .. dirname .. '/GeneratedFiles/')
qtprefix ('Qt5')
targetdir ('../../bin/%{cfg.platform}/')

files {
'../demos/' .. dirname .. '/**.h',
'../demos/' .. dirname .. '/**.cpp',
'../demos/' .. dirname .. '/**.ui',
'../demos/' .. dirname .. '/**.qrc',
}
flags {
"MultiProcessorCompile",
}
includedirs {
'../core/',
'../demos/' .. dirname .. '/',
}
links {
'QDiscordCore',
}
qtmodules {
'core',
'gui',
'network',
'websockets',
'widgets',
}

filter {'configurations:Debug'}
qtsuffix ('d')

filter {'configurations:Release'}
optimize ('Full')
defines {
'QT_NO_DEBUG',
}

filter {'platforms:x86'}
qtpath (QTDIR_X86)

filter {'platforms:x64'}
qtpath (QTDIR_X64)

filter {}
end

group ('Demos')
demo ('BotDemo01', 'botdemo01')
demo ('BotUser', 'botuser')
demo ('Embeds', 'embeds')
34 changes: 34 additions & 0 deletions src/premake/libs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
project ('QDiscordCore')
premake.extensions.qt.enable()
location ('../projects/')
kind ('StaticLib')
qtgenerateddir ('../core/GeneratedFiles/')
qtprefix ('Qt5')
files {
'../core/**.h',
'../core/**.cpp',
}
flags {
"MultiProcessorCompile",
}
includedirs {
'../core/',
}

filter {'configurations:Release'}
optimize ('Full')
defines {
'QT_NO_DEBUG',
}

filter {'platforms:x86'}
objdir ('../../bin/x86/obj/')
qtpath (QTDIR_X86)
targetdir ('../../bin/x86/')

filter {'platforms:x86_64 or x64'}
objdir ('../../bin/x64/obj/')
qtpath (QTDIR_X64)
targetdir ('../../bin/x64/')

filter {}
207 changes: 0 additions & 207 deletions src/premake/main.lua

This file was deleted.

0 comments on commit 74cbc95

Please sign in to comment.