switch to xmake (hopefully everything works)
This commit is contained in:
parent
b1bbc19d62
commit
dfabc25ef8
|
@ -1,6 +1,7 @@
|
||||||
# noinspection SpellCheckingInspection
|
# noinspection SpellCheckingInspection
|
||||||
Checks: >
|
Checks: >
|
||||||
*,
|
*,
|
||||||
|
-ctad-maybe-unsupported,
|
||||||
-abseil-*,
|
-abseil-*,
|
||||||
-altera-*,
|
-altera-*,
|
||||||
-bugprone-easily-swappable-parameters,
|
-bugprone-easily-swappable-parameters,
|
||||||
|
|
4
.clangd
4
.clangd
|
@ -1,2 +1,4 @@
|
||||||
Diagnostics:
|
Diagnostics:
|
||||||
Suppress: -Wmissing-template-arg-list-after-template-kw
|
Suppress: >
|
||||||
|
-Wmissing-template-arg-list-after-template-kw,
|
||||||
|
-Wctad-maybe-unsupported
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,6 +4,7 @@
|
||||||
.idea/
|
.idea/
|
||||||
.vs/
|
.vs/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.xmake/
|
||||||
|
|
||||||
bin/
|
bin/
|
||||||
build/
|
build/
|
||||||
|
|
116
meson.build
116
meson.build
|
@ -1,116 +0,0 @@
|
||||||
project(
|
|
||||||
'draconis++', 'cpp',
|
|
||||||
version: '0.1.0',
|
|
||||||
default_options: [
|
|
||||||
'cpp_std=c++20',
|
|
||||||
'default_library=static',
|
|
||||||
'warning_level=everything',
|
|
||||||
'buildtype=release'
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
cpp = meson.get_compiler('cpp')
|
|
||||||
|
|
||||||
if host_machine.system() == 'darwin'
|
|
||||||
add_languages('objcpp')
|
|
||||||
objcpp = meson.get_compiler('objcpp')
|
|
||||||
add_project_arguments(
|
|
||||||
objcpp.get_supported_arguments([
|
|
||||||
'-Wno-c++20-compat',
|
|
||||||
'-Wno-c++20-extensions',
|
|
||||||
'-Wno-c++98-compat',
|
|
||||||
'-Wno-c++98-compat-pedantic',
|
|
||||||
'-Wno-disabled-macro-expansion',
|
|
||||||
'-Wno-missing-prototypes',
|
|
||||||
'-Wno-padded',
|
|
||||||
'-Wno-pre-c++20-compat-pedantic',
|
|
||||||
'-Wno-switch-default',
|
|
||||||
'-Wunused-function',
|
|
||||||
'-fvisibility=hidden'
|
|
||||||
]),
|
|
||||||
language: 'objcpp'
|
|
||||||
)
|
|
||||||
endif
|
|
||||||
|
|
||||||
common_cpp_args = [
|
|
||||||
'-Wno-c++20-compat',
|
|
||||||
'-Wno-c++20-extensions',
|
|
||||||
'-Wno-c++98-compat',
|
|
||||||
'-Wno-c++98-compat-pedantic',
|
|
||||||
'-Wno-disabled-macro-expansion',
|
|
||||||
'-Wno-missing-prototypes',
|
|
||||||
'-Wno-padded',
|
|
||||||
'-Wno-pre-c++20-compat-pedantic',
|
|
||||||
'-Wno-switch-default',
|
|
||||||
'-Wunused-function',
|
|
||||||
'-fvisibility=hidden'
|
|
||||||
]
|
|
||||||
|
|
||||||
if host_machine.system() == 'windows'
|
|
||||||
common_cpp_args += ['-DCURL_STATICLIB']
|
|
||||||
endif
|
|
||||||
|
|
||||||
add_project_arguments(
|
|
||||||
cpp.get_supported_arguments(common_cpp_args),
|
|
||||||
language: 'cpp'
|
|
||||||
)
|
|
||||||
|
|
||||||
source_file_names = [
|
|
||||||
'src/main.cpp',
|
|
||||||
'src/config/config.cpp',
|
|
||||||
'src/config/weather.cpp'
|
|
||||||
]
|
|
||||||
|
|
||||||
if host_machine.system() == 'linux'
|
|
||||||
source_file_names += ['src/os/linux.cpp']
|
|
||||||
elif host_machine.system() == 'freebsd'
|
|
||||||
source_file_names += ['src/os/freebsd.cpp']
|
|
||||||
elif host_machine.system() == 'darwin'
|
|
||||||
source_file_names += [
|
|
||||||
'src/os/macos.cpp',
|
|
||||||
'src/os/macos/bridge.mm',
|
|
||||||
]
|
|
||||||
elif host_machine.system() == 'windows'
|
|
||||||
source_file_names += ['src/os/windows.cpp']
|
|
||||||
endif
|
|
||||||
|
|
||||||
sources = []
|
|
||||||
|
|
||||||
foreach file : source_file_names
|
|
||||||
sources += files(file)
|
|
||||||
endforeach
|
|
||||||
|
|
||||||
deps = [
|
|
||||||
dependency('fmt'),
|
|
||||||
dependency('libcurl'),
|
|
||||||
dependency('tomlplusplus'),
|
|
||||||
dependency('yyjson')
|
|
||||||
]
|
|
||||||
|
|
||||||
if host_machine.system() == 'darwin'
|
|
||||||
deps += dependency('Foundation')
|
|
||||||
deps += dependency('MediaPlayer')
|
|
||||||
deps += dependency('SystemConfiguration')
|
|
||||||
deps += dependency('iconv')
|
|
||||||
elif host_machine.system() == 'linux' or host_machine.system() == 'freebsd'
|
|
||||||
deps += dependency('sdbus-c++')
|
|
||||||
deps += dependency('x11')
|
|
||||||
endif
|
|
||||||
|
|
||||||
objc_args = []
|
|
||||||
link_args = []
|
|
||||||
|
|
||||||
if host_machine.system() == 'darwin'
|
|
||||||
objc_args += ['-fobjc-arc']
|
|
||||||
elif host_machine.system() == 'windows'
|
|
||||||
windows_sdk_lib_dir = 'C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64'
|
|
||||||
link_args += ['-L' + windows_sdk_lib_dir, '-lwindowsapp', '-static']
|
|
||||||
endif
|
|
||||||
|
|
||||||
executable(
|
|
||||||
'draconis++',
|
|
||||||
sources,
|
|
||||||
objc_args: objc_args,
|
|
||||||
link_args: link_args,
|
|
||||||
dependencies: deps
|
|
||||||
)
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -27,17 +28,15 @@ inline fn GetConfigPath() -> std::string {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Config::getInstance() -> Config {
|
fn Config::getInstance() -> Config {
|
||||||
try {
|
|
||||||
fs::path configPath = GetConfigPath();
|
fs::path configPath = GetConfigPath();
|
||||||
configPath /= "draconis++/config.toml";
|
configPath /= "draconis++/config.toml";
|
||||||
|
|
||||||
const Result<Config> result = rfl::toml::load<Config>(configPath.string());
|
const Result<Config> result = rfl::toml::load<Config>(configPath.string());
|
||||||
|
|
||||||
if (result)
|
if (!result) {
|
||||||
return result.value();
|
fmt::println(stderr, "Failed to load config file: {}", result.error()->what());
|
||||||
|
exit(1);
|
||||||
fmt::println("Failed to load config file: {}", result.error().value().what());
|
}
|
||||||
} catch (const std::exception& e) { fmt::println("Error getting config path: {}", e.what()); }
|
|
||||||
|
return result.value();
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,8 @@ fn main() -> i32 {
|
||||||
const string nowPlaying = GetNowPlaying();
|
const string nowPlaying = GetNowPlaying();
|
||||||
if (!nowPlaying.empty())
|
if (!nowPlaying.empty())
|
||||||
fmt::println("{}", nowPlaying);
|
fmt::println("{}", nowPlaying);
|
||||||
else fmt::println("No song playing");
|
else
|
||||||
|
fmt::println("No song playing");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
70
xmake.lua
Normal file
70
xmake.lua
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
---@diagnostic disable: undefined-field, undefined-global
|
||||||
|
|
||||||
|
add_requires("fmt", "libcurl", "tomlplusplus", "yyjson")
|
||||||
|
|
||||||
|
if os.host() == "macosx" then
|
||||||
|
add_requires("Foundation", "MediaPlayer", "SystemConfiguration", "iconv")
|
||||||
|
elseif os.host() == "linux" or os.host() == "bsd" then
|
||||||
|
add_requires("sdbus-c++", "x11")
|
||||||
|
end
|
||||||
|
|
||||||
|
add_cxxflags(
|
||||||
|
"-Wno-c++20-compat",
|
||||||
|
"-Wno-c++20-extensions",
|
||||||
|
"-Wno-c++98-compat",
|
||||||
|
"-Wno-c++98-compat-pedantic",
|
||||||
|
"-Wno-disabled-macro-expansion",
|
||||||
|
"-Wno-missing-prototypes",
|
||||||
|
"-Wno-padded",
|
||||||
|
"-Wno-pre-c++20-compat-pedantic",
|
||||||
|
"-Wno-switch-default",
|
||||||
|
"-Wunused-function",
|
||||||
|
"-fvisibility=hidden"
|
||||||
|
)
|
||||||
|
|
||||||
|
if os.host() == "macosx" then
|
||||||
|
add_mxxflags(
|
||||||
|
"-Wno-c++20-compat",
|
||||||
|
"-Wno-c++20-extensions",
|
||||||
|
"-Wno-c++98-compat",
|
||||||
|
"-Wno-c++98-compat-pedantic",
|
||||||
|
"-Wno-disabled-macro-expansion",
|
||||||
|
"-Wno-missing-prototypes",
|
||||||
|
"-Wno-padded",
|
||||||
|
"-Wno-pre-c++20-compat-pedantic",
|
||||||
|
"-Wno-switch-default",
|
||||||
|
"-Wunused-function",
|
||||||
|
"-fvisibility=hidden",
|
||||||
|
"-fobjc-arc"
|
||||||
|
)
|
||||||
|
elseif os.host() == "windows" then
|
||||||
|
add_cxxflags("-DCURL_STATICLIB")
|
||||||
|
add_ldflags("-LC:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64", "-lwindowsapp", "static")
|
||||||
|
end
|
||||||
|
|
||||||
|
target("draconis++")
|
||||||
|
set_languages("c++20")
|
||||||
|
set_kind("binary")
|
||||||
|
|
||||||
|
add_rules("plugin.compile_commands.autoupdate", { outputdir = "." })
|
||||||
|
add_rules("mode.debug", "mode.release")
|
||||||
|
|
||||||
|
add_files("src/main.cpp", "src/config/config.cpp", "src/config/weather.cpp")
|
||||||
|
|
||||||
|
if os.host() == "bsd" then
|
||||||
|
add_files("src/os/freebsd.cpp")
|
||||||
|
elseif os.host() == "linux" then
|
||||||
|
add_files("src/os/linux.cpp")
|
||||||
|
elseif os.host() == "macosx" then
|
||||||
|
add_files("src/os/macos.cpp", "src/os/macos/bridge.mm")
|
||||||
|
elseif os.host() == "windows" then
|
||||||
|
add_files("src/os/windows.cpp")
|
||||||
|
end
|
||||||
|
|
||||||
|
add_packages("fmt", "libcurl", "tomlplusplus", "yyjson")
|
||||||
|
|
||||||
|
if os.host() == "macosx" then
|
||||||
|
add_packages("Foundation", "MediaPlayer", "SystemConfiguration", "iconv")
|
||||||
|
elseif os.host() == "linux" or os.host() == "bsd" then
|
||||||
|
add_packages("sdbus-c++", "x11")
|
||||||
|
end
|
Loading…
Reference in a new issue