Skip to content

Commit

Permalink
screw os x (and win fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
karwler committed May 26, 2017
1 parent b987527 commit beae813
Show file tree
Hide file tree
Showing 22 changed files with 167 additions and 271 deletions.
32 changes: 5 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ endif()
# include directories
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include_directories(/usr/local/include /Library/Frameworks)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

Expand Down Expand Up @@ -120,12 +118,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
"zlib1.dll")
endif()
link_directories(${LIB_DIR})

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(LIB_SDL2 SDL2)
find_library(LIB_SDL2_IMG SDL2_image)
find_library(LIB_SDL2_TTF SDL2_ttf)
find_library(LIB_SDL2_MIX SDL2_mixer)

endif()

Expand All @@ -137,20 +129,13 @@ target_compile_features(VertiRead PUBLIC cxx_nullptr cxx_enum_forward_declaratio
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(VertiRead SDL2.lib SDL2_mixer.lib SDL2_image.lib SDL2_ttf.lib)

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(VertiRead ${LIB_SDL2} ${LIB_SDL2_IMG} ${LIB_SDL2_TTF} ${LIB_SDL2_MIX})

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(VertiRead SDL2 SDL2_mixer SDL2_image SDL2_ttf)

endif()

# target path
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/VertiRead.app/Contents/MacOS")
else()
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
endif()
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")

# target properties
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
Expand All @@ -175,21 +160,14 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_custom_command(TARGET VertiRead POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIB_DIR}/${dll_file} ${EXECUTABLE_OUTPUT_PATH})
endforeach()
add_custom_command(TARGET VertiRead POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/data ${EXECUTABLE_OUTPUT_PATH})

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_custom_command(TARGET VertiRead POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${EXECUTABLE_OUTPUT_PATH}/../Resources
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/rsc/Info.plist ${EXECUTABLE_OUTPUT_PATH}/..
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/rsc/icon.icns ${EXECUTABLE_OUTPUT_PATH}/../Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/data ${EXECUTABLE_OUTPUT_PATH}/../Resources)

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_custom_command(TARGET VertiRead POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/rsc/vertiread.desktop ${EXECUTABLE_OUTPUT_PATH}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/data ${EXECUTABLE_OUTPUT_PATH})
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/rsc/vertiread.desktop ${EXECUTABLE_OUTPUT_PATH})
endif()
add_custom_command(TARGET VertiRead POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/rsc/icon.ico ${EXECUTABLE_OUTPUT_PATH}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/data ${EXECUTABLE_OUTPUT_PATH})

# filter file for ms visual studio
foreach(source IN LISTS SRC_FILES)
Expand Down
25 changes: 7 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
#VertiRead
A simple manga reader and music player for Linux, Windows and OS X.
A simple manga reader and music player for Linux and Windows.
So far it's usable for reading, playing music and basic playlist editing.
It still has some bugs and untested parts.

Used libraries are SDL2, SDL2_image, SDL2_ttf and SDL2_mixer.
The minimum required Cmake version is 3.1.0 and your compiler needs to support at least C++11.

Note: When setting the output directory in Qt, don’t name it ‘build’, cause it might mess up the executable’s location.

##Linux
All dependencies need to be installed manually.
Installing the packages "libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev" should do the trick. (Assuming that all necessary dependencies for those are installed automatically in the process.)

There’s a pre-made launcher, which is copied to the build directory after compilation.
If you want a menu entry for the program, just set the executable’s and icon’s path to the .desktop file and move it to either "/usr/share/applications" or "~/.local/share/applications".

Settings files are being saved in "~/.vertiread".
Note: It's possible that the mouse wheel won't work properly under Linux and I have no idea why.

##Windows
All necessary libraries are already included in the project, however they're built only for the MSVC 14 (2015).

Settings files are being saved in "%AppData%\VertiRead".

##OS X
The project is configured to use the SDL2 frameworks, which need to be installed manually.
The frameworks’ location is set to /Library/Frameworks.

Settings files are being saved in "~/Library/Application Support/VertiRead".

##Changing the default settings
Most defaults and constants are defined in the "src/prog/defaults.h" file.
Just look around and see what you can find.
46 changes: 12 additions & 34 deletions VertiRead.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TEMPLATE = app
CONFIG += c++11
CONFIG -= app_bundle qt

win32:CONFIG(debug, debug|release) {
win32: CONFIG(debug, debug|release) {
CONFIG += console
} else {
CONFIG -= console
Expand All @@ -14,8 +14,7 @@ win32: TARGET = VertiRead
else: TARGET = vertiread

OBJECTS_DIR = $$OUT_PWD/bin
macx: DESTDIR = $$OUT_PWD/VertiRead.app/Contents/MacOS
else: DESTDIR = $$OUT_PWD/build
DESTDIR = $$OUT_PWD/build

# copy data dir and dependencies
win32 {
Expand All @@ -31,19 +30,16 @@ win32 {
}
LIB_WIN ~= s,/,\\,g
postbuild.commands = $$quote(cmd /c copy $$LIB_WIN\\*.dll $${DEST_WIN}) && \
postbuild.commands = $$quote(cmd /c copy $$LIB_WIN\\*.dll $$DEST_WIN) && \
$$quote(cmd /c copy $$PWD_WIN\\rsc\\icon.ico $$DEST_WIN) && \
$$quote(cmd /c xcopy /e/i/y $$PWD_WIN\\data\\* $$DEST_WIN)
}
macx {
postbuild.commands = mkdir -p $$DESTDIR/../Resources && \
cp $$PWD/rsc/Info.plist $$DESTDIR/.. && \
cp $$PWD/rsc/icon.icns $$DESTDIR/../Resources && \
cp -r $$PWD/data/* $$DESTDIR/../Resources
}
linux {
postbuild.commands = cp $$PWD/rsc/vertiread.desktop $$DESTDIR && \
cp $$PWD/rsc/icon.ico $$DESTDIR && \
cp -r $$PWD/data/* $$DESTDIR
}

QMAKE_EXTRA_TARGETS += postbuild
POST_TARGETDEPS += postbuild

Expand All @@ -52,31 +48,13 @@ INCLUDEPATH += $$PWD/src
win32: INCLUDEPATH += $$PWD/include

# dependencies' directories
win32 {
LIBS += -L$$LIB_WIN
}
macx {
FRMWK = -F/Library/Frameworks

QMAKE_CFLAGS += $$FRMWK
QMAKE_CXXFLAGS += $$FRMWK

LIBS += $$FRMWK
}
win32: LIBS += -L$$LIB_WIN

# linker flags
macx {
LIBS += -framework SDL2 \
-framework SDL2_image \
-framework SDL2_ttf \
-framework SDL2_mixer
}
else {
LIBS += -lSDL2 \
-lSDL2_image \
-lSDL2_ttf \
-lSDL2_mixer
}
LIBS += -lSDL2 \
-lSDL2_image \
-lSDL2_ttf \
-lSDL2_mixer

# set sources
SOURCES += src/engine/audioSys.cpp \
Expand All @@ -98,7 +76,7 @@ SOURCES += src/engine/audioSys.cpp \
src/utils/popups.cpp \
src/prog/library.cpp \
src/utils/capturers.cpp \
src/utils/settings.cpp
src/utils/settings.cpp

HEADERS += src/engine/audioSys.h \
src/engine/engine.h \
Expand Down
Binary file removed data/textures/icon.png
Binary file not shown.
22 changes: 0 additions & 22 deletions rsc/Info.plist

This file was deleted.

12 changes: 9 additions & 3 deletions src/engine/audioSys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

AudioSys::AudioSys(const AudioSettings& SETS) :
sets(SETS),
curSong(0),
curMusic(nullptr),
muted(false),
played(false),
Expand Down Expand Up @@ -148,9 +149,14 @@ bool AudioSys::PlaylistLoaded() const {
void AudioSys::LoadPlaylist(const Playlist& newList) {
FreeMusic();

playlist.resize(newList.songs.size());
for (size_t i=0; i!=newList.songs.size(); i++)
playlist[i] = newList.songPath(i);
for (size_t i=0; i!=newList.songs.size(); i++) {
string path = newList.songPath(i);
Mix_Music* tmp = Mix_LoadMUS(path.c_str());
if (tmp) {
Mix_FreeMusic(tmp);
playlist.push_back(path);
}
}
}

void AudioSys::UnloadPlaylist() {
Expand Down
1 change: 0 additions & 1 deletion src/engine/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ void Engine::Run() {

winSys->CreateWindow();
scene = new Scene(Filer::LoadGeneralSettings()); // initializes program and library
winSys->SetIcon(scene->getLibrary()->getTex("icon")->surface);

// initialize values
scene->getProgram()->Event_OpenBookList();
Expand Down
Loading

0 comments on commit beae813

Please sign in to comment.