1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-05-29 02:45:07 +02:00
This commit is contained in:
andy Augustin 2016-04-11 21:54:19 +00:00
commit 65ed08d2fc
2 changed files with 35 additions and 11 deletions

4
.gitignore vendored
View File

@ -1 +1,5 @@
CMakeLists.txt.user
build/
.idea/

View File

@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8)
project(doorlockd)
option(USE_COLORIZED_LOGS "Colorized logging" ON)
option(DORLOCKD_CMAKE_DEBUG "Set to on for some Debug output" Off)
set(DOORLOCK_VERSION_MAJOR 1)
set(DOORLOCK_VERSION_MINOR 3)
@ -13,7 +14,10 @@ set(DOORLOCK_VERSION "${DOORLOCK_VERSION_MAJOR}.${DOORLOCK_VERSION_MINOR}-${DOOR
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
MESSAGE(STATUS "doorlockd version: ${DOORLOCK_VERSION}")
if(DORLOCKD_CMAKE_DEBUG)
message(STATUS "[${CMAKE_CURRENT_LIST_DIR}:${CMAKE_CURRENT_LIST_LINE}] "
"doorlockd version: ${DOORLOCK_VERSION}")
endif()
# Get the current working branch
execute_process(
@ -24,6 +28,11 @@ execute_process(
)
set(GIT_BRANCH "\"${GIT_BRANCH}\"")
if(DORLOCKD_CMAKE_DEBUG)
message(STATUS "[${CMAKE_CURRENT_LIST_DIR}:${CMAKE_CURRENT_LIST_LINE}] "
"git branch: ${GIT_BRANCH}")
endif()
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%h
@ -33,6 +42,11 @@ execute_process(
)
set(GIT_COMMIT_HASH "\"${GIT_COMMIT_HASH}\"")
if(DORLOCKD_CMAKE_DEBUG)
message(STATUS "[${CMAKE_CURRENT_LIST_DIR}:${CMAKE_CURRENT_LIST_LINE}] "
"git commit hash: ${GIT_COMMIT_HASH}")
endif()
add_definitions(-std=c++11)
configure_file (
@ -40,9 +54,6 @@ configure_file (
"${PROJECT_BINARY_DIR}/config.h"
)
include_directories(${PROJECT_BINARY_DIR})
include_directories(${Boost_INCLUDE_DIRS})
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb -Wall -pedantic -Weffc++ -Wextra")
set(CMAKE_CXX_FLAGS "-O2 -Wall -pedantic -Wextra -Weffc++")
set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb -Wall -pedantic -Wextra")
@ -51,13 +62,17 @@ set(CMAKE_C_FLAGS "-O2 -Wall -pedantic -Wextra")
find_package(Boost 1.55.0 COMPONENTS program_options system REQUIRED)
set(JSON_INCLUDE_DIR "/usr/include/jsoncpp" CACHE PATH "path to jsoncpp includes")
include_directories(${JSON_INCLUDE_DIR})
find_package (Threads)
find_package(Qt5Widgets)
set(LIBDOORLOCK_SRCS
include_directories(
${Boost_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}
${JSON_INCLUDE_DIR})
set(_LIBDOORLOCK_SRCS
lib/clientmessage.cpp
lib/clientmessage.h
lib/door.cpp
@ -75,10 +90,10 @@ set(LIBDOORLOCK_SRCS
lib/util.cpp
lib/util.h)
set(DOORLOCKD_SRCS
set(_DOORLOCKD_SRCS
daemon/doorlockd.cpp)
set(DOORLOCK_CLIENT_SRCS
set(_DOORLOCK_CLIENT_SRCS
client/qrwidget.cpp
client/qrwidget.h
client/doorlock-client.cpp
@ -88,16 +103,21 @@ set(DOORLOCK_CLIENT_SRCS
client/wave.h
client/wave.cpp)
add_library(doorlock STATIC ${LIBDOORLOCK_SRCS})
add_library(doorlock STATIC ${_LIBDOORLOCK_SRCS})
target_link_libraries(doorlock jsoncpp ldap ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
add_executable(doorlockd ${DOORLOCKD_SRCS})
add_executable(doorlockd ${_DOORLOCKD_SRCS})
target_link_libraries(doorlockd doorlock)
add_executable(doorlock-client ${DOORLOCK_CLIENT_SRCS})
add_executable(doorlock-client ${_DOORLOCK_CLIENT_SRCS})
target_link_libraries(doorlock-client doorlock qrencode ao sndfile Qt5::Widgets)
target_include_directories(doorlock-client PRIVATE ${CMAKE_SOURCE_DIR})
mark_as_advanced(
_LIBDOORLOCK_SRCS
_DOORLOCKD_SRCS
_DOORLOCK_CLIENT_SRCS)
install(TARGETS doorlockd DESTINATION sbin/)
install(TARGETS doorlock-client DESTINATION bin/)