Skip to content

Commit

Permalink
Merge pull request #1 from shadowsocks/master
Browse files Browse the repository at this point in the history
Move to use CMake build system shadowsocks#521
  • Loading branch information
ChickenSeller authored Aug 9, 2017
2 parents 7231f9a + ba961cd commit 6d51b73
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 132 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.pro.user*
*.user*
*.swp
.directory
build/
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ branches:
before_install:
- sudo add-apt-repository ppa:hzwhuang/ss-qt5 -y
- sudo apt-get -qq update
- sudo apt-get -qq install -y qt5-qmake qt5-default qtbase5-dev libbotan1.10-dev gcc-4.8 libqrencode-dev libzbar-dev libappindicator-dev libqtshadowsocks-dev
- sudo apt-get -qq install -y qt5-default qtbase5-dev libbotan1.10-dev gcc-4.8 libqrencode-dev libzbar-dev libappindicator-dev libqtshadowsocks-dev cmake3

script:
- qmake
- mkdir build && cd build
- cmake ..
- make

50 changes: 50 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.1)

project(Shadowsocks-Qt5
VERSION 2.10.0
LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

find_package(Qt5Core)
find_package(Qt5Gui)
find_package(Qt5Widgets)
find_package(Qt5Network)
if(UNIX AND NOT APPLE)
find_package(Qt5DBus)
endif()
find_package(PkgConfig)

pkg_check_modules(QSS REQUIRED QtShadowsocks>=1.10.0)
find_library(QSS_LIBRARY_VAR
NAMES ${QSS_LIBRARIES}
HINTS ${QSS_LIBRARY_DIRS} ${QSS_LIBDIR})

pkg_check_modules(QRENCODE REQUIRED libqrencode)
find_library(QRENCODE_LIBRARY_VAR
NAMES ${QRENCODE_LIBRARIES}
HINTS ${QRENCODE_LIBRARY_DIRS} ${QRENCODE_LIBDIR})

pkg_check_modules(ZBAR REQUIRED zbar)
find_library(ZBAR_LIBRARY_VAR
NAMES ${ZBAR_LIBRARIES}
HINTS ${ZBAR_LIBRARY_DIRS} ${ZBAR_LIBDIR})

if(UNIX AND NOT APPLE)
pkg_check_modules(APPINDICATOR REQUIRED appindicator-0.1)
find_library(APPINDICATOR_LIBRARY_VAR
NAMES ${APPINDICATOR_LIBRARIES}
HINTS ${APPINDICATOR_LIBRARY_DIRS} ${APPINDICATOR_LIBDIR})
endif()

if(WIN32 OR APPLE)
add_definitions(-DFD_SETSIZE=1024)
endif()

add_subdirectory(src)
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Priority: extra
Maintainer: Symeon Huang <[email protected]>
Build-Depends: debhelper (>= 9),
pkg-config,
qt5-qmake,
cmake (>= 3.1.0) | cmake3 (>= 3.1.0),
qtbase5-dev,
libqrencode-dev,
libqtshadowsocks-dev (>= 1.10.0),
Expand Down
9 changes: 1 addition & 8 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#!/usr/bin/make -f

export QT_SELECT := qt5
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
dh $@ --parallel

override_dh_auto_configure:
qmake

override_dh_auto_install-indep:
make INSTALL_ROOT=$(CURDIR)/debian/tmp
dh $@ --buildsystem=cmake --parallel
43 changes: 0 additions & 43 deletions shadowsocks-qt5.pro

This file was deleted.

60 changes: 60 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
set(APP_NAME "ss-qt5")
add_definitions(-DAPP_VERSION="${PROJECT_VERSION}")

set(SOURCE
icons.qrc
translations.qrc
main.cpp
mainwindow.cpp
ip4validator.cpp
portvalidator.cpp
ssvalidator.cpp
qrwidget.cpp
sharedialog.cpp
editdialog.cpp
logdialog.cpp
connection.cpp
confighelper.cpp
urihelper.cpp
uriinputdialog.cpp
sqprofile.cpp
settingsdialog.cpp
statusnotifier.cpp
connectiontablemodel.cpp
connectionitem.cpp
qrcodecapturer.cpp
)

if (WIN32)
list(APPEND SOURCE ss-qt5.rc)
endif()

add_executable(${APP_NAME} ${SOURCE})

target_link_libraries(${APP_NAME}
PUBLIC Qt5::Core
PUBLIC Qt5::Gui
PUBLIC Qt5::Widgets
PUBLIC Qt5::Network
PRIVATE ${QSS_LIBRARY_VAR}
PRIVATE ${QRENCODE_LIBRARY_VAR}
PRIVATE ${ZBAR_LIBRARY_VAR})
target_include_directories(${APP_NAME}
PRIVATE ${QSS_INCLUDE_DIRS}
PRIVATE ${QRENCODE_INCLUDE_DIRS}
PRIVATE ${ZBAR_INCLUDE_DIRS})

if (UNIX AND NOT APPLE)
target_link_libraries(${APP_NAME}
PRIVATE Qt5::DBus
PRIVATE ${APPINDICATOR_LIBRARY_VAR})
target_include_directories(${APP_NAME} PRIVATE ${APPINDICATOR_INCLUDE_DIRS})
endif()

install(TARGETS ${APP_NAME}
RUNTIME DESTINATION bin)

if (UNIX)
install(FILES shadowsocks-qt5.desktop DESTINATION share/applications)
install(FILES icons/shadowsocks-qt5.png DESTINATION share/icons/hicolor/512x512/apps)
endif()
File renamed without changes.
2 changes: 1 addition & 1 deletion src/sharedialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<customwidget>
<class>QRWidget</class>
<extends>QWidget</extends>
<header>src/qrwidget.h</header>
<header>qrwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
Expand Down
76 changes: 0 additions & 76 deletions src/ss-qt5.pri

This file was deleted.

0 comments on commit 6d51b73

Please sign in to comment.