Compare commits

...

29 Commits
dev ... main

Author SHA1 Message Date
Vinayak Ambigapathy 901147ac3c Good bin ago%!(EXTRA string=2 months)
anulax1225 7136685517 modified linux exec ago%!(EXTRA string=7 months)
anulax1225 59096eab78 Added compile commands module to premake for lsp intergration ago%!(EXTRA string=7 months)
anulax1225 cf4f218675 Added compile commands module to premake for lsp intergration ago%!(EXTRA string=7 months)
anulax1225 115a0bc47f New linux bin ago%!(EXTRA string=11 months)
Ambigapathy Vinayak 83a530b56d Adapted a parameter of init and of the premake5 file ago%!(EXTRA string=11 months)
anulax1225 f7a8e01098 Modified setup.sh ago%!(EXTRA string=11 months)
anulax1225 a9a8250158 Update linux bin ago%!(EXTRA string=11 months)
Ambigapathy Vinayak c532f161b0 modified installer ago%!(EXTRA string=11 months)
Ambigapathy Vinayak ef24325827 modified installer ago%!(EXTRA string=11 months)
Ambigapathy Vinayak 73745d5e0f Windows setup working ago%!(EXTRA string=11 months)
Ambigapathy Vinayak a0ad36ac93 Added windows support but path not working ago%!(EXTRA string=11 months)
Ambigapathy Vinayak 2e8b96381d Added windows support but path not working ago%!(EXTRA string=11 months)
anulax1225 eb7f53e499 Fixed error in reconfig func ago%!(EXTRA string=11 months)
anulax1225 9a2b979a51 Bad compilation fixed ago%!(EXTRA string=11 months)
anulax1225 f1a7f44fa0 Modified script.sh ago%!(EXTRA string=11 months)
anulax1225 ec96c56545 Modified logic in packages config and simplefied some args ago%!(EXTRA string=11 months)
anulax1225 51e87a76c2
Update README.md ago%!(EXTRA string=11 months)
anulax1225 50b1e94d5e
Added command to add path env variable ago%!(EXTRA string=11 months)
anulax1225 132823f393
created setup.bat ago%!(EXTRA string=11 months)
anulax1225 706478f5c1 Fixed speling error ago%!(EXTRA string=11 months)
anulax1225 6c6e210522 Fixed comma error ago%!(EXTRA string=11 months)
anulax1225 41da487b20 Added a default include dir and fixed double reconfig ago%!(EXTRA string=11 months)
anulax1225 640781160e Modified log style ago%!(EXTRA string=11 months)
anulax1225 374b3d3c34 Fixed path error in setup.sh ago%!(EXTRA string=11 months)
anulax1225 c75a3ec50b Modified log style ago%!(EXTRA string=11 months)
anulax1225 49756a0fe6 Clean executable... ago%!(EXTRA string=11 months)
anulax1225 107c524783 added a linux setup file ago%!(EXTRA string=11 months)
anulax1225 c0a07a8735 Added linux executable of bakasable ago%!(EXTRA string=11 months)
  1. 1
      README.md
  2. BIN
      bin/linux/bakasable
  3. BIN
      bin/linux/premake5
  4. 44
      bin/vendor/export-compile-commands/README.md
  5. 4
      bin/vendor/export-compile-commands/_manifest.lua
  6. 3
      bin/vendor/export-compile-commands/_preload.lua
  7. 133
      bin/vendor/export-compile-commands/export-compile-commands.lua
  8. BIN
      bin/windows/bakasable.exe
  9. BIN
      bin/windows/premake5.exe
  10. 11
      path.ps1
  11. 16
      setup.bat
  12. 34
      setup.sh

@ -0,0 +1 @@
# Baka developpement enviroment

Binary file not shown.

Binary file not shown.

@ -0,0 +1,44 @@
## Generate compile_commands.json for premake projects
This module implements [JSON Compilation Database Format
Specification](http://clang.llvm.org/docs/JSONCompilationDatabase.html) for
premake projects.
Install this module somewhere premake can find it, for example:
```
git clone https://github.com/tarruda/premake-export-compile-commands export-compile-commands
```
Then put this at the top of your system script(eg: ~/.premake/premake-system.lua):
```lua
require "export-compile-commands"
```
Note that while possible, it is not recommended to put the `require` line in
project-specific premake configuration because the "export-compile-commands"
module will need to be installed everywhere your project is built.
After the above steps, the "export-compile-commands" action will be available
for your projects:
```
premake5 export-compile-commands
```
The `export-compile-commands` action will generate one json file per
config/platform combination in each workspace, all under the `compile_commands`
subdirectory. For example, say you have defined `debug` and `release`
configurations with `x32` and `x64` platforms, the output will be something
like:
```
Generated WORKSPACE_BUILD_DIR/compile_commands/debug_x32.json...
Generated WORKSPACE_BUILD_DIR/compile_commands/debug_x64.json...
Generated WORKSPACE_BUILD_DIR/compile_commands/release_x32.json...
Generated WORKSPACE_BUILD_DIR/compile_commands/release_x64.json...
```
where each file contain the compilation commands for the corresponding
config/platform combo.

@ -0,0 +1,4 @@
return {
'_preload.lua',
'export-compile-commands.lua',
}

@ -0,0 +1,3 @@
return function(cfg)
return _ACTION == 'export-compile-commands'
end

@ -0,0 +1,133 @@
local p = premake
p.modules.export_compile_commands = {}
local m = p.modules.export_compile_commands
local workspace = p.workspace
local project = p.project
function m.getToolset(cfg)
return p.tools[cfg.toolset or 'gcc']
end
function m.getIncludeDirs(cfg)
local flags = {}
for _, dir in ipairs(cfg.includedirs) do
table.insert(flags, '-I' .. p.quoted(dir))
end
for _, dir in ipairs(cfg.sysincludedir or {}) do
table.insert(result, '-isystem ' .. p.quoted(dir))
end
return flags
end
function m.getCommonFlags(cfg)
local toolset = m.getToolset(cfg)
local flags = toolset.getcppflags(cfg)
flags = table.join(flags, toolset.getdefines(cfg.defines))
flags = table.join(flags, toolset.getundefines(cfg.undefines))
-- can't use toolset.getincludedirs because some tools that consume
-- compile_commands.json have problems with relative include paths
flags = table.join(flags, m.getIncludeDirs(cfg))
flags = table.join(flags, toolset.getcflags(cfg))
return table.join(flags, cfg.buildoptions)
end
function m.getObjectPath(prj, cfg, node)
return path.join(cfg.objdir, path.appendExtension(node.objname, '.o'))
end
function m.getDependenciesPath(prj, cfg, node)
return path.join(cfg.objdir, path.appendExtension(node.objname, '.d'))
end
function m.getFileFlags(prj, cfg, node)
return table.join(m.getCommonFlags(cfg), {
'-o', m.getObjectPath(prj, cfg, node),
'-MF', m.getDependenciesPath(prj, cfg, node),
'-c', node.abspath
})
end
function m.generateCompileCommand(prj, cfg, node)
return {
directory = prj.location,
file = node.abspath,
command = 'cc '.. table.concat(m.getFileFlags(prj, cfg, node), ' ')
}
end
function m.includeFile(prj, node, depth)
return path.iscppfile(node.abspath)
end
function m.getConfig(prj)
if _OPTIONS['export-compile-commands-config'] then
return project.getconfig(prj, _OPTIONS['export-compile-commands-config'],
_OPTIONS['export-compile-commands-platform'])
end
for cfg in project.eachconfig(prj) do
-- just use the first configuration which is usually "Debug"
return cfg
end
end
function m.getProjectCommands(prj, cfg)
local tr = project.getsourcetree(prj)
local cmds = {}
p.tree.traverse(tr, {
onleaf = function(node, depth)
if not m.includeFile(prj, node, depth) then
return
end
table.insert(cmds, m.generateCompileCommand(prj, cfg, node))
end
})
return cmds
end
local function execute()
for wks in p.global.eachWorkspace() do
local cfgCmds = {}
for prj in workspace.eachproject(wks) do
for cfg in project.eachconfig(prj) do
local cfgKey = string.format('%s', cfg.shortname)
if not cfgCmds[cfgKey] then
cfgCmds[cfgKey] = {}
end
cfgCmds[cfgKey] = table.join(cfgCmds[cfgKey], m.getProjectCommands(prj, cfg))
end
end
for cfgKey,cmds in pairs(cfgCmds) do
local outfile = string.format('compile_commands/%s.json', cfgKey)
p.generate(wks, outfile, function(wks)
p.w('[')
for i = 1, #cmds do
local item = cmds[i]
local command = string.format([[
{
"directory": "%s",
"file": "%s",
"command": "%s"
}]],
item.directory,
item.file,
item.command:gsub('\\', '\\\\'):gsub('"', '\\"'))
if i > 1 then
p.w(',')
end
p.w(command)
end
p.w(']')
end)
end
end
end
newaction {
trigger = 'export-compile-commands',
description = 'Export compiler commands in JSON Compilation Database Format',
execute = execute
}
return m

Binary file not shown.

Binary file not shown.

@ -0,0 +1,11 @@
echo "Searching path in env PATH"
$PATH = [Environment]::GetEnvironmentVariable("PATH", "Machine")
$bakasable_path = "C:\Program Files\bakasable"
if( $PATH -notlike "*"+$bakasable_path+"*" ){
echo "Path not found in env PATH"
echo "Adding path"
[Environment]::SetEnvironmentVariable("PATH", "$PATH;$bakasable_path", "Machine")
}
else {
echo "Path already added"
}

@ -0,0 +1,16 @@
@echo off
cd %~dp0
echo Installing bakasable
md "C:\Program Files\bakasable"
md "C:\Program Files\bakasable\cache"
xcopy /y .\bin\windows\bakasable.exe "C:\Program Files\bakasable"
xcopy /y .\bin\windows\premake5.exe "C:\Program Files\bakasable"
powershell .\path.ps1
pause

@ -0,0 +1,34 @@
cd $(dirname "$0")
handle_error() {
echo "An error occurred on line $1"
rm -rf ~/.bakasable
cd $(pwd)
exit 1
}
trap 'handle_error $LINENO' ERR
echo Installing bakasable
mkdir -m 777 ~/.bakasable
mkdir ~/.bakasable/cache
cp -f ./bin/linux/bakasable ~/.bakasable/
if [ ! $(which premake5) ]; then
echo Installing premake
cp -f ./bin/linux/premake5 ~/.bakasable/
chmod +x ~/.bakasable/premake5
echo Installing export-compile-commands module
cp -rf ./bin/vendor/export-compile-commands ~/.bakasable/
echo 'require "export-compile-commands"' >> ~/.bakasable/premake-system.lua
fi
echo Searching path in env PATH
if [ ! $(which bakasable) ]; then
echo Path not found in env PATH
echo Adding path
export PATH=\$PATH:~/.bakasable
echo "export PATH=\$PATH:~/.bakasable" >> ~/.bashrc
else
echo Path already added
fi
cd $(pwd)
Loading…
Cancel
Save