Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(premake5) It seems that in visual studio, "Additional Include Directories" is not generated properly #90

Closed
doyoubi opened this issue May 29, 2015 · 9 comments

Comments

@doyoubi
Copy link

doyoubi commented May 29, 2015

includedirs { "src" } in premake config file will generate ..\src;%(AdditionalIncludeDirectories) for Additional Include Directories in visual studio 2013. But ..\src seems only relative to the current code source file, not relative to $(ProjectDir). Should premake add $(ProjectDir)before ..\src ?

@doyoubi doyoubi changed the title It seems that in visual studio, Addional Include Directories is not generated properly It seems that in visual studio, Additional Include Directories is not generated properly May 29, 2015
@doyoubi doyoubi closed this as completed May 29, 2015
@doyoubi doyoubi reopened this May 29, 2015
@doyoubi doyoubi changed the title It seems that in visual studio, Additional Include Directories is not generated properly (premake5) It seems that in visual studio, "Additional Include Directories" is not generated properly May 29, 2015
@tvandijck
Copy link
Contributor

No.. it should not use the $(ProjectDir) at all, since they already are relative to the vcxproj, adding $(ProjectDir) would be completely redundant...

@starkos
Copy link
Member

starkos commented May 29, 2015

I've never had a problem with this. Can you provide a small sample that demonstrates the problem you're seeing?

@doyoubi
Copy link
Author

doyoubi commented May 30, 2015

@tvandijck you are right, later I found it work. Maybe I made some mistakes at the first time.
But in my vs2013, without $(ProjectDir), after typing include "" there is no prompt for the files and directories under the Additional Include Directories, while with $(ProjectDir) added, the prompt works well.
My file list looks like this:

| premake5.lua
|
| -- src/ 
|     | header/ 
|     |   |
|     |   | header.h
|     |
|     | main/
|       | 
|       | main.cpp
|
| -- build/
      |
      | files generated by premake, including .sln and .vcxproj

and my premake5.lua is :

solution "TestSln"
    location "build"
    includedirs { "src" }
    configurations { "DEBUG" }

project "proj1"
    kind "ConsoleApp"
    language "C++"
    files { "src/**.h", "src/**.cpp" }

Without $(ProjectDir), after typing include "" in the main.cpp, there is no prompt for header and main directories.
Should we add $(ProjectDir) explicitly to get around it?

@TurkeyMan
Copy link
Contributor

So, you've specified the include path as a solution property, and also specified that the solution should be located in build/. location is the path that the include dir is relative to, which explains the ../ present in the path. Just move the includedirs statement into the project, and you should be fine.

@TurkeyMan
Copy link
Contributor

I doubt many people try to do this, but it does raise questions about this (and other) options being specified at the solution scope...

@doyoubi
Copy link
Author

doyoubi commented May 30, 2015

@TurkeyMan Thanks for your explanation.
But for this premake config file, since the project proj1 inherits the location from solution, specifying the includedirs in the solution scope and project scope seems to give the same Additional Include Directories for the proj1.
Now I can't reproduce the problem that compiler said it can't find the header.h file. But without the $(ProjectDir), prompt for #include in my vs2013 doesn't works. After changing ..\src;%(AdditionalIncludeDirectories) to $(ProjectDir)\..\src;%(AdditionalIncludeDirectories) manually, the prompt works again.

@starkos
Copy link
Member

starkos commented Jun 1, 2015

But without the $(ProjectDir), prompt for #include in my vs2013 doesn't works

What is this "prompt for #include"?

@tvandijck
Copy link
Contributor

For what it is worth however... this is not unique behavior to just includedirs, this is the same with vpaths, which is why we needed support for tokens in there, so we could setup global vpaths in the solution, but still use %{prj.basedir} as the basedirectory... it's somewhat cumbersome, and maybe a food for thought.

@doyoubi doyoubi closed this as completed Jun 2, 2015
@starkos
Copy link
Member

starkos commented Jun 2, 2015

Premake converts all paths to absolute at the time they are received from the script, and then to project relative at export time. If that isn't working transparently, regardless of at which scope the paths were specified, then it should be considered a bug. Small examples that demonstrate the problem would be helpful.

tvandijck pushed a commit to Blizzard/premake-core that referenced this issue May 1, 2017
tvandijck pushed a commit to Blizzard/premake-core that referenced this issue May 2, 2017
tvandijck pushed a commit to Blizzard/premake-core that referenced this issue Jun 6, 2017
tvandijck pushed a commit to Blizzard/premake-core that referenced this issue Jun 14, 2017
tvandijck pushed a commit to Blizzard/premake-core that referenced this issue Jun 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants