Skip to content

Commit

Permalink
Improve install documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolarevelant committed Aug 26, 2023
1 parent d12401d commit 7854d13
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")

if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT DEFINED DATA_PATH)
set(DATA_PATH "${CMAKE_SOURCE_DIR}/")
set(DATA_PATH "${CMAKE_SOURCE_DIR}")
endif ()

message("Build type: ${CMAKE_BUILD_TYPE}")
Expand All @@ -24,7 +24,7 @@ if (DEFINED DATA_PATH)
add_subdirectory(src)
else ()
# System configuration path (used by configure_file)
set(DATA_PATH /usr/share/${PROJECT_NAME}/)
set(DATA_PATH ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME})

# Create the target
add_subdirectory(src)
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,29 @@ with the version code (MAJOR.MINOR.PATCH).

## Installation

From the source directory:
To install into ``/usr/local``, run:

```bash
git clone https://github.com/nicolarevelant/italian-draughts.git
cd italian-draughts
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
/usr/bin/italian-draughts
cmake --build build -- -j8
sudo cmake --install build
```

To set a custom application data path (instead of /usr/share/italian-draughts/)
The installation path can be changed using the ``-DCMAKE_INSTALL_PREFIX=<installation path>``
argument for ``cmake``.

To set a custom application data path (instead of ``<installation path>/share/italian-draughts``)
you can set the `DATA_PATH` cmake variable.

If CMAKE_BUILD_TYPE equals Debug and DATA_PATH is not set then DATA_PATH is set
to the absolute path of the project root directory.

If you set a custom path the manual pages and the installation rules will be ignored.
If you set a custom DATA_PATH (or CMAKE_BUILD_TYPE equals Debug) the manual pages
and the installation target will be ignored.

Windows and macOS are not supported yet.

# Copyright and license

Expand Down
8 changes: 4 additions & 4 deletions src/Frame/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ wxMenuBar *Frame::createMenuBar() {

wxPanel *Frame::createChessboard(wxWindow *parent, const std::string &path) {
// load images
wxBitmap pcPawn{path + "images/pcPawn.png"};
wxBitmap pcPawn{path + "/images/pcPawn.png"};
if (!pcPawn.IsOk()) return nullptr;
wxBitmap pcDame(path + "images/pcDame.png");
wxBitmap pcDame(path + "/images/pcDame.png");
if (!pcDame.IsOk()) return nullptr;
wxBitmap plPawn(path + "images/plPawn.png");
wxBitmap plPawn(path + "/images/plPawn.png");
if (!plPawn.IsOk()) return nullptr;
wxBitmap plDame(path + "images/plDame.png");
wxBitmap plDame(path + "/images/plDame.png");
if (!plDame.IsOk()) return nullptr;
wxSize imageSize = pcPawn.GetSize();
if (pcDame.GetSize() != imageSize || plPawn.GetSize() != imageSize || plDame.GetSize() != imageSize) return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const wxColour &Resources::getColor(const std::string &key, const wxColour &def)
}

bool Resources::fillColorsMap(ColorsMap &colors, const std::string &path, const std::string &theme) {
std::ifstream file(path + "themes/" + theme);
std::ifstream file(path + "/themes/" + theme);
if (file.is_open()) {
std::string line;
while (std::getline(file, line)) {
Expand Down

0 comments on commit 7854d13

Please sign in to comment.