Caphyon / clang-power-tools

Bringing clang-tidy magic to Visual Studio C++ developers.
http://www.clangpowertools.com
Apache License 2.0
482 stars 57 forks source link

Include paths are not set #101

Closed mariusz102102 closed 6 years ago

mariusz102102 commented 6 years ago

Step to reproduce:

  1. Download http://www.cocos2d-x.org/filedown/cocos2d-x-3.16.zip
  2. Unzip
  3. open cocos2d-x-3.16\build\cocos2d-win32.sln
  4. project cpp-tests "Clang Power Tools"->Compile Bug: include directories were not extracted from. vcproj.

` Start Clang Compile

VERBOSE: CPU logical core count: 12 VERBOSE: LLVM location: C:\Program Files\LLVM\bin VERBOSE: Source directory: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\proj.win32 VERBOSE: Scanning for .vcxproj files VERBOSE: Found 1 projects [ INFO ] WILL PROCESS PROJECTS: cpp-tests.vcxproj [ INFO ] 1. PROCESSING PROJECT G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\proj.win32\cpp-tests.vcxproj VERBOSE: Configuration platform: Debug|Win32 VERBOSE: Property sheets: VERBOSE: G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\cocos2dx.props VERBOSE: G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\cocos2d_headers.props VERBOSE: PCH not enabled for this project! VERBOSE: Preprocessor definitions: VERBOSE: -DWIN32 VERBOSE: -D_DEBUG VERBOSE: -D_WINDOWS VERBOSE: -D_USE_MATH_DEFINES VERBOSE: -DGL_GLEXT_PROTOTYPES VERBOSE: -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 VERBOSE: -DCOCOS2D_DEBUG=1 VERBOSE: -D_CRT_SECURE_NO_WARNINGS VERBOSE: -D_SCL_SECURE_NO_WARNINGS VERBOSE: -DCOCOS2DXWIN32_EXPORTS VERBOSE: -D_VARIADIC_MAX=10 VERBOSE: -DUNICODE VERBOSE: -D_UNICODE VERBOSE: -D_USING_V110SDK71 VERBOSE: Platform toolset: v120 v120_xp v140 v140_xp v141 v141_xp VERBOSE: Additional includes: VERBOSE: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE: Visual Studio location: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community VERBOSE: MSCVER: 14.11.25503 VERBOSE: WinSDK version: 7.0 VERBOSE: Include directories: VERBOSE: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\proj.win32 VERBOSE: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include VERBOSE: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\atlmfc\include VERBOSE: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\VS\include VERBOSE: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt VERBOSE: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include VERBOSE: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE: Force includes: VERBOSE: Processing 133 cpps 133: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\AllocatorTest\AllocatorTest.cpp 132: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\BaseTest.cpp 131: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\BillBoardTest\BillBoardTest.cpp 130: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\BugsTest\Bug-12847.cpp 129: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\BugsTest\Bug-15594.cpp 128: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\BugsTest\Bug-15776.cpp 127: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\BugsTest\Bug-14327.cpp 126: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\BugsTest\Bug-CCDrawNode.cpp 125: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\BugsTest\Bug-Child.cpp 124: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\Camera3DTest\Camera3DTest.cpp 123: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\ChipmunkTest\ChipmunkTest.cpp 122: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\ClippingNodeTest\ClippingNodeTest.cpp In file included from G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\AllocatorTest\AllocatorTest.cpp:26: In file included from G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\AllocatorTest/AllocatorTest.h:28: G:\clang_power_tools\cocos2d-x-3.16\tests\cpp-tests\Classes\AllocatorTest/../BaseTest.h:28:10: fatal error: 'cocos2d.h' file not found

include "cocos2d.h"

     ^~~~~~~~~~~

1 error generated.

Got errors.

Done Clang Compile

`

mariusz102102 commented 6 years ago

It seems like include directories were not extracted from property sheets. $(EngineRoot)=G:\clang_power_tools\cocos2d-x-3.16\cocos\2d

..\Classes
G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\..\..\
G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\..\..\cocos
G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\..\..\cocos\editor-support
G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\..\..\external
G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\..\..\external\chipmunk\include
G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\..\..\external\curl\include\win32
G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\..\..\external\websockets\win32\include
G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\..\..\extensions
G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\..\..\external\bullet\include
G:\clang_power_tools\cocos2d-x-3.16\cocos\2d\..\..\external\bullet\include\bullet
%(AdditionalIncludeDirectories)
$(EngineRoot)cocos
$(EngineRoot)cocos/editor-support
$(EngineRoot)external\glfw3\include\win32
$(EngineRoot)external\win32-specific\gles\include\OGLES
$(EngineRoot)external\freetype2\include\win32\freetype2
$(EngineRoot)external\freetype2\include\win32\
$(EngineRoot)external
$(EngineRoot)external\openssl\include\win32
mariusz102102 commented 6 years ago

In attachment simplified test case.

It contains: Default console application + PropertySheet.props (18 lines only). PropertySheet has User Macros VAR=c:\temp, macro is used in AdditionalIncludeDirectories.

It seems like Macros (in my test case my $(VAR) ) are not supported for AdditionalIncludeDirectories.

Below PropertySheet.props:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros">
    <VAR>C:\temp</VAR>
  </PropertyGroup>
  <PropertyGroup />
  <ItemDefinitionGroup>
    <ClCompile>
      <AdditionalIncludeDirectories>$(VAR);G:\</AdditionalIncludeDirectories>
    </ClCompile>
  </ItemDefinitionGroup>
  <ItemGroup>
    <BuildMacro Include="VAR">
      <Value>$(VAR)</Value>
    </BuildMacro>
  </ItemGroup>
</Project>

ConsoleApplication2.zip

cpp-red-lion commented 6 years ago

Thanks for all the test data, Mariusz. We'll dig into it 👍 It was a pleasure talking with you at Meeting C++ !

We'll post here, when we have a working fix.

mariusz102102 commented 6 years ago

Victor,

Did you have a chance to work on this issue?

Regards, Mariusz

cpp-red-lion commented 6 years ago

Hi Mariusz,

My buddy Gabi @hero101111 already fixed your issue. This was part of a much bigger internal change in the engine that processes VS property-sheets. We're testing every scenario since Thursday to make sure we don't have any regressions.

A new major version 2.0 of the extension should be out soon (hopefully, today).

We'll close all the affected issues on GitHub and you'll get a notification when to update.

Thanks for your patience, Victor

hero101111 commented 6 years ago

Hi Mariusz,

We're happy to inform you that we've just released version 2.0 of Clang Power Tools. It fixes the project xml data limitations that were at the core of this issue.

Your projects should now integrate successfully with Clang Power Tools.

The Visual Studio Extension should now update automatically to v2.0. If you've disabled automatic updates you'll have to update the extension manually.

Thank you for feedback and patience.

Regards, Gabriel.

mariusz102102 commented 6 years ago

Unfortunately it does not work for me. I checked project attached to defect https://github.com/Caphyon/clang-power-tools/files/1462823/ConsoleApplication2.zip and I see below only error: 2017-11-27 22_35_40-consoleapplication2 - microsoft visual studio

hero101111 commented 6 years ago

Your sample project works just fine. Got any more info regarding your testing context?

Start Clang Compile

[ INFO ] WILL PROCESS PROJECTS: 
    ConsoleApplication2.vcxproj

[ INFO ] 1. PROCESSING PROJECT C:\Users\Gabriel\Downloads\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.vcxproj
clang++.exe: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
1: C:\Users\Gabriel\Downloads\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.cpp
C:\Users\Gabriel\Downloads\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.cpp(11): warning: array index 10 is past the end of the array (which contains 10 elements) [-Warray-bounds]
    return a[10];
           ^ ~~

C:\Users\Gabriel\Downloads\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.cpp(9): message: array 'a' declared here
        int a[10];
        ^
1
 warning generated.

Done Clang Compile
mariusz102102 commented 6 years ago

Strange.... I just reloaded project and it works... Maybe it related to randomness in https://github.com/Caphyon/clang-power-tools/issues/124