Skip to content

Commit

Permalink
build: windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
kamui-fin committed Feb 1, 2022
1 parent d4b25ff commit 7e1056e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 27 deletions.
37 changes: 26 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

set(Gazou_MODEL_FOLDER ${CMAKE_INSTALL_PREFIX}/share/gazou/models)
if (WIN32)
set(Gazou_MODEL_FOLDER models)
else()
set(Gazou_MODEL_FOLDER ${CMAKE_INSTALL_PREFIX}/share/gazou/models)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
set(LIBS Qt5::Widgets tesseract lept)
set(SRC
Expand All @@ -33,39 +37,50 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()

option(GUI "Build X11 GUI support" ON)
option(GUI "Build GUI support" ON)

configure_file(src/config.h.in config.h)
include_directories(${PROJECT_BINARY_DIR})

find_package(PkgConfig)

pkg_check_modules(TESSERACT REQUIRED tesseract>=4.0.0)
pkg_check_modules(LEPTONICA REQUIRED lept>=1.70)
pkg_check_modules(tess REQUIRED tesseract)
pkg_check_modules(lept REQUIRED lept)

find_package(Qt5Widgets REQUIRED VERSION 5.10)

if (GUI)
find_package(Qt5X11Extras)
if (UNIX AND NOT APPLE)
find_package(Qt5X11Extras)
endif()
find_package(QHotkey CONFIG QUIET)
if (NOT QHotkey_FOUND)
add_subdirectory(third-party/QHotkey EXCLUDE_FROM_ALL)
endif()
list(APPEND LIBS qhotkey)
list(APPEND SRC src/gui_x11.cpp
list(APPEND SRC src/gui.cpp
src/configwindow.cpp
)
add_compile_definitions(GUI)
endif()

add_executable(${PROJECT_NAME} ${SRC})
# Windows target
if (WIN32)
add_executable(${PROJECT_NAME} WIN32 ${SRC})
else()
add_executable(${PROJECT_NAME} ${SRC})
endif()

target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic)
target_link_libraries(${PROJECT_NAME} ${LIBS})

install(TARGETS gazou RUNTIME DESTINATION bin)
install(DIRECTORY models DESTINATION share/gazou)
install(FILES resources/gazou.desktop DESTINATION share/applications)
install(FILES resources/gazou.png DESTINATION share/pixmaps)
# Install targets
if (UNIX AND NOT APPLE)
install(TARGETS gazou RUNTIME DESTINATION bin)
install(DIRECTORY models DESTINATION share/gazou)
install(FILES resources/gazou.desktop DESTINATION share/applications)
install(FILES resources/gazou.png DESTINATION share/pixmaps)
endif()

# format entire project
file(GLOB_RECURSE
Expand Down
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,9 @@ Gazou is a Japanese OCR for Linux written in C++. It utilizes image processing,

## Installation

### Gentoo
### Windows

First, enable my gentoo overlay with `eselect-repository`. If you don't have it already, follow the [guide](https://wiki.gentoo.org/wiki/Eselect/Repository) on the Gentoo wiki first.

```
eselect repository add kamui git https://github.com/kamui-fin/gentoo-overlay.git
emerge --sync kamui
```

Then you can emerge the package normally with:

```
emerge -av gazou
```
You can grab the latest portable zip build from the [releases](https://github.com/kamui-fin/gazou/releases). Simply unzip and execute `gazou.exe` and the app should run.

### Arch

Expand Down
2 changes: 1 addition & 1 deletion src/configwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <QPushButton>

#include "configwindow.h"
#include "gui_x11.h"
#include "gui.h"
#include "keydialog.h"
#include "utils.h"

Expand Down
2 changes: 1 addition & 1 deletion src/gui_x11.cpp → src/gui.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "gui_x11.h"
#include "gui.h"
#include "configwindow.h"
#include <QApplication>
#include <QClipboard>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "utils.h"

#ifdef GUI
#include "gui_x11.h"
#include "gui.h"
#endif

State state;
Expand Down

0 comments on commit 7e1056e

Please sign in to comment.