Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(build): when building without XSS extension
Browse files Browse the repository at this point in the history
  • Loading branch information
sudden6 committed Jul 13, 2017
1 parent 8c2703b commit ab62221
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 23 deletions.
31 changes: 19 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

option(PLATFORM_EXTENSIONS "Enable platform specific extensions, requires extra dependencies" ON)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
Expand Down Expand Up @@ -279,18 +281,6 @@ set(${PROJECT_NAME}_SOURCES
src/persistence/smileypack.h
src/persistence/toxsave.cpp
src/persistence/toxsave.h
src/platform/autorun.h
src/platform/capslock.h
src/platform/timer.h
src/platform/autorun_osx.cpp
src/platform/autorun_win.cpp
src/platform/autorun_xdg.cpp
src/platform/capslock_osx.cpp
src/platform/capslock_win.cpp
src/platform/capslock_x11.cpp
src/platform/timer_osx.cpp
src/platform/timer_win.cpp
src/platform/timer_x11.cpp
src/video/cameradevice.cpp
src/video/cameradevice.h
src/video/camerasource.cpp
Expand Down Expand Up @@ -451,6 +441,23 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
)
endif()

if (PLATFORM_EXTENSIONS)
set(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES}
src/platform/autorun.h
src/platform/capslock.h
src/platform/timer.h
src/platform/autorun_osx.cpp
src/platform/autorun_win.cpp
src/platform/autorun_xdg.cpp
src/platform/capslock_osx.cpp
src/platform/capslock_win.cpp
src/platform/capslock_x11.cpp
src/platform/timer_osx.cpp
src/platform/timer_win.cpp
src/platform/timer_x11.cpp
)
endif()

add_definitions(-DQT_MESSAGELOGCONTEXT=1)

if (NOT DEFINED ENABLE_STATUSNOTIFIER)
Expand Down
29 changes: 18 additions & 11 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ function(search_dependency pkg)
if(NOT ${pkg}_FOUND)
if(NOT arg_OPTIONAL)
message(FATAL_ERROR "${pkg} package, library or framework not found")
else()
message(STATUS "${pkg} not found")
endif()
else()
link_directories(${${pkg}_LIBRARY_DIRS})
Expand All @@ -78,6 +80,7 @@ function(search_dependency pkg)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
endforeach()
set(ALL_LIBRARIES ${ALL_LIBRARIES} ${${pkg}_LIBRARIES} PARENT_SCOPE)
message(STATUS "${pkg} found")
endif()

set(${pkg}_FOUND ${${pkg}_FOUND} PARENT_SCOPE)
Expand Down Expand Up @@ -108,9 +111,11 @@ endif()

search_dependency(OPENAL PACKAGE openal FRAMEWORK OpenAL)

# Automatic auto-away support. (X11 also using for capslock detection)
search_dependency(X11 PACKAGE x11 OPTIONAL)
search_dependency(XSS LIBRARY Xss OPTIONAL)
if (PLATFORM_EXTENSIONS AND UNIX AND NOT APPLE)
# Automatic auto-away support. (X11 also using for capslock detection)
search_dependency(X11 PACKAGE x11 OPTIONAL)
search_dependency(XSS LIBRARY Xss OPTIONAL)
endif()

if(APPLE)
search_dependency(AVFOUNDATION FRAMEWORK AVFoundation)
Expand Down Expand Up @@ -178,14 +183,16 @@ if (X11_FOUND AND XSS_FOUND)
set(X11_EXT True)
endif()

if (${APPLE_EXT} OR ${X11_EXT})
add_definitions(
-DQTOX_PLATFORM_EXT=1
)
else()
add_definitions(
-DQTOX_PLATFORM_EXT=0
)
if (PLATFORM_EXTENSIONS)
if (${APPLE_EXT} OR ${X11_EXT})
add_definitions(
-DQTOX_PLATFORM_EXT
)
message(STATUS "Using platform extensions")
else()
message(WARNING "Not using platform extensions, dependencies not found")
set(PLATFORM_EXTENSIONS OFF)
endif()
endif()

add_definitions(
Expand Down

0 comments on commit ab62221

Please sign in to comment.