<commit_before>#
# project: fips-soloud
#
if (NOT FIPS_IMPORT)
    cmake_minimum_required(VERSION 2.8)
    get_filename_component(FIPS_ROOT_DIR "../fips" ABSOLUTE)
    include("${FIPS_ROOT_DIR}/cmake/fips.cmake")
    fips_setup()
    fips_project(fips-soloud)
    fips_include_directories(soloud/include)
endif()

# default option values
set(soloud_winmm_default 0)
set(soloud_wasapi_default 0)
set(soloud_coreaudio_default 0)
set(soloud_openal_default 0)
set(soloud_opensles_default 0)
set(soloud_alsa_default 0)
set(soloud_sdlstatic_default 0)
set(soloud_tools_default 0)
set(soloud_null_default 0)
if (FIPS_WINDOWS)
    set(soloud_winmm_default 1)
endif()
if (FIPS_OSX)
    set(soloud_coreaudio_default 1)
endif()
if (FIPS_EMSCRIPTEN)
    set(soloud_sdlstatic_default 1)
elseif (FIPS_PNACL)
    set(soloud_null_default 1)
elseif (FIPS_ANDROID)
    set(soloud_opensles_default 1)
elseif (FIPS_LINUX)
    set(soloud_alsa_default 1)
endif()
if (FIPS_PNACL)
    set(soloud_modplug_default 0)
else()
    set(soloud_modplug_default 1)
endif()
if (NOT FIPS_IMPORT)
    set(soloud_tools_default 1)
endif()

# backend options
option(SOLOUD_SDL "Compile soloud with SDL backend" OFF)
option(SOLOUD_SDL_STATIC "Compile soloud with static SDL backend" ${soloud_sdlstatic_default})
option(SOLOUD_SDL2_STATIC "Compile soloud with static SDL2 backend" OFF)
option(SOLOUD_PORTAUDIO "Compile soloud with PortAudio backend" OFF)
option(SOLOUD_OPENAL "Compile soloud with OpenAL backend" ${soloud_openal_default})
option(SOLOUD_OPENSLES "Compile soloud with OpenSLES backend" ${soloud_opensles_default})
option(SOLOUD_XAUDIO2 "Compile soloud with XAudio2 backend" OFF)
option(SOLOUD_WINMM "Compile soloud with WinMM backend" ${soloud_winmm_default})
option(SOLOUD_WASAPI "Compile soloud with WASAPI backend" ${soloud_wasapi_default})
option(SOLOUD_ALSA "Compile soloud with ALSA backend" ${soloud_alsa_default})
option(SOLOUD_OSS "Compile soloud with OSS backend" OFF)
option(SOLOUD_COREAUDIO "Compile soloud with CoreAudio backend" ${soloud_coreaudio_default})
option(SOLOUD_NULL "Compile soloud with NULL backend" ${soloud_null_default})
option(SOLOUD_LIBMODPLUG "Add libmodplug support to soloud" ${soloud_modplug_default})
option(SOLOUD_PORTMIDI "Add portmidi support to soloud" OFF)
option(SOLOUD_TOOLS "Compile soloud tools" ${soloud_tools_default})

fips_begin_module(soloud)
    fips_src(soloud/src/audiosource/modplug GROUP audiosource)
    fips_src(soloud/src/audiosource/monotone GROUP audiosource)
    fips_src(soloud/src/audiosource/sfxr GROUP audiosource)
    fips_src(soloud/src/audiosource/speech GROUP audiosource)
    fips_src(soloud/src/audiosource/tedsid GROUP audiosource)
    fips_src(soloud/src/audiosource/vic GROUP audiosource)
    fips_src(soloud/src/audiosource/wav GROUP audiosource)
    fips_src(soloud/src/filter GROUP filter)
    fips_src(soloud/src/core GROUP core)
    fips_src(soloud/include GROUP include)
    if (SOLOUD_OPENAL) 
        fips_src(soloud/src/backend/openal GROUP openal)
    endif()
    if (SOLOUD_OPENSLES)
        fips_src(soloud/src/backend/opensles GROUP opensles)
        fips_libs(OpenSLES)
    endif()
    if (SOLOUD_ALSA)
        fips_src(soloud/src/backend/alsa GROUP alsa)
        fips_libs(asound)
    endif()
    if (SOLOUD_OSS)
        fips_src(soloud/src/backend/oss GROUP oss)
    endif()
    if (SOLOUD_COREAUDIO)
        fips_src(soloud/src/backend/coreaudio GROUP coreaudio)
        fips_frameworks_osx(AudioToolbox)
    endif()
    if (SOLOUD_PORTAUDIO)
        fips_src(soloud/src/backend/portaudio GROUP portaudio)
    endif()
    if (SOLOUD_SDL)
        fips_src(soloud/src/backend/sdl GROUP sdl)
    endif()
    if (SOLOUD_SDL_STATIC)
        fips_src(soloud/src/backend/sdl_static GROUP sdl_static)
    endif()
    if (SOLOUD_SDL2_STATIC)
        fips_src(soloud/src/backend/sdl2_static GROUP sdl2_static)
    endif()
    if (SOLOUD_WASAPI)
        fips_src(soloud/src/backend/wasapi GROUP wasapi)
    endif()
    if (SOLOUD_XAUDIO2)
        fips_src(soloud/src/backend/xaudio2 GROUP xaudio2)
    endif()
    if (SOLOUD_WINMM)
        fips_src(soloud/src/backend/winmm GROUP winmm)
    endif()
    if (SOLOUD_NULL)
        fips_src(soloud/src/backend/null GROUP null)
    endif()
fips_end_module()

# configuration defines need only be visible in the implementation files
if (SOLOUD_OPENAL) 
    target_compile_definitions(soloud PRIVATE WITH_OPENAL=1)
endif()
if (SOLOUD_OPENSLES)
    target_compile_definitions(soloud PRIVATE WITH_OPENSLES=1)
endif()
if (SOLOUD_ALSA)
    target_compile_definitions(soloud PRIVATE WITH_ALSA=1)
endif()
if (SOLOUD_OSS)
    target_compile_definitions(soloud PRIVATE WITH_OSS=1)
endif()
if (SOLOUD_COREAUDIO)
    target_compile_definitions(soloud PRIVATE WITH_COREAUDIO=1)
endif()
if (SOLOUD_PORTAUDIO)
    target_compile_definitions(soloud PRIVATE WITH_PORTAUDIO=1)
endif()
if (SOLOUD_SDL)
    target_compile_definitions(soloud PRIVATE WITH_SDL=1)
endif()
if (SOLOUD_SDL_STATIC)
    target_compile_definitions(soloud PRIVATE WITH_SDL_STATIC=1)
endif()
if (SOLOUD_SDL2_STATIC)
    target_compile_definitions(soloud PRIVATE WITH_SDL2_STATIC=1)
endif()
if (SOLOUD_WASAPI)
    target_compile_definitions(soloud PRIVATE WITH_WASAPI=1)
endif()
if (SOLOUD_XAUDIO2)
    target_compile_definitions(soloud PRIVATE WITH_XAUDIO2=1)
endif()
if (SOLOUD_WINMM)
    target_compile_definitions(soloud PRIVATE WITH_WINMM=1)
endif()
if (SOLOUD_NULL)
    target_compile_definitions(soloud PRIVATE WITH_NULL=1)
endif()
if (SOLOUD_LIBMODPLUG)
    target_compile_definitions(soloud PRIVATE WITH_MODPLUG=1)
endif()

if (SOLOUD_LIBMODPLUG)
    add_definitions(-DMODPLUG_STATIC=1)
    fips_include_directories(soloud/ext/libmodplug/src/libmodplug)
    fips_begin_module(libmodplug)
        fips_src(soloud/ext/libmodplug/src GROUP .)
    fips_end_module()
    if (FIPS_WINDOWS)
        target_compile_definitions(libmodplug PRIVATE HAVE_SINF=1 HAVE_STDINT_H=1)
    else() 
        target_compile_definitions(libmodplug PRIVATE HAVE_SINF=1 HAVE_SETENV=1 HAVE_STDINT_H=1)
    endif()
endif()
if (SOLOUD_TOOLS)
    # some tools need C++ exceptions enabled
    set(FIPS_EXCEPTIONS ON CACHE BOOL "Enable C++ exceptions" FORCE)
    fips_ide_group(demos)
    fips_begin_app(simplest cmdline)
        fips_src(soloud/demos/simplest GROUP .)
        fips_deps(soloud)
    fips_end_app()
    fips_begin_app(welcome cmdline)
        fips_src(soloud/demos/welcome GROUP .)
        fips_deps(soloud)
    fips_end_app()
    fips_begin_app(nulldemo cmdline)
        fips_src(soloud/demos/null GROUP .)
        fips_deps(soloud)
    fips_end_app()
    fips_begin_app(enumerate cmdline)
        fips_src(soloud/demos/enumerate GROUP .)
        fips_deps(soloud)
    fips_end_app()
    fips_begin_app(c_test cmdline)
        fips_src(soloud/demos/c_test GROUP .)
        fips_src(soloud/src/c_api GROUP .)
        fips_deps(soloud)
    fips_end_app()
endif()

set(args)
if (FIPS_CLANG)
    set(args "-Wno-unused-function -Wno-unused-private-field -Wno-dangling-else -Wno-missing-braces -Wno-unused-value -Wno-parentheses -Wno-sign-compare -Wno-unused-variable -Wno-deprecated-register -Wno-writable-strings -Wno-reorder -Wno-delete-non-virtual-dtor")
elseif (FIPS_GCC)
    set(args "-Wno-unused-function -Wno-missing-braces -Wno-unused-value -Wno-parentheses -Wno-sign-compare -Wno-unused-variable -Wno-reorder -Wno-deprecated-register -Wno-delete-non-virtual-dtor")
endif()
if (args)
    set_target_properties(soloud PROPERTIES COMPILE_FLAGS ${args}) 
    if (SOLOUD_LIBMODPLUG)
        set_target_properties(libmodplug PROPERTIES COMPILE_FLAGS ${args})
    endif()
    if (SOLOUD_TOOLS)
        set_target_properties(enumerate PROPERTIES COMPILE_FLAGS ${args})
        set_target_properties(c_test PROPERTIES COMPILE_FLAGS ${args})
    endif()
endif()

if (NOT FIPS_IMPORT)
    fips_finish()
endif()

<commit_msg>Use XAudio2 backend as default on Windows<commit_after>#
# project: fips-soloud
#
if (NOT FIPS_IMPORT)
    cmake_minimum_required(VERSION 2.8)
    get_filename_component(FIPS_ROOT_DIR "../fips" ABSOLUTE)
    include("${FIPS_ROOT_DIR}/cmake/fips.cmake")
    fips_setup()
    fips_project(fips-soloud)
    fips_include_directories(soloud/include)
endif()

# default option values
set(soloud_winmm_default 0)
set(soloud_wasapi_default 0)
set(soloud_xaudio2_default 0)
set(soloud_coreaudio_default 0)
set(soloud_openal_default 0)
set(soloud_opensles_default 0)
set(soloud_alsa_default 0)
set(soloud_sdlstatic_default 0)
set(soloud_tools_default 0)
set(soloud_null_default 0)
if (FIPS_WINDOWS)
    set(soloud_xaudio2_default 1)
endif()
if (FIPS_OSX)
    set(soloud_coreaudio_default 1)
endif()
if (FIPS_EMSCRIPTEN)
    set(soloud_sdlstatic_default 1)
elseif (FIPS_PNACL)
    set(soloud_null_default 1)
elseif (FIPS_ANDROID)
    set(soloud_opensles_default 1)
elseif (FIPS_LINUX)
    set(soloud_alsa_default 1)
endif()
if (FIPS_PNACL)
    set(soloud_modplug_default 0)
else()
    set(soloud_modplug_default 1)
endif()
if (NOT FIPS_IMPORT)
    set(soloud_tools_default 1)
endif()

# backend options
option(SOLOUD_SDL "Compile soloud with SDL backend" OFF)
option(SOLOUD_SDL_STATIC "Compile soloud with static SDL backend" ${soloud_sdlstatic_default})
option(SOLOUD_SDL2_STATIC "Compile soloud with static SDL2 backend" OFF)
option(SOLOUD_PORTAUDIO "Compile soloud with PortAudio backend" OFF)
option(SOLOUD_OPENAL "Compile soloud with OpenAL backend" ${soloud_openal_default})
option(SOLOUD_OPENSLES "Compile soloud with OpenSLES backend" ${soloud_opensles_default})
option(SOLOUD_XAUDIO2 "Compile soloud with XAudio2 backend" ${soloud_xaudio2_default})
option(SOLOUD_WINMM "Compile soloud with WinMM backend" ${soloud_winmm_default})
option(SOLOUD_WASAPI "Compile soloud with WASAPI backend" ${soloud_wasapi_default})
option(SOLOUD_ALSA "Compile soloud with ALSA backend" ${soloud_alsa_default})
option(SOLOUD_OSS "Compile soloud with OSS backend" OFF)
option(SOLOUD_COREAUDIO "Compile soloud with CoreAudio backend" ${soloud_coreaudio_default})
option(SOLOUD_NULL "Compile soloud with NULL backend" ${soloud_null_default})
option(SOLOUD_LIBMODPLUG "Add libmodplug support to soloud" ${soloud_modplug_default})
option(SOLOUD_PORTMIDI "Add portmidi support to soloud" OFF)
option(SOLOUD_TOOLS "Compile soloud tools" ${soloud_tools_default})

fips_begin_module(soloud)
    fips_src(soloud/src/audiosource/modplug GROUP audiosource)
    fips_src(soloud/src/audiosource/monotone GROUP audiosource)
    fips_src(soloud/src/audiosource/sfxr GROUP audiosource)
    fips_src(soloud/src/audiosource/speech GROUP audiosource)
    fips_src(soloud/src/audiosource/tedsid GROUP audiosource)
    fips_src(soloud/src/audiosource/vic GROUP audiosource)
    fips_src(soloud/src/audiosource/wav GROUP audiosource)
    fips_src(soloud/src/filter GROUP filter)
    fips_src(soloud/src/core GROUP core)
    fips_src(soloud/include GROUP include)
    if (SOLOUD_OPENAL) 
        fips_src(soloud/src/backend/openal GROUP openal)
    endif()
    if (SOLOUD_OPENSLES)
        fips_src(soloud/src/backend/opensles GROUP opensles)
        fips_libs(OpenSLES)
    endif()
    if (SOLOUD_ALSA)
        fips_src(soloud/src/backend/alsa GROUP alsa)
        fips_libs(asound)
    endif()
    if (SOLOUD_OSS)
        fips_src(soloud/src/backend/oss GROUP oss)
    endif()
    if (SOLOUD_COREAUDIO)
        fips_src(soloud/src/backend/coreaudio GROUP coreaudio)
        fips_frameworks_osx(AudioToolbox)
    endif()
    if (SOLOUD_PORTAUDIO)
        fips_src(soloud/src/backend/portaudio GROUP portaudio)
    endif()
    if (SOLOUD_SDL)
        fips_src(soloud/src/backend/sdl GROUP sdl)
    endif()
    if (SOLOUD_SDL_STATIC)
        fips_src(soloud/src/backend/sdl_static GROUP sdl_static)
    endif()
    if (SOLOUD_SDL2_STATIC)
        fips_src(soloud/src/backend/sdl2_static GROUP sdl2_static)
    endif()
    if (SOLOUD_WASAPI)
        fips_src(soloud/src/backend/wasapi GROUP wasapi)
    endif()
    if (SOLOUD_XAUDIO2)
        fips_src(soloud/src/backend/xaudio2 GROUP xaudio2)
    endif()
    if (SOLOUD_WINMM)
        fips_src(soloud/src/backend/winmm GROUP winmm)
    endif()
    if (SOLOUD_NULL)
        fips_src(soloud/src/backend/null GROUP null)
    endif()
fips_end_module()

# configuration defines need only be visible in the implementation files
if (SOLOUD_OPENAL) 
    target_compile_definitions(soloud PRIVATE WITH_OPENAL=1)
endif()
if (SOLOUD_OPENSLES)
    target_compile_definitions(soloud PRIVATE WITH_OPENSLES=1)
endif()
if (SOLOUD_ALSA)
    target_compile_definitions(soloud PRIVATE WITH_ALSA=1)
endif()
if (SOLOUD_OSS)
    target_compile_definitions(soloud PRIVATE WITH_OSS=1)
endif()
if (SOLOUD_COREAUDIO)
    target_compile_definitions(soloud PRIVATE WITH_COREAUDIO=1)
endif()
if (SOLOUD_PORTAUDIO)
    target_compile_definitions(soloud PRIVATE WITH_PORTAUDIO=1)
endif()
if (SOLOUD_SDL)
    target_compile_definitions(soloud PRIVATE WITH_SDL=1)
endif()
if (SOLOUD_SDL_STATIC)
    target_compile_definitions(soloud PRIVATE WITH_SDL_STATIC=1)
endif()
if (SOLOUD_SDL2_STATIC)
    target_compile_definitions(soloud PRIVATE WITH_SDL2_STATIC=1)
endif()
if (SOLOUD_WASAPI)
    target_compile_definitions(soloud PRIVATE WITH_WASAPI=1)
endif()
if (SOLOUD_XAUDIO2)
    target_compile_definitions(soloud PRIVATE WITH_XAUDIO2=1)
endif()
if (SOLOUD_WINMM)
    target_compile_definitions(soloud PRIVATE WITH_WINMM=1)
endif()
if (SOLOUD_NULL)
    target_compile_definitions(soloud PRIVATE WITH_NULL=1)
endif()
if (SOLOUD_LIBMODPLUG)
    target_compile_definitions(soloud PRIVATE WITH_MODPLUG=1)
endif()

if (SOLOUD_LIBMODPLUG)
    add_definitions(-DMODPLUG_STATIC=1)
    fips_include_directories(soloud/ext/libmodplug/src/libmodplug)
    fips_begin_module(libmodplug)
        fips_src(soloud/ext/libmodplug/src GROUP .)
    fips_end_module()
    if (FIPS_WINDOWS)
        target_compile_definitions(libmodplug PRIVATE HAVE_SINF=1 HAVE_STDINT_H=1)
    else() 
        target_compile_definitions(libmodplug PRIVATE HAVE_SINF=1 HAVE_SETENV=1 HAVE_STDINT_H=1)
    endif()
endif()
if (SOLOUD_TOOLS)
    # some tools need C++ exceptions enabled
    set(FIPS_EXCEPTIONS ON CACHE BOOL "Enable C++ exceptions" FORCE)
    fips_ide_group(demos)
    fips_begin_app(simplest cmdline)
        fips_src(soloud/demos/simplest GROUP .)
        fips_deps(soloud)
    fips_end_app()
    fips_begin_app(welcome cmdline)
        fips_src(soloud/demos/welcome GROUP .)
        fips_deps(soloud)
    fips_end_app()
    fips_begin_app(nulldemo cmdline)
        fips_src(soloud/demos/null GROUP .)
        fips_deps(soloud)
    fips_end_app()
    fips_begin_app(enumerate cmdline)
        fips_src(soloud/demos/enumerate GROUP .)
        fips_deps(soloud)
    fips_end_app()
    fips_begin_app(c_test cmdline)
        fips_src(soloud/demos/c_test GROUP .)
        fips_src(soloud/src/c_api GROUP .)
        fips_deps(soloud)
    fips_end_app()
endif()

set(args)
if (FIPS_CLANG)
    set(args "-Wno-unused-function -Wno-unused-private-field -Wno-dangling-else -Wno-missing-braces -Wno-unused-value -Wno-parentheses -Wno-sign-compare -Wno-unused-variable -Wno-deprecated-register -Wno-writable-strings -Wno-reorder -Wno-delete-non-virtual-dtor")
elseif (FIPS_GCC)
    set(args "-Wno-unused-function -Wno-missing-braces -Wno-unused-value -Wno-parentheses -Wno-sign-compare -Wno-unused-variable -Wno-reorder -Wno-deprecated-register -Wno-delete-non-virtual-dtor")
endif()
if (args)
    set_target_properties(soloud PROPERTIES COMPILE_FLAGS ${args}) 
    if (SOLOUD_LIBMODPLUG)
        set_target_properties(libmodplug PROPERTIES COMPILE_FLAGS ${args})
    endif()
    if (SOLOUD_TOOLS)
        set_target_properties(enumerate PROPERTIES COMPILE_FLAGS ${args})
        set_target_properties(c_test PROPERTIES COMPILE_FLAGS ${args})
    endif()
endif()

if (NOT FIPS_IMPORT)
    fips_finish()
endif()


{'fraction_non_alphanumeric': 0.08938512145748988, 'fraction_numerical': 0.0071482793522267205, 'mean_word_length': 4.805728975394786, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '175304', 'n_tokens_mistral': 6262, 'n_tokens_neox': 5919, 'n_words': 1068}