heyManNice / EasyMusic

这是一个致力于用C++和win32api打造的开源第三方网易云音乐。
BSD 3-Clause "New" or "Revised" License
343 stars 13 forks source link

Improve project #3

Open star-hengxing opened 11 months ago

star-hengxing commented 11 months ago

这里写了一个简单 xmake.lua 文件,可以直接编译当前项目。

set_project("EasyMusic")

set_xmakever("2.8.3")

set_allowedplats("windows")
set_allowedmodes("debug", "release")

set_languages("c++20")

set_warnings("all")
add_rules("mode.debug", "mode.release")

set_encodings("source:utf-8")

add_requires("stb", "cpr", "yyjson")

if is_mode("release") and is_plat("windows") then
    add_requires("vc-ltl5")
end

target("EasyMusic")
    set_kind("binary")
    add_files("*.cpp")

    if is_plat("windows") then
        add_syslinks("gdi32", "dwmapi")
    end

    add_packages("stb", "cpr", "yyjson")
    if is_mode("release") and is_plat("windows") then
        add_packages("vc-ltl5")
    end

使用之前需要把 myhead.h 里的 #pragma comment 全部注释掉。 并确保你的电脑正确安装了 VS 2022。

操作:

$ xmake -y 
[  7%]: compiling.release allClass.cpp
[  7%]: compiling.release allProc.cpp
[  7%]: compiling.release foottool.cpp
[  7%]: compiling.release gdiDevice.cpp
[  7%]: compiling.release headtool.cpp
[  7%]: compiling.release Lmenu.cpp
[  7%]: compiling.release main.cpp
[  7%]: compiling.release mytools.cpp
[  7%]: compiling.release network.cpp
[  7%]: compiling.release PlayingSong.cpp
[  7%]: compiling.release tooltip.cpp
[ 85%]: linking.release EasyMusic.exe
[100%]: build ok, spent 5.015s
$ eza -l -T build 
d----    -  3 Oct 17:27 build
d----    -  3 Oct 17:27 └── windows
d----    -  3 Oct 17:27    └── x64
d----    -  3 Oct 17:27       └── release
-a--- 902k  3 Oct 17:27          └── EasyMusic.exe
heyManNice commented 11 months ago

xmake非常方便的构建工具。脚本也很好用,解决了我安装库遇到的错误。稍作研究后将采纳你的意见