diff --git a/CMakeLists.txt b/CMakeLists.txt index b6b39dc..d213eaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ endif() # Configurable options OPTION(WITH_GUI "Build the GUI" OFF) + # Third party libraries find_package(OpenCV REQUIRED core highgui imgproc objdetect PATHS ${OpenCV_PREFIX}/lib/cmake/ @@ -25,10 +26,21 @@ find_package(OpenCV REQUIRED core highgui imgproc objdetect NO_DEFAULT_PATH) # For some reason CMake uses its defaults before the above paths. IF(APPLE) -find_library(FOUNDATION Foundation) -SET(EXTRA_LIBS ${FOUNDATION}) + find_library(FOUNDATION Foundation) + SET(EXTRA_LIBS ${FOUNDATION}) ENDIF() +IF(UNIX AND NOT APPLE) + FIND_PROGRAM(HAVE_GNUSTEP NAMES gnustep-config) + IF(HAVE_GNUSTEP) + SET(WITH_GUI "Build the GUI" ON) + MESSAGE(STATUS "Found GnuStep") + ELSE(HAVE_GNUSTEP) + MESSAGE(STATUS "Cannot find GnuStep") + ENDIF(HAVE_GNUSTEP) +ENDIF(UNIX AND NOT APPLE) + + # Third party programs if(NOT DEFINED FFMPEG) find_program(FFMPEG ffmpeg) @@ -98,6 +110,9 @@ IF(WITH_GUI) SET(CPACK_BINARY_PACKAGEMAKER OFF) SET(CPACK_SOURCE_TGZ OFF) ADD_SUBDIRECTORY(src/qt-gui) + MESSAGE(STATUS "Will build the GUI") +else() + MESSAGE(STATUS "Missing GUI components - will NOT build the GUI") endif() #cpack stuff goes here diff --git a/src/qt-gui/CMakeLists.txt b/src/qt-gui/CMakeLists.txt index 8ddb0a4..84fd2b4 100644 --- a/src/qt-gui/CMakeLists.txt +++ b/src/qt-gui/CMakeLists.txt @@ -36,8 +36,24 @@ SET(MOC_HEADERS QT4_WRAP_CPP(MOC_SRCS ${MOC_HEADERS}) INCLUDE_DIRECTORIES(".") -set_source_files_properties(osx-configuration.mm PROPERTIES COMPILE_FLAGS -ObjC++) - +IF(UNIX AND NOT APPLE) + INCLUDE_DIRECTORIES(/usr/local/include/GNUstep /usr/include/GNUstep) + EXECUTE_PROCESS(COMMAND gnustep-config --objc-flags + OUTPUT_VARIABLE GnuStep_FLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE) + EXECUTE_PROCESS(COMMAND gnustep-config --base-libs + OUTPUT_VARIABLE GnuStep_LINK_FLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE) + STRING(REPLACE "\n" "" GnuStep_FLAGS ${GnuStep_FLAGS}) + STRING(REPLACE "\n" "" GnuStep_LINK_FLAGS ${GnuStep_LINK_FLAGS}) + + SET(GnuStep_LINK_FLAGS "-Wl,--no-as-needed ${GnuStep_LINK_FLAGS}") + set_source_files_properties(osx-configuration.mm PROPERTIES + COMPILE_FLAGS "${GnuStep_FLAGS}" + LINKER_FLAGS "${GnuStep_LINK_FLAGS}") +ELSE() + set_source_files_properties(osx-configuration.mm PROPERTIES COMPILE_FLAGS -ObjC++) +ENDIF() add_executable(demo-application main.cpp @@ -65,6 +81,10 @@ ADD_EXECUTABLE(${BundleName} MACOSX_BUNDLE ${MOC_SRCS} ${EXTRA_SRC} ) +IF(UNIX AND NOT APPLE) + SET_TARGET_PROPERTIES(${BundleName} PROPERTIES + LINK_FLAGS "${GnuStep_LINK_FLAGS}") +ENDIF() TARGET_LINK_LIBRARIES(${BundleName} ${LIBS} ${QT_LIBRARIES} clmTracker avatarAnim ${EXTRA_LIBS}) diff --git a/src/qt-gui/osx-configuration.mm b/src/qt-gui/osx-configuration.mm index 2e3e1f6..4d841f5 100644 --- a/src/qt-gui/osx-configuration.mm +++ b/src/qt-gui/osx-configuration.mm @@ -19,6 +19,7 @@ #include #include +#include #include #include #include