Add meson option to not link with LibSass

This commit is contained in:
scorpion-26 2024-04-14 18:03:34 +02:00
parent e58d51d140
commit b9ab546c4f
3 changed files with 14 additions and 3 deletions

View file

@ -37,8 +37,6 @@ gtk_layer_shell = dependency('gtk-layer-shell-0')
pulse = dependency('libpulse')
sass = dependency('libsass')
headers = [
'src/Common.h',
@ -72,7 +70,7 @@ sources = [
'src/SNI.cpp',
]
dependencies = [gtk, gtk_layer_shell, pulse, wayland_client, sass]
dependencies = [gtk, gtk_layer_shell, pulse, wayland_client]
if get_option('WithHyprland')
add_global_arguments('-DWITH_HYPRLAND', language: 'cpp')
@ -82,6 +80,10 @@ if get_option('WithWorkspaces')
add_global_arguments('-DWITH_WORKSPACES', language: 'cpp')
headers += 'src/Workspaces.h'
endif
if get_option('WithLibSass')
add_global_arguments('-DWITH_LIBSASS', language: 'cpp')
dependencies += dependency('libsass')
endif
if get_option('WithNvidia')
add_global_arguments('-DWITH_NVIDIA', language: 'cpp')
headers += 'src/NvidiaGPU.h'

View file

@ -4,6 +4,9 @@ option('WithHyprland', type: 'boolean', value : true)
# Workspaces general, enables Wayland protocol
option('WithWorkspaces', type: 'boolean', value : true)
# Support for loading SCSS directly
option('WithLibSass', type: 'boolean', value : true)
# Tray icons
option('WithSNI', type: 'boolean', value : true)

View file

@ -5,12 +5,15 @@
#include <array>
#include <fstream>
#ifdef WITH_LIBSASS
#include <sass.h>
#endif
namespace CSS
{
static GtkCssProvider* sProvider;
#ifdef WITH_LIBSASS
bool CompileAndLoadSCSS(const std::string& scssFile)
{
if (!std::ifstream(scssFile).is_open())
@ -43,6 +46,7 @@ namespace CSS
sass_delete_file_context(ctx);
return true;
}
#endif
bool LoadCSS(const std::string& cssFile)
{
@ -112,6 +116,7 @@ namespace CSS
for (auto& dir : locations)
{
#ifdef WITH_LIBSASS
if (!Config::Get().forceCSS)
{
if (CompileAndLoadSCSS(dir + "/style.scss"))
@ -124,6 +129,7 @@ namespace CSS
LOG("Warning: Failed loading SCSS, falling back to CSS!");
}
}
#endif
if (LoadCSS(dir + "/style.css"))
{