diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..12c2790 --- /dev/null +++ b/meson.build @@ -0,0 +1,117 @@ +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 +) + diff --git a/xmake.lua b/xmake.lua deleted file mode 100644 index a62d8e3..0000000 --- a/xmake.lua +++ /dev/null @@ -1,70 +0,0 @@ ----@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