Skip to content

Commit

Permalink
Merge pull request #952 from Ghabry/cmake
Browse files Browse the repository at this point in the history
Update CMake File
  • Loading branch information
carstene1ns authored Sep 18, 2016
2 parents d6bc2cc + 93c0955 commit 4930c4f
Show file tree
Hide file tree
Showing 18 changed files with 619 additions and 226 deletions.
682 changes: 500 additions & 182 deletions CMakeLists.txt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions builds/cmake/Modules/FindFluidSynth.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ find_path(FLUIDSYNTH_INCLUDE_DIR "fluidsynth.h")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FluidSynth DEFAULT_MSG FLUIDSYNTH_LIBRARY FLUIDSYNTH_INCLUDE_DIR)

set(FLUIDSYNTH_INCLUDE_DIRS ${FLUIDSYNTH_INCLUDE_DIR})
set(FLUIDSYNTH_LIBRARIES ${FLUIDSYNTH_LIBRARY})

mark_as_advanced(FLUIDSYNTH_INCLUDE_DIR FLUIDSYNTH_LIBRARY)
5 changes: 5 additions & 0 deletions builds/cmake/Modules/FindHarfbuzz.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ endif()

find_package_handle_standard_args(Harfbuzz
REQUIRED_VARS HARFBUZZ_INCLUDE_DIR HARFBUZZ_LIBRARY)

set(HARFBUZZ_INCLUDE_DIRS ${HARFBUZZ_INCLUDE_DIR})
set(HARFBUZZ_LIBRARIES ${HARFBUZZ_LIBRARY})

mark_as_advanced(HARFBUZZ_INCLUDE_DIR HARFBUZZ_LIBRARY)
10 changes: 10 additions & 0 deletions builds/cmake/Modules/FindOggVorbis.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
find_path(OGGVORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
find_library(OGGVORBIS_LIBRARY NAMES vorbisfile libvorbisfile)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OggVorbis DEFAULT_MSG OGGVORBIS_INCLUDE_DIR OGGVORBIS_LIBRARY)

set(OGGVORBIS_INCLUDE_DIRS ${OGGVORBIS_INCLUDE_DIR})
set(OGGVORBIS_LIBRARIES ${OGGVORBIS_LIBRARY})

mark_as_advanced(OGGVORBIS_INCLUDE_DIR OGGVORBIS_LIBRARY)
5 changes: 5 additions & 0 deletions builds/cmake/Modules/FindPixman.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ endif()

find_package_handle_standard_args(Pixman
REQUIRED_VARS PIXMAN_INCLUDE_DIR PIXMAN_LIBRARY)

set(PIXMAN_INCLUDE_DIRS ${PIXMAN_INCLUDE_DIR})
set(PIXMAN_LIBRARIES ${PIXMAN_LIBRARY})

mark_as_advanced(PIXMAN_INCLUDE_DIR PIXMAN_LIBRARY)
5 changes: 5 additions & 0 deletions builds/cmake/Modules/FindSDL2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,8 @@ include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR
VERSION_VAR SDL2_VERSION_STRING)

set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
set(SDL2_LIBRARIES ${SDL2_LIBRARY})

mark_as_advanced(SDL2_INCLUDE_DIR SDL2_LIBRARY)
12 changes: 6 additions & 6 deletions builds/cmake/Modules/FindSDL2_mixer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ find_library(SDL2_MIXER_LIBRARY
)

if(SDL2_MIXER_INCLUDE_DIR AND EXISTS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h")
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_MIXER_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_MIXER_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_MIXER_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL2_MIXER_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_MAJOR "${SDL2_MIXER_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_MIXER_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_MINOR "${SDL2_MIXER_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_MIXER_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_PATCH "${SDL2_MIXER_VERSION_PATCH_LINE}")
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_MAJOR "${SDL2_MIXER_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_MINOR "${SDL2_MIXER_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_PATCH "${SDL2_MIXER_VERSION_PATCH_LINE}")
set(SDL2_MIXER_VERSION_STRING ${SDL2_MIXER_VERSION_MAJOR}.${SDL2_MIXER_VERSION_MINOR}.${SDL2_MIXER_VERSION_PATCH})
unset(SDL2_MIXER_VERSION_MAJOR_LINE)
unset(SDL2_MIXER_VERSION_MINOR_LINE)
Expand Down
29 changes: 6 additions & 23 deletions builds/cmake/Modules/FindSndFile.cmake
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
# SNDFILE_LIBRARIES
# SNDFILE_INCLUDE_DIR
# SndFile_FOUND

include(FindPackageHandleStandardArgs)

find_library(OGG_LIBRARY ogg)
find_library(FLAC_LIBRARY FLAC)
find_library(VORBIS_LIBRARY vorbis)
find_library(VORBISENC_LIBRARY vorbisenc)

find_library(SNDFILE_LIBRARY sndfile)
find_path(SNDFILE_INCLUDE_DIR sndfile.h)
find_library(SNDFILE_LIBRARY NAMES sndfile libsndfile)

if((EXISTS ${SNDFILE_LIBRARY}) AND (EXISTS ${SNDFILE_INCLUDE_DIR}))
foreach(i OGG_LIBRARY FLAC_LIBRARY VORBIS_LIBRARY VORBISENC_LIBRARY)
if(EXISTS ${${i}})
list(APPEND SNDFILE_LIBRARIES "${${i}}")
endif()
endforeach()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_INCLUDE_DIR SNDFILE_LIBRARY)

list(APPEND SNDFILE_LIBRARIES "${SNDFILE_LIBRARY}")
message(STATUS "sndfile dependencies: ${SNDFILE_LIBRARIES}")
endif()
set(SNDFILE_INCLUDE_DIRS ${SNDFILE_INCLUDE_DIR})
set(SNDFILE_LIBRARIES ${SNDFILE_LIBRARY})

find_package_handle_standard_args(SndFile
REQUIRED_VARS SNDFILE_INCLUDE_DIR SNDFILE_LIBRARIES)
mark_as_advanced(SNDFILE_INCLUDE_DIR SNDFILE_LIBRARY)
10 changes: 10 additions & 0 deletions builds/cmake/Modules/FindWildMidi.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
find_path(WILDMIDI_INCLUDE_DIR wildmidi_lib.h)
find_library(WILDMIDI_LIBRARY NAMES wildmidi libwildmidi WildMidi libWildMidi)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(wildmidi DEFAULT_MSG WILDMIDI_INCLUDE_DIR WILDMIDI_LIBRARY)

set(WILDMIDI_INCLUDE_DIRS ${WILDMIDI_INCLUDE_DIR})
set(WILDMIDI_LIBRARIES ${WILDMIDI_LIBRARY})

mark_as_advanced(WILDMIDI_INCLUDE_DIR WILDMIDI_LIBRARY)
24 changes: 24 additions & 0 deletions builds/cmake/Modules/FindXMP.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
include(FindPackageHandleStandardArgs)

find_path(XMP_INCLUDE_DIR_INTERNAL xmp.h)
find_library(XMP_LIBRARY xmp libxmp xmp-lite libxmp-lite)
if(EXISTS "${XMP_INCLUDE_DIR_INTERNAL}")
set(XMP_INCLUDE_DIR "${XMP_INCLUDE_DIR_INTERNAL}")
else()
find_path(XMP_INCLUDE_DIR_INTERNAL libxmp/xmp.h)
if(EXISTS "${XMP_INCLUDE_DIR_INTERNAL}")
set(XMP_INCLUDE_DIR "${XMP_INCLUDE_DIR_INTERNAL}/libxmp")
else()
find_path(XMP_INCLUDE_DIR_INTERNAL libxmp-lite/xmp.h)
if(EXISTS "${XMP_INCLUDE_DIR_INTERNAL}")
set(XMP_INCLUDE_DIR "${XMP_INCLUDE_DIR_INTERNAL}/libxmp-lite")
endif()
endif()
endif()

find_package_handle_standard_args(XMP REQUIRED_VARS XMP_INCLUDE_DIR XMP_LIBRARY)

set(XMP_INCLUDE_DIRS ${XMP_INCLUDE_DIR})
set(XMP_LIBRARIES ${XMP_LIBRARY})

mark_as_advanced(XMP_INCLUDE_DIR XMP_LIBRARY)
13 changes: 13 additions & 0 deletions builds/cmake/Modules/Findliblcf.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
find_path(LIBLCF_INCLUDE_DIR_INTERNAL liblcf/reader_lcf.h)
find_library(LIBLCF_LIBRARY NAMES lcf liblcf)
if(EXISTS "${LIBLCF_INCLUDE_DIR_INTERNAL}")
set(LIBLCF_INCLUDE_DIR "${LIBLCF_INCLUDE_DIR_INTERNAL}/liblcf")
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(liblcf DEFAULT_MSG LIBLCF_INCLUDE_DIR LIBLCF_LIBRARY)

set(LIBLCF_INCLUDE_DIRS ${LIBLCF_INCLUDE_DIR})
set(LIBLCF_LIBRARIES ${LIBLCF_LIBRARY})

mark_as_advanced(LIBLCF_INCLUDE_DIR LIBLCF_LIBRARY)
2 changes: 1 addition & 1 deletion builds/cmake/Modules/Findmpg123.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ find_path(MPG123_INCLUDE_DIR mpg123.h)
find_library(MPG123_LIBRARY NAMES mpg123 libmpg123)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPG123 DEFAULT_MSG MPG123_INCLUDE_DIR MPG123_LIBRARY)
find_package_handle_standard_args(mpg123 DEFAULT_MSG MPG123_INCLUDE_DIR MPG123_LIBRARY)

set(MPG123_INCLUDE_DIRS ${MPG123_INCLUDE_DIR})
set(MPG123_LIBRARIES ${MPG123_LIBRARY})
Expand Down
10 changes: 10 additions & 0 deletions builds/cmake/Modules/Findspeexdsp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
find_path(SPEEXDSP_INCLUDE_DIR speex/speex_resampler.h)
find_library(SPEEXDSP_LIBRARY NAMES speexdsp libspeexdsp)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(speexdsp DEFAULT_MSG SPEEXDSP_INCLUDE_DIR SPEEXDSP_LIBRARY)

set(SPEEXDSP_INCLUDE_DIRS ${SPEEXDSP_INCLUDE_DIR})
set(SPEEXDSP_LIBRARIES ${SPEEXDSP_LIBRARY})

mark_as_advanced(SPEEXDSP_INCLUDE_DIR SPEEXDSP_LIBRARY)
2 changes: 1 addition & 1 deletion src/audio_al.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct ALAudio : public AudioInterface {
void BGM_Stop() override;
bool BGM_PlayedOnce() const override;
bool BGM_IsPlaying() const override;
unsigned BGM_GetTicks() override;
unsigned BGM_GetTicks() const override;
void BGM_Fade(int) override;
void BGM_Volume(int) override;
void BGM_Pitch(int) override;
Expand Down
2 changes: 2 additions & 0 deletions src/sdl_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@
# include "audio_al.h"
#endif

#ifdef SUPPORT_AUDIO
AudioInterface& SdlUi::GetAudio() {
return *audio_;
}
#endif

// SDL 1.2 compatibility
#if SDL_MAJOR_VERSION==1
Expand Down
2 changes: 2 additions & 0 deletions src/sdl_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ class SdlUi : public BaseUi {
uint32_t GetTicks() const override;
void Sleep(uint32_t time_milli) override;

#ifdef SUPPORT_AUDIO
AudioInterface& GetAudio() override;
#endif

/** @} */

Expand Down
9 changes: 5 additions & 4 deletions src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@

#ifdef USE_SDL
# define USE_SDL_MIXER

# define SUPPORT_AUDIO
#
# ifdef PSP
# undef USE_SDL_MIXER
# define NO_SDL_MIXER
Expand Down Expand Up @@ -97,9 +98,9 @@
# endif

# ifdef NO_SDL_MIXER
# undef SUPPORT_AUDIO
# else
# define SUPPORT_AUDIO
# if !defined(HAVE_OPENAL)
# undef SUPPORT_AUDIO
# endif
# endif

# ifdef WANT_FMMIDI
Expand Down
18 changes: 9 additions & 9 deletions tests/filefinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
#include "main_data.h"

namespace {
/*
void CheckIsRPG2kProject() {
EASYRPG_SHARED_PTR<FileFinder::ProjectTree> const
tree = FileFinder::CreateProjectTree(".");
std::shared_ptr<FileFinder::DirectoryTree> const
tree = FileFinder::CreateDirectoryTree(".");
assert(FileFinder::IsRPG2kProject(*tree));
FileFinder::SetDirectoryTree(tree);
}
*/

void CheckIsDirectory() {
assert(FileFinder::IsDirectory("."));
}

void CheckEnglishFilename() {
assert(!FileFinder::FindImage("Backdrop", "castle").empty());
assert(!FileFinder::FindImage("CharSet", "Chara1").empty());
}

}

int main(int, char**) {
Main_Data::Init();

CheckIsDirectory();
CheckIsRPG2kProject();

Player::GetEncoding();
Player::escape_symbol = ReaderUtil::Recode("\\", Player::encoding);
Player::engine = Player::EngineRpg2k;
// FileFinder::Init();
FileFinder::InitRtpPaths();

CheckIsDirectory();
// CheckIsRPG2kProject();
CheckEnglishFilename();

FileFinder::Quit();
Expand Down

0 comments on commit 4930c4f

Please sign in to comment.