Blame phd2_2.6.5_disable_cams.patch

Mattia Verga d05674d
From 0d87a84540e90bb17e6d4183fd32d422c410861f Mon Sep 17 00:00:00 2001
Mattia Verga d05674d
From: Andy Galasso <andy.galasso@gmail.com>
Mattia Verga d05674d
Date: Mon, 7 May 2018 12:19:46 -0400
Mattia Verga d05674d
Subject: [PATCH] Linux: add option to exclude binary drivers from build (ZWO
Mattia Verga d05674d
 and QHY)
Mattia Verga d05674d
Mattia Verga d05674d
---
Mattia Verga d05674d
 cameras.h                   |   4 +-
Mattia Verga d05674d
 thirdparty/thirdparty.cmake | 104 +++++++++++++++++++++++---------------------
Mattia Verga d05674d
 2 files changed, 58 insertions(+), 50 deletions(-)
Mattia Verga d05674d
Mattia Verga d05674d
diff --git a/cameras.h b/cameras.h
Mattia Verga d05674d
index 4d4ba67c..a7cdff02 100644
Mattia Verga d05674d
--- a/cameras.h
Mattia Verga d05674d
+++ b/cameras.h
Mattia Verga d05674d
@@ -109,7 +109,9 @@
Mattia Verga d05674d
 #  define QHY_CAMERA
Mattia Verga d05674d
 # endif
Mattia Verga d05674d
 # define INDI_CAMERA
Mattia Verga d05674d
-# define ZWO_ASI
Mattia Verga d05674d
+# ifdef HAVE_ZWO_CAMERA
Mattia Verga d05674d
+#  define ZWO_ASI
Mattia Verga d05674d
+# endif
Mattia Verga d05674d
 # define SXV
Mattia Verga d05674d
 # ifdef HAVE_SBIG_CAMERA
Mattia Verga d05674d
 #   define SBIG
Mattia Verga d05674d
diff --git a/thirdparty/thirdparty.cmake b/thirdparty/thirdparty.cmake
Mattia Verga d05674d
index 2bb1de8c..88157b2d 100644
Mattia Verga d05674d
--- a/thirdparty/thirdparty.cmake
Mattia Verga d05674d
+++ b/thirdparty/thirdparty.cmake
Mattia Verga d05674d
@@ -1207,60 +1207,66 @@ endif()  # APPLE
Mattia Verga d05674d
 #############################################
Mattia Verga d05674d
 if(UNIX AND NOT APPLE)
Mattia Verga d05674d
 
Mattia Verga d05674d
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^armv6(.*)")
Mattia Verga d05674d
-    set(arch "armv6")
Mattia Verga d05674d
-    set(qhyarch "armv6")
Mattia Verga d05674d
- elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^armv7(.*)|arm64|aarch64|^armv8(.*)")
Mattia Verga d05674d
-  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
Mattia Verga d05674d
-    set(arch "armv8")
Mattia Verga d05674d
-    set(qhyarch "armv8")
Mattia Verga d05674d
-  else()
Mattia Verga d05674d
-    set(arch "armv7")
Mattia Verga d05674d
-    set(qhyarch "armv7")
Mattia Verga d05674d
-  endif()
Mattia Verga d05674d
- elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86|X86|amd64|AMD64|i.86")
Mattia Verga d05674d
-  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
Mattia Verga d05674d
-    set(arch "x64")
Mattia Verga d05674d
-    set(qhyarch "x86_64")
Mattia Verga d05674d
-  else()
Mattia Verga d05674d
-    set(arch "x86")
Mattia Verga d05674d
-    set(qhyarch "x86_32")
Mattia Verga d05674d
-  endif()
Mattia Verga d05674d
- else()
Mattia Verga d05674d
-   message(FATAL_ERROR "unknown system architecture")
Mattia Verga d05674d
- endif()
Mattia Verga d05674d
-
Mattia Verga d05674d
-  find_path(ZWO_INCLUDE_DIR ASICamera2.h
Mattia Verga d05674d
-     NO_DEFAULT_PATHS
Mattia Verga d05674d
-     PATHS ${PHD_PROJECT_ROOT_DIR}/cameras
Mattia Verga d05674d
-  )
Mattia Verga d05674d
+  if (NOT OPENSOURCE_ONLY)
Mattia Verga d05674d
+
Mattia Verga d05674d
+    if (CMAKE_SYSTEM_PROCESSOR MATCHES "^armv6(.*)")
Mattia Verga d05674d
+      set(zwoarch "armv6")
Mattia Verga d05674d
+      set(qhyarch "armv6")
Mattia Verga d05674d
+    elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^armv7(.*)|arm64|aarch64|^armv8(.*)")
Mattia Verga d05674d
+      if(CMAKE_SIZEOF_VOID_P EQUAL 8)
Mattia Verga d05674d
+        set(zwoarch "armv8")
Mattia Verga d05674d
+        set(qhyarch "armv8")
Mattia Verga d05674d
+      else()
Mattia Verga d05674d
+        set(zwoarch "armv7")
Mattia Verga d05674d
+        set(qhyarch "armv7")
Mattia Verga d05674d
+      endif()
Mattia Verga d05674d
+    elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86|X86|amd64|AMD64|i.86")
Mattia Verga d05674d
+      if(CMAKE_SIZEOF_VOID_P EQUAL 8)
Mattia Verga d05674d
+        set(zwoarch "x64")
Mattia Verga d05674d
+        set(qhyarch "x86_64")
Mattia Verga d05674d
+      else()
Mattia Verga d05674d
+        set(zwoarch "x86")
Mattia Verga d05674d
+        set(qhyarch "x86_32")
Mattia Verga d05674d
+      endif()
Mattia Verga d05674d
+    else()
Mattia Verga d05674d
+      message(FATAL_ERROR "unknown system architecture")
Mattia Verga d05674d
+    endif()
Mattia Verga d05674d
 
Mattia Verga d05674d
-  find_library(asiCamera2
Mattia Verga d05674d
-                NAMES ASICamera2
Mattia Verga d05674d
-                NO_DEFAULT_PATHS
Mattia Verga d05674d
-                PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/zwolibs/${arch})
Mattia Verga d05674d
-  if(NOT asiCamera2)
Mattia Verga d05674d
-    message(FATAL_ERROR "Cannot find the asiCamera2 drivers")
Mattia Verga d05674d
-  endif()
Mattia Verga d05674d
-  message(STATUS "Found ASICamera2 lib ${asiCamera2}")
Mattia Verga d05674d
-  set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${asiCamera2})
Mattia Verga d05674d
+    find_path(ZWO_INCLUDE_DIR ASICamera2.h
Mattia Verga d05674d
+      NO_DEFAULT_PATHS
Mattia Verga d05674d
+      PATHS ${PHD_PROJECT_ROOT_DIR}/cameras
Mattia Verga d05674d
+    )
Mattia Verga d05674d
 
Mattia Verga d05674d
-  if(IS_DIRECTORY ${PHD_PROJECT_ROOT_DIR}/cameras/qhyccdlibs/linux/${qhyarch})
Mattia Verga d05674d
-    add_definitions(-DHAVE_QHY_CAMERA=1)
Mattia Verga d05674d
+    find_library(asiCamera2
Mattia Verga d05674d
+                 NAMES ASICamera2
Mattia Verga d05674d
+                 NO_DEFAULT_PATHS
Mattia Verga d05674d
+                 PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/zwolibs/${zwoarch})
Mattia Verga d05674d
 
Mattia Verga d05674d
-    # be careful not to pick up any other qhy lib on the system
Mattia Verga d05674d
-    find_library( qhylib
Mattia Verga d05674d
-                  NAMES qhy
Mattia Verga d05674d
-                  NO_DEFAULT_PATH
Mattia Verga d05674d
-                  PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/qhyccdlibs/linux/${qhyarch})
Mattia Verga d05674d
-    if(NOT qhylib)
Mattia Verga d05674d
-      message(FATAL_ERROR "Cannot find the qhy SDK libs")
Mattia Verga d05674d
+    if(NOT asiCamera2)
Mattia Verga d05674d
+      message(FATAL_ERROR "Cannot find the asiCamera2 drivers")
Mattia Verga d05674d
     endif()
Mattia Verga d05674d
-    set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${qhylib})
Mattia Verga d05674d
-  endif()
Mattia Verga d05674d
+    message(STATUS "Found ASICamera2 lib ${asiCamera2}")
Mattia Verga d05674d
+    add_definitions(-DHAVE_ZWO_CAMERA=1)
Mattia Verga d05674d
+    set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${asiCamera2})
Mattia Verga d05674d
+
Mattia Verga d05674d
+    if(IS_DIRECTORY ${PHD_PROJECT_ROOT_DIR}/cameras/qhyccdlibs/linux/${qhyarch})
Mattia Verga d05674d
+      add_definitions(-DHAVE_QHY_CAMERA=1)
Mattia Verga d05674d
+
Mattia Verga d05674d
+      # be careful not to pick up any other qhy lib on the system
Mattia Verga d05674d
+      find_library(qhylib
Mattia Verga d05674d
+                   NAMES qhy
Mattia Verga d05674d
+                   NO_DEFAULT_PATH
Mattia Verga d05674d
+                   PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/qhyccdlibs/linux/${qhyarch})
Mattia Verga d05674d
+      if(NOT qhylib)
Mattia Verga d05674d
+        message(FATAL_ERROR "Cannot find the qhy SDK libs")
Mattia Verga d05674d
+      endif()
Mattia Verga d05674d
+      set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${qhylib})
Mattia Verga d05674d
+    endif()
Mattia Verga d05674d
+
Mattia Verga d05674d
+    # temporarily disable qhy camera pending fix for link error on Ubuntu Trusty
Mattia Verga d05674d
+    remove_definitions(-DHAVE_QHY_CAMERA=1)
Mattia Verga d05674d
 
Mattia Verga d05674d
-  # temporarily disable qhy camera pending fix for link error on Ubuntu Trusty
Mattia Verga d05674d
-  remove_definitions(-DHAVE_QHY_CAMERA=1)
Mattia Verga d05674d
+  endif()  # OPENSOURCE_ONLY
Mattia Verga d05674d
 
Mattia Verga d05674d
   # math library is needed, and should be one of the last things to link to here
Mattia Verga d05674d
   find_library(mathlib NAMES m)