Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
kracejic committed Feb 20, 2017
2 parents 02cf951 + f3eed83 commit 541221e
Show file tree
Hide file tree
Showing 28 changed files with 431 additions and 72 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ external/*
.tags
*.out
*.swp
*.swo
*.swn
*.pyc
*.exe
tags
*.log
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ add_subdirectory(doc)

# External resources/repositories are downloaded here
add_subdirectory(external)
include_directories( ${EXTERNAL_SPDLOG_INCLUDE_DIR} )

# Images, databases and other data which needs to be installed for project
add_subdirectory(data)
Expand Down
Empty file.
Empty file.
Empty file modified data/dataWindows/share/themes/Flat-Plat/gtk-2.0/render-bits.sh
100644 → 100755
Empty file.
Empty file modified data/dataWindows/share/themes/Flat-Plat/gtk-3.0/parse-sass.sh
100644 → 100755
Empty file.
Empty file.
29 changes: 28 additions & 1 deletion external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,36 @@ add_custom_target(external-Json-update
set(EXTERNAL_JSON_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Json/src/Json/src" PARENT_SCOPE)


#------------------------------------------------------------------------------
# spdlog
# * sets EXTERNAL_SPDLOG_INCLUDE_DIR

ExternalProject_Add(
spdlog
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
# For shallow git clone (without downloading whole history)
# GIT_SHALLOW 1
# For point at certain tag
# GIT_TAG 1.5.7
#disables auto update on every build
UPDATE_DISCONNECTED 1
#disable following
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_DIR "" INSTALL_COMMAND ""
)
# Update json target
add_custom_target(external-spdlog-update
COMMENT "Updated gabime/spdlog"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spdlog/src/spdlog
COMMAND ${GIT_EXECUTABLE} pull
DEPENDS spdlog)
# set include directory
set(EXTERNAL_SPDLOG_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/spdlog/src/spdlog/include" PARENT_SCOPE)


#------------------------------------------------------------------------------
# Convenience update all
add_custom_target(external-update-all
COMMENT "Updated all external projects"
DEPENDS external-Catch-update external-Json-update)
DEPENDS external-Catch-update external-Json-update external-spdlog-update)

20 changes: 12 additions & 8 deletions packaging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,16 @@ set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/out")


# set human names to exetuables
set(CPACK_PACKAGE_EXECUTABLES "runningdict" "RunningDictdt")
set(CPACK_CREATE_DESKTOP_LINKS "runningdict")
set(CPACK_PACKAGE_EXECUTABLES "runningDictGui" "RunningDict")
set(CPACK_CREATE_DESKTOP_LINKS "runningDictGui")
set(CPACK_STRIP_FILES TRUE)


if(WIN32 AND NOT UNIX)
#--------------------------------------------------------------------------
# Windows specific
set(CPACK_GENERATOR "STGZ;ZIP")
set(CPACK_GENERATOR "ZIP")
message(STATUS "Package generation - Windows")
message(STATUS " + STGZ YES ")
message(STATUS " + ZIP YES ")

# NSIS windows installer
Expand Down Expand Up @@ -85,9 +84,9 @@ else()
/usr/share/icons/hicolor
/usr/share/icons/hicolor/256x256
/usr/share/icons/hicolor/256x256/apps
/usr/share/icons/hicolor
/usr/share/icons/hicolor/256x256
/usr/share/icons/hicolor/256x256/apps)
/usr/share/icons/gnome
/usr/share/icons/gnome/256x256
/usr/share/icons/gnome/256x256/apps)
else()
message(STATUS " + RPM NO ")
endif()
Expand All @@ -102,14 +101,19 @@ else()


# Icon and app shortcut for Linux systems
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/runningdict.desktop
# Note: .desktop must have same name as executable
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/runningdictgui.desktop
DESTINATION share/applications/
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/runningdict.png
DESTINATION share/icons/hicolor/256x256/apps/
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/runningdict.png
DESTINATION share/icons/gnome/256x256/apps/
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
# License file
install(FILES ${PROJECT_SOURCE_DIR}/license.md
DESTINATION share/doc/${PROJECT_NAME}/
Expand Down
9 changes: 0 additions & 9 deletions packaging/runningdict.desktop

This file was deleted.

Binary file modified packaging/runningdict.ico
Binary file not shown.
Binary file modified packaging/runningdict.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions packaging/runningdictgui.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=RunningDict
Comment=Translator for developers
Keywords=dictionary
Exec=runningDictGui
Icon=runningdict
Terminal=false
Type=Application
Categories=Utility;
24 changes: 23 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ config file and adding absolute path into *additionalSearchDirs* array.
| option | description |
|--------------------------------|----------------------------------|
| -DCMAKE_CXX_COMPILER="clang++" | change compiler to clang |
| -DCMAKE_BUILD_TYPE=Release | change build type to release |
| -DCMAKE_BUILD_TYPE=Release | change build type to Release |
| -DVERSION_TYPE=stable | change version type to stable |
| -DVERSION_HOST=build | change build machine name |
| -DCMAKE_INSTALL_PREFIX="/" | change install location |
| -DUSE_BOOST_FILESYSTEM=FALSE | whether to use boost::filesystem instead of the experimental filesystem |

Expand Down Expand Up @@ -175,6 +177,14 @@ cmake ..
make check
~~~

If you want to install the software, do this:

~~~
mkdir build ; cd build
cmake -DCMAKE_INSTALL_PREFIX="/usr" -DCMAKE_BUILD_TYPE=Release -DVERSION_HOST=linux -DVERSION_TYPE=stable ..
sudo make install
~~~


### Build on windows

Expand Down Expand Up @@ -228,6 +238,18 @@ console widow is closed too fast.
[bug](https://social.msdn.microsoft.com/Forums/en-US/8f40dcd8-c67f-4eba-9134-a19b9178e481/vs-2015-rc-linker-stdcodecvt-error?forum=vcgeneral)
which prevents this project being built.

### Release

* Increase version in master *CMakeLists.txt*.
* Build configuration
* Windows: `cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DUSE_BOOST_FILESYSTEM=TRUE -DVERSION_HOST=win7 -DVERSION_TYPE=stable ..`
* Linux: `cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DVERSION_HOST=linux -DVERSION_TYPE=stable ..`
* `ninja check`
* `ninja package`
* packages are in *out* directory inside of the build folder.
* commit changes
* create git tag
* push changes and tag to server


## Notes
Expand Down
7 changes: 6 additions & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ set(SRCS
Worker.cpp
Search.cpp
Processer.cpp
log.cpp
)

set(HEADERS
Expand All @@ -28,16 +29,19 @@ set(HEADERS
Search.h
Processer.h
SpeedTimer.h
log.h
)

find_package (Threads)
add_executable(runningDict main.cpp ${SRCS} ${HEADERS})
target_link_libraries (runningDict ${CMAKE_THREAD_LIBS_INIT})
set_property(TARGET runningDict PROPERTY CXX_STANDARD 14) # we want C++14
add_dependencies(runningDict Json spdlog)

add_library(libRunningDict SHARED LibInterface.cpp ${SRCS} ${HEADERS} LibInterface.h)
target_link_libraries (libRunningDict ${CMAKE_THREAD_LIBS_INIT})
set_property(TARGET libRunningDict PROPERTY CXX_STANDARD 14) # we want C++14
add_dependencies(libRunningDict Json spdlog)



Expand Down Expand Up @@ -87,6 +91,7 @@ set(GUISRC
gui/SettingsWindow.cpp
gui/NewWordWindow.cpp
gui/ChangeWordWindow.cpp
gui/NewDictWindow.cpp
gui/Logic.cpp
)

Expand All @@ -106,7 +111,7 @@ if(GTK3MM_FOUND)
else()
add_executable(runningDictGui ${GUISRC} ${SRCS} ${WINDOWS_ICON_RESOURCE})
endif()
add_dependencies(runningDictGui Json)
add_dependencies(runningDictGui Json spdlog)

add_custom_target(gui-run
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin
Expand Down
18 changes: 14 additions & 4 deletions source/Dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ Dict::Dict(const std::string& filename, int bonus, bool enabled)
//-----------------------------------------------------------------------------
void Dict::fill(const std::string& content)
{
mContent.reset(new std::string(content));
string temp = content;
temp.erase(std::remove(temp.begin(), temp.end(), '\r'), temp.end());
mContent.reset(new string(std::move(temp)));
mIs_open = true;
}
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -105,6 +107,7 @@ bool Dict::open(const std::string& filename)
tmp.assign((std::istreambuf_iterator<char>(file)),
std::istreambuf_iterator<char>());
file.close();
tmp.erase(std::remove(tmp.begin(), tmp.end(), '\r'), tmp.end());
mContent.reset(new std::string(move(tmp)));
mIs_open = true;
mErrorState = false;
Expand Down Expand Up @@ -164,7 +167,7 @@ bool Dict::addWord(const std::string& word, const std::string& translation)

// add word
tmp.append("\n"s + wordCopy + "\n " + translation);
if(tmp[0] == '\n')
if (tmp[0] == '\n')
tmp.erase(0, 1);

mContent.reset(new string(move(tmp)));
Expand Down Expand Up @@ -411,14 +414,21 @@ TEST_CASE("adding to an empty dictionary")
{
Dict d;
d.fill("");
d.addWord("test","test");
d.addWord("test", "test");
REQUIRE(*(d.getContens()) == "test\n test");

d.fill("\n");
d.addWord("test","test");
d.addWord("test", "test");
REQUIRE(*(d.getContens()) == "test\n test");
}

TEST_CASE("cr lf removal")
{
Dict d;
d.fill("test\r\n test\n");
REQUIRE(*(d.getContens()) == "test\n test\n");
}

TEST_CASE("checking for a word")
{
Dict d;
Expand Down
Loading

0 comments on commit 541221e

Please sign in to comment.