2020-07-24 17:38:25 +02:00
|
|
|
-- premake5.lua
|
|
|
|
|
2021-06-09 20:39:14 +02:00
|
|
|
require "premake_modules/usage"
|
2021-06-21 12:35:59 +02:00
|
|
|
require "premake_modules/emscripten"
|
|
|
|
|
|
|
|
------------------------------------------
|
|
|
|
|
|
|
|
newoption {
|
|
|
|
trigger = "raspberry-pi",
|
|
|
|
description = "adds specific define for compiling on Raspberry Pi"
|
|
|
|
}
|
|
|
|
|
|
|
|
table.insert(premake.option.get("os").allowed, { "emscripten", "Emscripten" })
|
|
|
|
|
|
|
|
------------------------------------------
|
2020-10-01 19:15:33 +02:00
|
|
|
|
2020-07-24 18:15:59 +02:00
|
|
|
-- you can redefine dependencies
|
2020-09-20 20:21:36 +02:00
|
|
|
SDL2_DIR = os.getenv("SDL2_DIR") or "dependencies/SDL2"
|
|
|
|
OPENAL_DIR = os.getenv("OPENAL_DIR") or "dependencies/openal-soft"
|
|
|
|
JPEG_DIR = os.getenv("JPEG_DIR") or "dependencies/jpeg"
|
|
|
|
|
2021-06-21 12:35:59 +02:00
|
|
|
WEBDEMO_DIR = os.getenv("WEBDEMO_DIR") or "../../content/web_demo@/" -- FIXME: make it better
|
|
|
|
WEBSHELL_PATH = "../.emscripten"
|
2020-10-01 19:15:33 +02:00
|
|
|
|
2020-09-20 20:21:36 +02:00
|
|
|
GAME_REGION = os.getenv("GAME_REGION") or "NTSC_VERSION" -- or PAL_VERSION
|
2021-05-22 11:51:22 +02:00
|
|
|
GAME_VERSION = os.getenv("APPVEYOR_BUILD_VERSION") or nil
|
|
|
|
|
2020-07-24 18:51:09 +02:00
|
|
|
if not (GAME_REGION == "NTSC_VERSION" or GAME_REGION == "PAL_VERSION") then
|
|
|
|
error("'GAME_REGION' should be 'NTSC_VERSION' or 'PAL_VERSION'")
|
2020-07-24 18:15:59 +02:00
|
|
|
end
|
2021-04-29 22:37:51 +02:00
|
|
|
|
|
|
|
------------------------------------------
|
2020-10-01 19:15:33 +02:00
|
|
|
|
2020-07-24 17:38:25 +02:00
|
|
|
workspace "REDRIVER2"
|
2021-06-21 14:28:50 +02:00
|
|
|
location "project_%{_ACTION}_%{os.target()}"
|
2020-11-20 18:26:28 +01:00
|
|
|
configurations { "Debug", "Release", "Release_dev" }
|
2021-06-21 14:28:50 +02:00
|
|
|
|
2020-07-24 18:15:59 +02:00
|
|
|
defines { VERSION }
|
2021-04-29 22:37:51 +02:00
|
|
|
|
2021-06-21 12:35:59 +02:00
|
|
|
if os.target() == "emscripten" then
|
|
|
|
platforms { "emscripten" }
|
|
|
|
|
|
|
|
buildoptions {
|
|
|
|
--"-s USE_PTHREADS=1",
|
2021-06-21 14:08:52 +02:00
|
|
|
--"-s PTHREAD_POOL_SIZE=8",
|
|
|
|
--"-s ABORTING_MALLOC=0",
|
|
|
|
--"-s FETCH=1",
|
2021-06-21 12:35:59 +02:00
|
|
|
--"-s PROXY_TO_PTHREAD=1",
|
2021-06-21 14:08:52 +02:00
|
|
|
--"-s WASM=1",
|
2021-06-21 12:35:59 +02:00
|
|
|
"-s TOTAL_MEMORY=1073741824",
|
|
|
|
"-s USE_SDL=2",
|
|
|
|
"-s FULL_ES2=1",
|
|
|
|
"-s USE_WEBGL2=1",
|
|
|
|
"-s ASYNCIFY=1",
|
|
|
|
"-s ALLOW_MEMORY_GROWTH=1",
|
|
|
|
"-s GL_TESTING=1",
|
|
|
|
"-Wno-c++11-narrowing",
|
|
|
|
"-Wno-constant-conversion",
|
|
|
|
"-Wno-writable-strings",
|
|
|
|
"-Wno-unused-value",
|
|
|
|
"-Wno-switch",
|
|
|
|
"-Wno-shift-op-parentheses",
|
|
|
|
"-Wno-parentheses",
|
|
|
|
"-Wno-format",
|
|
|
|
}
|
|
|
|
linkoptions {
|
|
|
|
--"-s USE_PTHREADS=1",
|
2021-06-21 14:08:52 +02:00
|
|
|
--"-s PTHREAD_POOL_SIZE=8",
|
|
|
|
--"-s ABORTING_MALLOC=0",
|
|
|
|
--"-s FETCH=1",
|
2021-06-21 12:35:59 +02:00
|
|
|
--"-s PROXY_TO_PTHREAD=1",
|
2021-06-21 14:08:52 +02:00
|
|
|
--"-s WASM=1",
|
2021-06-21 12:35:59 +02:00
|
|
|
"-s TOTAL_MEMORY=1073741824",
|
|
|
|
"-s USE_SDL=2",
|
|
|
|
"-s FULL_ES2=1",
|
|
|
|
"-s USE_WEBGL2=1",
|
|
|
|
"-s ASYNCIFY=1",
|
|
|
|
"-s ALLOW_MEMORY_GROWTH=1",
|
|
|
|
"-s GL_TESTING=1",
|
|
|
|
("--shell-file " .. WEBSHELL_PATH .. "/shell.html"),
|
|
|
|
("--preload-file " .. WEBDEMO_DIR)
|
|
|
|
}
|
|
|
|
|
2021-06-21 14:08:52 +02:00
|
|
|
targetextension ".bc"
|
|
|
|
|
2021-06-21 12:35:59 +02:00
|
|
|
filter { "kind:*App" }
|
|
|
|
targetextension ".html"
|
|
|
|
|
|
|
|
postbuildcommands {
|
|
|
|
"{COPY} " .. WEBSHELL_PATH .. "/style.css %{cfg.buildtarget.directory}"
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
platforms { "x86" } --, "x86_64" }
|
|
|
|
end
|
|
|
|
|
|
|
|
startproject "REDRIVER2"
|
|
|
|
|
2021-04-29 22:37:51 +02:00
|
|
|
configuration "raspberry-pi"
|
|
|
|
defines { "__RPI__" }
|
2020-09-30 05:55:53 +02:00
|
|
|
|
2020-12-10 07:33:28 +01:00
|
|
|
filter "system:Linux"
|
|
|
|
buildoptions {
|
|
|
|
"-Wno-narrowing",
|
|
|
|
"-Wno-endif-labels",
|
|
|
|
"-Wno-write-strings",
|
|
|
|
"-Wno-format-security",
|
|
|
|
"-Wno-unused-result",
|
2020-12-10 21:47:59 +01:00
|
|
|
"-fpermissive"
|
2020-12-10 07:33:28 +01:00
|
|
|
}
|
2020-12-10 21:47:59 +01:00
|
|
|
|
2020-12-10 07:33:28 +01:00
|
|
|
cppdialect "C++11"
|
2020-12-10 21:47:59 +01:00
|
|
|
|
2020-12-10 22:06:44 +01:00
|
|
|
filter {"system:Linux", "platforms:x86"}
|
|
|
|
buildoptions {
|
|
|
|
"-m32"
|
|
|
|
}
|
|
|
|
|
|
|
|
linkoptions {
|
|
|
|
"-m32"
|
|
|
|
}
|
2020-12-10 07:33:28 +01:00
|
|
|
|
2020-11-20 16:59:46 +01:00
|
|
|
filter "system:Windows"
|
|
|
|
disablewarnings { "4996", "4554", "4244", "4101", "4838", "4309" }
|
|
|
|
|
2020-08-10 09:32:01 +02:00
|
|
|
filter "configurations:Debug"
|
|
|
|
defines {
|
2020-12-21 18:10:29 +01:00
|
|
|
"_DEBUG",
|
|
|
|
"DEBUG"
|
2020-08-10 09:32:01 +02:00
|
|
|
}
|
|
|
|
symbols "On"
|
|
|
|
|
|
|
|
filter "configurations:Release"
|
|
|
|
defines {
|
|
|
|
"NDEBUG",
|
|
|
|
}
|
2020-10-24 20:52:13 +02:00
|
|
|
|
2020-11-20 18:26:28 +01:00
|
|
|
filter "configurations:Release_dev"
|
2020-10-24 20:52:13 +02:00
|
|
|
defines {
|
|
|
|
"NDEBUG",
|
|
|
|
}
|
2020-09-27 00:44:27 +02:00
|
|
|
|
2021-06-21 14:08:52 +02:00
|
|
|
if os.target() == "windows" or os.target() == "emscripten" then
|
2021-06-21 12:35:59 +02:00
|
|
|
include "premake_libjpeg.lua"
|
|
|
|
end
|
|
|
|
|
2021-06-09 20:39:14 +02:00
|
|
|
-- Psy-Cross layer
|
|
|
|
include "PsyCross/premake5.lua"
|
2020-08-10 09:32:01 +02:00
|
|
|
|
2020-07-24 17:38:25 +02:00
|
|
|
-- game iteslf
|
|
|
|
project "REDRIVER2"
|
2021-02-14 20:05:50 +01:00
|
|
|
kind "WindowedApp"
|
|
|
|
|
2020-12-28 15:27:00 +01:00
|
|
|
language "c++"
|
2020-07-24 17:38:25 +02:00
|
|
|
targetdir "bin/%{cfg.buildcfg}"
|
|
|
|
|
|
|
|
includedirs {
|
2020-12-28 11:28:40 +01:00
|
|
|
"Game",
|
2020-07-24 17:38:25 +02:00
|
|
|
}
|
2021-06-09 20:39:14 +02:00
|
|
|
|
|
|
|
uses {
|
|
|
|
"PsyCross",
|
|
|
|
}
|
2020-07-24 17:38:25 +02:00
|
|
|
|
2020-07-24 18:51:09 +02:00
|
|
|
defines { GAME_REGION }
|
2021-05-22 11:51:22 +02:00
|
|
|
|
|
|
|
if GAME_VERSION ~= nil then
|
|
|
|
defines{ "GAME_VERSION_N=\""..GAME_VERSION.."\"" }
|
|
|
|
end
|
2020-07-24 18:51:09 +02:00
|
|
|
|
2020-09-27 00:44:27 +02:00
|
|
|
files {
|
2020-12-28 11:28:40 +01:00
|
|
|
"Game/**.h",
|
2020-12-28 15:27:00 +01:00
|
|
|
"Game/**.c"
|
2020-07-24 17:38:25 +02:00
|
|
|
}
|
|
|
|
|
2021-06-21 14:08:52 +02:00
|
|
|
filter {"system:Windows or linux or platforms:emscripten"}
|
2021-06-09 20:39:14 +02:00
|
|
|
--dependson { "PsyX" }
|
|
|
|
links { "jpeg" }
|
|
|
|
|
2020-09-30 07:09:06 +02:00
|
|
|
files {
|
|
|
|
"utils/**.h",
|
|
|
|
"utils/**.cpp",
|
2020-10-21 07:43:29 +02:00
|
|
|
"utils/**.c",
|
2020-09-30 07:09:06 +02:00
|
|
|
"redriver2_psxpc.cpp",
|
|
|
|
"DebugOverlay.cpp",
|
|
|
|
}
|
2021-06-21 14:08:52 +02:00
|
|
|
|
|
|
|
filter "platforms:emscripten"
|
|
|
|
includedirs {
|
|
|
|
OPENAL_DIR.."/include",
|
|
|
|
JPEG_DIR.."/",
|
|
|
|
}
|
2020-09-27 00:44:27 +02:00
|
|
|
|
2020-07-24 17:38:25 +02:00
|
|
|
filter "system:Windows"
|
2021-02-14 20:05:50 +01:00
|
|
|
entrypoint "mainCRTStartup"
|
|
|
|
|
2020-07-24 17:38:25 +02:00
|
|
|
files {
|
|
|
|
"Windows/resource.h",
|
|
|
|
"Windows/Resource.rc",
|
|
|
|
"Windows/main.ico"
|
|
|
|
}
|
2021-02-14 20:05:50 +01:00
|
|
|
|
2020-07-24 17:38:25 +02:00
|
|
|
includedirs {
|
2020-07-24 18:15:59 +02:00
|
|
|
SDL2_DIR.."/include",
|
|
|
|
OPENAL_DIR.."/include",
|
2020-09-20 20:21:36 +02:00
|
|
|
JPEG_DIR.."/",
|
2020-07-24 17:38:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
linkoptions {
|
|
|
|
"/SAFESEH:NO", -- Image Has Safe Exception Handers: No. Because of openal-soft
|
2020-09-27 00:44:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
filter "system:linux"
|
2020-09-30 05:55:53 +02:00
|
|
|
includedirs {
|
|
|
|
"/usr/include/SDL2"
|
|
|
|
}
|
|
|
|
|
2020-09-27 00:44:27 +02:00
|
|
|
links {
|
|
|
|
"GL",
|
|
|
|
"openal",
|
|
|
|
"SDL2",
|
2020-11-19 16:27:50 +01:00
|
|
|
"dl",
|
2020-09-27 00:44:27 +02:00
|
|
|
}
|
2020-07-24 17:38:25 +02:00
|
|
|
|
|
|
|
filter "configurations:Debug"
|
2020-10-05 20:42:09 +02:00
|
|
|
targetsuffix "_dbg"
|
2020-07-24 17:38:25 +02:00
|
|
|
defines {
|
|
|
|
"DEBUG_OPTIONS",
|
2020-10-05 20:42:09 +02:00
|
|
|
"COLLISION_DEBUG",
|
|
|
|
"CUTSCENE_RECORDER"
|
2020-07-24 17:38:25 +02:00
|
|
|
}
|
2020-10-01 19:15:33 +02:00
|
|
|
symbols "On"
|
2020-07-24 17:38:25 +02:00
|
|
|
|
|
|
|
filter "configurations:Release"
|
2020-12-20 11:40:16 +01:00
|
|
|
optimize "Speed"
|
2020-10-01 19:15:33 +02:00
|
|
|
|
2020-11-20 18:26:28 +01:00
|
|
|
filter "configurations:Release_dev"
|
2020-10-05 20:42:09 +02:00
|
|
|
targetsuffix "_dev"
|
2020-07-24 17:38:25 +02:00
|
|
|
defines {
|
2020-10-01 19:15:33 +02:00
|
|
|
"DEBUG_OPTIONS",
|
2020-10-05 20:42:09 +02:00
|
|
|
"COLLISION_DEBUG",
|
|
|
|
"CUTSCENE_RECORDER"
|
2020-07-24 17:38:25 +02:00
|
|
|
}
|
2020-12-21 18:10:29 +01:00
|
|
|
optimize "Speed"
|
2020-12-28 15:27:00 +01:00
|
|
|
|
|
|
|
filter { "files:**.c", "files:**.C" }
|
|
|
|
compileas "C++"
|