Skip to content

Instantly share code, notes, and snippets.

@elgiano
Last active August 8, 2020 11:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elgiano/da4f9167dac53e9fc9e178584b68c859 to your computer and use it in GitHub Desktop.
Save elgiano/da4f9167dac53e9fc9e178584b68c859 to your computer and use it in GitHub Desktop.
supercollider CMakeLists patch for Android
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c8ad17de..9a9c6f019 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,11 +3,15 @@ include(SCVersion.txt)
# CMake versions can only consist of digits and periods, so don't use _TWEAK
project(SuperCollider VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR}.${SC_VERSION_PATCH})
-if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
set(LINUX 1)
endif()
-if(CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD|DragonFly|OpenBSD|NetBSD")
+if (CMAKE_SYSTEM_NAME MATCHES "Android")
+ set(ANDROID 1)
+endif()
+
+if(CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD|Android|DragonFly|OpenBSD|NetBSD")
set(LINUX_OR_BSD 1)
endif()
diff --git a/lang/CMakeLists.txt b/lang/CMakeLists.txt
index 933cfd38e..aa5ff663e 100644
--- a/lang/CMakeLists.txt
+++ b/lang/CMakeLists.txt
@@ -321,6 +321,10 @@ elseif(WIN32)
target_link_libraries(libsclang wsock32 ws2_32 portmidi iphlpapi)
endif()
+if (ANDROID)
+ target_link_libraries(libsclang android-glob)
+endif()
+
if (GC_SANITYCHECK)
target_compile_definitions(libsclang PUBLIC GC_SANITYCHECK)
endif()
diff --git a/server/scsynth/CMakeLists.txt b/server/scsynth/CMakeLists.txt
index 370d20c60..4bdce7c29 100644
--- a/server/scsynth/CMakeLists.txt
+++ b/server/scsynth/CMakeLists.txt
@@ -230,6 +230,11 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
target_link_libraries(libscsynth rt)
endif()
+if (ANDROID)
+ target_link_libraries(libscsynth android-glob)
+ target_compile_options(libscsynth PRIVATE -fPIC)
+endif()
+
add_executable(scsynth
scsynth_main.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment