Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Commit

Permalink
Cleanup CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
wangqr committed Sep 10, 2019
1 parent 7b4bb45 commit 847ca22
Show file tree
Hide file tree
Showing 17 changed files with 310 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ script:
./build/version.sh .;
mkdir build-dir;
cd build-dir;
cmake -DCMAKE_CXX_FLAGS='-Wall -Wextra -Wno-unused-parameter -pedantic' ..;
cmake -DCMAKE_CXX_FLAGS='-Wall -Wextra -Wno-unused-parameter -pedantic' -DCMAKE_C_FLAGS='-Wall' -DWITH_STARTUPLOG=ON ..;
make -j2;
fi

Expand Down
350 changes: 231 additions & 119 deletions CMakeLists.txt

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions cmake/FindAviSynth.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
find_package(PkgConfig)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_AviSynth QUIET AviSynth)
find_path(AviSynth_INCLUDE_DIRS
NAMES avisynth.h
PATHS ${PC_AviSynth_INCLUDE_DIRS}
HINTS ${PC_AviSynth_INCLUDE_DIRS}
)
find_library(AviSynth_LIBRARIES
NAMES avisynth
PATHS ${PC_AviSynth_LIBRARY_DIRS}
PATH_SUFFIXES c_api
HINTS ${PC_AviSynth_LIBRARY_DIRS}
)
set(AviSynth_VERSION ${PC_AviSynth_VERSION})
include(FindPackageHandleStandardArgs)
Expand Down
8 changes: 4 additions & 4 deletions cmake/FindFFMS2.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
find_package(PkgConfig)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_FFMS2 QUIET ffms2)
find_path(FFMS2_INCLUDE_DIRS
NAMES ffms.h ffmscompat.h
PATHS ${PC_FFMS2_INCLUDE_DIRS}
HINTS ${PC_FFMS2_INCLUDE_DIRS}
)
find_library(FFMS2_LIBRARIES
NAMES ffms2
PATHS ${PC_FFMS2_LIBRARY_DIRS}
HINTS ${PC_FFMS2_LIBRARY_DIRS}
)
set(FFMS2_VERSION ${PC_FFMS2_VERSION})
include(FindPackageHandleStandardArgs)
Expand All @@ -16,4 +16,4 @@ find_package_handle_standard_args(FFMS2
FFMS2_LIBRARIES
FFMS2_INCLUDE_DIRS
VERSION_VAR FFMS2_VERSION
)
)
2 changes: 1 addition & 1 deletion cmake/FindFFTW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if( NOT FFTW_ROOT AND ENV{FFTWDIR} )
endif()

# Check if we can use PkgConfig
find_package(PkgConfig)
find_package(PkgConfig QUIET)

#Determine from PKG
if( PKG_CONFIG_FOUND AND NOT FFTW_ROOT )
Expand Down
10 changes: 4 additions & 6 deletions cmake/FindHunspell.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@

# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
if( NOT WIN32 )
find_package(PkgConfig)

pkg_check_modules(HUNSPELL_PKG QUIET hunspell)
endif( NOT WIN32 )
find_package(PkgConfig QUIET)

pkg_check_modules(HUNSPELL_PKG QUIET hunspell)

FIND_PATH(HUNSPELL_INCLUDE_DIR NAMES hunspell.h
PATHS
Expand Down Expand Up @@ -53,8 +52,7 @@ if (HUNSPELL_FOUND)
try_compile(HUNSPELL_HAS_STRING_API "${CMAKE_BINARY_DIR}/hunspell_string_api"
"${CMAKE_CURRENT_LIST_DIR}/hunspell_string_api.cpp"
LINK_LIBRARIES ${HUNSPELL_LIBRARIES}
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${HUNSPELL_INCLUDE_DIR}" "-DLINK_LIBRARIES=${HUNSPELL_LIBRARIES}"
OUTPUT_VARIABLE debuggggg)
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${HUNSPELL_INCLUDE_DIR}")
if (HUNSPELL_HAS_STRING_API)
message(STATUS "Hunspell has string API")
else(HUNSPELL_HAS_STRING_API)
Expand Down
14 changes: 14 additions & 0 deletions cmake/FindOSS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
find_package(PkgConfig QUIET)
pkg_check_modules(PC_oss QUIET oss)
find_path(OSS_INCLUDE_DIRS
NAMES sys/soundcard.h
HINTS ${PC_oss_INCLUDE_DIRS}
)
set(OSS_VERSION ${PC_ass_VERSION})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OSS
FOUND_VAR OSS_FOUND
REQUIRED_VARS
OSS_INCLUDE_DIRS
VERSION_VAR OSS_VERSION
)
19 changes: 19 additions & 0 deletions cmake/FindPortAudio.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
find_package(PkgConfig QUIET)
pkg_check_modules(PC_portaudio QUIET portaudio-2.0)
find_path(PortAudio_INCLUDE_DIRS
NAMES portaudio.h
HINTS ${PC_portaudio_INCLUDE_DIRS}
)
find_library(PortAudio_LIBRARIES
NAMES portaudio
HINTS ${PC_portaudio_LIBRARY_DIRS}
)
set(PortAudio_VERSION ${PC_portaudio_VERSION})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PortAudio
FOUND_VAR PortAudio_FOUND
REQUIRED_VARS
PortAudio_LIBRARIES
PortAudio_INCLUDE_DIRS
VERSION_VAR PortAudio_VERSION
)
9 changes: 4 additions & 5 deletions cmake/FindPulseAudio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ if(NOT PulseAudio_FIND_VERSION)
set(PulseAudio_FIND_VERSION "0.9.9")
endif(NOT PulseAudio_FIND_VERSION)

if (NOT WIN32)
include(FindPkgConfig)
pkg_check_modules(PC_PULSEAUDIO QUIET libpulse>=${PulseAudio_FIND_VERSION})
pkg_check_modules(PC_PULSEAUDIO_MAINLOOP QUIET libpulse-mainloop-glib)
endif (NOT WIN32)

find_package(PkgConfig QUIET)
pkg_check_modules(PC_PULSEAUDIO QUIET libpulse>=${PulseAudio_FIND_VERSION})
pkg_check_modules(PC_PULSEAUDIO_MAINLOOP QUIET libpulse-mainloop-glib)

find_path(PULSEAUDIO_INCLUDE_DIR pulse/pulseaudio.h
HINTS
Expand Down
11 changes: 6 additions & 5 deletions cmake/Findass.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
find_package(PkgConfig)
pkg_check_modules(PC_ass QUIET ass)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_ass QUIET libass)
find_path(ass_INCLUDE_DIRS
NAMES ass/ass.h ass/ass_types.h
PATHS ${PC_ass_INCLUDE_DIRS}
PATH_SUFFIXES libass
HINTS ${PC_ass_INCLUDE_DIRS}
)
find_library(ass_LIBRARIES
NAMES ass
PATHS ${PC_ass_LIBRARY_DIRS}
HINTS ${PC_ass_LIBRARY_DIRS}
)
set(ass_VERSION ${PC_ass_VERSION})
include(FindPackageHandleStandardArgs)
Expand All @@ -16,4 +17,4 @@ find_package_handle_standard_args(ass
ass_LIBRARIES
ass_INCLUDE_DIRS
VERSION_VAR ass_VERSION
)
)
9 changes: 5 additions & 4 deletions cmake/Finduchardet.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
find_package(PkgConfig)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_uchardet QUIET uchardet)
find_path(uchardet_INCLUDE_DIRS
NAMES uchardet/uchardet.h
PATHS ${PC_uchardet_INCLUDE_DIRS}
HINTS ${PC_uchardet_INCLUDE_DIRS}
)
find_library(uchardet_LIBRARIES
NAMES uchardet
PATHS ${PC_uchardet_LIBRARY_DIRS}
PATH_SUFFIXES build/src
HINTS ${PC_uchardet_LIBRARY_DIRS}
)
set(uchardet_VERSION ${PC_uchardet_VERSION})
include(FindPackageHandleStandardArgs)
Expand All @@ -16,4 +17,4 @@ find_package_handle_standard_args(uchardet
uchardet_LIBRARIES
uchardet_INCLUDE_DIRS
VERSION_VAR uchardet_VERSION
)
)
2 changes: 1 addition & 1 deletion libaegisub/audio/provider_ram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void RAMAudioProvider::FillBuffer(void *buf, int64_t start, int64_t count) const
break;
}

const int i = (start * bytes_per_sample) >> CacheBits;
const size_t i = (start * bytes_per_sample) >> CacheBits;
const int start_offset = (start * bytes_per_sample) & (CacheBlockSize-1);
const int read_size = std::min<int>(bytes_remaining, CacheBlockSize - start_offset);

Expand Down
12 changes: 12 additions & 0 deletions src/audio_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,25 @@

#include <boost/range/iterator_range.hpp>

#ifdef WITH_ALSA
std::unique_ptr<AudioPlayer> CreateAlsaPlayer(agi::AudioProvider *providers, wxWindow *window);
#endif
#ifdef WITH_DIRECTSOUND
std::unique_ptr<AudioPlayer> CreateDirectSoundPlayer(agi::AudioProvider *providers, wxWindow *window);
std::unique_ptr<AudioPlayer> CreateDirectSound2Player(agi::AudioProvider *providers, wxWindow *window);
#endif
#ifdef WITH_OPENAL
std::unique_ptr<AudioPlayer> CreateOpenALPlayer(agi::AudioProvider *providers, wxWindow *window);
#endif
#ifdef WITH_PORTAUDIO
std::unique_ptr<AudioPlayer> CreatePortAudioPlayer(agi::AudioProvider *providers, wxWindow *window);
#endif
#ifdef WITH_LIBPULSE
std::unique_ptr<AudioPlayer> CreatePulseAudioPlayer(agi::AudioProvider *providers, wxWindow *window);
#endif
#ifdef WITH_OSS
std::unique_ptr<AudioPlayer> CreateOSSPlayer(agi::AudioProvider *providers, wxWindow *window);
#endif

namespace {
struct factory {
Expand Down
2 changes: 1 addition & 1 deletion src/frame_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ enum {
};

#ifdef WITH_STARTUPLOG
#define StartupLog(a) MessageBox(0, a, "Aegisub startup log", 0)
#define StartupLog(a) wxMessageBox(a, "Aegisub startup log")
#else
#define StartupLog(a) LOG_I("frame_main/init") << a
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ wxIMPLEMENT_APP(AegisubApp);
static const char *LastStartupState = nullptr;

#ifdef WITH_STARTUPLOG
#define StartupLog(a) MessageBox(0, L ## a, L"Aegisub startup log", 0)
#define StartupLog(a) wxMessageBox(wxT(a), wxT("Aegisub startup log"))
#else
#define StartupLog(a) LastStartupState = a
#endif
Expand Down
1 change: 0 additions & 1 deletion src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const char *GetAegisubBuildTime() {

const char *GetAegisubBuildCredit() {
return BUILD_CREDIT;
return "";
}
#endif

Expand Down
2 changes: 2 additions & 0 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@
const char *GetAegisubLongVersionString();
/// Version string used in About box, looks nicer
const char *GetAegisubShortVersionString();
#ifdef BUILD_CREDIT
/// Timestamp of build, only shown in About box
const char *GetAegisubBuildTime();
/// Name of who built the binary
const char *GetAegisubBuildCredit();
#endif
/// Is release?
bool GetIsOfficialRelease();
/// Version number
Expand Down

0 comments on commit 847ca22

Please sign in to comment.