1if not _ACTION then 2 _ACTION="vs2010" 3end 4 5isPosix = false 6isVisualStudio = false 7isOSX = false 8 9if _ACTION == "vs2002" or _ACTION == "vs2003" or _ACTION == "vs2005" or _ACTION == "vs2008" or _ACTION == "vs2010" then 10 isVisualStudio = true 11end 12 13if _ACTION == "codeblocks" or _ACTION == "gmake" 14then 15 isPosix = true 16end 17 18if _ACTION == "xcode3" or os.is("macosx") 19then 20 isOSX = true 21end 22 23 24 25solution "TaskScheduler" 26 27 language "C++" 28 29 location ( "Build/" .. _ACTION ) 30 flags {"NoManifest", "ExtraWarnings", "StaticRuntime", "NoMinimalRebuild", "FloatFast", "EnableSSE2" } 31 optimization_flags = { "OptimizeSpeed" } 32 targetdir("Bin") 33 34if isPosix or isOSX then 35 defines { "_XOPEN_SOURCE=600" } 36end 37 38if isVisualStudio then 39 debugdir ("Bin") 40end 41 42 43 local config_list = { 44 "Release", 45 "Debug", 46 "Instrumented_Release", 47 "Instrumented_Debug" 48 } 49 local platform_list = { 50 "x32", 51 "x64" 52 } 53 54 configurations(config_list) 55 platforms(platform_list) 56 57 58-- CONFIGURATIONS 59 60configuration "Instrumented_Release" 61 defines { "NDEBUG", "MT_INSTRUMENTED_BUILD", "MT_UNICODE" } 62 flags { "Symbols", optimization_flags } 63 64configuration "Instrumented_Debug" 65 defines { "_DEBUG", "_CRTDBG_MAP_ALLOC", "MT_INSTRUMENTED_BUILD", "MT_UNICODE" } 66 flags { "Symbols" } 67 68configuration "Release" 69 defines { "NDEBUG", "MT_UNICODE" } 70 flags { "Symbols", optimization_flags } 71 72configuration "Debug" 73 defines { "_DEBUG", "_CRTDBG_MAP_ALLOC", "MT_UNICODE"} 74 flags { "Symbols" } 75 76configuration "x32" 77if isVisualStudio then 78 buildoptions { "/wd4127" } 79else 80 buildoptions { "-std=c++11" } 81 if isPosix then 82 linkoptions { "-rdynamic" } 83 if not isOSX then 84 buildoptions { "-fsanitize=thread -fPIE -g" } 85 linkoptions { "-fsanitize=thread -static-libtsan -pie" } 86 end 87 end 88end 89 90configuration "x64" 91if isVisualStudio then 92 buildoptions { "/wd4127" } 93else 94 buildoptions { "-std=c++11" } 95 if isPosix then 96 linkoptions { "-rdynamic" } 97 if not isOSX then 98 buildoptions { "-fsanitize=thread -fPIE -g" } 99 linkoptions { "-fsanitize=thread -static-libtsan -pie" } 100 end 101 end 102end 103 104 105-- give each configuration/platform a unique output directory 106 107for _, config in ipairs(config_list) do 108 for _, plat in ipairs(platform_list) do 109 configuration { config, plat } 110 objdir ( "Build/" .. _ACTION .. "/tmp/" .. config .. "-" .. plat ) 111 end 112end 113 114os.mkdir("./Bin") 115 116-- SUBPROJECTS 117 118 119project "UnitTest++" 120 kind "StaticLib" 121 defines { "_CRT_SECURE_NO_WARNINGS" } 122 files { 123 "TestFramework/UnitTest++/**.cpp", 124 "TestFramework/UnitTest++/**.h", 125 } 126 127if isPosix or isOSX then 128 excludes { "TestFramework/UnitTest++/Win32/**.*" } 129else 130 excludes { "TestFramework/UnitTest++/Posix/**.*" } 131end 132 133 134project "Squish" 135 kind "StaticLib" 136 defines { "_CRT_SECURE_NO_WARNINGS" } 137 files { 138 "Squish/**.*", 139 } 140 141 includedirs 142 { 143 "Squish" 144 } 145 146 147project "TaskScheduler" 148 kind "StaticLib" 149 flags {"NoPCH"} 150 files { 151 "Scheduler/**.*", 152 } 153 154 includedirs 155 { 156 "Squish", "Scheduler/Include", "TestFramework/UnitTest++" 157 } 158 159 if isPosix or isOSX then 160 excludes { "Src/Platform/Windows/**.*" } 161 else 162 excludes { "Src/Platform/Posix/**.*" } 163 end 164 165project "Tests" 166 flags {"NoPCH"} 167 kind "ConsoleApp" 168 files { 169 "Tests/**.*", 170 } 171 172 includedirs 173 { 174 "Squish", "Scheduler/Include", "TestFramework/UnitTest++" 175 } 176 177 if isPosix or isOSX then 178 excludes { "Src/Platform/Windows/**.*" } 179 else 180 excludes { "Src/Platform/Posix/**.*" } 181 end 182 183 links { 184 "UnitTest++", "Squish", "TaskScheduler" 185 } 186 187 188 if isPosix or isOSX then 189 links { "pthread" } 190 end 191 192 193 194