premake - premake5 precompiled headers not working -


(this using premake5 alpha binary available download on website)

i'm trying port existing vs solution on using premake5.

it uses ms style precompiled headers(stdafx.h/stdafx.cpp).

when specify test project:

pchheader "stdafx.h" pchsource "stdafx.cpp" 

it set project using precompiled headers, not setting stdafx.cpp generate precompiled headers(/yc). instead files in project trying use(/yu) , nobody generating pch. not build..

i'm guessing works somehow, black magic missing here?

here entire premake5 file reference

-- premake5.lua  solution "cloud"     configurations { "debug", "release", "final" }     platforms { "win32_avx2", "win64_avx2"}     location "premake"       flags{"multiprocessorcompile", "extrawarnings", "fatalcompilewarnings", "fatallinkwarnings", "floatfast"}    startproject "cloud"  vectorextensions "avx2"    filter { "platforms:win32" }  	system "windows"  	architecture "x32"  filter { "platforms:win64" }  	system "windows"  	architecture "x64"  	  filter "configurations:debug"      defines { "debug" }      flags { "symbols" }  filter "configurations:release"      defines { "ndebug" }  	flags{"symbols"}      optimize "speed"  filter "configurations:final"      defines { "ndebug" }  	flags{"linktimeoptimization"}      optimize "speed"  	  group "app"    --primary executable	  project "cloud"  	location "../src_test/cloud"  	kind "consoleapp"  	language "c++"  	targetdir "..//%{cfg.buildcfg}"  	pchheader "stdafx.h"  	pchsource "stdafx.cpp"  	vpaths{  		{["src/pch/*"] = "../src_test/cloud/stdafx.*"},  		{["src/*"] = "../src_test/cloud/**.cpp"},  		{["module/*"] = "../src_test/cloud/module*.h"},  		{["core/*"] = "../src_test/cloud/core*.h"},  		{["headers*"] = "../src_test/cloud/*.h"},  		--{["src_c/*"] = "../src_test/cloud/**.c"}  	}  	files { "../src_test/cloud/*.h", "../src_test/cloud/*.c", "../src_test/cloud/*.cpp", "../src_test/cloud/*.hpp" }	

one related question: how disable precompiled header usage on specific files within project? of files not build if pch included, have manually disabled them in existing solution/projects.

thanks!

it's because pchsource requires file path (like files) since stdafx.cpp not in same directory script, premake not find it. try using pchsource "../src_test/cloud/stdafxcpp" instead, should fix problem.

also see don't add "../src_test/cloud/" include directory, means pch header included using relative path, right ? if so, you'll need update pchheader reflect that. due way visual studio works, need set pchheader appears in cpp files. e.g. if in cpp files have #include "../src_test/cloud/stdafx.h" need use in premake: pchheader "../src_test/cloud/stdafx.h".

and finally, deactivate precompiled headers on files, can use filters:

-- deactivate precompiled headers c files filter "files:**.c"     flags { "nopch" } 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -