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 isOSX then 84 buildoptions { "-fsanitize=address -fno-omit-frame-pointer" } 85 else 86 buildoptions { "-fsanitize=thread -fPIE -g" } 87 linkoptions { "-fsanitize=thread -static-libtsan -pie" } 88 end 89 end 90end 91 92configuration "x64" 93if isVisualStudio then 94 buildoptions { "/wd4127" } 95else 96 buildoptions { "-std=c++11" } 97 if isPosix then 98 linkoptions { "-rdynamic" } 99 if isOSX then 100 buildoptions { "-fsanitize=address -fno-omit-frame-pointer" } 101 else 102 buildoptions { "-fsanitize=thread -fPIE -g" } 103 linkoptions { "-fsanitize=thread -static-libtsan -pie" } 104 end 105 end 106end 107 108 109-- give each configuration/platform a unique output directory 110 111for _, config in ipairs(config_list) do 112 for _, plat in ipairs(platform_list) do 113 configuration { config, plat } 114 objdir ( "Build/" .. _ACTION .. "/tmp/" .. config .. "-" .. plat ) 115 end 116end 117 118os.mkdir("./Bin") 119 120-- SUBPROJECTS 121 122 123project "UnitTest++" 124 kind "StaticLib" 125 defines { "_CRT_SECURE_NO_WARNINGS" } 126 files { 127 "TestFramework/UnitTest++/**.cpp", 128 "TestFramework/UnitTest++/**.h", 129 } 130 131if isPosix or isOSX then 132 excludes { "TestFramework/UnitTest++/Win32/**.*" } 133else 134 excludes { "TestFramework/UnitTest++/Posix/**.*" } 135end 136 137 138project "Squish" 139 kind "StaticLib" 140 defines { "_CRT_SECURE_NO_WARNINGS" } 141 files { 142 "Squish/**.*", 143 } 144 145 includedirs 146 { 147 "Squish" 148 } 149 150 151project "TaskScheduler" 152 kind "StaticLib" 153 flags {"NoPCH"} 154 files { 155 "Scheduler/**.*", 156 } 157 158 includedirs 159 { 160 "Squish", "Scheduler/Include", "TestFramework/UnitTest++" 161 } 162 163 if isPosix or isOSX then 164 excludes { "Src/Platform/Windows/**.*" } 165 else 166 excludes { "Src/Platform/Posix/**.*" } 167 end 168 169project "Tests" 170 flags {"NoPCH"} 171 kind "ConsoleApp" 172 files { 173 "Tests/**.*", 174 } 175 176 includedirs 177 { 178 "Squish", "Scheduler/Include", "TestFramework/UnitTest++" 179 } 180 181 if isPosix or isOSX then 182 excludes { "Src/Platform/Windows/**.*" } 183 else 184 excludes { "Src/Platform/Posix/**.*" } 185 end 186 187 links { 188 "UnitTest++", "Squish", "TaskScheduler" 189 } 190 191 192 if isPosix or isOSX then 193 links { "pthread" } 194 end 195 196 197 198