Hi All.This is the first time I am trying to use Gradle to see if it matches our needs.We are building C++ libs on Win.MSVC120 64bit.Now,we have tried to build a lib which builds fine via VisualStudio.But setting the same compiler options using Gradle we are getting a compilation error for a method where we reinterpret cast of function pointer:
error C2664: ‘void gluTessCallback(GLUtesselator *,GLenum,void (__stdcall *)(void))’ : cannot convert argument 3 from ‘GLvoid (__cdecl *)(void)’ to ‘void (__stdcall *)(void)’
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
The strange thing here is that in the code we do use reinterpret_cast<>() method so it is not clear why that error persists.It also compiles fine using the same toolchain via MSVC.And therefore I wonder if it has something to do with Gradle itself,or something wrong with our settings.
Here is the gradle.build
apply plugin: ‘c’
apply plugin: ‘cpp’
model{
/* Toolchain */
toolChains{
visualCpp(VisualCpp){
installDir "C:/Program Files (x86)/Microsoft Visual Studio 12.0"
}
}
/* Platforms */
platforms {
x64 {
architecture "x86_64"
}
}
/* Build types */
buildTypes {
debug
release
}
components {
MyLib(NativeLibrarySpec){
binaries.all {
cppCompiler.args '/TP','/WX-','/GS','/W3', '/Gd','/MDd','/RTC1','/EHsc','/fp:precise','/errorReport:prompt','/Zc:forScope','/Zc:wchar_t','/DWIN32','/D_CRT_SECURE_NO_WARNINGS','/D_LIB' ,'/DUNICODE' ,'/D_UNICODE'
}
sources {
cpp {
source {
srcDir "MyLib/src/"
exclude "**/*.xml"
exclude "**/*.txt"
exclude "**/*.vcxproj"
exclude "**/*.directory"
exclude "**/*.vcxproj.user"
exclude "**/*.vcxproj.filters"
}
exportedHeaders {
srcDir "C:/Program Files (x86)/Windows Kits/8.1/Include"
srcDir "ThirdParty/glm-0.9.7.0/glm"
srcDir "ThirdParty/boost_1_58"
srcDir "MyLib/include"
srcDir "ThirdParty/glew-1.10.0/include"
}
}
}
}
}
}
Appreciate any help here.Thanks!