Changeset View
Changeset View
Standalone View
Standalone View
build/premake/premake5.lua
newoption { trigger = "android", description = "Use non-working Android cross-compiling mode" } | newoption { trigger = "android", description = "Use non-working Android cross-compiling mode" } | ||||
newoption { trigger = "atlas", description = "Include Atlas scenario editor projects" } | newoption { trigger = "atlas", description = "Include Atlas scenario editor projects" } | ||||
newoption { trigger = "coverage", description = "Enable code coverage data collection (GCC only)" } | newoption { trigger = "coverage", description = "Enable code coverage data collection (GCC only)" } | ||||
newoption { trigger = "gles", description = "Use non-working OpenGL ES 2.0 mode" } | newoption { trigger = "gles", description = "Use non-working OpenGL ES 2.0 mode" } | ||||
newoption { trigger = "icc", description = "Use Intel C++ Compiler (Linux only; should use either \"--cc icc\" or --without-pch too, and then set CXX=icpc before calling make)" } | newoption { trigger = "icc", description = "Use Intel C++ Compiler (Linux only; should use either \"--cc icc\" or --without-pch too, and then set CXX=icpc before calling make)" } | ||||
newoption { trigger = "jenkins-tests", description = "Configure CxxTest to use the XmlPrinter runner which produces Jenkins-compatible output" } | newoption { trigger = "jenkins-tests", description = "Configure CxxTest to use the XmlPrinter runner which produces Jenkins-compatible output" } | ||||
newoption { trigger = "minimal-flags", description = "Only set compiler/linker flags that are really needed. Has no effect on Windows builds" } | newoption { trigger = "minimal-flags", description = "Only set compiler/linker flags that are really needed. Has no effect on Windows builds" } | ||||
newoption { trigger = "outpath", description = "Location for generated project files" } | newoption { trigger = "outpath", description = "Location for generated project files" } | ||||
newoption { trigger = "with-system-mozjs45", description = "Search standard paths for libmozjs45, instead of using bundled copy" } | newoption { trigger = "with-system-mozjs45", description = "Search standard paths for libmozjs45, instead of using bundled copy" } | ||||
newoption { trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" } | newoption { trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" } | ||||
newoption { trigger = "without-audio", description = "Disable use of OpenAL/Ogg/Vorbis APIs" } | newoption { trigger = "without-audio", description = "Disable use of OpenAL/Ogg/Vorbis APIs" } | ||||
newoption { trigger = "without-lobby", description = "Disable the use of gloox and the multiplayer lobby" } | newoption { trigger = "without-lobby", description = "Disable the use of gloox and the multiplayer lobby" } | ||||
newoption { trigger = "without-miniupnpc", description = "Disable use of miniupnpc for port forwarding" } | newoption { trigger = "without-miniupnpc", description = "Disable use of miniupnpc for port forwarding" } | ||||
newoption { trigger = "without-nvtt", description = "Disable use of NVTT" } | newoption { trigger = "without-nvtt", description = "Disable use of NVTT" } | ||||
newoption { trigger = "without-pch", description = "Disable generation and usage of precompiled headers" } | newoption { trigger = "without-pch", description = "Disable generation and usage of precompiled headers" } | ||||
newoption { trigger = "with-rlinterface", description = "Enable RPC interface for reinforcement learning" } | |||||
newoption { trigger = "without-tests", description = "Disable generation of test projects" } | newoption { trigger = "without-tests", description = "Disable generation of test projects" } | ||||
-- Linux/BSD specific options | -- Linux/BSD specific options | ||||
newoption { trigger = "prefer-local-libs", description = "Prefer locally built libs. Any local libraries used must also be listed within a file within /etc/ld.so.conf.d so the dynamic linker can find them at runtime." } | newoption { trigger = "prefer-local-libs", description = "Prefer locally built libs. Any local libraries used must also be listed within a file within /etc/ld.so.conf.d so the dynamic linker can find them at runtime." } | ||||
-- OS X specific options | -- OS X specific options | ||||
newoption { trigger = "macosx-bundle", description = "Enable OSX bundle, the argument is the bundle identifier string (e.g. com.wildfiregames.0ad)" } | newoption { trigger = "macosx-bundle", description = "Enable OSX bundle, the argument is the bundle identifier string (e.g. com.wildfiregames.0ad)" } | ||||
newoption { trigger = "macosx-version-min", description = "Set minimum required version of the OS X API, the build will possibly fail if an older SDK is used, while newer API functions will be weakly linked (i.e. resolved at runtime)" } | newoption { trigger = "macosx-version-min", description = "Set minimum required version of the OS X API, the build will possibly fail if an older SDK is used, while newer API functions will be weakly linked (i.e. resolved at runtime)" } | ||||
newoption { trigger = "sysroot", description = "Set compiler system root path, used for building against a non-system SDK. For example /usr/local becomes SYSROOT/user/local" } | newoption { trigger = "sysroot", description = "Set compiler system root path, used for building against a non-system SDK. For example /usr/local becomes SYSROOT/user/local" } | ||||
-- Windows specific options | -- Windows specific options | ||||
newoption { trigger = "build-shared-glooxwrapper", description = "Rebuild glooxwrapper DLL for Windows. Requires the same compiler version that gloox was built with" } | newoption { trigger = "build-shared-glooxwrapper", description = "Rebuild glooxwrapper DLL for Windows. Requires the same compiler version that gloox was built with" } | ||||
newoption { trigger = "use-shared-glooxwrapper", description = "Use prebuilt glooxwrapper DLL for Windows" } | newoption { trigger = "use-shared-glooxwrapper", description = "Use prebuilt glooxwrapper DLL for Windows" } | ||||
newoption { trigger = "large-address-aware", description = "Make the executable large address aware. Do not use for development, in order to spot memory issues easily" } | newoption { trigger = "large-address-aware", description = "Make the executable large address aware. Do not use for development, in order to spot memory issues easily" } | ||||
-- Install options | -- Install options | ||||
newoption { trigger = "bindir", description = "Directory for executables (typically '/usr/games'); default is to be relocatable" } | newoption { trigger = "bindir", description = "Directory for executables (typically '/usr/games'); default is to be relocatable" } | ||||
newoption { trigger = "datadir", description = "Directory for data files (typically '/usr/share/games/0ad'); default is ../data/ relative to executable" } | newoption { trigger = "datadir", description = "Directory for data files (typically '/usr/share/games/0ad'); default is ../data/ relative to executable" } | ||||
newoption { trigger = "libdir", description = "Directory for libraries (typically '/usr/lib/games/0ad'); default is ./ relative to executable" } | newoption { trigger = "libdir", description = "Directory for libraries (typically '/usr/lib/games/0ad'); default is ./ relative to executable" } | ||||
-- Root directory of project checkout relative to this .lua file | -- Root directory of project checkout relative to this .lua file | ||||
rootdir = "../.." | rootdir = "../.." | ||||
if _OPTIONS["with-rlinterface"] then | |||||
if os.istarget("windows") then | |||||
Stan: Do you need me to translate the below shell commands in windows bash ? | |||||
Done Inline ActionsYeah, that would be awesome and help me out a lot :) Essentially, I am running the protobuf compiler (protoc) using the C++ plugin and then changing the file extensions from .cc to .cpp so they are detected during the build. Generating the python files is probably not necessary but it would be nice if it would also work on windows (they are only necessary for building the python client). For the python files, I copy the .proto file to the python project and then build it using python's grpc_tools.protoc. irishninja: Yeah, that would be awesome and help me out a lot :)
Essentially, I am running the protobuf… | |||||
error("The RL interface is current not supported on Windows.") | |||||
else | |||||
-- Generate cpp files | |||||
protodir = rootdir .. "/source/rlinterface/proto/" | |||||
gencppfiles = "protoc --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` RLAPI.proto && protoc --cpp_out=. RLAPI.proto" | |||||
updatefilenames = "mv RLAPI.pb.{cc,cpp} && mv RLAPI.grpc.pb.{cc,cpp}" | |||||
os.execute("cd " .. protodir .. " && " .. gencppfiles .. " && " .. updatefilenames) | |||||
-- Generate python files | |||||
clientsdir = rootdir .. "/source/tools/clients/" | |||||
preparepython = "mkdir -p source/tools/clients/python/zero_ad/proto/zero_ad && cp source/rlinterface/proto/RLAPI.proto source/tools/clients/python/zero_ad" | |||||
genpythonfiles = "python -m grpc_tools.protoc --python_out=python --grpc_python_out=python -Ipython python/zero_ad/RLAPI.proto" | |||||
os.execute("cd " .. rootdir .. " && " .. preparepython) | |||||
_, _, exitcode = os.execute("cd " .. clientsdir .. " && " .. genpythonfiles) | |||||
if exitcode > 0 then | |||||
error("Unable to generate GRPC files for Python client. Is grpcio-tools installed?") | |||||
end | |||||
end | |||||
end | |||||
dofile("extern_libs5.lua") | dofile("extern_libs5.lua") | ||||
-- detect compiler for non-Windows | -- detect compiler for non-Windows | ||||
if os.istarget("macosx") then | if os.istarget("macosx") then | ||||
cc = "clang" | cc = "clang" | ||||
elseif os.istarget("linux") and _OPTIONS["icc"] then | elseif os.istarget("linux") and _OPTIONS["icc"] then | ||||
cc = "icc" | cc = "icc" | ||||
elseif not os.istarget("windows") then | elseif not os.istarget("windows") then | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | function project_set_build_flags() | ||||
if _OPTIONS["without-audio"] then | if _OPTIONS["without-audio"] then | ||||
defines { "CONFIG2_AUDIO=0" } | defines { "CONFIG2_AUDIO=0" } | ||||
end | end | ||||
if _OPTIONS["without-nvtt"] then | if _OPTIONS["without-nvtt"] then | ||||
defines { "CONFIG2_NVTT=0" } | defines { "CONFIG2_NVTT=0" } | ||||
end | end | ||||
if _OPTIONS["with-rlinterface"] then | |||||
defines { "WITH_RLINTERFACE=1" } | |||||
else | |||||
defines { "WITH_RLINTERFACE=0" } | |||||
end | |||||
if _OPTIONS["without-lobby"] then | if _OPTIONS["without-lobby"] then | ||||
defines { "CONFIG2_LOBBY=0" } | defines { "CONFIG2_LOBBY=0" } | ||||
end | end | ||||
if _OPTIONS["without-miniupnpc"] then | if _OPTIONS["without-miniupnpc"] then | ||||
defines { "CONFIG2_MINIUPNPC=0" } | defines { "CONFIG2_MINIUPNPC=0" } | ||||
end | end | ||||
▲ Show 20 Lines • Show All 391 Lines • ▼ Show 20 Lines | extern_libs = { | ||||
"enet", | "enet", | ||||
"boost", -- dragged in via server->simulation.h->random | "boost", -- dragged in via server->simulation.h->random | ||||
} | } | ||||
if not _OPTIONS["without-miniupnpc"] then | if not _OPTIONS["without-miniupnpc"] then | ||||
table.insert(extern_libs, "miniupnpc") | table.insert(extern_libs, "miniupnpc") | ||||
end | end | ||||
setup_static_lib_project("network", source_dirs, extern_libs, {}) | setup_static_lib_project("network", source_dirs, extern_libs, {}) | ||||
if _OPTIONS["with-rlinterface"] then | |||||
source_dirs = { | |||||
"rlinterface", | |||||
"rlinterface/proto" | |||||
} | |||||
extern_libs = { | |||||
"boost", | |||||
Done Inline ActionsDo you need the SDL2 ? Also indent :) Stan: Do you need the SDL2 ? Also indent :) | |||||
"spidermonkey", | |||||
"sdl", -- key definitions | |||||
"grpc", | |||||
} | |||||
setup_static_lib_project("rlinterface", source_dirs, extern_libs, { no_pch = 1 }) | |||||
end | |||||
source_dirs = { | source_dirs = { | ||||
Done Inline ActionsIndentation seems wrong wraitii: Indentation seems wrong | |||||
"third_party/tinygettext/src", | "third_party/tinygettext/src", | ||||
} | } | ||||
extern_libs = { | extern_libs = { | ||||
"iconv", | "iconv", | ||||
"boost", | "boost", | ||||
} | } | ||||
setup_third_party_static_lib_project("tinygettext", source_dirs, extern_libs, { } ) | setup_third_party_static_lib_project("tinygettext", source_dirs, extern_libs, { } ) | ||||
▲ Show 20 Lines • Show All 337 Lines • ▼ Show 20 Lines | |||||
if not _OPTIONS["without-lobby"] then | if not _OPTIONS["without-lobby"] then | ||||
table.insert(used_extern_libs, "gloox") | table.insert(used_extern_libs, "gloox") | ||||
end | end | ||||
if not _OPTIONS["without-miniupnpc"] then | if not _OPTIONS["without-miniupnpc"] then | ||||
table.insert(used_extern_libs, "miniupnpc") | table.insert(used_extern_libs, "miniupnpc") | ||||
end | end | ||||
if _OPTIONS["with-rlinterface"] then | |||||
table.insert(used_extern_libs, "grpc") | |||||
end | |||||
-- Bundles static libs together with main.cpp and builds game executable. | -- Bundles static libs together with main.cpp and builds game executable. | ||||
function setup_main_exe () | function setup_main_exe () | ||||
local target_type = get_main_project_target_type() | local target_type = get_main_project_target_type() | ||||
project_create("pyrogenesis", target_type) | project_create("pyrogenesis", target_type) | ||||
filter "system:not macosx" | filter "system:not macosx" | ||||
linkgroups 'On' | linkgroups 'On' | ||||
▲ Show 20 Lines • Show All 498 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Do you need me to translate the below shell commands in windows bash ?