diff --git a/CMakeLists.txt b/CMakeLists.txt index 4986d24f8..5edd3a349 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,10 +39,20 @@ if (NOT CMAKE_BUILD_TYPE) endif() if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + # If the user does not specify NO_ALSA, check for the package, and THEN set the definition + # so the build doesn't fail. if (NOT NO_ALSA) - find_package(ALSA REQUIRED) - add_definitions(-DUSE_ALSA) + find_package(ALSA) + if (ALSA_FOUND) + add_definitions(-DUSE_ALSA) + message(STATUS "Building the Clipboard Project with ALSA support.") + else() + message(STATUS "ALSA Library not found, building the Clipboard Project without ALSA support.") + endif() + else() + message(STATUS "Building the Clipboard Project without ALSA support.") endif() + #find_path(LIBURING_INCLUDE_DIR liburing.h) #if (LIBURING_INCLUDE_DIR) # message(STATUS "Building the Clipboard Project with io_uring support") @@ -96,14 +106,14 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${LIB_LOCATION}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${BIN_LOCATION}) function(enable_lto this_target) -include(CheckIPOSupported) -check_ipo_supported(RESULT lto_supported) -if(lto_supported AND NOT NO_LTO) - set_property(TARGET ${this_target} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) - if(CMAKE_COMPILER_IS_GNUCXX) - list(APPEND CMAKE_CXX_COMPILE_OPTIONS_IPO "-flto=auto") # set the thread amount to what is available on the CPU + include(CheckIPOSupported) + check_ipo_supported(RESULT lto_supported) + if(lto_supported AND NOT NO_LTO) + set_property(TARGET ${this_target} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) + if(CMAKE_COMPILER_IS_GNUCXX) + list(APPEND CMAKE_CXX_COMPILE_OPTIONS_IPO "-flto=auto") # set the thread amount to what is available on the CPU + endif() endif() -endif() endfunction() add_subdirectory(src/gui) diff --git a/install.sh b/install.sh index fe1f2727a..b7b7c2f19 100755 --- a/install.sh +++ b/install.sh @@ -101,13 +101,13 @@ then fi verify_flatpak -elif command -v snap > /dev/null 2>&1 -then - if can_use_sudo - then - sudo snap install clipboard - verify - fi +# elif command -v snap > /dev/null 2>&1 +# then +# if can_use_sudo +# then +# sudo snap install clipboard +# verify +# fi elif command -v nix-env > /dev/null 2>&1 then nix-env -iA nixpkgs.clipboard-jh diff --git a/src/cb/src/platforms/linux.cpp b/src/cb/src/platforms/linux.cpp index d70a6f413..74d40f67a 100644 --- a/src/cb/src/platforms/linux.cpp +++ b/src/cb/src/platforms/linux.cpp @@ -14,7 +14,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see .*/ #include "../clipboard.hpp" +#if defined(USE_ALSA) #include +#endif void dummy_handler(const char* file, int line, const char* function, int err, const char* fmt, ...) {} @@ -47,4 +49,4 @@ bool playAsyncSoundEffect(const std::valarray& samples) { #else return false; #endif -} \ No newline at end of file +}