mudgangster

Tiny, scriptable MUD client
Log | Files | Refs | README

make.lua (1957B)


      1 require( "ggbuild.gen_ninja" )
      2 require( "ggbuild.git_version" )
      3 
      4 require( "libs.libclipboard" )
      5 require( "libs.tracy" )
      6 require( "libs.whereami" )
      7 
      8 obj_cxxflags( ".*", "-I source -I libs" )
      9 
     10 msvc_obj_cxxflags( ".*", "/W4 /wd4100 /wd4146 /wd4189 /wd4201 /wd4307 /wd4324 /wd4351 /wd4127 /wd4505 /wd4530 /wd4702 /wd4706 /D_CRT_SECURE_NO_WARNINGS" )
     11 msvc_obj_cxxflags( ".*", "/wd4244 /wd4267" ) -- silence conversion warnings because there are tons of them
     12 msvc_obj_cxxflags( ".*", "/fp:fast /GR- /EHs-c-" )
     13 
     14 gcc_obj_cxxflags( ".*", "-std=c++11 -msse3 -ffast-math -fno-exceptions -fno-rtti -fno-strict-aliasing -fno-strict-overflow -fvisibility=hidden" )
     15 gcc_obj_cxxflags( ".*", "-Wall -Wextra -Wcast-align -Wvla -Wformat-security" ) -- -Wconversion
     16 gcc_obj_cxxflags( ".*", "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-implicit-fallthrough -Wno-format-truncation" )
     17 gcc_obj_cxxflags( ".*", "-Werror=vla -Werror=format-security -Werror=unused-value" )
     18 
     19 if config ~= "release" then
     20 	obj_cxxflags( ".*", "-DTRACY_ENABLE" )
     21 end
     22 
     23 local platform_srcs, platform_libs
     24 
     25 if OS == "windows" then
     26 	require( "libs.lua" )
     27 	require( "libs.lpeg" )
     28 	require( "libs.lfs" )
     29 
     30 	platform_srcs = "src/win32.cc"
     31 	platform_libs = { "lua", "lpeg", "lfs" }
     32 else
     33 	platform_srcs = "src/x11.cc"
     34 	platform_libs = { "libclipboard" }
     35 end
     36 
     37 bin( "mudgangster", {
     38 	srcs = {
     39 		platform_srcs,
     40 		"src/ui.cc", "src/script.cc", "src/textbox.cc", "src/input.cc", "src/platform_network.cc",
     41 	},
     42 
     43 	libs = {
     44 		platform_libs,
     45 		"tracy",
     46 		"whereami"
     47 	},
     48 
     49 	rc = "src/rc",
     50 
     51 	msvc_extra_ldflags = "gdi32.lib Ws2_32.lib",
     52 	gcc_extra_ldflags = "-lm -lpthread -lX11 -lxcb -llua",
     53 } )
     54 
     55 obj_dependencies( "src/script.cc", "build/lua_combined.h" )
     56 
     57 printf( [[
     58 rule combine-lua
     59     command = $lua ggbuild/pack_lua.lua src/lua main.lua
     60     description = lua_combined.h
     61 ]] )
     62 print( "build build/lua_combined.h: combine-lua " .. table.concat( glob( "src/lua/*.lua" ), " " ) .. " | ggbuild/pack_lua.lua" )