[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] [PATCH] Add cmake option NO_GPL3 to simplify building of GPL2 binaries



From: Dan Stowell <danstowell@xxxxxxxxxxxxxxxxxxxxx>

---
 CMakeLists.txt              |    6 +++++-
 QtCollider/CMakeLists.txt   |    5 ++++-
 QtCollider/QWidgetProxy.cpp |    2 +-
 editors/CMakeLists.txt      |   12 ++++++++++--
 4 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3bb68d2..a0b1a13 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -165,8 +165,8 @@ option(SC_MEMORY_DEBUGGING "Build sclang&scsynth for memory debugging (disable m
 option(GC_SANITYCHECK "Enable sanity checks in the sclang garbage collector.")
 
 option(NO_LIBSNDFILE "Disable soundfile functionality. (Not recommended.)" OFF)
-
 option(NO_AVAHI "Disable Avahi support. (Not recommended.)" OFF)
+option(NO_GPL3 "Disable GPL3 code, for GPL2 compatibility. (Not recommended.)" OFF)
 
 option(SCLANG_SERVER "Build with internal server." ON)
 
@@ -287,6 +287,10 @@ if(MINGW)
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstackrealign")
 endif()
 
+if (NO_GPL3)
+	add_definitions(-DNO_GPL3)
+endif()
+
 #############################################
 # subdirectories
 add_subdirectory(external_libraries)
diff --git a/QtCollider/CMakeLists.txt b/QtCollider/CMakeLists.txt
index 97b3e3f..dfdf061 100644
--- a/QtCollider/CMakeLists.txt
+++ b/QtCollider/CMakeLists.txt
@@ -71,7 +71,6 @@ set( QT_COLLIDER_SRCS
   ${QT_COLLIDER_DIR}/QObjectProxy.cpp
   ${QT_COLLIDER_DIR}/QWidgetProxy.cpp
   ${QT_COLLIDER_DIR}/QcObjectFactory.cpp
-  ${QT_COLLIDER_DIR}/hacks/hacks_x11.cpp
   ${QT_COLLIDER_DIR}/primitives/primitives.cpp
   ${QT_COLLIDER_DIR}/primitives/prim_QObject.cpp
   ${QT_COLLIDER_DIR}/primitives/prim_QPen.cpp
@@ -113,6 +112,10 @@ set( QT_COLLIDER_SRCS
   ${QT_COLLIDER_DIR}/style/style.cpp
 )
 
+if(NOT NO_GPL3)
+    list(APPEND QT_COLLIDER_SRCS ${QT_COLLIDER_DIR}/hacks/hacks_x11.cpp)
+endif()
+
 if(QT_COLLIDER_LANG_CLIENT)
     list(APPEND QT_COLLIDER_HDRS ${QT_COLLIDER_DIR}/LanguageClient.h)
     list(APPEND QT_COLLIDER_SRCS ${QT_COLLIDER_DIR}/LanguageClient.cpp)
diff --git a/QtCollider/QWidgetProxy.cpp b/QtCollider/QWidgetProxy.cpp
index b89d548..832dc83 100644
--- a/QtCollider/QWidgetProxy.cpp
+++ b/QtCollider/QWidgetProxy.cpp
@@ -183,7 +183,7 @@ void QWidgetProxy::bringFrontEvent() {
   w->show();
   w->raise();
 
-#ifdef Q_WS_X11
+#if defined(Q_WS_X11) && !defined(NO_GPL3)
   raise_window(QX11Info::display(), w);
 #endif
 }
diff --git a/editors/CMakeLists.txt b/editors/CMakeLists.txt
index 1f730d8..02a1b45 100644
--- a/editors/CMakeLists.txt
+++ b/editors/CMakeLists.txt
@@ -19,10 +19,18 @@ if(SC_EL)
 endif()
 
 if(SC_ED)
-	add_subdirectory(sced)
+	if(NO_GPL3)
+		message(WARNING "SC_ED requested, but NO_GPL3 flag is on, so not activated.")
+	else()
+		add_subdirectory(sced)
+	endif()
 endif()
 
 if(SC_VIM)
-	add_subdirectory(scvim)
+	if(NO_GPL3)
+		message(WARNING "SC_VIM requested, but NO_GPL3 flag is on, so not activated.")
+	else()
+		add_subdirectory(scvim)
+	endif()
 endif()
 
-- 
1.7.5.4


_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/