aboutsummaryrefslogtreecommitdiff
path: root/src/sfx/CMakeLists.txt
blob: 099e65ff37bec5fe9a3dc14d12dcbe73e3f90ebe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
set(inc "inc")

if(PS1_BUILD)
    set(src
        "ps1/src/sound.c")
    set(inc ${inc} "ps1/inc")
    set(privdeps system PSXSDK::PSXSDK)
elseif(SDL1_2_BUILD)
    set(src
        "sdl-1.2/src/sound.c")
    set(inc ${inc} "sdl-1.2/inc")
    set(deps ${deps} SDL_mixer)
    set(privdeps ${privdeps} SDL header)
endif()

add_library(sfx ${src})
target_include_directories(sfx PUBLIC ${inc})
target_include_directories(sfx PRIVATE ${privinc})
target_link_libraries(sfx PUBLIC ${deps} PRIVATE ${privdeps})

if(PS1_BUILD)
    set(modes VMODE_PAL VMODE_NTSC)

    if(VIDEO_MODE)
        if(NOT "${VIDEO_MODE}" IN_LIST modes)
            message(FATAL_ERROR "Invalid video mode ${VIDEO_MODE}. Available options:\n"
                "${modes}\n"
                "Run CMake again using one of the available video modes e.g.: cmake .. -DVIDEO_MODE=VMODE_PAL")
        endif()

        target_compile_definitions(sfx PRIVATE VIDEO_MODE=${VIDEO_MODE})
    else()
        message(FATAL_ERROR "Please define video mode. Available options:\n"
            "${modes}\n"
            "Run CMake again using one of the available video modes e.g.: cmake .. -DVIDEO_MODE=VMODE_PAL")
    endif()
endif()