Giter VIP home page Giter VIP logo

Comments (5)

sajattack avatar sajattack commented on August 13, 2024 1

That's pretty useless advice for anyone not using cmake. The missing library in this case appears to be -lvorbisfile.

from pspsdk.

sharkwouter avatar sharkwouter commented on August 13, 2024 1

You'll need to link to:

  • vorbisfile
  • vorbis
  • ogg

from pspsdk.

sharkwouter avatar sharkwouter commented on August 13, 2024

Yeah, SDL2_mixer needs some more libraries to work. I'd do something like this in the CMakeLists.txt file:

cmake_minimum_required(VERSION 3.0)

project(sdl2_mixer)

add_executable(${PROJECT_NAME} main.c)

find_package(PkgConfig REQUIRED)
pkg_search_module(SDL2 REQUIRED sdl2)
pkg_search_module(SDL2_MIXER REQUIRED SDL2_mixer)

target_include_directories(${PROJECT_NAME} PRIVATE
    ${SDL2_INCLUDE_DIRS}
    ${SDL2_MIXER_INCLUDE_DIRS}
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    ${SDL2_LIBRARIES}
    ${SDL2_MIXER_LIBRARIES}
)

if(PSP)
    target_link_libraries(${PROJECT_NAME} PRIVATE
        SDL2main
    )
    create_pbp_file(
        TARGET ${PROJECT_NAME}
        ICON_PATH NULL
        BACKGROUND_PATH NULL
        PREVIEW_PATH NULL
        TITLE ${PROJECT_NAME}
    )
endif()

from pspsdk.

sharkwouter avatar sharkwouter commented on August 13, 2024

CMake is just using psp-pkg-config, though, you can do that in your makefile too. The commands CMake uses here are:

psp-pkg-config --libs SDL2_mixer

It seems there is a bug, though. It doesn't return what you'd expect. I'll fix that.

from pspsdk.

diamant3 avatar diamant3 commented on August 13, 2024

Thanks guys! It is compiled correctly now. I just linked those three libraries. My last thing to do is fix my code. 😅

CMakeLists.txt

cmake_minimum_required(VERSION 3.0)

project(sdl2_mixer)

add_executable(${PROJECT_NAME} main.c)

find_package(PkgConfig REQUIRED)
pkg_search_module(SDL2 REQUIRED sdl2)

target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS})

target_link_libraries(${PROJECT_NAME} PRIVATE
    ${SDL2_LIBRARIES}
)

if(PSP)
    target_link_libraries(${PROJECT_NAME} PRIVATE
        SDL2main
        SDL2_mixer
        vorbisfile
        vorbis
        ogg
    )
    create_pbp_file(
        TARGET ${PROJECT_NAME}
        ICON_PATH NULL
        BACKGROUND_PATH NULL
        PREVIEW_PATH NULL
        TITLE ${PROJECT_NAME}
    )
endif()

output:

[ 50%] Linking C executable sdl2_mixer
Not stripping binary, build type is .
Calling psp-fixup-imports
Not building PRX
Calling mksfoex
Calling pack-pbp with ELF file
[0]        316 bytes | PARAM.SFO
[1]          0 bytes | NULL
[2]          0 bytes | NULL
[3]          0 bytes | NULL
[4]          0 bytes | NULL
[5]          0 bytes | NULL
[6]    2498372 bytes | /home/diamant3/sdl2_mixer/build/sdl2_mixer
[7]          0 bytes | NULL
EBOOT.PBP file created.
[100%] Built target sdl2_mixer

from pspsdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.