medfall

A super great game engine
Log | Files | Refs

commit 75d2713a9ef04d25ed8cd3b4b86771c87737be73
parent f4d1f5b0044179b63ef45587b76ad1f772ff1326
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Jun 25 14:18:19 +0300

Build the server on OpenBSD

Diffstat:
make.lua | 10++++++++--
scripts/gen_makefile.lua | 27+++++++++++++++++++--------
2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/make.lua b/make.lua @@ -4,6 +4,14 @@ local common_objs = { "memory_arena", "log", "ggformat", "strlcpy", "strlcat", " local game_objs = { "work_queue", "renderer", "shaders", "gl", "glad", "immediate", "text_renderer", "obj", common_objs } local game_libs = { "glfw", "stb_truetype", "tinyobjloader" } +if OS ~= "windows" then + bin( "srv", { "server/main", common_objs } ) +end + +if OS == "openbsd" then + return +end + bin( "medfall", { "main", "hm", "heightmap", "terrain_manager", "btt", "gpubtt", "skybox", "http", game_objs }, { "lz4", game_libs } ) msvc_bin_ldflags( "medfall", "opengl32.lib gdi32.lib Ws2_32.lib" ) gcc_bin_ldflags( "medfall", "-lX11 -lXrandr -lXinerama -lXcursor" ) @@ -43,8 +51,6 @@ msvc_bin_ldflags( "sound", "ole32.lib" ) bin( "pp", { "pp", "heightmap", common_objs }, { "lz4", "squish", "stb_image" } ) if OS ~= "windows" then - bin( "srv", { "server/main", common_objs } ) - bin( "utils/genkeys/genkeys", { "utils/genkeys/genkeys", common_objs }, { "monocypher" } ) bin( "utils/genkeys/sign", { "utils/genkeys/sign", common_objs }, { "monocypher" } ) diff --git a/scripts/gen_makefile.lua b/scripts/gen_makefile.lua @@ -29,6 +29,7 @@ local configs = { lib_suffix = ".a", toolchain = "gcc", + cxx = "g++", cxxflags = "-I . -c -x c++ -std=c++11 -msse2 -ffast-math -fno-exceptions -fno-rtti -fno-strict-aliasing -fno-strict-overflow -D_USE_MATH_DEFINES", ldflags = "-lm -lpthread -ldl", @@ -55,6 +56,14 @@ local configs = { -- TODO: OSX } +configs[ "openbsd" ] = configs[ "linux" ] +configs[ "openbsd-debug" ] = configs[ "linux-debug" ] +configs[ "openbsd-release" ] = { + ldflags = "-lm -lpthread -s", + cxxflags = configs.openbsd.cxxflags .. " -O2", + cxx = "eg++", +} + local function identify_host() local dll_ext = package.cpath:match( "(%a+)$" ) @@ -206,7 +215,7 @@ printf( "" ) printf( "all: $(BINS)" ) printf( "" ) -if OS == "windows" then +if toolchain == "msvc" then printf( [[ VC = ${ProgramFiles(x86)}\Microsoft Visual Studio 14.0\VC @@ -244,26 +253,28 @@ printf( [[ @lib -OUT:$@ $^ ]], lib_suffix ) -else +elseif toolchain == "gcc" then + +local cxx = rightmost( "cxx" ) printf( [[ $(BINS): %%: @env printf "\e[1;31mbuilding $@\e[0m\n" @mkdir -p "$(@D)" - @$(CXX) -o $@ $^ $(LDFLAGS) -]] ) + @%s -o $@ $^ $(LDFLAGS) +]], cxx ) printf( [[ %s/%%%s: %%.cc @env printf "\e[1;32mbuilding $<\e[0m\n" @mkdir -p "$(@D)" - @$(CXX) $(CXXFLAGS) -o $@ $< -MMD -MP -]], dir, obj_suffix ) + @%s $(CXXFLAGS) -o $@ $< -MMD -MP +]], dir, obj_suffix, cxx ) printf( [[ $(OBJS): %%: @env printf "\e[1;32mbuilding $<\e[0m\n" @mkdir -p "$(@D)" - @$(CXX) $(CXXFLAGS) -o $@ $< -MMD -MP -]] ) + @%s $(CXXFLAGS) -o $@ $< -MMD -MP +]], cxx ) printf( [[ %%%s: @env printf "\e[1;35mbuilding $@\e[0m\n"