Support generate makefile

This commit is contained in:
dijunkun
2023-11-17 00:38:13 -08:00
parent bd2722f408
commit 0b90feed79
8 changed files with 76 additions and 53 deletions

View File

@@ -14,4 +14,14 @@ sudo apt-get install libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev li
sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev
sudo apt remove libssl-dev libglib2.0-dev sudo apt remove libssl-dev libglib2.0-dev
install:
@echo hello world
install -D build/linux/x86_64/release/remote_desk -t /usr/bin
install -D config/config.ini -t /usr/bin
install -D build/linux/x86_64/release/libprojectx.so -t /usr/lib
install -D thirdparty/nvcodec/Lib/x64/libnvidia-encode.so.1 -t /usr/lib
install -D thirdparty/nvcodec/Lib/x64/libnvidia-encode.so -t /usr/lib
install -D thirdparty/nvcodec/Lib/x64/libnvcuvid.so.1 -t /usr/lib
install -D thirdparty/nvcodec/Lib/x64/libnvcuvid.so -t /usr/lib

View File

@@ -20,7 +20,7 @@ X11SessionImpl::~X11SessionImpl() {
void X11SessionImpl::Release() { delete this; } void X11SessionImpl::Release() { delete this; }
int X11SessionImpl::Initialize() {} int X11SessionImpl::Initialize() { return 0; }
void X11SessionImpl::RegisterObserver(x11_session_observer *observer) { void X11SessionImpl::RegisterObserver(x11_session_observer *observer) {
observer_ = observer; observer_ = observer;

View File

@@ -28,7 +28,7 @@ package("ffmpeg")
add_versions("git:5.0.1", "n5.0.1") add_versions("git:5.0.1", "n5.0.1")
add_versions("git:4.0.2", "n4.0.2") add_versions("git:4.0.2", "n4.0.2")
add_configs("gpl", {description = "Enable GPL code", default = true, type = "boolean"}) add_configs("gpl", {description = "Enable GPL code", default = false, type = "boolean"})
add_configs("ffprobe", {description = "Enable ffprobe program.", default = false, type = "boolean"}) add_configs("ffprobe", {description = "Enable ffprobe program.", default = false, type = "boolean"})
add_configs("ffmpeg", {description = "Enable ffmpeg program.", default = true, type = "boolean"}) add_configs("ffmpeg", {description = "Enable ffmpeg program.", default = true, type = "boolean"})
add_configs("ffplay", {description = "Enable ffplay program.", default = false, type = "boolean"}) add_configs("ffplay", {description = "Enable ffplay program.", default = false, type = "boolean"})
@@ -42,14 +42,14 @@ package("ffmpeg")
add_configs("vdpau", {description = "Enable vdpau library.", default = false, type = "boolean"}) add_configs("vdpau", {description = "Enable vdpau library.", default = false, type = "boolean"})
add_configs("hardcoded-tables", {description = "Enable hardcoded tables.", default = true, type = "boolean"}) add_configs("hardcoded-tables", {description = "Enable hardcoded tables.", default = true, type = "boolean"})
add_configs("asm", {description = "Enable asm", default = false, type = "boolean"}) add_configs("asm", {description = "Enable asm", default = false, type = "boolean"})
add_configs("libx264", {description = "Enable libx264", default = true, type = "boolean"}) add_configs("libopenh264", {description = "Enable libopenh264", default = true, type = "boolean"})
end end
add_links("avfilter", "avdevice", "avformat", "avcodec", "swscale", "swresample", "avutil") add_links("avfilter", "avdevice", "avformat", "avcodec", "swscale", "swresample", "avutil")
if is_plat("macosx") then if is_plat("macosx") then
add_frameworks("CoreFoundation", "Foundation", "CoreVideo", "CoreMedia", "AudioToolbox", "VideoToolbox", "Security") add_frameworks("CoreFoundation", "Foundation", "CoreVideo", "CoreMedia", "AudioToolbox", "VideoToolbox", "Security")
elseif is_plat("linux") then elseif is_plat("linux") then
add_syslinks("pthread") add_syslinks("pthread", "openh264")
end end
if is_plat("linux", "macosx") then if is_plat("linux", "macosx") then

View File

@@ -68,13 +68,20 @@ target("remote_desk")
"-lxcb-shm", "-lXext", "-lX11", "-lXv", "-ldl", "-lpthread", "-lxcb-shm", "-lXext", "-lX11", "-lXv", "-ldl", "-lpthread",
{force = true}) {force = true})
end end
after_install(function (target)
os.cp("$(projectdir)/thirdparty/nvcodec/Lib/x64/*.so", "$(projectdir)/out/bin")
os.cp("$(projectdir)/thirdparty/nvcodec/Lib/x64/*.so.1", "$(projectdir)/out/bin")
os.cp("$(projectdir)/out/lib/*.so", "$(projectdir)/out/bin")
os.rm("$(projectdir)/out/include")
os.rm("$(projectdir)/out/lib")
end)
target("linux_capture") -- target("linux_capture")
set_kind("binary") -- set_kind("binary")
add_packages("sdl2", "imgui", "ffmpeg", "openh264") -- add_packages("sdl2", "imgui", "ffmpeg", "openh264")
add_files("remote_desk_gui/linux_capture.cpp") -- add_files("remote_desk_gui/linux_capture.cpp")
add_ldflags("-lavformat", "-lavdevice", "-lavfilter", "-lavcodec", -- add_ldflags("-lavformat", "-lavdevice", "-lavfilter", "-lavcodec",
"-lswscale", "-lavutil", "-lswresample", -- "-lswscale", "-lavutil", "-lswresample",
"-lasound", "-lxcb-shape", "-lxcb-xfixes", "-lsndio", "-lxcb", -- "-lasound", "-lxcb-shape", "-lxcb-xfixes", "-lsndio", "-lxcb",
"-lxcb-shm", "-lXext", "-lX11", "-lXv", "-lpthread", "-lSDL2", "-lopenh264", -- "-lxcb-shm", "-lXext", "-lX11", "-lXv", "-lpthread", "-lSDL2", "-lopenh264",
"-ldl" ,{force = true}) -- "-ldl" ,{force = true})

0
src/common/common.cpp Normal file
View File

0
src/log/log.cpp Normal file
View File

View File

View File

@@ -5,6 +5,7 @@ set_license("LGPL-3.0")
add_rules("mode.release", "mode.debug") add_rules("mode.release", "mode.debug")
set_languages("c++17") set_languages("c++17")
set_installdir("$(projectdir)/out")
option("server_only") option("server_only")
set_showmenu(true) set_showmenu(true)
@@ -20,7 +21,7 @@ if is_os("windows") then
add_links("windowsapp", "User32", "Strmiids", "Mfuuid", "Secur32", "Bcrypt") add_links("windowsapp", "User32", "Strmiids", "Mfuuid", "Secur32", "Bcrypt")
add_requires("cuda") add_requires("cuda")
elseif is_os("linux") then elseif is_os("linux") then
set_config("cflags", "-fPIC") add_cxflags("-fPIC")
add_syslinks("pthread") add_syslinks("pthread")
elseif is_os("macosx") then elseif is_os("macosx") then
add_ldflags("-ld_classic", {force = true}) add_ldflags("-ld_classic", {force = true})
@@ -39,7 +40,7 @@ else
add_packages("vcpkg::libnice") add_packages("vcpkg::libnice")
add_requires("openh264 2.1.1", {configs = {shared = false}}) add_requires("openh264 2.1.1", {configs = {shared = false}})
elseif is_os("linux") then elseif is_os("linux") then
add_requires("ffmpeg 5.1.2") add_requires("ffmpeg 5.1.2", {system = false})
add_requires("glib", {system = true}) add_requires("glib", {system = true})
add_requires("vcpkg::libnice 0.1.21") add_requires("vcpkg::libnice 0.1.21")
add_requires("openh264 2.1.1", {configs = {shared = false}}) add_requires("openh264 2.1.1", {configs = {shared = false}})
@@ -51,16 +52,17 @@ else
end end
includes("application/remote_desk") includes("application/remote_desk")
includes("application/signal_server") -- includes("application/signal_server")
target("log") target("log")
set_kind("headeronly") set_kind("static")
add_packages("spdlog") add_packages("spdlog")
add_headerfiles("src/log/log.h") add_files("src/log/log.cpp")
add_includedirs("src/log", {public = true}) add_includedirs("src/log", {public = true})
target("common") target("common")
set_kind("headeronly") set_kind("static")
add_files("src/common/common.cpp")
add_includedirs("src/common", {public = true}) add_includedirs("src/common", {public = true})
target("inih") target("inih")
@@ -69,7 +71,8 @@ else
add_includedirs("src/inih", {public = true}) add_includedirs("src/inih", {public = true})
target("ringbuffer") target("ringbuffer")
set_kind("headeronly") set_kind("static")
add_files("src/ringbuffer/ringbuffer.cpp")
add_includedirs("src/ringbuffer", {public = true}) add_includedirs("src/ringbuffer", {public = true})
target("thread") target("thread")
@@ -219,45 +222,48 @@ else
set_kind("shared") set_kind("shared")
add_deps("log") add_deps("log")
add_deps("pc") add_deps("pc")
add_installfiles("src/interface/*.h", {prefixdir = "include"})
add_files("src/rtc/*.cpp") add_files("src/rtc/*.cpp")
add_packages("asio", "nlohmann_json", "cuda") add_packages("asio", "nlohmann_json", "cuda")
add_includedirs("src/rtc", "src/pc", "src/interface") add_includedirs("src/rtc", "src/pc", "src/interface")
add_rules("utils.symbols.export_all", {export_classes = true}) add_rules("utils.symbols.export_all", {export_classes = true})
-- set_policy("build.merge_archive", true) -- after_install(function (target)
-- set_targetdir("$(projectdir)/libdrtc/lib") -- os.rm("$(projectdir)/out/lib/*.a")
-- os.rm("$(projectdir)/out/include/log.h")
-- end)
target("host") -- target("host")
set_kind("binary") -- set_kind("binary")
add_deps("projectx") -- add_deps("projectx")
add_files("tests/peerconnection/host.cpp") -- add_files("tests/peerconnection/host.cpp")
add_includedirs("src/interface") -- add_includedirs("src/interface")
target("guest") -- target("guest")
set_kind("binary") -- set_kind("binary")
add_deps("projectx") -- add_deps("projectx")
add_files("tests/peerconnection/guest.cpp") -- add_files("tests/peerconnection/guest.cpp")
add_includedirs("src/interface") -- add_includedirs("src/interface")
target("nicetest") -- target("nicetest")
set_kind("binary") -- set_kind("binary")
add_files("tests/peerconnection/nice.cpp") -- add_files("tests/peerconnection/nice.cpp")
add_includedirs("E:/SourceCode/vcpkg/installed/x64-windows-static/include/glib-2.0") -- add_includedirs("E:/SourceCode/vcpkg/installed/x64-windows-static/include/glib-2.0")
add_includedirs("E:/SourceCode/vcpkg/installed/x64-windows-static/lib/glib-2.0/include") -- add_includedirs("E:/SourceCode/vcpkg/installed/x64-windows-static/lib/glib-2.0/include")
add_linkdirs("E:/SourceCode/vcpkg/installed/x64-windows-static/lib") -- add_linkdirs("E:/SourceCode/vcpkg/installed/x64-windows-static/lib")
add_links("nice", "glib-2.0", "gio-2.0", "gmodule-2.0", "gobject-2.0", "gthread-2.0", -- add_links("nice", "glib-2.0", "gio-2.0", "gmodule-2.0", "gobject-2.0", "gthread-2.0",
"pcre2-8", "pcre2-16", "pcre2-32", "pcre2-posix", -- "pcre2-8", "pcre2-16", "pcre2-32", "pcre2-posix",
"zlib", "ffi", "libcrypto", "libssl", "intl", "iconv", "charset", "bz2", -- "zlib", "ffi", "libcrypto", "libssl", "intl", "iconv", "charset", "bz2",
"Shell32", "Advapi32", "Dnsapi", "Shlwapi", "Iphlpapi") -- "Shell32", "Advapi32", "Dnsapi", "Shlwapi", "Iphlpapi")
target("fec_client") -- target("fec_client")
set_kind("binary") -- set_kind("binary")
add_packages("openfec") -- add_packages("openfec")
add_files("tests/fec/simple_client.cpp") -- add_files("tests/fec/simple_client.cpp")
add_includedirs("tests/fec") -- add_includedirs("tests/fec")
target("fec_server") -- target("fec_server")
set_kind("binary") -- set_kind("binary")
add_packages("openfec") -- add_packages("openfec")
add_files("tests/fec/simple_server.cpp") -- add_files("tests/fec/simple_server.cpp")
add_includedirs("tests/fec") -- add_includedirs("tests/fec")
end end