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 -fsanitize=address -fPIE -g -fno-omit-frame-pointer" } 95 linkoptions { "-fsanitize=address -pie" } 96 end 97 end 98end 99 100configuration "x64" 101if isVisualStudio then 102-- Compiler Warning (level 4) C4127. Conditional expression is constant 103 buildoptions { "/wd4127" } 104else 105 buildoptions { "-std=c++11" } 106 if isPosix then 107 linkoptions { "-rdynamic" } 108 if isOSX then 109 buildoptions { "-Wno-invalid-offsetof -Wno-deprecated-declarations -fno-omit-frame-pointer" } 110 --linkoptions { "-fsanitize=undefined" } 111 else 112-- defines { "MT_THREAD_SANITIZER"} 113 buildoptions { "-Wno-invalid-offsetof -fsanitize=address -fPIE -g -fno-omit-frame-pointer" } 114 linkoptions { "-fsanitize=address -pie" } 115 end 116 end 117end 118 119 120-- give each configuration/platform a unique output directory 121 122for _, config in ipairs(config_list) do 123 for _, plat in ipairs(platform_list) do 124 configuration { config, plat } 125 objdir ( "Build/" .. _ACTION .. "/tmp/" .. config .. "-" .. plat ) 126 end 127end 128 129os.mkdir("./Bin") 130 131-- SUBPROJECTS 132 133 134project "UnitTest++" 135 kind "StaticLib" 136 defines { 137 "_CRT_SECURE_NO_WARNINGS" 138 } 139 140 files { 141 "ThirdParty/UnitTest++/UnitTest++/**.cpp", 142 "ThirdParty/UnitTest++/UnitTest++/**.h", 143 } 144 145 if isPosix or isOSX then 146 excludes { "ThirdParty/UnitTest++/UnitTest++/Win32/**.*" } 147 else 148 excludes { "ThirdParty/UnitTest++/UnitTest++/Posix/**.*" } 149 end 150 151 152project "Squish" 153 kind "StaticLib" 154 defines { 155 "_CRT_SECURE_NO_WARNINGS" 156 } 157 158 files { 159 "ThirdParty/Squish/**.*", 160 } 161 162 includedirs { 163 "ThirdParty/Squish" 164 } 165 166project "TaskScheduler" 167 kind "StaticLib" 168 flags {"NoPCH"} 169 files { 170 "Scheduler/**.*", 171 "ThirdParty/Boost.Context/*.h", 172 } 173 174 includedirs { 175 "ThirdParty/Squish", "Scheduler/Include", "ThirdParty/UnitTest++/UnitTest++", "ThirdParty/Boost.Context" 176 } 177 178 if isPosix or isOSX then 179 excludes { "Src/Platform/Windows/**.*" } 180 else 181 excludes { "Src/Platform/Posix/**.*" } 182 end 183 184project "TaskSchedulerTests" 185 flags {"NoPCH"} 186 kind "ConsoleApp" 187 files { 188 "SchedulerTests/**.*", 189 } 190 191 includedirs { 192 "ThirdParty/Squish", "Scheduler/Include", "ThirdParty/UnitTest++/UnitTest++" 193 } 194 195 if isPosix or isOSX then 196 excludes { "Src/Platform/Windows/**.*" } 197 else 198 excludes { "Src/Platform/Posix/**.*" } 199 end 200 201 links { 202 "UnitTest++", "Squish", "TaskScheduler" 203 } 204 205 if isPosix or isOSX then 206 links { "pthread" } 207 end 208 209 210 211