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

Commit

Permalink
Improve project organization
Browse files Browse the repository at this point in the history
- lib: will be used in the future for shared libraries used by the main executable and/or the native plugins
- imports:  will be used in the future for shared QML components used by the main executable and/or the native plugins
- src: all C++/QML sources needed to build executable
  - src/lib: internal libraries used to build the executable (unit tested)
  - src/imports: internal QML components used to build the executable -> should be unit tested using Qt test framework
  - src/main: sources of the main executable -> not testd: contains only the startup classes and the main function
- tests: tests for both internal and public libraries/QML components
  • Loading branch information
ColinDuquesnoy committed Jan 7, 2018
1 parent 43f10f6 commit cf898fc
Show file tree
Hide file tree
Showing 216 changed files with 27 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ include(cmake/InstallDirs.cmake)
include(cmake/Cotire.cmake)

add_subdirectory(src)
add_subdirectory(plugins)
if(BUILD_TESTS)
enable_testing(true)
add_subdirectory(tests)
endif()

# Summary
message(STATUS "Building MellowPlayer v${MellowPlayer_VERSION}")
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/appveyor/runtests.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cd ..\..\build\src\tests
cd ..\..\build\tests
set QTDIR=C:\Qt\5.9\msvc2015_64
set PATH=%QTDIR%\bin;%QTDIR%\lib;%PATH%

Expand Down
2 changes: 1 addition & 1 deletion scripts/beautify.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ def js_beautify_recursive(root_path):
os.chdir("..")

clang_format_recursive(os.path.join(os.getcwd(), "src"))
js_beautify_recursive(os.path.join(os.getcwd(), "src/plugins"))
js_beautify_recursive(os.path.join(os.getcwd(), "plugins"))
2 changes: 1 addition & 1 deletion scripts/packaging/osx/make_dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build_dir=build
mkdir -p ${build_dir}/src/main/MellowPlayer.app/Contents/PlugIns/services
mkdir -p ${build_dir}/src/main/MellowPlayer.app/Contents/Resources

cp -R src/plugins/ ${build_dir}/src/main/MellowPlayer.app/Contents/PlugIns/services
cp -R plugins/ ${build_dir}/src/main/MellowPlayer.app/Contents/PlugIns/services
cp scripts/packaging/osx/mellowplayer.icns ${build_dir}/src/main/MellowPlayer.app/Contents/Resources
cp scripts/packaging/osx/Info.plist ${build_dir}/src/main/MellowPlayer.app/Contents

Expand Down
2 changes: 1 addition & 1 deletion scripts/packaging/windows/make_installer.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set BUILD_DIR=build
mkdir %BUILD_DIR%\bin
mkdir %BUILD_DIR%\bin\plugins
xcopy /S /C /Y %BUILD_DIR%\src\main\Release\MellowPlayer.exe %BUILD_DIR%\bin
xcopy /S /E /D /C /Y src\plugins %BUILD_DIR%\bin\plugins
xcopy /S /E /D /C /Y plugins %BUILD_DIR%\bin\plugins

%QTDIR%\bin\windeployqt %BUILD_DIR%\bin\MellowPlayer.exe -qmldir=src

Expand Down
4 changes: 2 additions & 2 deletions scripts/travis/commit-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
make -j2;

# run tests
pushd src/tests;
pushd tests;
catchsegv ctest --output-on-failure;
popd;
fi
Expand All @@ -27,7 +27,7 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
make -j2;

# run tests
pushd src/tests;
pushd tests;
ctest --output-on-failure;
popd;
fi
4 changes: 2 additions & 2 deletions scripts/travis/full-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
make -j2;

# run all tests
pushd src/tests
pushd tests
ctest --output-on-failure;
popd;
src/main/MellowPlayer --auto-quit-delay 10000 --log-level 1;
Expand All @@ -34,7 +34,7 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
make -j2;

# run all tests
pushd src/tests
pushd tests
ctest --output-on-failure;
popd

Expand Down
5 changes: 0 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
include_directories(lib)
add_subdirectory(lib/MellowPlayer)
add_subdirectory(plugins)
if(BUILD_TESTS)
enable_testing(true)
add_subdirectory(tests)
endif()
add_subdirectory(imports)
add_subdirectory(main)
5 changes: 5 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This directory contains internal C++ and QML sources needed to build the main executable.

- lib: contains internal static libraries
- imports: contains internal QML sources imported by main.qml.
- main: contains the sources of the main executable.
3 changes: 3 additions & 0 deletions src/imports/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory contains internal QML components used in the MellowPlayer executable.

When public QML components will be needed (e.g. for native c++ plugins), they will reside in a top level ``imports`` directory.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ QStringList StreamingServiceLoader::searchPaths() const
{
QStringList paths;

paths.append(BuildConfig::getSourceDir() + QDir::separator() + "src" + QDir::separator() + "plugins");
paths.append(BuildConfig::getSourceDir() + QDir::separator() + "plugins");
paths.append(QFileInfo(QDir::currentPath(), "plugins").absoluteFilePath());
// appimage path is in /$mountpoint/usr/bin/../share/mellowplayer/plugins
paths.append(QFileInfo(qApp->applicationDirPath(), "../share/mellowplayer/plugins").absoluteFilePath());
Expand Down
3 changes: 3 additions & 0 deletions src/lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory contains internal static libraries used to create the MellowPlayer executable.

When public libraries will be needed (e.g. for native c++ plugins), they will reside in a top level lib directory.
3 changes: 2 additions & 1 deletion src/tests/CMakeLists.txt → tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/3rdparty/catch)
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/3rdparty/fakeit)
include_directories(${CMAKE_SOURCE_DIR}/3rdparty/gtest-gmock)
include_directories(../src/lib)
include_directories(.)
include_directories(Lib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(-DPLUGINS_DIR=\"${CMAKE_SOURCE_DIR}/src/plugins\")
add_definitions(-DPLUGINS_DIR=\"${CMAKE_SOURCE_DIR}/plugins\")
add_definitions(-DTEST_SUITE=1)
set(CMAKE_CXX_FLAGS "${TESTS_CMAKE_CXX_FLAGS}")

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit cf898fc

Please sign in to comment.