-
-
Notifications
You must be signed in to change notification settings - Fork 644
Open
Description
I've been having some troubles getting my precompiled headers to work with premake5.
I've read the premake docs about precompiled headers and both docs about pchheader and pchsource and how they function. But I still keep getting this error.
==== Building framework (debug_x64) ====
Creating bin/x64/Debug
Creating obj/x64/Debug
stdafx.h
CameraComponent.cpp
cc1plus: error: one or more PCH files were found, but they were invalid
cc1plus: error: use -Winvalid-pch for more information
cc1plus: fatal error: obj/x64/Debug/stdafx.h: No such file or directory
compilation terminated.
framework.make:142: recipe for target 'obj/x64/Debug/CameraComponent.o' failed
make[1]: *** [obj/x64/Debug/CameraComponent.o] Error 1
Makefile:28: recipe for target 'framework' failed
make: *** [framework] Error 2
Below you can find the code. In the code I've got some project settings in a seperate lua file. such as names for the solution etc. The pch header works as intended on windows btw.
-- Solution configuration
local settings = require "project_settings"
local solution_name = settings.solution_name or "SDL2_Template"
local project_name = settings.project_name or solution_name
workspace(solution_name)
configurations{
"Debug",
"Release"
}
platforms{
"x64"
}
language "C++"
basedir(proj_dir)
location("build")
local proj_dir = settings.project_dir
project(project_name)
kind "ConsoleApp"
local p = path.getabsolute(path.join(proj_dir,"bin"))
print("Debug dir is " .. p)
includedirs{
path.join(proj_dir,"include"),
path.join(proj_dir,"3rdparty/include"),
path.join(proj_dir,"src")
}
files{
path.join(proj_dir,"src/**.cpp"),
path.join(proj_dir,"src/**.h"),
}
removefiles { "**/backup/**"}
filter "action:gmake"
pchheader("stdafx.h")
pchsource("src/stdafx.cpp")
filter "action:vs*" -- for Visual Studio actions
pchheader "stdafx.h"
pchsource(path.join(proj_dir,"src/stdafx.cpp"))
vpaths{ ["*"] = "src"}
-- general properties
filter "configurations:Debug"
symbols "on"
filter "configurations:Release"
flags{ "OptimizeSpeed","No64BitChecks"}
filter "system:windows"
local dll_hell = path.join(proj_dir, "AdditionalLibs")
local exe_hell = path.join(proj_dir,"bin")
print("Set build command to copy from ".. dll_hell .. " to " .. exe_hell)
prebuildcommands("JBT.py " .. path.join(proj_dir,"src"))
postbuildcommands{'xcopy \"'.. dll_hell .. '\" \"' .. exe_hell .. "\" /Y"}
local s = settings.win64_settings()
defines{"WINDOWS"}
links(s.links)
includedirs(s.includedirs)
libdirs(s.libdirs)
filter "system:linux"
local s = settings.linux64_settings()
links(s.links)
includedirs(s.includedirs)
libdirs(s.libdirs)
buildoptions{
"-x c++","-std=c++11","`sdl2-config --cflags --libs`"
}
sysincludedirs { "/usr/local/include/","/usr/include/" }