364 lines
15 KiB
CMake
364 lines
15 KiB
CMake
cmake_minimum_required(VERSION 3.22)
|
|
project(looper VERSION 1.0.0 LANGUAGES C CXX)
|
|
|
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Emscripten")
|
|
set(EMSCRIPTEN ON)
|
|
message("Building for WASM.")
|
|
endif()
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(SDL_MIXER_X_STATIC ON CACHE BOOL "")
|
|
set(SDL_MIXER_X_SHARED OFF CACHE BOOL "")
|
|
set(DOWNLOAD_AUDIO_CODECS_DEPENDENCY OFF CACHE BOOL "")
|
|
set(AUDIO_CODECS_BUILD_LOCAL_SDL2 OFF CACHE BOOL "" FORCE)
|
|
set(MIXERX_LGPL ON CACHE BOOL "" FORCE)
|
|
set(USE_MIDI ON CACHE BOOL "" FORCE)
|
|
set(USE_MIDI_NATIVE_ALT OFF CACHE BOOL "" FORCE)
|
|
set(USE_MIDI_NATIVE OFF CACHE BOOL "" FORCE)
|
|
set(USE_MIDI_TIMIDITY OFF CACHE BOOL "" FORCE)
|
|
set(USE_MIDI_FLUIDLITE OFF CACHE BOOL "" FORCE)
|
|
set(USE_MIDI_OPNMIDI OFF CACHE BOOL "" FORCE)
|
|
set(USE_MIDI_ADLMIDI OFF CACHE BOOL "" FORCE)
|
|
set(USE_MIDI_FLUIDSYNTH ON CACHE BOOL "" FORCE)
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
set(BUILD_FB2K OFF CACHE BOOL "" FORCE)
|
|
set(BUILD_CLI OFF CACHE BOOL "" FORCE)
|
|
set(BUILD_WINAMP OFF CACHE BOOL "" FORCE)
|
|
set(BUILD_XMPLAY OFF CACHE BOOL "" FORCE)
|
|
set(BUILD_AUDACIOUS OFF CACHE BOOL "" FORCE)
|
|
set(BUILD_V123 OFF CACHE BOOL "" FORCE)
|
|
set(JSONCPP_WITH_TESTS OFF CACHE BOOL "" FORCE)
|
|
set(BUILD_STATIC_LIBS ON CACHE BOOL "" FORCE)
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
|
set(JSONCPP_WITH_PKGCONFIG_SUPPORT OFF CACHE BOOL "" FORCE)
|
|
set(JSONCPP_WITH_CMAKE_PACKAGE OFF CACHE BOOL "" FORCE)
|
|
option(ENABLE_DBUS "Enables DBus support" ON)
|
|
option(USE_PORTALS "Enables libportal" ON)
|
|
if (DEFINED EMSCRIPTEN)
|
|
set(BUILD_STATIC ON CACHE BOOL "" FORCE)
|
|
set(ENABLE_DBUS OFF CACHE BOOL "" FORCE)
|
|
set(DOWNLOAD_AUDIO_CODECS_DEPENDENCY ON CACHE BOOL "" FORCE)
|
|
set(SDL_MIXER_X_SHARED OFF CACHE BOOL "" FORCE)
|
|
set(SDL_MIXER_X_STATIC ON CACHE BOOL "" FORCE)
|
|
set(USE_OGG_VORBIS_STB ON CACHE BOOL "" FORCE)
|
|
set(USE_OPUS OFF CACHE BOOL "" FORCE)
|
|
set(USE_MODPLUG OFF CACHE BOOL "" FORCE)
|
|
set(USE_GME OFF CACHE BOOL "" FORCE)
|
|
set(USE_WAVPACK OFF CACHE BOOL "" FORCE)
|
|
set(USE_XMP OFF CACHE BOOL "" FORCE)
|
|
set(USE_MIDI_EDMIDI OFF CACHE BOOL "" FORCE)
|
|
set(USE_PORTALS OFF CACHE BOOL "" FORCE)
|
|
set(USE_SYSTEM_SDL2 ON CACHE BOOL "" FORCE)
|
|
set(USE_MPEG OFF CACHE BOOL "" FORCE)
|
|
set(USE_CELT OFF CACHE BOOL "" FORCE)
|
|
set(USE_ATRAC9 OFF CACHE BOOL "" FORCE)
|
|
set(USE_SPEEX OFF CACHE BOOL "" FORCE)
|
|
set(USE_G719 OFF CACHE BOOL "" FORCE)
|
|
set(EXTRA_FLAGS "-sUSE_VORBIS -sUSE_MPG123=1 -sUSE_ZLIB -sUSE_OGG=1 -sUSE_MODPLUG=1 -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 --shell-file=${CMAKE_CURRENT_SOURCE_DIR}/web/shell.html --js-library=${CMAKE_CURRENT_SOURCE_DIR}/web/api.js")
|
|
set(DEBUG_INFO ${CMAKE_BUILD_TYPE} STREQUAL Debug OR ${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo)
|
|
set(RELASE_OPTS ${CMAKE_BUILD_TYPE} STREQUAL Release OR ${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo)
|
|
set(PROFILE_ENABLED ${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo)
|
|
set(EXTRA_LINKER_FLAGS "-sALLOW_MEMORY_GROWTH=1 -sEXPORTED_RUNTIME_METHODS=UTF8ToString,stringToUTF8,lengthBytesUTF8 -sEXPORTED_FUNCTIONS=_malloc,_main -sASYNCIFY_IMPORTS=read_file")
|
|
set(OPENMP OFF CACHE BOOL "" FORCE)
|
|
set(SOUNDSTRETCH OFF CACHE BOOL "" FORCE)
|
|
set(SOUNDTOUCH_DLL OFF CACHE BOOL "" FORCE)
|
|
if(DEBUG_INFO)
|
|
option(STACK_OVERFLOW_CHECK "Enables extra stack overflow checks" OFF)
|
|
if(${STACK_OVERFLOW_CHECK})
|
|
set(EXTRA_LINKER_FLAGS "${EXTRA_LINKER_FLAGS} -sSTACK_OVERFLOW_CHECK=2")
|
|
endif()
|
|
set(EXTRA_FLAGS "${EXTRA_FLAGS} -g -gsource-map")
|
|
set(EXTRA_LINKER_FLAGS "${EXTRA_LINKER_FLAGS} --emit-symbol-map -sASSERTIONS=1")
|
|
endif()
|
|
if(RELEASE_OPTS)
|
|
set(EXTRA_FLAGS "${EXTRA_FLAGS} -flto")
|
|
set(EXTRA_LINKER_FLAGS "${EXTRA_LINKER_FLAGS} --closure 1")
|
|
endif()
|
|
if(PROFILE_ENABLED)
|
|
set(EXTRA_LINKER_FLAGS "${EXTRA_LINKER_FLAGS} --profiling --profiling-funcs")
|
|
endif()
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}")
|
|
set(EXTRA_LINKER_FLAGS "${EXTRA_LINKER_FLAGS} ${EXTRA_FLAGS}")
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_LINKER_FLAGS}")
|
|
set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/web/cmake" ${CMAKE_FIND_ROOT_PATH})
|
|
set(SDL2_DIR ${CMAKE_CURRENT_SOURCE_DIR}/web/cmake)
|
|
else()
|
|
set(BUILD_STATIC OFF CACHE BOOL "")
|
|
endif()
|
|
option(BUILD_SDL "Enables built-in SDL" OFF)
|
|
option(BUILD_SDL_IMAGE "Enables built-in SDL_image" ${BUILD_SDL})
|
|
if(DEFINED ANDROID_NDK)
|
|
set(USE_SYSTEM_SDL2 ON CACHE BOOL "" FORCE)
|
|
set(AUDIOCODECS_BUILD_TIMIDITYSDL OFF CACHE BOOL "" FORCE)
|
|
set(AUDIOCODECS_BUILD_OPUS OFF CACHE BOOL "" FORCE)
|
|
set(USE_OGG_VORBIS_STB ON CACHE BOOL "" FORCE)
|
|
set(AUDIOCODECS_BUILD_WAVPACK OFF CACHE BOOL "" FORCE)
|
|
set(USE_WAVPACK OFF CACHE BOOL "" FORCE)
|
|
set(USE_MODPLUG OFF CACHE BOOL "" FORCE)
|
|
set(USE_XMP OFF CACHE BOOL "" FORCE)
|
|
set(USE_GME OFF CACHE BOOL "" FORCE)
|
|
set(USE_MIDI_EDMIDI OFF CACHE BOOL "" FORCE)
|
|
set(USE_OPUS OFF CACHE BOOL "" FORCE)
|
|
set(USE_MPEG OFF CACHE BOOL "" FORCE)
|
|
set(USE_CELT OFF CACHE BOOL "" FORCE)
|
|
set(USE_ATRAC9 OFF CACHE BOOL "" FORCE)
|
|
set(USE_SPEEX OFF CACHE BOOL "" FORCE)
|
|
set(USE_G719 OFF CACHE BOOL "" FORCE)
|
|
set(USE_VORBIS OFF CACHE BOOL "" FORCE)
|
|
endif()
|
|
if (BUILD_SDL)
|
|
set(SDL_SHARED OFF CACHE BOOL "" FORCE)
|
|
set(SDL_STATIC ON CACHE BOOL "" FORCE)
|
|
set(SDL_TEST OFF CACHE BOOL "" FORCE)
|
|
set(USE_SYSTEM_SDL2 ON CACHE BOOL "" FORCE)
|
|
set(SDL_MIXER_X_STATIC ON CACHE BOOL "" FORCE)
|
|
add_subdirectory(${CMAKE_SOURCE_DIR}/subprojects/SDL)
|
|
install(TARGETS SDL2-static SDL2main EXPORT SDL_EXPORTS)
|
|
install(EXPORT SDL_EXPORTS DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
|
export(TARGETS SDL2-static sdl-build-options SDL2main FILE ${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake NAMESPACE SDL2)
|
|
set(SDL2_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake/built_sdl)
|
|
endif()
|
|
if (BUILD_SDL_IMAGE)
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
|
set(SDL2IMAGE_SAMPLES OFF CACHE BOOL "" FORCE)
|
|
set(SDL2IMAGE_TESTS OFF CACHE BOOL "" FORCE)
|
|
add_subdirectory(${CMAKE_SOURCE_DIR}/subprojects/SDL_image)
|
|
set(SDL2_image_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake/built_sdl_image)
|
|
endif()
|
|
find_package(PkgConfig)
|
|
#add_subdirectory(subprojects/jsoncpp)
|
|
|
|
include(GNUInstallDirs)
|
|
add_subdirectory(subprojects/SDL-Mixer-X)
|
|
add_subdirectory(subprojects/vgmstream)
|
|
|
|
if (DEFINED EMSCRIPTEN)
|
|
set(EXTRA_LIBS )
|
|
else()
|
|
set(EXTRA_LIBS libvgmstream_shared)
|
|
endif()
|
|
if(SDL_MIXER_X_STATIC)
|
|
set(SDL_MIXER_X_TARGET SDL2_mixer_ext_Static)
|
|
else()
|
|
set(SDL_MIXER_X_TARGET SDL2_mixer_ext)
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${SDL_MIXER_X_TARGET})
|
|
endif()
|
|
add_custom_target(looper_assets COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/assets/update_assets.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
|
find_package(Git)
|
|
if (Git_FOUND)
|
|
execute_process(COMMAND ./version.sh OUTPUT_VARIABLE TAG WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
message("" ${TAG})
|
|
else()
|
|
set(TAG "unknown")
|
|
endif()
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
set(DEBUG ON)
|
|
endif()
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|
include(log)
|
|
#execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/meson2cmake_cfg.py ${CMAKE_CURRENT_SOURCE_DIR}/config.meson.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in)
|
|
set(DEBUG_MODE_VALUE ${DEBUG})
|
|
configure_file(config.cmake.h.in config.h)
|
|
|
|
macro(target_pkgconfig)
|
|
push_fnstack("target_pkgconfig")
|
|
cmake_parse_arguments(PARSED_ARGS "OPTIONAL;PRIVATE;PUBLIC;INTERFACE" "PREFIX" "TARGETS;LIBRARIES" ${ARGN})
|
|
if (NOT ${PARSED_ARGS_PREFIX})
|
|
warning(MESSAGE "No prefix specified for reading thie PKGConfig variable to. Attempting to guess it from the library specification...")
|
|
if (NOT ${PARSED_ARGS_LIBRARIES})
|
|
fatal(MESSAGE "... But it turns out no library specification was specified. Giving up.")
|
|
else()
|
|
set(PARSED_ARGS_PREFIX ${PARSED_ARGS_LIBRARIES})
|
|
endif()
|
|
else()
|
|
if(NOT ${PARSED_ARGS_NAME})
|
|
warning(MESSAGE "No library name was specified. Assuming it is the same as the prefix.")
|
|
set(PARSED_ARGS_LIBSPEC ${PARSED_ARGS_LIBRARIES})
|
|
endif()
|
|
endif()
|
|
pkg_check_modules(${PARSED_ARGS_PREFIX} IMPORTED_TARGET ${PARSED_ARGS_LIBRARIES})
|
|
set(PARSED_ARGS_PUBLICITY PRIVATE)
|
|
if(${PARSED_ARGS_PRIVATE})
|
|
set(PARSED_ARGS_PUBLICITY PRIVATE)
|
|
elseif(${PARSED_ARGS_PUBLIC})
|
|
set(PARSED_ARGS_PUBLICITY PUBLIC)
|
|
elseif(${PARSED_ARGS_INTERFACE})
|
|
set(PARSED_ARGS_PUBLICITY INTERFACE)
|
|
endif()
|
|
foreach(TARGET IN ITEMS ${PARSED_ARGS_TARGETS})
|
|
target_link_libraries(${TARGET} ${PARSED_ARGS_PUBLICITY} PkgConfig::${PARSED_ARGS_PREFIX})
|
|
endforeach()
|
|
pop_fnstack()
|
|
endmacro()
|
|
set(INC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} subprojects/vgmstream/src subprojects/vgmstream/src/base)
|
|
set(UI_BACKENDS "")
|
|
list(POP_FRONT UI_BACKENDS)
|
|
macro(prefix_all)
|
|
set(ARGS ${ARGV})
|
|
list(POP_FRONT ARGS OUT_VAR PREFIX)
|
|
set(${OUT_VAR} )
|
|
foreach(ARG IN ITEMS ${ARGS})
|
|
list(APPEND ${OUT_VAR} ${PREFIX}${ARG})
|
|
endforeach()
|
|
endmacro()
|
|
prefix_all(LIBRARY_SOURCES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/
|
|
backend.cpp
|
|
options.cpp
|
|
playback.cpp
|
|
util.cpp
|
|
log.cpp
|
|
dbus.cpp
|
|
translation.cpp
|
|
)
|
|
add_library(liblooper STATIC ${LIBRARY_SOURCES})
|
|
target_include_directories(liblooper PUBLIC ${INC})
|
|
set(JSONCPP_TARGET PkgConfig::jsoncpp)
|
|
set(SOUNDTOUCH_TARGET PkgConfig::SoundTouch)
|
|
function(set_to_value_of_condition var)
|
|
if (${ARGN})
|
|
set(${var} ON PARENT_SCOPE)
|
|
else()
|
|
set(${var} OFF PARENT_SCOPE)
|
|
endif()
|
|
endfunction()
|
|
set_to_value_of_condition(BUILD_THIRDPARTY DEFINED EMSCRIPTEN OR DEFINED ANDROID_NDK)
|
|
find_package(Intl)
|
|
set_to_value_of_condition(_USE_LIBINTL_LITE NOT Intl_FOUND)
|
|
option(BUILD_JSONCPP "Builds JsonCpp instead of using the system package." ${BUILD_THIRDPARTY})
|
|
option(BUILD_SOUNDTOUCH "Builds SoundTouch instead of using the system package" ${BUILD_THIRDPARTY})
|
|
option(USE_LIBINTL_LITE "Set to ON to build and use libintl-lite" ${_USE_LIBINTL_LITE})
|
|
set(LIBINTL_LIBRARY)
|
|
set(LIBINTL_INCDIRS)
|
|
if(BUILD_JSONCPP)
|
|
add_subdirectory(subprojects/jsoncpp)
|
|
set(JSONCPP_TARGET jsoncpp_static)
|
|
endif()
|
|
if(BUILD_SOUNDTOUCH)
|
|
add_subdirectory(subprojects/soundtouch)
|
|
set(SOUNDTOUCH_TARGET SoundTouch)
|
|
endif()
|
|
if(USE_LIBINTL_LITE)
|
|
add_subdirectory(subprojects/libintl-lite)
|
|
set(LIBINTL_LIBRARY intl CACHE INTERNAL "")
|
|
set(LIBINTL_INCDIRS "subprojects/libintl-lite" CACHE INTERNAL "")
|
|
else()
|
|
find_package(Intl REQUIRED)
|
|
set(LIBINTL_LIBRARY Intl::Intl CACHE INTERNAL "")
|
|
set(LIBINTL_INCDIRS ${Intl_INCLUDE_DIRS} CACHE INTERNAL "")
|
|
endif()
|
|
target_include_directories(liblooper PUBLIC ${LIBINTL_INCDIRS})
|
|
target_link_libraries(liblooper PUBLIC ${LIBINTL_LIBRARY})
|
|
if(DEFINED EMSCRIPTEN)
|
|
add_subdirectory(subprojects/jsoncpp)
|
|
add_subdirectory(subprojects/soundtouch)
|
|
target_link_libraries(liblooper PUBLIC ${SDL_MIXER_X_TARGET} ${SOUNDTOUCH_TARGET} libvgmstream ${JSONCPP_TARGET})
|
|
target_compile_options(liblooper PUBLIC "-sUSE_SDL=2")
|
|
else()
|
|
if(NOT BUILD_SOUNDTOUCH)
|
|
pkg_check_modules(SoundTouch IMPORTED_TARGET soundtouch)
|
|
endif()
|
|
if (NOT BUILD_JSONCPP)
|
|
pkg_check_modules(jsoncpp IMPORTED_TARGET jsoncpp)
|
|
endif()
|
|
if (NOT BUILD_SDL)
|
|
find_package(SDL2 REQUIRED)
|
|
endif()
|
|
if (ENABLE_DBUS)
|
|
find_package(sdbus-c++)
|
|
if(NOT ${sdbus-c++_FOUND})
|
|
set(ENABLE_DBUS OFF)
|
|
message("Warning: Dbus support not found - Not enabling DBus")
|
|
endif()
|
|
endif()
|
|
target_link_libraries(liblooper PUBLIC SDL2::SDL2 SDL2-static SDL2main ${SDL_MIXER_X_TARGET} ${SOUNDTOUCH_TARGET} libvgmstream libvgmstream_shared ${JSONCPP_TARGET})
|
|
endif()
|
|
if (${ENABLE_DBUS})
|
|
target_link_libraries(liblooper PUBLIC SDBusCpp::sdbus-c++)
|
|
target_compile_definitions(liblooper PUBLIC DBUS_ENABLED)
|
|
endif()
|
|
macro(add_ui_backend)
|
|
set(ARGS ${ARGV})
|
|
list(POP_FRONT ARGS target)
|
|
add_library(${target} STATIC ${ARGS})
|
|
message("Enabling UI backend '" ${target} "'...")
|
|
list(APPEND UI_BACKENDS ${target})
|
|
set(UI_BACKENDS ${UI_BACKENDS} PARENT_SCOPE)
|
|
add_dependencies(${target} looper_assets)
|
|
target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${INC})
|
|
target_link_libraries(${target} PRIVATE liblooper)
|
|
if(${USE_PORTALS})
|
|
target_pkgconfig(TARGETS ${target} PRIVATE PREFIX libPortal LIBRARIES libportal)
|
|
if (NOT ${libPortal_FOUND} EQUAL "1")
|
|
set(USE_PORTALS OFF)
|
|
else()
|
|
info("Enabling libportal support...")
|
|
target_compile_definitions(imgui_ui PRIVATE "PORTALS")
|
|
endif()
|
|
endif()
|
|
endmacro()
|
|
macro(ui_backend_subdir)
|
|
cmake_parse_arguments(UI_OPTS "" "SUBDIR;NAME;READABLE_NAME" "" ${ARGN} )
|
|
message("Backend ${UI_OPTS_READABLE_NAME} defined...")
|
|
set(UI_DISABLE_OPT DISABLE_${UI_OPTS_NAME}_UI)
|
|
option(${UI_DISABLE_OPT} "Disables the ${UI_OPTS_READABLE_NAME} UI" OFF)
|
|
if (NOT ${${UI_DISABLE_OPT}})
|
|
cmake_path(GET UI_OPTS_SUBDIR STEM UI_OPTS_DIRNAME)
|
|
set(BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${UI_OPTS_SUBDIR})
|
|
add_subdirectory(${UI_OPTS_SUBDIR})
|
|
list(APPEND ENABLED_UIS "${UI_OPTS_DIRNAME}")
|
|
message("Enabled backend ${UI_OPTS_READABLE_NAME}.")
|
|
else()
|
|
message("Disabled backend ${UI_OPTS_READABLE_NAME}")
|
|
endif()
|
|
endmacro()
|
|
set(ENABLED_UIS )
|
|
ui_backend_subdir(NAME "IMGUI" READABLE_NAME "Dear ImGui" SUBDIR backends/ui/imgui)
|
|
if (NOT (DEFINED EMSCRIPTEN OR DEFINED ANDROID_NDK))
|
|
ui_backend_subdir(NAME "GTK" READABLE_NAME "GTK4" SUBDIR backends/ui/gtk)
|
|
endif()
|
|
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/gen_ui_backend_inc.py ${ENABLED_UIS})
|
|
prefix_all(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ backend_glue.cpp main.cpp daemon_backend.cpp proxy_backend.cpp)
|
|
if(DEFINED EMSCRIPTEN)
|
|
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
|
endif()
|
|
|
|
set(TARGET_NAME looper)
|
|
if(DEFINED EMSCRIPTEN)
|
|
set(TARGET_NAME index)
|
|
endif()
|
|
function(copy_to_bindir src dst)
|
|
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${src}" "$<TARGET_FILE_DIR:${TARGET_NAME}>/${dst}")
|
|
endfunction()
|
|
if (DEFINED ANDROID_NDK)
|
|
add_library(${TARGET_NAME} SHARED ${SOURCES})
|
|
else()
|
|
add_executable(${TARGET_NAME} ${SOURCES})
|
|
endif()
|
|
add_dependencies(${TARGET_NAME} looper_assets ${UI_BACKENDS})
|
|
|
|
if(DEFINED EMSCRIPTEN)
|
|
copy_to_bindir(assets/icon.svg icon.svg)
|
|
copy_to_bindir(assets/icon.png icon.png)
|
|
copy_to_bindir(web/shell.js shell.js)
|
|
endif()
|
|
find_program(ASCLI_EXE NAMES "appstreamcli" NO_CACHE)
|
|
if(${ASCLI_EXE} STREQUAL "ASCLIEXE-NOTFOUND")
|
|
message("Cannot verify Appstream Metadata.")
|
|
else()
|
|
add_test(NAME "verify appstream metadata" COMMAND ${ASCLI_EXE} validate --no-net --pedantic "assets/com.complecwaft.Looper.metainfo.xml")
|
|
endif()
|
|
target_link_libraries(${TARGET_NAME} PUBLIC liblooper ${UI_BACKENDS})
|
|
install(TARGETS ${TARGET_NAME} ${EXTRA_LIBS})
|
|
if (${BUILD_SDL2})
|
|
install(EXPORT SDL2-static SDL2main)
|
|
endif()
|
|
if (NOT DEFINED EMSCRIPTEN)
|
|
install(FILES assets/icon.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps/)
|
|
install(FILES assets/com.complecwaft.Looper.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
|
install(FILES assets/com.complecwaft.Looper.metainfo.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
|
|
install(DIRECTORY assets/translations/ TYPE LOCALE PATTERN "*" EXCLUDE PATTERN "looper.pot")
|
|
endif()
|
|
|