0

I’m trying to build the abuse-tool from Abuse with cmake. Abuse-tool mainly depends on SDL1.2 and SDL_mixer.

So I have following CMakeLists.txt file :

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 returns :

*** 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.

Added SDL_CONFIG with Test 2 & 3, cmake . && make returns :

/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

Added sudo to Test 2 & 3, cmake . && make with Test 4 returns :

*** 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.

Back to square one :/

Basically I'm not able to build the abuse-tool with the SDL_mixer library with cmake.

Any help would be appreciate on this. Thanks.

Some references :
- https://gist.github.com/gamefreak/615275 (SDL 1.2)
- https://gist.github.com/SergNikitin/d8d9441120d00459201d (SDL 2)

Wingjam
  • 742
  • 8
  • 17
  • 2
    In CMake, `ExternalProject_Add` just performs needed commands as a building steps (download, configure, build, and so on). You may try to perform commands manually (from the command line, without CMake), and find command which works for you. Then try to transform the **right commands** into `ExternalProject_Add` call. If you will face with a difficultes on specific transformation, then ask about that specific transformation. – Tsyvarev Oct 23 '18 at 07:47

1 Answers1

0

I recently had some truble with sdl when installing dosbox-0.74-2.tar.gz on Ububtu 14.x and have the exact same line; looked like I needed to install "libsdl1.2" or "libsdl1.2-dev" make sure you have the latest version or the one that is right for you compile. If you keep having the same issue, since sdl is up to date do as it says, add in your PATH to the sdl bin directory and/or set the SDL_CONFIG variable:

export PATH=/path/to/sdl/bin:$PATH

export SDL_CONFIG=/full/path/to/sdl-config

and then try again. This should fix your output. Also don't miss the chance and give a try to Star Wars Dark Forces dosbox/psx game, just saying if its possible would be great.