Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ moc_*
qrc_*
imagewriter
.tmp/

# build directory
build/

# Compiled Object files
*.slo
*.lo
Expand Down
68 changes: 68 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
cmake_minimum_required(VERSION 3.19)
project(Imagewriter VERSION 1.10 LANGUAGES CXX)

# try to find Qt6
find_package(Qt6 6.2
COMPONENTS DBus Gui Widgets)
if (Qt6_FOUND)
message(STATUS "Using Qt6")
qt_standard_project_setup()
else()
# try to fall back to Qt5
find_package(Qt5 5.15
COMPONENTS DBus Gui Widgets)
if (Qt5_FOUND)
message(STATUS "Using Qt5")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
else()
message(FATAL_ERROR "Qt6 and Qt5 not found")
endif()
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=hidden -fvisibility-inlines-hidden")

add_executable(imagewriter
main.cpp
MainWindow.cpp
PlatformHal.cpp
PlatformUdisks.cpp
Platform.cpp
PlatformUdisks2.cpp
udisks2_interface.cpp
udisks2_mountpoints_interface.cpp
imagewriter.qrc
)

include(FindPackageHandleStandardArgs)
if(USEHAL)
# try to find HAL
find_path(HAL_INCLUDE_DIR NAMES hal/libhal.h)
find_library(HAL_LIBRARY NAMES hal)
find_package_handle_standard_args(HAL REQUIRED_VARS HAL_INCLUDE_DIR HAL_LIBRARY)
target_compile_definitions(imagewriter PUBLIC USEHAL)
elseif(USEUDISKS)
target_compile_definitions(imagewriter PUBLIC USEUDISKS)
else() # default to USEUDISKS2
target_compile_definitions(imagewriter PUBLIC USEUDISKS2)
endif()

target_compile_definitions(imagewriter PUBLIC "APP_VERSION=\"${CMAKE_PROJECT_VERSION}\"")

target_link_libraries(imagewriter
PRIVATE Qt::DBus Qt::Gui Qt::Widgets ${HAL_LIBRARY})

target_include_directories(imagewriter
PRIVATE HAL_INCLUDE_DIR UDISKS_INCLUDE_DIR UDISKS2_INCLUDE_DIR)

# install
include(GNUInstallDirs)
install(TARGETS imagewriter
RUNTIME
RESOURCE imagewriter.qrc)
install(DIRECTORY icons DESTINATION "${DATAROOTDIR}/icons/hicolor/")
install(FILES imagewriter.1 DESTINATION ${mandir})
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,26 @@ In order to compile, run

% qmake DEFINES=USEHAL imagewriter.pro

or

% cmake -DUSEHAL=ON ..

** udisks1 **

% qmake DEFINES=USEUDISKS imagewriter.pro

or

% cmake -DUSEUDISKS=ON ..

** udisks2 **

% qmake DEFINES=USEUDISKS2 imagewriter.pro

or

% cmake -DUSEUDISKS2=ON ..

Failing to specify the define will likely not work out.

Then run
Expand Down
6 changes: 3 additions & 3 deletions imagewriter.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# #####################################################################
# Automatically generated by qmake (2.01a) Thu Oct 23 14:13:58 2008
# #####################################################################
# print deprecation warning
message("qmake support is deprecated and will be removed in future release. Use CMake instead.")

unix:isEmpty(PREFIX):PREFIX = /usr/local
TEMPLATE = app
TARGET = imagewriter
Expand Down