premake4.lua 3.68 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
function setTargetObjDir(outDir)
	for _, cfg in ipairs(configurations()) do
		for _, plat in ipairs(platforms()) do
			local action = _ACTION or ""
			
			local prj = project()
			
			--"_debug_win32_vs2008"
			local suffix = "_" .. cfg .. "_" .. plat .. "_" .. action
			
			targetPath = outDir
			
			suffix = string.lower(suffix)

			local obj_path = "../intermediate/" .. cfg .. "/" .. action .. "/" .. prj.name
			
			obj_path = string.lower(obj_path)
			
			configuration {cfg, plat}
				targetdir(targetPath)
				objdir(obj_path)
				targetsuffix(suffix)
		end
	end
end

function linkLib(libBaseName)
	for _, cfg in ipairs(configurations()) do
		for _, plat in ipairs(platforms()) do
			local action = _ACTION or ""
			
			local prj = project()
			
			local cfgName = cfg
			
			--"_debug_win32_vs2008"
			local suffix = "_" .. cfgName .. "_" .. plat .. "_" .. action
			
			libFullName = libBaseName .. string.lower(suffix)
			
			configuration {cfg, plat}
				links(libFullName)
		end
	end
end

solution "test"
	configurations { "debug", "release" }
	platforms { "x32", "x64" }

	location ("./" .. (_ACTION or ""))
	language "C++"
53
	flags { "ExtraWarnings" }
54 55 56 57 58 59 60 61 62 63 64 65 66
	
	configuration "debug"
		defines { "DEBUG" }
		flags { "Symbols" }

	configuration "release"
		defines { "NDEBUG" }
		flags { "Optimize" }

	configuration "vs*"
		defines { "_CRT_SECURE_NO_WARNINGS" }
		
	configuration "gmake"
67
		buildoptions "-msse4.2 -Werror=cast-qual"
68 69 70

	project "gtest"
		kind "StaticLib"
71 72 73
		
		defines { "GTEST_HAS_PTHREAD=0" }

74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
		files { 
			"../thirdparty/gtest/src/gtest-all.cc",
			"../thirdparty/gtest/src/**.h",
		}

		includedirs {
			"../thirdparty/gtest/",
			"../thirdparty/gtest/include",
		}

		setTargetObjDir("../thirdparty/lib")

	project "unittest"
		kind "ConsoleApp"
		
		files { 
			"../include/**.h",
			"../test/unittest/**.cpp",
			"../test/unittest/**.h",
		}
		
		includedirs {
			"../include/",
			"../thirdparty/gtest/include/",
		}

		libdirs "../thirdparty/lib"

		setTargetObjDir("../bin")

		linkLib "gtest"
		links "gtest"
		
	project "perftest"
		kind "ConsoleApp"
		
		files { 
			"../include/**.h",
			"../test/perftest/**.cpp",
			"../test/perftest/**.c",
			"../test/perftest/**.h",
		}
		
		includedirs {
			"../include/",
			"../thirdparty/gtest/include/",
			"../thirdparty/",
			"../thirdparty/jsoncpp/include/",
			"../thirdparty/libjson/",
			"../thirdparty/yajl/include/",
		}

		libdirs "../thirdparty/lib"

		setTargetObjDir("../bin")

		linkLib "gtest"
		links "gtest"

solution "example"
	configurations { "debug", "release" }
	platforms { "x32", "x64" }
	location ("./" .. (_ACTION or ""))
	language "C++"
138
	flags { "ExtraWarnings" }
139 140 141 142 143 144 145 146 147 148 149 150 151
	includedirs "../include/"

	configuration "debug"
		defines { "DEBUG" }
		flags { "Symbols" }

	configuration "release"
		defines { "NDEBUG" }
		flags { "Optimize", "EnableSSE2" }

	configuration "vs*"
		defines { "_CRT_SECURE_NO_WARNINGS" }

152 153
--	configuration "gmake"
-- 		buildoptions "-Weverything"
154

155 156 157 158 159 160 161 162 163 164
	project "condense"
		kind "ConsoleApp"
		files "../example/condense/*"
		setTargetObjDir("../bin")

	project "pretty"
		kind "ConsoleApp"
		files "../example/pretty/*"
		setTargetObjDir("../bin")

165 166 167 168 169
	project "prettyauto"
		kind "ConsoleApp"
		files "../example/prettyauto/*"
		setTargetObjDir("../bin")

170 171 172 173 174 175 176 177 178
	project "tutorial"
		kind "ConsoleApp"
		files "../example/tutorial/*"
		setTargetObjDir("../bin")

	project "serialize"
		kind "ConsoleApp"
		files "../example/serialize/*"
		setTargetObjDir("../bin")
179 180 181 182 183

	project "simpledom"
		kind "ConsoleApp"
		files "../example/simpledom/*"
		setTargetObjDir("../bin")