2024-05-22 06:01:25 +08:00
require ( " premake " , " >=5.0.0-beta2 " )
-- add "-Wl,--whole-archive -Wl,-Bstatic -lmylib -Wl,-Bdynamic -Wl,--no-whole-archive"
-- via: links { 'mylib:static_whole' }
-- https://premake.github.io/docs/Overrides-and-Call-Arrays/#introducing-overrides
premake.override ( premake.tools . gcc , " getlinks " , function ( originalFn , cfg , systemonly , nogroups )
-- source:
-- premake.tools.gcc.getlinks(cfg, systemonly, nogroups)
-- https://github.com/premake/premake-core/blob/d842e671c7bc7e09f2eeaafd199fd01e48b87ee7/src/tools/gcc.lua#L568C15-L568C22
local result = originalFn ( cfg , systemonly , nogroups )
2024-05-30 02:09:58 +08:00
local whole_syslibs = { " -Wl,--whole-archive " }
2024-05-22 06:01:25 +08:00
local static_whole_syslibs = { " -Wl,--whole-archive -Wl,-Bstatic " }
local endswith = function ( s , ptrn )
return ptrn == string.sub ( s , - string.len ( ptrn ) )
end
local idx_to_remove = { }
for idx , name in ipairs ( result ) do
if endswith ( name , " :static_whole " ) then
name = string.sub ( name , 0 , - 14 )
table.insert ( static_whole_syslibs , name ) -- it already includes '-l'
table.insert ( idx_to_remove , idx )
2024-05-30 02:09:58 +08:00
elseif endswith ( name , " :whole_archive " ) then
name = string.sub ( name , 0 , - 15 )
table.insert ( whole_syslibs , name ) -- it already includes '-l'
table.insert ( idx_to_remove , idx )
2024-05-22 06:01:25 +08:00
end
end
-- remove from the end to avoid trouble with table indexes shifting
for iii = # idx_to_remove , 1 , - 1 do
table.remove ( result , idx_to_remove [ iii ] )
end
local move = function ( a1 , a2 )
local t = # a2
for i = 1 , # a1 do a2 [ t + i ] = a1 [ i ] end
end
2024-05-30 02:09:58 +08:00
local new_result = { }
if # whole_syslibs > 1 then
table.insert ( whole_syslibs , " -Wl,--no-whole-archive " )
move ( whole_syslibs , new_result )
end
2024-05-22 06:01:25 +08:00
if # static_whole_syslibs > 1 then
table.insert ( static_whole_syslibs , " -Wl,-Bdynamic -Wl,--no-whole-archive " )
2024-05-30 02:09:58 +08:00
move ( static_whole_syslibs , new_result )
2024-05-22 06:01:25 +08:00
end
2024-05-30 02:09:58 +08:00
-- https://stackoverflow.com/a/71719579
-- because of the dumb way linux handles linking, the order becomes important
-- I've encountered a problem with linking and it was failing with error "undefined reference to `__imp_WSACloseEvent'"
-- despite 'Ws2_32' being added to the list of libraries, turns out some symbols from 'Ws2_32' were being stripped,
-- because no library before it (on the command line) mentioned any of its symbols, the static libs were being appended afterwards on the command line,
-- and they were mentioning some of the now-stripped symbols
move ( result , new_result )
return new_result
2024-05-22 06:01:25 +08:00
end )
2024-06-08 07:49:30 +08:00
local function table_append ( table_dest , table_src )
local dest_start = # table_dest
for idx = 1 , # table_src do
table_dest [ dest_start + idx ] = table_src [ idx ]
end
end
2024-05-22 06:01:25 +08:00
2024-06-15 21:54:01 +08:00
local function table_postfix_items ( table , postfix )
local ret = { }
for idx = 1 , # table do
ret [ idx ] = table [ idx ] .. postfix
end
return ret
end
2024-05-22 06:01:25 +08:00
-- pre-define stuff
local os_iden = ' ' -- identifier
if os.target ( ) == " windows " then
os_iden = ' win '
elseif os.target ( ) == " linux " then
os_iden = ' linux '
else
error ( ' Unsupported os target: " ' .. os.target ( ) .. ' " ' )
end
2024-05-29 03:23:41 +08:00
local deps_dir = path.getabsolute ( path.join ( ' build ' , ' deps ' , os_iden , _ACTION ) , _MAIN_SCRIPT_DIR )
2024-05-22 06:01:25 +08:00
2024-06-08 07:49:30 +08:00
local function genproto ( )
2024-05-31 20:09:36 +08:00
local deps_install_prefix = ' '
if os.is64bit ( ) then
deps_install_prefix = ' install64 '
else
deps_install_prefix = ' install32 '
end
local protoc_exe = path.join ( deps_dir , ' protobuf ' , deps_install_prefix , ' bin ' , ' protoc ' )
2024-05-27 09:03:27 +08:00
2024-06-15 21:52:55 +08:00
local out_dir = ' proto_gen/ ' .. os_iden
2024-05-22 06:01:25 +08:00
2024-08-22 09:53:27 +08:00
if os.target ( ) == " windows " then
2024-05-31 20:09:36 +08:00
protoc_exe = protoc_exe .. ' .exe '
end
2024-05-22 06:01:25 +08:00
2024-05-31 20:09:36 +08:00
if not os.isfile ( protoc_exe ) then
error ( " protoc not found! " .. protoc_exe )
return
end
2024-05-22 06:01:25 +08:00
2024-05-31 20:09:36 +08:00
print ( " Generating from .proto file! " )
local ok_mk , err_mk = os.mkdir ( out_dir )
if not ok_mk then
error ( " Error: " .. err_mk )
return
end
2024-08-22 09:53:27 +08:00
if os.target ( ) == " linux " then
2024-05-31 20:09:36 +08:00
local ok_chmod , err_chmod = os.chmod ( protoc_exe , " 777 " )
if not ok_chmod then
error ( " Error: " .. err_chmod )
2024-05-22 06:01:25 +08:00
return
end
end
2024-05-31 20:09:36 +08:00
2024-08-22 09:53:27 +08:00
if ( os.host ( ) == " linux " and os.target ( ) == " windows " ) then
protoc_exe = ' wine ' .. protoc_exe
end
2024-05-31 20:09:36 +08:00
return os.execute ( protoc_exe .. ' dll/net.proto -I./dll/ --cpp_out= ' .. out_dir )
end
newoption {
category = ' protobuf files ' ,
trigger = " genproto " ,
description = " Generate .cc/.h files from .proto file " ,
2024-05-22 06:01:25 +08:00
}
newoption {
2024-05-31 20:09:36 +08:00
category = ' build ' ,
2024-05-22 06:01:25 +08:00
trigger = " emubuild " ,
description = " Set the EMU_BUILD_STRING " ,
2024-05-22 08:09:18 +08:00
value = " your_string " ,
default = os.date ( " %Y_%m_%d-%H_%M_%S " ) ,
}
2024-06-16 01:09:31 +08:00
newoption {
category = ' visual-includes ' ,
trigger = " incexamples " ,
description = " Add all example files in the projects (no impact on build) " ,
}
newoption {
category = ' visual-includes ' ,
trigger = " incdeps " ,
description = " Add all header files from the third-party dependencies in the projects (no impact on build) " ,
}
2024-05-31 20:09:36 +08:00
-- windows options
if os.target ( ) == ' windows ' then
2024-05-22 08:09:18 +08:00
newoption {
2024-05-31 20:09:36 +08:00
category = " build " ,
2024-05-22 08:09:18 +08:00
trigger = " dosstub " ,
description = " Change the DOS stub of the Windows builds " ,
}
newoption {
2024-05-31 20:09:36 +08:00
category = " build " ,
2024-05-22 08:09:18 +08:00
trigger = " winsign " ,
description = " Sign Windows builds with a fake certificate " ,
}
newoption {
2024-05-31 20:09:36 +08:00
category = " build " ,
2024-05-22 08:09:18 +08:00
trigger = " winrsrc " ,
description = " Add resources to Windows builds " ,
2024-05-22 06:01:25 +08:00
}
2024-05-31 20:09:36 +08:00
end
-- End windows options
2024-05-22 06:01:25 +08:00
-- common defines
---------
local common_emu_defines = { -- added to all filters, later defines will be appended
" UTF_CPP_CPLUSPLUS=201703L " , " CURL_STATICLIB " , " CONTROLLER_SUPPORT " , " EMU_BUILD_STRING= " .. _OPTIONS [ " emubuild " ] ,
}
-- include dirs
---------
local common_include = {
' dll ' ,
2024-06-15 21:52:55 +08:00
' proto_gen/ ' .. os_iden ,
2024-05-22 06:01:25 +08:00
' libs ' ,
' libs/utfcpp ' ,
' helpers ' ,
' crash_printer ' ,
' sdk ' ,
" overlay_experimental " ,
}
local x32_deps_include = {
2024-05-29 03:24:41 +08:00
path.join ( deps_dir , " libssq/include " ) ,
path.join ( deps_dir , " curl/install32/include " ) ,
path.join ( deps_dir , " protobuf/install32/include " ) ,
path.join ( deps_dir , " zlib/install32/include " ) ,
path.join ( deps_dir , " mbedtls/install32/include " ) ,
2024-05-22 06:01:25 +08:00
}
local x32_deps_overlay_include = {
2024-05-29 03:24:41 +08:00
path.join ( deps_dir , " ingame_overlay/install32/include " ) ,
path.join ( deps_dir , " ingame_overlay/deps/System/install32/include " ) ,
path.join ( deps_dir , " ingame_overlay/deps/mini_detour/install32/include " ) ,
2024-05-22 06:01:25 +08:00
}
local x64_deps_include = {
2024-05-29 03:24:41 +08:00
path.join ( deps_dir , " libssq/include " ) ,
path.join ( deps_dir , " curl/install64/include " ) ,
path.join ( deps_dir , " protobuf/install64/include " ) ,
path.join ( deps_dir , " zlib/install64/include " ) ,
path.join ( deps_dir , " mbedtls/install64/include " ) ,
2024-05-22 06:01:25 +08:00
}
local x64_deps_overlay_include = {
2024-05-29 03:24:41 +08:00
path.join ( deps_dir , " ingame_overlay/install64/include " ) ,
path.join ( deps_dir , " ingame_overlay/deps/System/install64/include " ) ,
path.join ( deps_dir , " ingame_overlay/deps/mini_detour/install64/include " ) ,
2024-05-22 06:01:25 +08:00
}
-- source & header files
---------
local common_files = {
-- dll/
2024-06-15 21:54:01 +08:00
" dll/** " ,
2024-06-15 21:52:55 +08:00
-- proto_gen/
' proto_gen/ ' .. os_iden .. ' /** ' ,
2024-06-15 21:54:01 +08:00
-- libs
" libs/** " ,
2024-05-22 06:01:25 +08:00
-- crash_printer/
' crash_printer/ ' .. os_iden .. ' .cpp ' , ' crash_printer/crash_printer/ ' .. os_iden .. ' .hpp ' ,
2024-06-15 21:54:01 +08:00
-- helpers/common_helpers
" helpers/common_helpers.cpp " , " helpers/common_helpers/** " ,
2024-06-29 11:51:34 +08:00
-- helpers/dbg_log
" helpers/dbg_log.cpp " , " helpers/dbg_log/** " ,
2024-06-15 21:54:01 +08:00
}
local overlay_files = {
" overlay_experimental/** " ,
}
local detours_files = {
" libs/detours/** " ,
2024-05-22 06:01:25 +08:00
}
-- libs to link
---------
2024-05-28 12:12:10 +08:00
local lib_prefix = ' lib '
2024-06-08 07:49:30 +08:00
local static_postfix = ' '
-- GCC/Clang add this prefix by default and linking ex: '-lssq' will look for 'libssq'
2024-05-28 12:12:10 +08:00
-- so we have to ommit this prefix since it's automatically added
2024-05-30 03:08:04 +08:00
if _ACTION and string.match ( _ACTION , ' gmake.* ' ) then
2024-05-28 12:12:10 +08:00
lib_prefix = ' '
2024-06-08 07:49:30 +08:00
if os.target ( ) ~= ' windows ' then -- for MinGw we compile everything with -static, and this conflicts with it
static_postfix = ' :static '
end
end
local zlib_archive_name = ' z '
if os.target ( ) == ' windows ' then
zlib_archive_name = ' zlibstatic ' -- even on MinGw we need this name
2024-05-28 12:12:10 +08:00
end
2024-06-08 07:49:30 +08:00
local deps_link = {
" ssq " .. static_postfix ,
zlib_archive_name .. static_postfix ,
lib_prefix .. " curl " .. static_postfix ,
" mbedcrypto " .. static_postfix ,
2024-08-16 05:53:55 +08:00
" mbedtls " .. static_postfix ,
" mbedx509 " .. static_postfix ,
2024-06-08 07:49:30 +08:00
}
-- add protobuf libs
table_append ( deps_link , {
lib_prefix .. " protobuf-lite " .. static_postfix ,
" absl_bad_any_cast_impl " .. static_postfix ,
" absl_bad_optional_access " .. static_postfix ,
" absl_bad_variant_access " .. static_postfix ,
" absl_base " .. static_postfix ,
" absl_city " .. static_postfix ,
" absl_civil_time " .. static_postfix ,
" absl_cord " .. static_postfix ,
" absl_cordz_functions " .. static_postfix ,
" absl_cordz_handle " .. static_postfix ,
" absl_cordz_info " .. static_postfix ,
" absl_cordz_sample_token " .. static_postfix ,
" absl_cord_internal " .. static_postfix ,
" absl_crc32c " .. static_postfix ,
" absl_crc_cord_state " .. static_postfix ,
" absl_crc_cpu_detect " .. static_postfix ,
" absl_crc_internal " .. static_postfix ,
" absl_debugging_internal " .. static_postfix ,
" absl_demangle_internal " .. static_postfix ,
" absl_die_if_null " .. static_postfix ,
" absl_examine_stack " .. static_postfix ,
" absl_exponential_biased " .. static_postfix ,
" absl_failure_signal_handler " .. static_postfix ,
" absl_flags_commandlineflag " .. static_postfix ,
" absl_flags_commandlineflag_internal " .. static_postfix ,
" absl_flags_config " .. static_postfix ,
" absl_flags_internal " .. static_postfix ,
" absl_flags_marshalling " .. static_postfix ,
" absl_flags_parse " .. static_postfix ,
" absl_flags_private_handle_accessor " .. static_postfix ,
" absl_flags_program_name " .. static_postfix ,
" absl_flags_reflection " .. static_postfix ,
" absl_flags_usage " .. static_postfix ,
" absl_flags_usage_internal " .. static_postfix ,
" absl_graphcycles_internal " .. static_postfix ,
" absl_hash " .. static_postfix ,
" absl_hashtablez_sampler " .. static_postfix ,
" absl_int128 " .. static_postfix ,
" absl_kernel_timeout_internal " .. static_postfix ,
" absl_leak_check " .. static_postfix ,
" absl_log_entry " .. static_postfix ,
" absl_log_flags " .. static_postfix ,
" absl_log_globals " .. static_postfix ,
" absl_log_initialize " .. static_postfix ,
" absl_log_internal_check_op " .. static_postfix ,
" absl_log_internal_conditions " .. static_postfix ,
" absl_log_internal_fnmatch " .. static_postfix ,
" absl_log_internal_format " .. static_postfix ,
" absl_log_internal_globals " .. static_postfix ,
" absl_log_internal_log_sink_set " .. static_postfix ,
" absl_log_internal_message " .. static_postfix ,
" absl_log_internal_nullguard " .. static_postfix ,
" absl_log_internal_proto " .. static_postfix ,
" absl_log_severity " .. static_postfix ,
" absl_log_sink " .. static_postfix ,
" absl_low_level_hash " .. static_postfix ,
" absl_malloc_internal " .. static_postfix ,
" absl_periodic_sampler " .. static_postfix ,
" absl_random_distributions " .. static_postfix ,
" absl_random_internal_distribution_test_util " .. static_postfix ,
" absl_random_internal_platform " .. static_postfix ,
" absl_random_internal_pool_urbg " .. static_postfix ,
" absl_random_internal_randen " .. static_postfix ,
" absl_random_internal_randen_hwaes " .. static_postfix ,
" absl_random_internal_randen_hwaes_impl " .. static_postfix ,
" absl_random_internal_randen_slow " .. static_postfix ,
" absl_random_internal_seed_material " .. static_postfix ,
" absl_random_seed_gen_exception " .. static_postfix ,
" absl_random_seed_sequences " .. static_postfix ,
" absl_raw_hash_set " .. static_postfix ,
" absl_raw_logging_internal " .. static_postfix ,
" absl_scoped_set_env " .. static_postfix ,
" absl_spinlock_wait " .. static_postfix ,
" absl_stacktrace " .. static_postfix ,
" absl_status " .. static_postfix ,
" absl_statusor " .. static_postfix ,
" absl_strerror " .. static_postfix ,
" absl_strings " .. static_postfix ,
" absl_strings_internal " .. static_postfix ,
" absl_string_view " .. static_postfix ,
" absl_str_format_internal " .. static_postfix ,
" absl_symbolize " .. static_postfix ,
" absl_synchronization " .. static_postfix ,
" absl_throw_delegate " .. static_postfix ,
" absl_time " .. static_postfix ,
" absl_time_zone " .. static_postfix ,
" absl_vlog_config_internal " .. static_postfix ,
" utf8_range " .. static_postfix ,
" utf8_validity " .. static_postfix ,
} )
2024-05-22 06:01:25 +08:00
local common_link_win = {
-- os specific
2024-06-08 07:49:30 +08:00
" Ws2_32 " .. static_postfix ,
" Iphlpapi " .. static_postfix ,
" Wldap32 " .. static_postfix ,
" Winmm " .. static_postfix ,
" Bcrypt " .. static_postfix ,
" Dbghelp " .. static_postfix ,
2024-05-29 03:25:55 +08:00
-- gamepad
2024-06-08 07:49:30 +08:00
" Xinput " .. static_postfix ,
2024-05-29 03:25:55 +08:00
-- imgui / overlay
2024-06-08 07:49:30 +08:00
" Gdi32 " .. static_postfix ,
" Dwmapi " .. static_postfix ,
2024-05-22 06:01:25 +08:00
}
2024-06-08 07:49:30 +08:00
-- add deps to win
table_append ( common_link_win , deps_link )
2024-05-22 06:01:25 +08:00
local common_link_linux = {
-- os specific
" pthread " , " dl " ,
}
2024-06-08 07:49:30 +08:00
-- add deps to linux
table_append ( common_link_linux , deps_link )
2024-05-22 06:01:25 +08:00
2024-05-30 02:49:28 +08:00
-- overlay libs
2024-06-08 07:49:30 +08:00
local overlay_link = {
" ingame_overlay " ,
" system " , -- ingame_overlay dependency
" mini_detour " , -- ingame_overlay dependency
2024-05-22 06:01:25 +08:00
}
2024-06-08 07:49:30 +08:00
-- we add them later when needed
2024-05-22 06:01:25 +08:00
-- dirs to custom libs
---------
2024-05-29 03:24:41 +08:00
local x32_ssq_libdir = path.join ( deps_dir , " libssq/build32 " )
local x64_ssq_libdir = path.join ( deps_dir , " libssq/build64 " )
2024-08-22 09:53:27 +08:00
local cmake_generator = os.getenv ( " CMAKE_GENERATOR " ) or " "
if cmake_generator == " " and os.host ( ) == ' windows ' or cmake_generator : find ( " Visual Studio " ) then
2024-05-22 06:01:25 +08:00
x32_ssq_libdir = x32_ssq_libdir .. " /Release "
x64_ssq_libdir = x64_ssq_libdir .. " /Release "
end
local x32_deps_libdir = {
x32_ssq_libdir ,
2024-05-29 03:24:41 +08:00
path.join ( deps_dir , " curl/install32/lib " ) ,
path.join ( deps_dir , " protobuf/install32/lib " ) ,
path.join ( deps_dir , " zlib/install32/lib " ) ,
path.join ( deps_dir , " mbedtls/install32/lib " ) ,
2024-05-22 06:01:25 +08:00
}
local x32_deps_overlay_libdir = {
2024-05-29 03:24:41 +08:00
path.join ( deps_dir , " ingame_overlay/install32/lib " ) ,
path.join ( deps_dir , " ingame_overlay/deps/System/install32/lib " ) ,
path.join ( deps_dir , " ingame_overlay/deps/mini_detour/install32/lib " ) ,
2024-05-22 06:01:25 +08:00
}
local x64_deps_libdir = {
x64_ssq_libdir ,
2024-05-29 03:24:41 +08:00
path.join ( deps_dir , " curl/install64/lib " ) ,
path.join ( deps_dir , " protobuf/install64/lib " ) ,
path.join ( deps_dir , " zlib/install64/lib " ) ,
path.join ( deps_dir , " mbedtls/install64/lib " ) ,
path.join ( deps_dir , " ingame_overlay/install64/lib " ) ,
2024-05-22 06:01:25 +08:00
}
local x64_deps_overlay_libdir = {
2024-05-29 03:24:41 +08:00
path.join ( deps_dir , " ingame_overlay/install64/lib " ) ,
path.join ( deps_dir , " ingame_overlay/deps/System/install64/lib " ) ,
path.join ( deps_dir , " ingame_overlay/deps/mini_detour/install64/lib " ) ,
2024-05-22 06:01:25 +08:00
}
2024-05-31 20:09:36 +08:00
-- generate proto
if _OPTIONS [ " genproto " ] then
if genproto ( ) then
print ( " Success! " )
else
error ( " protoc error " )
end
end
-- End generate proto
2024-05-22 06:01:25 +08:00
-- tokenization
-- https://premake.github.io/docs/Tokens/
-- this means expand the global var 'abc' --> %{abc}
-- this means expand the global var 'abc' and resolve its full path --> %{!abc}
-- this means expand the global var 'abc' as a filepath agnostic to the shell (bash/cmd) --> %[%{abc}]
-- string concat and functions calls
-- https://premake.github.io/docs/Your-First-Script#functions-and-arguments
-- "asd" .. "zxc" --> "asdzxc"
-- when doing string concat, call premake functions/actions with regular brackets
-- this will work: targetdir("build/" .. os_iden)
-- this will fail: targetdir "build/" .. os_iden
-- both are function calls actually, ex: filter({ 'a', 'b' }) is similar to filter { 'a', 'b' }
-- stuff defined globally will affect all workspaces & projects
-- https://premake.github.io/docs/Scopes-and-Inheritance/
2024-05-24 13:37:08 +08:00
filter { } -- reset the filter and remove all active keywords
2024-05-22 06:01:25 +08:00
configurations { " debug " , " release " , }
platforms { " x64 " , " x32 " , }
2024-05-29 03:27:47 +08:00
language " C++ "
cppdialect " C++17 "
cdialect " C17 "
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , " action:gmake* " , }
2024-05-22 06:01:25 +08:00
cdialect ( " gnu17 " ) -- gamepad.c relies on some linux-specific functions like strdup() and MAX_PATH
filter { } -- reset the filter and remove all active keywords
2024-05-29 03:27:47 +08:00
characterset " Unicode "
2024-05-22 06:01:25 +08:00
staticruntime " on " -- /MT or /MTd
runtime " Release " -- ensure we never link with /MTd, otherwise deps linking will fail
flags {
" NoPCH " , -- no precompiled header on Windows
2024-06-15 21:54:01 +08:00
" MultiProcessorCompile " , -- /MP "Enable Visual Studio to use multiple compiler processes when building"
2024-05-29 03:26:39 +08:00
" RelativeLinks " ,
2024-05-22 06:01:25 +08:00
}
2024-05-29 03:27:47 +08:00
targetprefix " " -- prevent adding the prefix libxxx on linux
2024-05-30 02:14:17 +08:00
visibility " Hidden " -- hide all symbols by default on GCC (unless they are marked visible)
2024-06-08 07:55:45 +08:00
linkgroups " On " -- turn off the awful order dependent linking on gcc/clang, causes the linker to go back and forth to find missing symbols
2024-05-30 02:14:17 +08:00
exceptionhandling " On " -- "Enable exception handling. ... although it does not affect execution."
2024-06-16 01:14:56 +08:00
stringpooling " On " -- cache similar strings
2024-05-27 09:03:56 +08:00
vpaths { -- just for visual niceness, see: https://premake.github.io/docs/vpaths/
[ " headers/* " ] = {
" **.h " , " **.hxx " , " **.hpp " ,
} ,
[ " src/* " ] = {
" **.c " , " **.cxx " , " **.cpp " , " **.cc " ,
} ,
2024-06-15 21:52:55 +08:00
[ " proto/* " ] = {
" **.proto " ,
} ,
2024-06-15 21:54:01 +08:00
[ " docs/* " ] = {
-- post build
" post_build/** " ,
-- licence files
" **/LICENSE " , " **/LICENCE " ,
" **.LICENSE " , " **.LICENCE " ,
" **.mit " ,
-- anything else
" **.txt " , " **.md " ,
} ,
2024-05-27 09:03:56 +08:00
}
2024-05-22 06:01:25 +08:00
-- arch
---------
filter { " platforms:x32 " , }
architecture " x86 "
filter { " platforms:x64 " , }
architecture " x86_64 "
-- debug/optimization flags
---------
2024-05-30 03:42:16 +08:00
filter { } -- reset the filter and remove all active keywords
2024-05-30 02:14:17 +08:00
intrinsics " On "
2024-05-22 06:01:25 +08:00
filter { " configurations:*debug " , }
symbols " On "
optimize " Off "
filter { " configurations:*release " , }
symbols " Off "
optimize " On "
--- common compiler/linker options
---------
2024-05-22 08:29:31 +08:00
-- Visual Studio common compiler/linker options
filter { " action:vs* " , }
2024-05-22 06:01:25 +08:00
buildoptions {
2024-06-08 07:56:30 +08:00
" /permissive- " , " /DYNAMICBASE " , " /bigobj " ,
2024-05-22 06:01:25 +08:00
" /utf-8 " , " /Zc:char8_t- " , " /EHsc " , " /GL- "
}
linkoptions {
-- source of emittoolversioninfo: https://developercommunity.visualstudio.com/t/add-linker-option-to-strip-rich-stamp-from-exe-hea/740443
" /NOLOGO " , " /emittoolversioninfo:no "
}
2024-05-22 08:29:31 +08:00
-- GNU make common compiler/linker options
filter { " action:gmake* " , }
2024-05-22 06:01:25 +08:00
buildoptions {
2024-05-30 02:14:17 +08:00
-- https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html
" -fno-jump-tables " , " -Wno-switch " ,
2024-05-22 06:01:25 +08:00
}
linkoptions {
2024-05-24 12:06:15 +08:00
" -Wl,--exclude-libs,ALL " ,
2024-05-22 06:01:25 +08:00
}
-- this is made separate because GCC complains but not CLANG
2024-06-15 21:54:01 +08:00
filter { " action:gmake* " , " files:*.cpp or *.cxx or *.cc or *.hpp or *.hxx " , }
2024-05-22 06:01:25 +08:00
buildoptions {
" -fno-char8_t " , -- GCC gives a warning when a .c file is compiled with this
}
filter { } -- reset the filter and remove all active keywords
-- defines
---------
2024-06-29 11:51:34 +08:00
filter { } -- reset the filter and remove all active keywords
defines { -- added to all filters, later defines will be appended
common_emu_defines ,
}
2024-05-22 06:01:25 +08:00
-- release mode defines
filter { " configurations:*release " }
defines {
" NDEBUG " , " EMU_RELEASE_BUILD "
}
-- debug mode defines
filter { " configurations:*debug " }
defines {
" DEBUG " ,
}
-- Windows defines
filter { " system:windows " , }
defines {
" _CRT_SECURE_NO_WARNINGS " ,
2024-05-24 10:50:14 +08:00
}
2024-05-22 06:01:25 +08:00
-- Linux defines
2024-06-15 21:54:01 +08:00
filter { " system:not windows " }
2024-05-22 06:01:25 +08:00
defines {
" GNUC " ,
}
2024-05-24 15:02:51 +08:00
-- MinGw on Windows
2024-05-30 02:48:49 +08:00
-- common compiler/linker options: source: https://gcc.gnu.org/onlinedocs/gcc/Cygwin-and-MinGW-Options.html
2024-05-23 07:19:06 +08:00
---------
2024-05-24 15:02:51 +08:00
filter { " system:windows " , " action:gmake* " , }
2024-05-29 03:29:00 +08:00
-- MinGw on Windows common defines
-- MinGw on Windows doesn't have a definition for '_S_IFDIR' which is microsoft specific: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions
-- this is used in 'base.cpp' -> if ( buffer.st_mode & _S_IFDIR)
-- instead microsoft has an alternative but only enabled when _CRT_DECLARE_NONSTDC_NAMES is defined
-- https://learn.microsoft.com/en-us/cpp/c-runtime-library/compatibility
2024-05-24 15:02:51 +08:00
defines {
-- '_CRT_NONSTDC_NO_WARNINGS',
' _CRT_DECLARE_NONSTDC_NAMES ' ,
}
2024-05-29 03:29:00 +08:00
linkoptions {
-- I don't know why but if libgcc/libstdc++ as well as pthreads are not statically linked
-- none of the output binary .dlls will reach their DllMain() in x64dbg
-- even when they're force-loaded in any process they immediately unload
2024-05-30 02:11:52 +08:00
-- '-static-libgcc' ,'-static-libstdc++',
' -static ' ,
2024-05-29 03:29:00 +08:00
}
2024-05-29 03:29:35 +08:00
-- MinGw on Windows cannot compile 'creatwth.cpp' from Detours lib (error: 'DWordMult' was not declared in this scope)
-- because intsafe.h isn't included by default
filter { " system:windows " , " action:gmake* " , " files:**/detours/creatwth.cpp " }
buildoptions {
" -include intsafe.h " ,
}
2024-05-23 07:19:06 +08:00
2024-06-15 21:54:01 +08:00
-- add extra files for clearance
filter { } -- reset the filter and remove all active keywords
2024-06-16 01:09:31 +08:00
-- post build docs
filter { ' options:incexamples ' , }
files {
' post_build/** ' ,
}
filter { ' options:incexamples ' , ' system:not windows ' , }
removefiles {
' post_build/win/** '
}
2024-06-15 21:54:01 +08:00
-- deps
2024-06-16 01:09:31 +08:00
filter { ' options:incdeps ' , " platforms:x32 " , }
2024-06-15 21:54:01 +08:00
files {
table_postfix_items ( x32_deps_include , ' /**.h ' ) ,
table_postfix_items ( x32_deps_include , ' /**.hxx ' ) ,
table_postfix_items ( x32_deps_include , ' /**.hpp ' ) ,
}
2024-06-16 01:09:31 +08:00
filter { ' options:incdeps ' , " platforms:x64 " , }
2024-06-15 21:54:01 +08:00
files {
table_postfix_items ( x64_deps_include , ' /**.h ' ) ,
table_postfix_items ( x64_deps_include , ' /**.hxx ' ) ,
table_postfix_items ( x64_deps_include , ' /**.hpp ' ) ,
}
filter { } -- reset the filter and remove all active keywords
2024-06-29 11:51:34 +08:00
-- include dirs
---------
-- common include dir
filter { } -- reset the filter and remove all active keywords
includedirs {
common_include ,
}
2024-06-15 21:54:01 +08:00
-- disable warnings for external libraries/deps
filter { ' files:proto_gen/** or libs/** or build/deps/** ' }
warnings ' Off '
filter { } -- reset the filter and remove all active keywords
2024-05-24 15:02:51 +08:00
2024-05-22 06:01:25 +08:00
-- post build change DOS stub + sign
---------
if os.target ( ) == " windows " then
2024-05-23 07:44:11 +08:00
-- token expansion like '%{cfg.platform}' happens later during project build
2024-05-27 09:03:27 +08:00
local dos_stub_exe = path.translate ( path.getabsolute ( ' resources/win/file_dos_stub/file_dos_stub_%{cfg.platform}.exe ' , _MAIN_SCRIPT_DIR ) , ' \\ ' )
local signer_tool = path.translate ( path.getabsolute ( ' third-party/build/win/cert/sign_helper.bat ' , _MAIN_SCRIPT_DIR ) , ' \\ ' )
2024-05-22 06:01:25 +08:00
-- change dos stub
2024-05-23 07:44:11 +08:00
filter { " system:windows " , " options:dosstub " , }
2024-05-22 06:01:25 +08:00
postbuildcommands {
2024-05-23 07:44:11 +08:00
' " ' .. dos_stub_exe .. ' " %[%{!cfg.buildtarget.abspath}] ' ,
2024-05-22 06:01:25 +08:00
}
-- sign
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " options:winsign " , }
2024-05-22 06:01:25 +08:00
postbuildcommands {
' " ' .. signer_tool .. ' " %[%{!cfg.buildtarget.abspath}] ' ,
}
filter { } -- reset the filter and remove all active keywords
end
2024-06-15 21:54:01 +08:00
2024-05-22 06:01:25 +08:00
workspace " gbe "
location ( " build/project/%{_ACTION}/ " .. os_iden )
2024-05-22 08:03:02 +08:00
-- Project api_regular
2024-05-22 06:01:25 +08:00
---------
2024-05-22 08:03:02 +08:00
project " api_regular "
2024-05-22 06:01:25 +08:00
kind " SharedLib "
location " %{wks.location}/%{prj.name} "
2024-05-22 08:03:02 +08:00
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/regular/%{cfg.platform} " )
2024-05-22 06:01:25 +08:00
-- name
---------
filter { " system:windows " , " platforms:x32 " , }
targetname " steam_api "
filter { " system:windows " , " platforms:x64 " , }
targetname " steam_api64 "
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , }
2024-05-22 06:01:25 +08:00
targetname " libsteam_api "
-- x32 include dir
filter { " platforms:x32 " , }
includedirs {
x32_deps_include ,
}
-- x64 include dir
filter { " platforms:x64 " , }
includedirs {
x64_deps_include ,
}
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files { -- added to all filters, later defines will be appended
common_files ,
}
2024-06-15 21:54:01 +08:00
removefiles {
detours_files ,
}
2024-05-22 06:01:25 +08:00
-- Windows common source files
filter { " system:windows " , }
removefiles {
" dll/wrap.cpp "
}
-- Windows x32 common source files
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " platforms:x32 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/api/32/resources.rc "
}
-- Windows x64 common source files
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " platforms:x64 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/api/64/resources.rc "
}
-- libs to link
---------
-- Windows libs to link
filter { " system:windows " , }
links {
common_link_win ,
}
-- Linux libs to link
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , }
2024-05-22 06:01:25 +08:00
links {
common_link_linux ,
}
-- libs search dir
---------
-- x32 libs search dir
filter { " platforms:x32 " , }
libdirs {
x32_deps_libdir ,
}
-- x64 libs search dir
filter { " platforms:x64 " , }
libdirs {
x64_deps_libdir ,
}
2024-05-22 08:03:02 +08:00
-- End api_regular
2024-05-22 06:01:25 +08:00
2024-05-22 08:03:02 +08:00
-- Project api_experimental
2024-05-22 06:01:25 +08:00
---------
2024-05-22 08:03:02 +08:00
project " api_experimental "
2024-05-22 06:01:25 +08:00
kind " SharedLib "
location " %{wks.location}/%{prj.name} "
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/experimental/%{cfg.platform} " )
-- name
---------
filter { " system:windows " , " platforms:x32 " , }
targetname " steam_api "
filter { " system:windows " , " platforms:x64 " , }
targetname " steam_api64 "
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , }
2024-05-22 06:01:25 +08:00
targetname " libsteam_api "
-- defines
---------
filter { } -- reset the filter and remove all active keywords
defines { -- added to all filters, later defines will be appended
" EMU_OVERLAY " , " ImTextureID=ImU64 " ,
}
-- Windows defines
filter { " system:windows " }
defines {
" EMU_EXPERIMENTAL_BUILD " ,
}
-- include dir
---------
-- x32 include dir
filter { " platforms:x32 " , }
includedirs {
x32_deps_include ,
x32_deps_overlay_include ,
}
-- x64 include dir
filter { " platforms:x64 " , }
includedirs {
x64_deps_include ,
x64_deps_overlay_include ,
}
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files { -- added to all filters, later defines will be appended
common_files ,
2024-06-15 21:54:01 +08:00
overlay_files ,
2024-05-22 06:01:25 +08:00
}
2024-06-16 01:14:56 +08:00
removefiles {
' libs/detours/uimports.cc ' ,
}
2024-06-15 21:54:01 +08:00
-- deps
2024-06-16 01:09:31 +08:00
filter { ' options:incdeps ' , " platforms:x32 " , }
2024-05-22 06:01:25 +08:00
files {
2024-06-15 21:54:01 +08:00
table_postfix_items ( x32_deps_overlay_include , ' /**.h ' ) ,
table_postfix_items ( x32_deps_overlay_include , ' /**.hxx ' ) ,
table_postfix_items ( x32_deps_overlay_include , ' /**.hpp ' ) ,
2024-05-22 06:01:25 +08:00
}
2024-06-16 01:09:31 +08:00
filter { ' options:incdeps ' , " platforms:x64 " , }
2024-06-15 21:54:01 +08:00
files {
table_postfix_items ( x64_deps_overlay_include , ' /**.h ' ) ,
table_postfix_items ( x64_deps_overlay_include , ' /**.hxx ' ) ,
table_postfix_items ( x64_deps_overlay_include , ' /**.hpp ' ) ,
}
-- Windows common source files
filter { " system:windows " , }
2024-05-22 06:01:25 +08:00
removefiles {
" dll/wrap.cpp "
}
-- Windows x32 common source files
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " platforms:x32 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/api/32/resources.rc "
}
-- Windows x64 common source files
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " platforms:x64 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/api/64/resources.rc "
}
2024-06-15 21:54:01 +08:00
-- Linux common source files
filter { " system:not windows " , }
removefiles {
detours_files ,
}
2024-05-22 06:01:25 +08:00
-- libs to link
---------
2024-06-08 07:49:30 +08:00
filter { } -- reset the filter and remove all active keywords
links {
overlay_link ,
}
2024-05-22 06:01:25 +08:00
-- Windows libs to link
filter { " system:windows " , }
links {
common_link_win ,
}
-- Linux libs to link
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , }
2024-05-22 06:01:25 +08:00
links {
common_link_linux ,
}
-- libs search dir
---------
-- x32 libs search dir
filter { " platforms:x32 " , }
libdirs {
x32_deps_libdir ,
x32_deps_overlay_libdir ,
}
-- x64 libs search dir
filter { " platforms:x64 " , }
libdirs {
x64_deps_libdir ,
x64_deps_overlay_libdir ,
}
2024-05-22 08:03:02 +08:00
-- End api_experimental
2024-05-22 06:01:25 +08:00
-- Project steamclient_experimental
---------
project " steamclient_experimental "
kind " SharedLib "
location " %{wks.location}/%{prj.name} "
-- targetdir
---------
filter { " system:windows " , }
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/steamclient_experimental " )
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , }
2024-05-22 06:01:25 +08:00
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/experimental/%{cfg.platform} " )
-- name
---------
filter { " system:windows " , " platforms:x32 " , }
targetname " steamclient "
filter { " system:windows " , " platforms:x64 " , }
targetname " steamclient64 "
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , }
2024-05-22 06:01:25 +08:00
targetname " steamclient "
-- defines
---------
filter { } -- reset the filter and remove all active keywords
defines { -- added to all filters, later defines will be appended
" STEAMCLIENT_DLL " , " EMU_OVERLAY " , " ImTextureID=ImU64 " ,
}
-- Windows defines
filter { " system:windows " }
defines {
" EMU_EXPERIMENTAL_BUILD " ,
}
-- include dir
---------
-- x32 include dir
filter { " platforms:x32 " , }
includedirs {
x32_deps_include ,
x32_deps_overlay_include ,
}
-- x64 include dir
filter { " platforms:x64 " , }
includedirs {
x64_deps_include ,
x64_deps_overlay_include ,
}
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files { -- added to all filters, later defines will be appended
common_files ,
2024-06-15 21:54:01 +08:00
overlay_files ,
2024-05-22 06:01:25 +08:00
}
2024-06-16 01:14:56 +08:00
removefiles {
' libs/detours/uimports.cc ' ,
}
2024-06-15 21:54:01 +08:00
-- deps
2024-06-16 01:09:31 +08:00
filter { ' options:incdeps ' , " platforms:x32 " , }
2024-06-15 21:54:01 +08:00
files {
table_postfix_items ( x32_deps_overlay_include , ' /**.h ' ) ,
table_postfix_items ( x32_deps_overlay_include , ' /**.hxx ' ) ,
table_postfix_items ( x32_deps_overlay_include , ' /**.hpp ' ) ,
}
2024-06-16 01:09:31 +08:00
filter { ' options:incdeps ' , " platforms:x64 " , }
2024-05-22 06:01:25 +08:00
files {
2024-06-15 21:54:01 +08:00
table_postfix_items ( x64_deps_overlay_include , ' /**.h ' ) ,
table_postfix_items ( x64_deps_overlay_include , ' /**.hxx ' ) ,
table_postfix_items ( x64_deps_overlay_include , ' /**.hpp ' ) ,
2024-05-22 06:01:25 +08:00
}
2024-06-15 21:54:01 +08:00
-- Windows common source files
filter { " system:windows " , }
2024-05-22 06:01:25 +08:00
removefiles {
" dll/wrap.cpp "
}
-- Windows x32 common source files
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " platforms:x32 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/client/32/resources.rc "
}
-- Windows x64 common source files
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " platforms:x64 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/client/64/resources.rc "
}
2024-06-15 21:54:01 +08:00
-- Linux common source files
filter { " system:not windows " , }
removefiles {
detours_files ,
}
2024-05-22 06:01:25 +08:00
-- libs to link
---------
2024-06-08 07:49:30 +08:00
filter { } -- reset the filter and remove all active keywords
links {
overlay_link ,
}
2024-05-22 06:01:25 +08:00
-- Windows libs to link
filter { " system:windows " , }
links {
common_link_win ,
}
-- Linux libs to link
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , }
2024-05-22 06:01:25 +08:00
links {
common_link_linux ,
}
-- libs search dir
---------
-- x32 libs search dir
filter { " platforms:x32 " , }
libdirs {
x32_deps_libdir ,
x32_deps_overlay_libdir ,
}
-- x64 libs search dir
filter { " platforms:x64 " , }
libdirs {
x64_deps_libdir ,
x64_deps_overlay_libdir ,
}
-- End steamclient_experimental
-- Project tool_lobby_connect
---------
project " tool_lobby_connect "
kind " ConsoleApp "
location " %{wks.location}/%{prj.name} "
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/tools/lobby_connect " )
targetname " lobby_connect_%{cfg.platform} "
-- defines
---------
filter { } -- reset the filter and remove all active keywords
defines { -- added to all filters, later defines will be appended
" NO_DISK_WRITES " , " LOBBY_CONNECT " ,
}
2024-05-29 03:52:23 +08:00
removedefines {
" CONTROLLER_SUPPORT " ,
}
2024-05-22 06:01:25 +08:00
-- include dir
---------
-- common include dir
-- x32 include dir
filter { " platforms:x32 " , }
includedirs {
x32_deps_include ,
}
-- x64 include dir
filter { " platforms:x64 " , }
includedirs {
x64_deps_include ,
}
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files { -- added to all filters, later defines will be appended
common_files ,
' tools/lobby_connect/lobby_connect.cpp '
}
2024-05-29 03:52:23 +08:00
removefiles {
2024-06-15 21:54:01 +08:00
" libs/gamepad/** " ,
detours_files ,
2024-05-29 03:52:23 +08:00
}
2024-05-22 06:01:25 +08:00
-- Windows x32 common source files
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " platforms:x32 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/launcher/32/resources.rc "
}
-- Windows x64 common source files
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " platforms:x64 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/launcher/64/resources.rc "
}
-- libs to link
---------
-- Windows libs to link
filter { " system:windows " , }
links {
common_link_win ,
2024-05-23 07:17:08 +08:00
' Comdlg32 ' ,
2024-05-22 06:01:25 +08:00
}
-- Linux libs to link
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , }
2024-05-22 06:01:25 +08:00
links {
common_link_linux ,
}
-- libs search dir
---------
-- x32 libs search dir
filter { " platforms:x32 " , }
libdirs {
x32_deps_libdir ,
}
-- x64 libs search dir
filter { " platforms:x64 " , }
libdirs {
x64_deps_libdir ,
}
-- End tool_lobby_connect
-- Project tool_generate_interfaces
project " tool_generate_interfaces "
kind " ConsoleApp "
location " %{wks.location}/%{prj.name} "
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/tools/generate_interfaces " )
targetname " generate_interfaces_%{cfg.platform} "
-- common source & header files
---------
files {
2024-06-15 21:54:01 +08:00
" tools/generate_interfaces/generate_interfaces.cpp "
2024-05-22 06:01:25 +08:00
}
-- End tool_generate_interfaces
-- Project lib_steamnetworkingsockets START
project " lib_steamnetworkingsockets "
kind " SharedLib "
location " %{wks.location}/%{prj.name} "
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/steamnetworkingsockets/%{cfg.platform} " )
targetname " steamnetworkingsockets "
2024-05-22 08:03:02 +08:00
2024-05-22 06:01:25 +08:00
-- common source & header files
---------
files {
" networking_sockets_lib/** " ,
2024-06-29 11:51:34 +08:00
" helpers/dbg_log.cpp " , " helpers/dbg_log/** " ,
' helpers/common_helpers.cpp ' , ' helpers/common_helpers/** ' ,
2024-05-22 06:01:25 +08:00
}
-- End lib_steamnetworkingsockets
-- Project lib_game_overlay_renderer
project " lib_game_overlay_renderer "
kind " SharedLib "
location " %{wks.location}/%{prj.name} "
-- targetdir
---------
filter { " system:windows " , }
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/steamclient_experimental " )
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , }
2024-05-22 06:01:25 +08:00
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/gameoverlayrenderer/%{cfg.platform} " )
-- name
---------
filter { " system:windows " , " platforms:x32 " , }
targetname " GameOverlayRenderer "
filter { " system:windows " , " platforms:x64 " , }
targetname " GameOverlayRenderer64 "
2024-06-15 21:54:01 +08:00
filter { " system:not windows " , }
2024-05-22 06:01:25 +08:00
targetname " gameoverlayrenderer "
-- include dir
---------
-- x32 include dir
filter { " platforms:x32 " , }
includedirs {
x32_deps_include ,
}
-- x64 include dir
filter { " platforms:x64 " , }
includedirs {
x64_deps_include ,
}
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files {
" game_overlay_renderer_lib/** "
}
-- x32 common source files
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " platforms:x32 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/game_overlay_renderer/32/resources.rc "
}
-- x64 common source files
2024-05-22 08:09:18 +08:00
filter { " system:windows " , " platforms:x64 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/game_overlay_renderer/64/resources.rc "
}
-- End lib_game_overlay_renderer
-- WINDOWS ONLY TARGETS START
if os.target ( ) == " windows " then
2024-05-24 10:39:37 +08:00
-- Project steamclient_experimental_stub
2024-05-22 06:01:25 +08:00
---------
2024-05-24 10:39:37 +08:00
project " steamclient_experimental_stub "
2024-05-22 06:01:25 +08:00
-- https://stackoverflow.com/a/63228027
kind " SharedLib "
location " %{wks.location}/%{prj.name} "
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/experimental/%{cfg.platform} " )
-- name
---------
filter { " platforms:x32 " , }
targetname " steamclient "
filter { " platforms:x64 " , }
targetname " steamclient64 "
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files { -- added to all filters, later defines will be appended
" steamclient/steamclient.cpp " ,
}
-- x32 common source files
2024-05-22 08:09:18 +08:00
filter { " platforms:x32 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/client/32/resources.rc "
}
-- x64 common source files
2024-05-22 08:09:18 +08:00
filter { " platforms:x64 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/client/64/resources.rc "
}
2024-05-24 10:39:37 +08:00
-- End steamclient_experimental_stub
2024-05-22 06:01:25 +08:00
2024-05-24 10:39:37 +08:00
-- Project steamclient_experimental_extra
project " steamclient_experimental_extra "
2024-05-22 06:01:25 +08:00
kind " SharedLib "
location " %{wks.location}/%{prj.name} "
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/steamclient_experimental/extra_dlls " )
targetname " steamclient_extra_%{cfg.platform} "
-- include dir
---------
-- x32 include dir
filter { " platforms:x32 " , }
includedirs {
x32_deps_include ,
}
-- x64 include dir
filter { " platforms:x64 " , }
includedirs {
x64_deps_include ,
}
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files {
" tools/steamclient_loader/win/extra_protection/** " ,
2024-06-15 21:54:01 +08:00
" helpers/pe_helpers.cpp " , " helpers/pe_helpers/** " ,
" helpers/common_helpers.cpp " , " helpers/common_helpers/** " ,
2024-05-22 06:01:25 +08:00
-- detours
2024-06-15 21:54:01 +08:00
detours_files ,
}
removefiles {
' libs/detours/uimports.cc ' ,
2024-05-22 06:01:25 +08:00
}
-- x32 common source files
2024-05-22 08:09:18 +08:00
filter { " platforms:x32 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/client/32/resources.rc "
}
-- x64 common source files
2024-05-22 08:09:18 +08:00
filter { " platforms:x64 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/client/64/resources.rc "
}
2024-05-24 10:39:37 +08:00
-- End steamclient_experimental_extra
2024-05-22 06:01:25 +08:00
2024-05-24 10:39:37 +08:00
-- Project steamclient_experimental_loader
project " steamclient_experimental_loader "
2024-05-22 06:01:25 +08:00
kind " WindowedApp "
location " %{wks.location}/%{prj.name} "
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/steamclient_experimental " )
targetname " steamclient_loader_%{cfg.platform} "
2024-05-24 15:02:51 +08:00
--- common compiler/linker options
---------
-- MinGW on Windows
filter { " action:gmake* " , }
-- source: https://gcc.gnu.org/onlinedocs/gcc/Cygwin-and-MinGW-Options.html
linkoptions {
-- MinGW on Windows cannot link wWinMain by default
" -municode " ,
}
2024-05-22 06:01:25 +08:00
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files {
2024-06-16 01:14:56 +08:00
" tools/steamclient_loader/win/* " , -- we want the .ini too
2024-06-15 21:54:01 +08:00
" helpers/pe_helpers.cpp " , " helpers/pe_helpers/** " ,
" helpers/common_helpers.cpp " , " helpers/common_helpers/** " ,
" helpers/dbg_log.cpp " , " helpers/dbg_log/** " ,
2024-06-29 11:51:34 +08:00
" libs/simpleini/** " ,
2024-05-22 06:01:25 +08:00
}
-- x32 common source files
2024-05-22 08:09:18 +08:00
filter { " platforms:x32 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/launcher/32/resources.rc "
}
-- x64 common source files
2024-05-22 08:09:18 +08:00
filter { " platforms:x64 " , " options:winrsrc " , }
2024-05-22 06:01:25 +08:00
files {
" resources/win/launcher/64/resources.rc "
}
-- libs to link
---------
filter { } -- reset the filter and remove all active keywords
links {
-- common_link_win,
2024-05-23 07:17:08 +08:00
' user32 ' ,
2024-05-22 06:01:25 +08:00
}
2024-05-24 10:39:37 +08:00
-- End steamclient_experimental_loader
2024-05-22 06:01:25 +08:00
2024-05-23 07:44:53 +08:00
2024-05-24 10:40:19 +08:00
-- Project tool_file_dos_stub_changer
project " tool_file_dos_stub_changer "
2024-05-23 07:44:53 +08:00
kind " ConsoleApp "
location " %{wks.location}/%{prj.name} "
2024-05-24 10:40:19 +08:00
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/file_dos_stub_changer " )
2024-05-23 07:44:53 +08:00
targetname " file_dos_stub_%{cfg.platform} "
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files {
" resources/win/file_dos_stub/file_dos_stub.cpp " ,
2024-06-15 21:54:01 +08:00
" helpers/pe_helpers.cpp " , " helpers/pe_helpers/** " ,
" helpers/common_helpers.cpp " , " helpers/common_helpers/** " ,
2024-05-23 07:44:53 +08:00
}
2024-05-24 10:40:19 +08:00
-- End tool_file_dos_stub_changer
2024-05-23 07:44:53 +08:00
2024-06-16 01:20:31 +08:00
-- Project test_crash_printer
---------
project " test_crash_printer "
kind " ConsoleApp "
location " %{wks.location}/%{prj.name} "
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/tests/crash_printer " )
targetname " test_crash_printer_%{cfg.platform} "
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files { -- added to all filters, later defines will be appended
' crash_printer/ ' .. os_iden .. ' .cpp ' , ' crash_printer/crash_printer/ ' .. os_iden .. ' .hpp ' ,
-- helpers
' helpers/common_helpers.cpp ' , ' helpers/common_helpers/** ' ,
-- test files
' crash_printer/tests/test_win.cpp ' ,
}
removefiles {
' post_build/** ' ,
' build/deps/** ' ,
}
-- libs to link
---------
filter { } -- reset the filter and remove all active keywords
-- Windows libs
links {
' Dbghelp ' ,
}
-- post build
---------
filter { } -- reset the filter and remove all active keywords
postbuildcommands {
' %[%{!cfg.buildtarget.abspath}] ' ,
}
-- End test_crash_printer
2024-05-22 06:01:25 +08:00
end
-- End WINDOWS ONLY TARGETS
2024-05-22 08:03:02 +08:00
2024-05-22 06:01:25 +08:00
-- LINUX ONLY TARGETS START
if os.target ( ) == " linux " then
2024-05-24 10:39:37 +08:00
-- Project steamclient_regular
2024-05-22 06:01:25 +08:00
---------
2024-05-24 10:39:37 +08:00
project " steamclient_regular "
2024-05-22 06:01:25 +08:00
kind " SharedLib "
location " %{wks.location}/%{prj.name} "
2024-05-22 08:03:02 +08:00
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/regular/%{cfg.platform} " )
2024-05-22 06:01:25 +08:00
targetname " steamclient "
-- defines
---------
filter { } -- reset the filter and remove all active keywords
defines { -- added to all filters, later defines will be appended
" STEAMCLIENT_DLL " ,
}
-- include dir
---------
-- x32 include dir
filter { " platforms:x32 " , }
includedirs {
x32_deps_include ,
}
-- x64 include dir
filter { " platforms:x64 " , }
includedirs {
x64_deps_include ,
}
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files { -- added to all filters, later defines will be appended
common_files ,
}
2024-06-15 21:54:01 +08:00
removefiles {
detours_files ,
}
2024-05-22 06:01:25 +08:00
-- libs to link
---------
filter { } -- reset the filter and remove all active keywords
links { -- added to all filters, later defines will be appended
common_link_linux ,
}
-- libs search dir
---------
-- x32 libs search dir
filter { " platforms:x32 " , }
libdirs {
x32_deps_libdir ,
}
-- x64 libs search dir
filter { " platforms:x64 " , }
libdirs {
x64_deps_libdir ,
}
2024-05-24 10:39:37 +08:00
-- End steamclient_regular
2024-05-22 06:01:25 +08:00
2024-06-16 01:20:31 +08:00
-- Project test_crash_printer_sa_handler
---------
project " test_crash_printer_sa_handler "
kind " ConsoleApp "
location " %{wks.location}/%{prj.name} "
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/tests/crash_printer " )
targetname " test_crash_printer_sa_handler_%{cfg.platform} "
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files { -- added to all filters, later defines will be appended
' crash_printer/ ' .. os_iden .. ' .cpp ' , ' crash_printer/crash_printer/ ' .. os_iden .. ' .hpp ' ,
-- helpers
' helpers/common_helpers.cpp ' , ' helpers/common_helpers/** ' ,
-- test files
' crash_printer/tests/test_linux_sa_handler.cpp ' ,
}
removefiles {
' post_build/** ' ,
' build/deps/** ' ,
}
-- post build
---------
filter { } -- reset the filter and remove all active keywords
postbuildcommands {
' %[%{!cfg.buildtarget.abspath}] ' ,
}
-- End test_crash_printer_sa_handler
-- Project test_crash_printer_sa_sigaction
---------
project " test_crash_printer_sa_sigaction "
kind " ConsoleApp "
location " %{wks.location}/%{prj.name} "
targetdir ( " build/ " .. os_iden .. " /%{_ACTION}/%{cfg.buildcfg}/tests/crash_printer " )
targetname " test_crash_printer_sa_sigaction_%{cfg.platform} "
-- common source & header files
---------
filter { } -- reset the filter and remove all active keywords
files { -- added to all filters, later defines will be appended
' crash_printer/ ' .. os_iden .. ' .cpp ' , ' crash_printer/crash_printer/ ' .. os_iden .. ' .hpp ' ,
-- helpers
' helpers/common_helpers.cpp ' , ' helpers/common_helpers/** ' ,
-- test files
' crash_printer/tests/test_linux_sa_sigaction.cpp ' ,
}
removefiles {
' post_build/** ' ,
' build/deps/** ' ,
}
-- post build
---------
filter { } -- reset the filter and remove all active keywords
postbuildcommands {
' %[%{!cfg.buildtarget.abspath}] ' ,
}
-- End test_crash_printer_sa_sigaction
2024-05-22 06:01:25 +08:00
end
-- End LINUX ONLY TARGETS
-- End Workspace