Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REQUIRE_JEMALLOC and USE_RNNOISE switches #112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions external/jemalloc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,30 @@ if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
return()
endif()

set(DESKTOP_APP_REQUIRE_JEMALLOC ON CACHE BOOL "Always prefer jemalloc by FreeBSD or use system memory allocator?")
if (DESKTOP_APP_REQUIRE_JEMALLOC)
target_compile_definitions(external_jemalloc INTERFACE DESKTOP_APP_REQUIRE_JEMALLOC)
endif()

if (DESKTOP_APP_USE_PACKAGED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JEMALLOC jemalloc)

if (JEMALLOC_FOUND)
target_include_directories(external_jemalloc SYSTEM
INTERFACE
${JEMALLOC_INCLUDE_DIRS}
)

target_link_options(external_jemalloc
INTERFACE
-Wl,--push-state,--no-as-needed,${JEMALLOC_LINK_LIBRARIES},--pop-state
)
if (DESKTOP_APP_REQUIRE_JEMALLOC)
target_include_directories(external_jemalloc SYSTEM
INTERFACE
${JEMALLOC_INCLUDE_DIRS}
)

target_link_options(external_jemalloc
INTERFACE
-Wl,--push-state,--no-as-needed,${JEMALLOC_LINK_LIBRARIES},--pop-state
)
else()
target_compile_definitions(external_jemalloc INTERFACE _GNU_SOURCE)
target_compile_options(external_jemalloc INTERFACE ${JEMALLOC_CFLAGS})
endif()

return()
endif()
Expand Down
13 changes: 11 additions & 2 deletions external/rnnoise/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ if (DESKTOP_APP_USE_PACKAGED)
add_library(desktop-app::external_rnnoise ALIAS external_rnnoise)

find_package(PkgConfig REQUIRED)
pkg_check_modules(RNNOISE REQUIRED IMPORTED_TARGET rnnoise)
if (NOT DEFINED DESKTOP_APP_USE_RNNOISE)
pkg_check_modules(RNNOISE IMPORTED_TARGET rnnoise)
elseif (DESKTOP_APP_USE_RNNOISE)
pkg_check_modules(RNNOISE REQUIRED IMPORTED_TARGET rnnoise)
endif()
set(DESKTOP_APP_USE_RNNOISE ${RNNOISE_FOUND} CACHE BOOL "Compile against RNNoise or not?")

target_link_libraries(external_rnnoise INTERFACE PkgConfig::RNNOISE)
if (RNNOISE_FOUND)
target_link_libraries(external_rnnoise INTERFACE PkgConfig::RNNOISE)
else()
target_compile_definitions(external_rnnoise INTERFACE USE_RNNOISE=0)
endif()
return()
endif()

Expand Down