如何将外部项目SDL_mixer添加到SDL 1.2项目?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何将外部项目SDL_mixer添加到SDL 1.2项目?相关的知识,希望对你有一定的参考价值。
我正在尝试使用cmake从Abuse构建滥用工具。滥用工具主要依赖于SDL1.2和SDL_mixer。
所以我有以下CMakeLists.txt文件:
cmake_minimum_required (VERSION 3.12)
find_package (Threads)
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
# SDL library
ExternalProject_Add(sdl_project
URL http://www.libsdl.org/release/SDL-1.2.15.tar.gz
PREFIX ${LIBS_DIR}/SDL
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./configure
BUILD_COMMAND make -j2
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(sdl_project SOURCE_DIR)
ExternalProject_Get_Property(sdl_project BINARY_DIR)
set(SDL_SRC ${SOURCE_DIR})
set(SDL_BIN ${BINARY_DIR})
# SDL_mixer library
ExternalProject_Add(sdl_mixer_project
URL http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.12.tar.gz
DEPENDS sdl_project
PREFIX ${LIBS_DIR}/SDL_mixer
BUILD_IN_SOURCE 1
# Test 1
CONFIGURE_COMMAND ./configure
# Test 2
CONFIGURE_COMMAND SDL_CONFIG=${LIBS_DIR}/SDL/src/sdl_project/sdl-config ./configure
# Test 3
CONFIGURE_COMMAND LDFLAGS=-L${SDL_BIN} CFLAGS=-I${SDL_SRC}/include SDL_CONFIG=${SDL_BIN}/sdl-config ./configure
# Test 4
CONFIGURE_COMMAND SDL_CONFIG=${LIBS_DIR}/SDL/src/sdl_project/sdl-config sudo ./configure
BUILD_COMMAND make -j2
INSTALL_COMMAND ""
)
file(GLOB source_files
"src/*.h"
"src/*.cpp"
)
add_executable(abuse-tool ${source_files})
add_dependencies(abuse-tool sdl_project sdl_mixer_project)
cmake。 && make with Test 1返回:
*** The sdl-config script installed by SDL could not be found
*** If SDL was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the SDL_CONFIG environment variable to the
*** full path to sdl-config.
添加了SDL_CONFIG和测试2和3,cmake。 &&回报:
/path/to/sdl-config: Permission denied
*** Could not run SDL test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means SDL was incorrectly installed
*** or that you have moved SDL since it was installed. In the latter case, you
*** may want to edit the sdl-config script: /path/to/sdl-config
将sudo
添加到测试2和3,cmake。 && make with Test 4返回:
*** The sdl-config script installed by SDL could not be found
*** If SDL was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the SDL_CONFIG environment variable to the
*** full path to sdl-config.
回到原点 :/
基本上我无法使用带有cmake的SDL_mixer库构建滥用工具。
任何帮助都会对此表示赞赏。谢谢。
一些参考: - https://gist.github.com/gamefreak/615275(SDL 1.2) - https://gist.github.com/SergNikitin/d8d9441120d00459201d(SDL 2)
在Ububtu 14.x上安装dosbox-0.74-2.tar.gz并且具有完全相同的行时,我最近与sdl有一些混乱;看起来我需要安装“libsdl1.2”或“libsdl1.2-dev”以确保您拥有最新版本或适合您编译的版本。如果你遇到同样的问题,因为sdl是最新的,按照它的说法,将你的PATH添加到sdl bin目录和/或设置SDL_CONFIG变量:
export PATH = / path / to / sdl / bin:$ PATH
export SDL_CONFIG = / full / path / to / sdl-config
然后再试一次。这应该可以修复你的输出。也不要错过这个机会并试一试星球大战黑暗力量dosbox / psx游戏,只是说它是否可能会很棒。
以上是关于如何将外部项目SDL_mixer添加到SDL 1.2项目?的主要内容,如果未能解决你的问题,请参考以下文章
如何像 SDL_Mixer 那样播放多种声音,但在 SDL2 中是原生的?