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 isOSX then 39 defines { "_DARWIN_C_SOURCE=1" } 40end 41 42 43if isVisualStudio then 44 debugdir ("Bin") 45end 46 47 48 local config_list = { 49 "Release", 50 "Debug", 51 "Instrumented_Release", 52 "Instrumented_Debug" 53 } 54 local platform_list = { 55 "x32", 56 "x64" 57 } 58 59 configurations(config_list) 60 platforms(platform_list) 61 62 63-- CONFIGURATIONS 64 65configuration "Instrumented_Release" 66 defines { "NDEBUG", "MT_INSTRUMENTED_BUILD", "MT_UNICODE" } 67 flags { "Symbols", optimization_flags } 68 69configuration "Instrumented_Debug" 70 defines { "_DEBUG", "_CRTDBG_MAP_ALLOC", "MT_INSTRUMENTED_BUILD", "MT_UNICODE" } 71 flags { "Symbols" } 72 73configuration "Release" 74 defines { "NDEBUG", "MT_UNICODE" } 75 flags { "Symbols", optimization_flags } 76 77configuration "Debug" 78 defines { "_DEBUG", "_CRTDBG_MAP_ALLOC", "MT_UNICODE"} 79 flags { "Symbols" } 80 81configuration "x32" 82if isVisualStudio then 83-- Compiler Warning (level 4) C4127. Conditional expression is constant 84 buildoptions { "/wd4127" } 85else 86 buildoptions { "-std=c++11" } 87 if isPosix then 88 linkoptions { "-rdynamic" } 89 if isOSX then 90 buildoptions { "-Wno-invalid-offsetof -Wno-deprecated-declarations -fno-omit-frame-pointer" } 91 --linkoptions { "-fsanitize=undefined" } 92 else 93-- defines { "MT_THREAD_SANITIZER"} 94 buildoptions { "-Wno-invalid-offsetof -fPIE -g -fno-omit-frame-pointer" } 95-- buildoptions { "-Wno-invalid-offsetof -fsanitize=address -fPIE -g -fno-omit-frame-pointer" } 96-- linkoptions { "-fsanitize=address -pie" } 97 end 98 end 99end 100 101configuration "x64" 102if isVisualStudio then 103-- Compiler Warning (level 4) C4127. Conditional expression is constant 104 buildoptions { "/wd4127" } 105else 106 buildoptions { "-std=c++11" } 107 if isPosix then 108 linkoptions { "-rdynamic" } 109 if isOSX then 110 buildoptions { "-Wno-invalid-offsetof -Wno-deprecated-declarations -fno-omit-frame-pointer" } 111 --linkoptions { "-fsanitize=undefined" } 112 else 113-- defines { "MT_THREAD_SANITIZER"} 114 buildoptions { "-Wno-invalid-offsetof -fsanitize=address -fPIE -g -fno-omit-frame-pointer" } 115 linkoptions { "-fsanitize=address -pie" } 116 end 117 end 118end 119 120 121-- give each configuration/platform a unique output directory 122 123for _, config in ipairs(config_list) do 124 for _, plat in ipairs(platform_list) do 125 configuration { config, plat } 126 objdir ( "Build/" .. _ACTION .. "/tmp/" .. config .. "-" .. plat ) 127 end 128end 129 130os.mkdir("./Bin") 131 132-- SUBPROJECTS 133 134 135project "UnitTest++" 136 kind "StaticLib" 137 defines { 138 "_CRT_SECURE_NO_WARNINGS" 139 } 140 141 files { 142 "ThirdParty/UnitTest++/UnitTest++/**.cpp", 143 "ThirdParty/UnitTest++/UnitTest++/**.h", 144 } 145 146 if isPosix or isOSX then 147 excludes { "ThirdParty/UnitTest++/UnitTest++/Win32/**.*" } 148 else 149 excludes { "ThirdParty/UnitTest++/UnitTest++/Posix/**.*" } 150 end 151 152 153project "Squish" 154 kind "StaticLib" 155 defines { 156 "_CRT_SECURE_NO_WARNINGS" 157 } 158 159 files { 160 "ThirdParty/Squish/**.*", 161 } 162 163 includedirs { 164 "ThirdParty/Squish" 165 } 166 167project "TaskScheduler" 168 kind "StaticLib" 169 flags {"NoPCH"} 170 files { 171 "Scheduler/**.*", 172 "ThirdParty/Boost.Context/*.h", 173 } 174 175 includedirs { 176 "ThirdParty/Squish", "Scheduler/Include", "ThirdParty/UnitTest++/UnitTest++", "ThirdParty/Boost.Context" 177 } 178 179 if isPosix or isOSX then 180 excludes { "Src/Platform/Windows/**.*" } 181 else 182 excludes { "Src/Platform/Posix/**.*" } 183 end 184 185project "TaskSchedulerTests" 186 flags {"NoPCH"} 187 kind "ConsoleApp" 188 files { 189 "SchedulerTests/**.*", 190 } 191 192 includedirs { 193 "ThirdParty/Squish", "Scheduler/Include", "ThirdParty/UnitTest++/UnitTest++" 194 } 195 196 if isPosix or isOSX then 197 excludes { "Src/Platform/Windows/**.*" } 198 else 199 excludes { "Src/Platform/Posix/**.*" } 200 end 201 202 links { 203 "UnitTest++", "Squish", "TaskScheduler" 204 } 205 206 if isPosix or isOSX then 207 links { "pthread" } 208 end 209 210 211 212