GithubHelp home page GithubHelp logo

premake / premake-core Goto Github PK

View Code? Open in Web Editor NEW
3.1K 94.0 610.0 31.46 MB

Premake

Home Page: https://premake.github.io/

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.11% Lua 13.04% C 73.44% HTML 5.62% CSS 0.03% C++ 0.47% Shell 4.18% Batchfile 0.04% CMake 0.46% Perl 0.66% Tcl 0.01% Roff 0.04% TeX 0.14% PostScript 0.03% SmPL 0.01% VBScript 0.10% JavaScript 0.13% Python 1.45% Dockerfile 0.03% GDB 0.02%
premake c lua hacktoberfest

premake-core's Introduction

Premake

Latest release Release date Commits BSD 3-Clause
Linux Windows Contributors Contributors

Welcome to Premake

Premake is a command line utility which reads a scripted definition of a software project, then uses it to perform build configuration tasks or generate project files for toolsets like Visual Studio, Xcode, and GNU Make. Premake's scripts are little Lua programs, so the sky's the limit!

workspace "MyWorkspace"
    configurations { "Debug", "Release" }

project "MyProject"
    kind "ConsoleApp"
    language "C++"
    files { "**.h", "**.cpp" }

    filter { "configurations:Debug" }
        defines { "DEBUG" }
        symbols "On"

    filter { "configurations:Release" }
        defines { "NDEBUG" }
        optimize "On"

Getting Started

Sponsors

Premake is a BSD-licensed open source project. Our many thanks to these fine people who help us spend more time adding features and supporting the community. 🎉

Want to join them? Learn more here. Use Premake at work? Ask your manager or marketing team about contributing too; your company logo will appear on our website and README, as well as all of our release pages.

Organizations

Individuals

Contributing

We love getting pull requests and rely heavily on the contributions of our community to keep Premake healthy and growing. If you're new to the project, our Contributing Guide is here.

A great big thank you to all of you who have already contributed your time and know-how!

Stay in touch

License

BSD 3-Clause

The Lua language and runtime library is © TeCGraf, PUC-Rio. See their website at http://www.lua.org/

premake-core's People

Contributors

aleksijuvani avatar bwhittle avatar dcourtois avatar dmail00 avatar englercj avatar hannes-harnisch avatar ifarbod avatar jarod42 avatar kyriets avatar lanurmi avatar leeonix avatar loneboco avatar manxorist avatar moomalade avatar nickclark2016 avatar pdoane-blizzard avatar ratzlaff avatar redorav avatar samsinsane avatar sirlynix avatar sp-jordi-vilalta avatar starkos avatar tbasnoopy avatar tdesveaux avatar tdesveauxpkfx avatar tempura-sukiyaki avatar tritao avatar turkeyman avatar tvandijck avatar worldofbay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

premake-core's Issues

No error reported when failed to parse extension

If premake fails to parse an "required" extension for some reason, for example :

if True then print("b") else print("c") else -- here we wrote else instead of end

Then no error reported, but "required" fails with "module not found".
This behavior makes hard to develop extensions.

PS. not sure if it's premake or lua default behavior.

QtCreator support

Hi,

It would be awesome to have QtCreator support right?

Cheers,
Alex

solution generated for VS2012 (and possibly VS2010) has a slight issue

If I build a standard premake5.lua with "premake5 vs2012", and have a "dependson" directive in one of the projects, an old-style solution dependency is still emitted. The project references you have set up inside of .vcxproj files is sufficient.

The specific code that is generating this is the "premake.vstudio.sln2005.projects" function. The code it calls (sln2005.projectdependencies) needs to be skipped for vs2012 (and possibly vs2010).

'install' action should be emit to makefiles

If the premake script defines an install action, it would be nice to emit an install rule to makefiles which just executes premake5 install... only trouble is, knowing the path/command to execute premake.
Ideas?
Possible to capture the binary being run for the gmake action and use the same command?

target.abspath returns a relative path

%{cfg.buildtarget.abspath} returns a relative path instead of an absolute path.

My usage :

    filter "options:not static"
        kind "SharedLib"
        postbuildcommands ("{COPY} %{cfg.buildtarget.abspath} "..os.getcwd().."/../")

I'm on windows, building for vs2013

Broken Clean action for C# Make projects

The clean action in the C# make backend is not implemented.

Clean:

vagrant@vagrant-ubuntu-trusty-64:/vagrant/CppSharp$ config=release_x64 make -C build/gmake/ clean
make: Entering directory `/vagrant/CppSharp/build/gmake'
make[1]: Nothing to be done for `clean'.
Cleaning Basic.Native
make[1]: Nothing to be done for `clean'.
make[1]: Nothing to be done for `clean'.
make[1]: Nothing to be done for `clean'.
make: Leaving directory `/vagrant/CppSharp/build/gmake'

After clean:

vagrant@vagrant-ubuntu-trusty-64:/vagrant/CppSharp$ ls -lh build/gmake/lib/Release_x64/*.dll
-rwxrwxrwx 1 vagrant vagrant  98K Jul 10 22:12 build/gmake/lib/Release_x64/Basic.CSharp.dll
-rwxrwxrwx 1 vagrant vagrant  16K Jul 10 22:12 build/gmake/lib/Release_x64/Basic.Tests.CSharp.dll

Checking the Premake source in make_csharp.lua reveals why:

    function make.csCleanRules(prj, toolset)
        --[[
        -- porting from 4.x
        _p('clean:')
        _p('\t@echo Cleaning %s', prj.name)
        _p('ifeq (posix,$(SHELLTYPE))')
        _p('\t$(SILENT) rm -f $(TARGETDIR)/%s.* $(COPYFILES)', target.basename)
        _p('\t$(SILENT) rm -rf $(OBJDIR)')
        _p('else')
        _p('\t$(SILENT) if exist $(subst /,\\\\,$(TARGETDIR)/%s) del $(subst /,\\\\,$(TARGETDIR)/%s.*)', target.name, target.basename)
        for target, source in pairs(cfgpairs[anycfg]) do
            _p('\t$(SILENT) if exist $(subst /,\\\\,%s) del $(subst /,\\\\,%s)', target, target)
        end
        for target, source in pairs(copypairs) do
            _p('\t$(SILENT) if exist $(subst /,\\\\,%s) del $(subst /,\\\\,%s)', target, target)
        end
        _p('\t$(SILENT) if exist $(subst /,\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\,$(OBJDIR))')
        _p('endif')
        _p('')
        --]]
    end

how to make virtual folder in project?

I have a solution contain a project, the source directory like
engine
--include
--src
i want to generate vs project like
engine
--core
----.h,.cpp
--math
----.h,.cpp
so how can i create the virtual folder such as core,math and find files?

os.outputof carries over newlines

Having custom buildoptions (and linkoptions) often require some *-config tools to be run for creating proper flags. I think this is supposed to be done with os.outputof(). However the final newline character gets carried over in the final Makefile. For example:

buildoptions { os.outputof("pkg-config --cflags jansson"), os.outputof("wx-config --cppflags") }

will result in an unwanted newline in the Makefile:

ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -I/usr/local/Cellar/jansson/2.7/include
 -I/usr/local/Cellar/wxmac/3.0.2/lib/wx/include/osx_cocoa-unicode-3.0 -I/usr/local/Cellar/wxmac/3.0.2/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__

causing gmake to fail with *** missing separator. Stop.

v110_xp platform toolset

I am trying to produce a .vcxproj for VS2012 that supports both Win32 and x64 targets, and produces Windows XP compatible executables for the Win32 version. The only way this is possible is to mix both v110 and v110_xp platform toolsets in this .vcxproj.

I am looking to see if it's possible to expand the acceptable list of platform toolsets to include v110_xp.
MSDN link describing v110_xp

It seems like an action is bound to only provide one platform toolset for any code generation 'session', so I'm not sure the architecture of premake even would allow this as it is.

Any thoughts about this?

Tests are broken

Tried to run tests, this is the output from the latest premake version:

Running action 'test'...
xcode_project.XCBuildConfigurationTarget_OnInfoPlist: ...emakeFork/modules/xcode/tests/test_xcode_project.lua:1010: (8) expected:
                INFOPLIST_FILE = "../../MyProject-Info.plist";
...but was:
                INFOPLIST_FILE = "D:/MyProject-Info.plist";
stack traceback:
    ...emakeFork/modules/xcode/tests/test_xcode_project.lua:1010: in function <...emakeFork/modules/xcode/tests/test_xcode_project.lua:992>
vstudio_vs2010_rule_vars.onPathVar: ...Fork/tests/actions/vstudio/vc2010/test_rule_vars.lua:108: (2) expected:
    <MyVar>..\..\path\to\file</MyVar>
...but was:
    <MyVar>D:\path\to\file</MyVar>
stack traceback:
    ...Fork/tests/actions/vstudio/vc2010/test_rule_vars.lua:108: in function <...Fork/tests/actions/vstudio/vc2010/test_rule_vars.lua:100>
running time : 2.562
1149 tests passed, 2 failed

Do you run them on Travis-CI?

Generating secondary solutions in same premake5.lua scripts is problematic

I am attempting to make 2 solution files in my project. One that contains all projects, and a second that contains a subset of the same projects.

Your wiki page on the subject indicates this is possible, but I'm not seeing a way through with the API as it is.

a) I can't specify the same project name without re-specifying all the details I already did further up in the same script.
b) The externalproject command requires a bunch of details. For instance, the uuid. And, the location. Both of which are internally known already (or only).

There ought to be a way to refer to the existing project declaration. Do you have plans for a "projectref" command?

The upshot of what i'm asking for is to generate a second solution with references to already generated project files.

Default targetdir is incorrect.

if I make a project that does not have the targetdir set.

solution 'SC2'
    configurations { 'Release', 'Debug' }
    platforms { 'x86', 'x86_64' }

    project 'Test'
        kind 'StaticLib'

        files { '**.cpp' }

I get this in my visual studio project:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <OutDir>.\</OutDir>
    <IntDir>obj\x86\Release\</IntDir>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <OutDir>.\</OutDir>
    <IntDir>obj\x86_64\Release\</IntDir>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <OutDir>.\</OutDir>
    <IntDir>obj\x86\Debug\</IntDir>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <OutDir>.\</OutDir>
    <IntDir>obj\x86_64\Debug\</IntDir>
  </PropertyGroup>

the "IntDir" properties correctly contain both platform and configuration...
but the "OutDir" are all '.', making each build overwrite each other.
it would probably be better to make the default behave the same as "IntDir", or not set the property at all and make it use the visual studio default.

Strange combinations of configurations and platforms

With premake5.lua contents like this:

solution "Foo"
    location "FooDir"
    configurations {"Debug", "Release"}
    platforms {"Win32", "x64"}

    filter "platforms:Win32"
        architecture "x86"

    filter "platforms:x64"
        architecture "x64"

    project "BarLib"
        location "libs/BarLib"
        kind "StaticLib"
        language "C++"
        files {"AutoGen/*AutoGen*.c", "*.c"}

And after running premake5 vs2012, I get the following output snippet in BarLib.vcxproj:

...
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug Win32|Win32">
      <Configuration>Debug Win32</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug Win32|x64">
      <Configuration>Debug Win32</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release Win32|Win32">
      <Configuration>Release Win32</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release Win32|x64">
      <Configuration>Release Win32</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
...

And Foo.sln contains the following snippet:

...
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {919BEEA8-7D3D-197F-66F8-2CD35239A0CF}.Debug|Win32.ActiveCfg = Debug Win32|Win32
        {919BEEA8-7D3D-197F-66F8-2CD35239A0CF}.Debug|Win32.Build.0 = Debug Win32|Win32
        {919BEEA8-7D3D-197F-66F8-2CD35239A0CF}.Debug|x64.ActiveCfg = Debug|x64
        {919BEEA8-7D3D-197F-66F8-2CD35239A0CF}.Debug|x64.Build.0 = Debug|x64
        {919BEEA8-7D3D-197F-66F8-2CD35239A0CF}.Release|Win32.ActiveCfg = Release Win32|Win32
        {919BEEA8-7D3D-197F-66F8-2CD35239A0CF}.Release|Win32.Build.0 = Release Win32|Win32
        {919BEEA8-7D3D-197F-66F8-2CD35239A0CF}.Release|x64.ActiveCfg = Release|x64
        {919BEEA8-7D3D-197F-66F8-2CD35239A0CF}.Release|x64.Build.0 = Release|x64
    EndGlobalSection
...

Note what's wrong: a configuration that has the platform concatenated onto it, and then the platform again concatenated.

Debug Win32|Win32
Debug Win32|x64
Release Win32|Win32
Release Win32|x64

Am I doing something wrong, or is this a bug?

why target tokens are not use otherwhere.

Why these Tokens

target.abspath
target.basename
target.bundlename
target.bundlepath
target.directory
target.extension
target.name
target.prefix
target.relpath
target.suffix

not use in postbuildcommands.
I will copy target and it's map file and pdb file to other path, pack those send to FTP server.
it is base on target name and path, but these tokens are not invalid in postbuildcommands.
i use $(TargetPath) $(TargetDir) VS support. others, use name directly. that is not good.
i think it is valuable in postbuildcommands

can I remove '-Wl,-x' from ALL_LDFLAGS when leaving off the "Symbols" flag?

I'm using Premake5 (stable and nightly) for gmake on mac 10.9.5 (clang 5.1).

Basing my premake file off the 'first scriI noticed that with a super simple c++ hello world file, I was able to run the make file for debug, but not for release. In release I would get a linker error:

ld: internal error: atom not found in symbolIndex(__ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The only difference between the debug and release configuration in my premake5.lua file is that debug has flags { "Symbols" } while release does not. It seems that when this flag is left off for a given configuration, it has -Wl,-x appended to the ALL_LDFLAGS variable in the resulting make file.

-Wl,-x is what is causing this linker error. It seems to be a known issue for clang on mac 10.9, but has yet to be fixed. In the meantime, I would like to know if there is a way for me to prevent premake from adding this flag.

For reference, here are my premake5.lua file and the resulting project makefile, after running premake5 gmake.

TL;DR

How can I prevent -Wl,-x from being added to the ALL_LDFLAGS makefile variable? I don't think always adding the Symbols flag is an acceptable workaround, since I may not want to use the -g compiler flag in a release build.


_EDIT_: I'm not sure, but this issue on the old forums seems to be similar: http://industriousone.com/topic/how-remove-flags-ldflags, although the end of the thread seems to indicate that the issue was fixed in revision 23d8ffcc9144.

files with tokens and "*"

prerequisites

mkdir testfiles
touch testfiles/{x64,win32}{bla,foo}
touch testfiles/{foo,baa}

premake5.lua:

solution "myTestSln"
  location "testfiles/sln"

  platforms { "x64", "win32" }
  configurations { "debug", "release" }

  project "myTestPrj1"
    kind "Utility"
    files "testfiles/%{cfg.platform}*"

Problem
No files are in the project.

Cause
The files function calls later in progress the store function (api.lua:765).
This function find a "*" and call os.matchfiles, which didn't find something. This is okay, because at this time we cannot detoken all tokens but we have to do this in such a case.

        store = function(field, current, value, processor)
            print(value)
            if value:find("*") then
                print("glob detected")
                value = os.matchfiles(value)
                for i, file in ipairs(value) do
                    value[i] = path.getabsolute(value[i])
                end
            else
                print("no glob detected")
                value = path.getabsolute(value)
            end
            return value
        end,

Fix
a) detokenize in the function above (in my opinion not a good idea)
b) make os.matchfiles later in the oven. But I have no clue if a complete fileliste is important before the oven runs.

I will do the fix if someone can answer me which solution is the best.

Token handling of absolute paths

I'm trying to do something quite simple, basically copy some headers as part of a post build command. It looks like this:

  local headers = path.getabsolute(path.join(LLVMRootDir, "lib/"))
  postbuildcommands { copy .. " " .. headers .. " " .. "%{cfg.targetdir}" }

And I get this in the Makefile after generation:

    cp -rf /vagrant/CppSharp/deps/llvm/lib ../lib/Debug_x32

For some other reason (trying to workaround something else) I was trying to make the second path absolute, so I tried using %{path.getabsolute(cfg.targetdir)} but the path remained relative.

I checked the source and it seems the detokening process tries hard to keep paths relative. What is the reason for this?

[Premake5] DebugCommand and DebugDir not working correctly in VS 2013

I am using Premake5 Alpha3. DebugCommand and DebugDir are not working properly for me. The command and directory are set in the project settings but using relative paths and VS complaints about this. When I convert everything to absolute path in the project settings of VS everything works. I think the paths need to be extended to absolute for this to work.

Thanks!
-Dirk

Use environment value add to output dir on Windows, make by gmake.

I write a TotalCommander Plugins wlx_csv, use it's environment path COMMANDER_PATH, you can see my Premake5.lua.

targetdir '$(COMMANDER_PATH)/Plugins/wlx/csv'

my COMMANDER_PATH value is D:\tools\TC8\totalcmd
But, I use premake5 gmake and make the project and show this

==== Building wlx_csv (debug) ====
Running prebuild commands
on
ragel -T1 ../csv/csv.rl
csv.c
Linking wlx_csv
d:/prog/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot open output file D:toolsTC8totalcmd/Plugins/wlx/csv/wlx_csv.wlx: No such file or directory
collect2.exe: error: ld returned 1 exit status
make[1]: *** [D:\tools\TC8\totalcmd/Plugins/wlx/csv/wlx_csv.wlx] Error 1
make: *** [wlx_csv] Error 2

the backslash isn't double backslash, so make COMMANDER_PATH invalid.

I wrote a Makefile and use $@ for -o param. this COMMANDER_PATH is available.

I see the Premake generated Makefile

TARGETDIR = $(COMMANDER_PATH)/Plugins/wlx/csv
TARGET = $(TARGETDIR)/wlx_csv.wlx
...
LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)

Maybe use TARGETDIR directly make that error.
I modify $(TARGET) to $@, it is pass.

LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)

or modify $(TARGET), it is pass again

LINKCMD = $(CC) -o $(subst \,/,$(TARGET)) $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)

But I think, is it -o problem?

LINKCMD = $(CC) -o "$(TARGET)" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)

yeah~ it is pass again!

So, I wish can solve the bug.
Thx.

Linux build fails not being able to load xcode package

While building premake on linux with make -f Bootstrap.mak linux, I get this error:

./build/bootstrap/premake_bootstrap embed
Error: /home/ipopov/devel/premake-core/src/base/globals.lua:77: module 'xcode' not found:
    no field package.preload['xcode']
    no file './xcode.lua'
    no file '/usr/local/share/lua/5.1/xcode.lua'
    no file '/usr/local/share/lua/5.1/xcode/init.lua'
    no file '/usr/local/lib/lua/5.1/xcode.lua'
    no file '/usr/local/lib/lua/5.1/xcode/init.lua'
    no file './xcode.so'
    no file '/usr/local/lib/lua/5.1/xcode.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: in function 'base'
    /home/ipopov/devel/premake-core/src/base/globals.lua:77: in function </home/ipopov/devel/premake-core/src/base/globals.lua:76>
    (tail call): ?
    ...home/ipopov/devel/premake-core/src/_premake_main.lua:116: in function '?'
    ...e/ipopov/devel/premake-core/src/base/_foundation.lua:71: in function 'callArray'
    ...home/ipopov/devel/premake-core/src/_premake_main.lua:359: in function <...home/ipopov/devel/premake-core/src/_premake_main.lua:358>
Bootstrap.mak:61: recipe for target 'linux' failed
make: *** [linux] Error 1

I don't need any xcode support.
I am using Ubuntu 15.04 on a 64-bit laptop.

PS:
It appeared that for some reason git submodules were not updated properly. Everything is OK now. Yhe issue cen be closed.

Unable to use "links" to link with .obj files in VS2010

I'm using premake 5.0-alpha3 to create a VS2010 project where I need to link to an .obj file.
I'm unable to use the "links" command as premake adds the ".lib" suffix, eg:
links { "something.obj" }
will add "something.obj.lib" to the project dependencies.

Is it possible to make the links function check for .obj and not add the lib suffix?
(The workaround for the moment is to use "linkoptions" to link with the obj)

Problems with selective file level optimizations and debug symbols on

If you define (for instance) this at the project level

flags { "Symbols" }

But then define this with a filter on specific source files

flags { "Optimize" }
optimize "Speed"

It is possible to see this error when you build in visual studio.

    cl : Command line error D8016: '/ZI' and '/O2' command-line options are incompatible

The bug seems to be the fact that the function m.clCompileFiles does not call m.debugInformationFormat() at the file level if necessary (if optimization is switched on for specific files).

forced slash replacement

prerequisites

premake5.lua

local qt_bin_path = "C:/dev/mx/v1/dep/qt/qt_33_x64_bin"

solution "myTestSln"
  location "testfiles/sln"

  platforms "x64"
  configurations "release"
  project "myTestPrj1"
    kind "Utility"
    files (qt_bin_path.."/bin/QtDeclarative_sofistik33_x64_4.dll")

    filter "files:**/*.dll"
      buildmessage ([[%{file.name} (copy)]])
      buildcommands [[xcopy /y "%{file.path:gsub("/","\\")}" "bla"]]
      buildoutputs ("bla")
    filter "*"

Problem
The resulting path can be an absolute and all "" in the path are replaced by "/". There is - afaik - no possibility to change the slashes and not all Windows tools - like xcopy - can handle paths with "/".

Cause
If premake is detecting absolute paths in non path variables, they are replaced by relative paths. This is not possible all the time (not sure but here can be a bug, too). It's never possible on Windows system where files are placed over different Partitions (C:; D:).

detoken.lua:66

local isAbs = path.isabsolute(result)
if isAbs and not field.paths and basedir then
  result = path.getrelative(basedir, result)
end

The path.getrelative function calls path.normalize which replaces all the "" to "/". This is not the system specification but required for further processing in premake.

path_normalize.c:30

if (ch == '\\') {
  ch = '/';
}

possible Solution
Allow avoiding path fixing.

detoken.lua:66

local isAbs = path.isabsolute(result)
if type(result) == "string" and result:find("!$") then
  result = result:match("(.-)!$"):gsub("/","\\")
elseif isAbs and not field.paths and basedir then
  result = path.getrelative(basedir, result)
end

premake5.lua (part replacement)

buildcommands [[xcopy /y "%{file.path.."!"}" "bla"]]

Or is there a way I didn't see?

vcxproj "Stability" question

I'm trying to figure out where the bug is here, but if I generate a solution and projects with this setup:

Solution MySolution
   configurations { "Debug", "Release" }
   platforms {"Win32", "x64", "Durango" }
   project MyProject
      ....

(And yes, I have overriden some functions in premake to allow the Durango platform)

It outputs them in the XML in this order:

Debug|Durango
Debug|Win32
Debug|x64
Release|Durango
Release|Win32
Release|x64

However, when I load the projects into Visual Studio 2012, Visual studio helpfully reorders the configurations to be in the following order:

Debug|Win32
Debug|x64
Debug|Durango
Release|Win32
Release|x64
Release|Durango

This wouldn't be a big deal except you have to deal with the reload of the projects.

Is there a sort function or something that is making premake not pay attention to the order of platforms as I specify them?

Ninja support

Hi,

What about supporting Ninja on Linux?

Thanks!

newoption 'category' field?

I've been thinking about this one for a while, and wonder if we can add a "catagory" field to the newoption API, so that we can distinguish between "vanilla premake", "blizzard " and "buildfile" specific options...

right now, everything gets clumped together in the --help output under "OPTIONS", but I would like to have that display "OPTION", with a list of stuff, then "OPTIONS - Blizzard", with a bunch of our own stuff, and then "OPTIONS - SC2_Game", or something like that...

any suggestions? objections? ideas?

premake5 alpha 2 on OS/X fails with xcode module not found error

$ ./premake5
Error: [string "src/_premake_main.lua"]:45: module 'xcode' not found:
    no field package.preload['xcode']
    no file './xcode.lua'
    no file '/usr/local/share/lua/5.1/xcode.lua'
    no file '/usr/local/share/lua/5.1/xcode/init.lua'
    no file '/usr/local/lib/lua/5.1/xcode.lua'
    no file '/usr/local/lib/lua/5.1/xcode/init.lua'
    no file './xcode.so'
    no file '/usr/local/lib/lua/5.1/xcode.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'

toolset("v140") throwing error

When creating a vs2015 solution, some of my projects (but not all) did not have

<PlatformToolset>v140</PlatformToolset>

I then tried to explicitly set the platform toolset using

toolset("v140")

That caused the following error:

invalid value 'v140' for toolset

Calling project() does not work in certain scopes

In premake 4 I was doing something like the following:

for i, platform in ipairs(solution().platforms) do
    configuration {platform}
        targetdir ("build/" .. platform .. "/" .. project().name)
end

Now in premake 5, I get the following error when trying to call project():

Error: no project in scope

project().name still works everywhere else. It only seems to be a problem when I am iterating over the list of platforms or configurations from the solution object. I have also replaced my configuration call with filter.

Also, is there a better or more preferred way, in premake 5, to iterate over platforms and configurations?

tmainCRTStartup

What's the go with emitting this EntryPointSymbol field into VS projects.

LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol main referenced in function __tmainCRTStartup

I've been having link troubles with this for years, but I always just go into my project and fix it.
I finally bothered to dig into premake and work out why it's emitting it. I see that unless the WinMain flag is defined, it is written.
Do we think this is right?
Surely if kind is WindowedApp, and os is windows, then this should be the default?
It never occurred to me that I would have to set WinMain flag in addition to WindowedApp, and I've just quietly put up with this for years... even though the solution was super obvious.

Opinions?

xcopy /E also copies folders when copying files

I didn't believe it at first, but xcopy seems to be the worst copy utility ever made.

By default, premake5 adds the "/E" argument which sould mean "recursive, including empty folders".
The problem is when you try to copy a file, it will also copy the hierarchy of the folder this file is in (only folders, no files).
The "/S" (which should mean recursive except empty folders) is also flawed, but it is much more random. Sometimes it copies 1 or 2 folders sometimes it doesn't...
I can't think of any reason it does that, but it does (tested on win7).
To try it just xcopy /E or /S a file which have sibling folders into an empty folder.

It seems the "/E" option should never be used when copying a single file... I blame xcopy on that one.
I have no idea how this can be fixed, robocopy just denies the copy of a single file if /E or /S is used.

Add force compile or force language option?

Today I met one question, some C99 code in msvc must compile by C++ compile.
but msvc default /TC or /TP choice by ext. so i add this code to force build by C++.

filter 'action:vs*'
    buildoptions '/TP'

I generate gmake file, also choice as cc by ext.
I think premake maybe add a forcelanguage.
in my memory, premake4 a prev verstion, language is force choice.

Change 'solution' to 'workspace'

As discussed on the forum, 'workspace' seems a more natural term for more users.
It would be good to switch this over at some point.

Favor a compiler on premake5

Hello,
I'm not sure this could be an improvement as it might already be possible although i don't know how to do it.

Put simply, on premake 4, I wanted to favor clang if it was present on the platform, rather than gcc, and here is the script I used :

if os.execute("clang -v") == 0 then
    premake.gcc.cc  = 'clang'
    premake.gcc.cxx = 'clang++'
elseif ...

Now on premake5 the premake.gcc value doesn't exist anymore, I tried setting premake.cc and premake.cxx instead of premake.gcc.cc and premake.gcc.cxx but it doesn't work.

Is it possible to do this the proper way ? If not, that would be a very interesting new feature to add.

Solution location is incorrect if you have multiple projects in subdirectories

I am trying to migrate from Premake4 to 5, but I've hit an issue

We have a large workspace/solution that includes multiple projects in separate directories. With structure as such:

../sln/premake4.lua
../sln/src
../projA/projA_premake.lua
../projA/src/..
../projB/projB_premake.lua
../projB/src/..

sln/premake4.lua contains the Solution definition and any solution wide config options, then calls the files for all the project using dofile, like this:

solution "test"
location "src"
configurations "debug"
platforms "linux"

    dofile "../projA/projA_premake.lua"
    dofile "../projB/projB_premake.lua"

With premake4 the workspace file is correctly generated in sln/src, but with premake5 it is generated in the projB directory. I've had a quick look at the code and I've noticed that the generate function calls path.getabsolute() which uses the current working directory. I'm guessing that either the dofile or something else is changing the working directory, but so far haven't been able to work out where to change it to the correct directory for the location as set in the solution directive.

premake5 Unix executable doesn't have xcode4 action

In the last official build, premake5.exe is correctly shipped with xcode4 action from the embedded module but it's not the case for the unix executable. We need to rebuild the unix version with premake5.exe to get the action. Thanks !

premake5 alpha 3 generate vs2010 project on vs2013 solution

Hello,

I've just created 3 project calling "premake5 vs2013"

in the solution I have 2 project which works perfectly fine and one which have the platform toolset option set to visual 2010 (not installed on my machine).

Has anyone seen this issue? Is there a work around?

buildcommands() don't support multiple commands

The current method of specifying custom build commands (the buildcommands, buildinputs, and buildoutputs APIs) don't allow multiple rule sets, with their own inputs and outputs to be specified. The values all get lumped together during project baking and the intended associations get lost.

Probably need to bring back the previous buildrule { ... } syntax.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.