Skip to content

Instantly share code, notes, and snippets.

@ideasman42
Created March 31, 2016 06:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ideasman42/0922c1311c9f17d8a985e9f53901f521 to your computer and use it in GitHub Desktop.
Save ideasman42/0922c1311c9f17d8a985e9f53901f521 to your computer and use it in GitHub Desktop.
Static libs test (no need for LD_PRELOAD ...)
diff --git a/toonz/sources/colorfx/CMakeLists.txt b/toonz/sources/colorfx/CMakeLists.txt
index 037eb6f..278252a 100644
--- a/toonz/sources/colorfx/CMakeLists.txt
+++ b/toonz/sources/colorfx/CMakeLists.txt
@@ -16,7 +16,7 @@ set(SOURCES
add_translation(colorfx ${HEADERS} ${SOURCES})
-add_library(colorfx SHARED ${HEADERS} ${SOURCES})
+add_library(colorfx STATIC ${HEADERS} ${SOURCES})
add_definitions(-D _USRDLL -DCOLORFX_EXPORTS -DUSE_MESA)
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libcolorfx.dylib")
diff --git a/toonz/sources/image/CMakeLists.txt b/toonz/sources/image/CMakeLists.txt
index 394b573..19379c7 100644
--- a/toonz/sources/image/CMakeLists.txt
+++ b/toonz/sources/image/CMakeLists.txt
@@ -73,7 +73,7 @@ elseif (UNIX)
3gp/tiio_3gp_proxy.cpp)
endif ()
-add_library(image SHARED ${HEADERS} ${SOURCES})
+add_library(image STATIC ${HEADERS} ${SOURCES})
add_definitions(-DTNZIMAGE_DLL -D_USRDLL -DIMAGE_EXPORTS)
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libimage.${LIB_PREFIX}")
diff --git a/toonz/sources/image/svg/tiio_svg.cpp b/toonz/sources/image/svg/tiio_svg.cpp
index 44a74e4..813b3a2 100644
--- a/toonz/sources/image/svg/tiio_svg.cpp
+++ b/toonz/sources/image/svg/tiio_svg.cpp
@@ -2056,7 +2056,7 @@ void writeOutlineStroke(TStroke *s, TPalette *plt, QTextStream &out, double ly,
//----------------------------------------------------------
-double computeAverageThickness(const TStroke *s)
+static double computeAverageThickness(const TStroke *s)
{
int count = s->getControlPointCount();
diff --git a/toonz/sources/sound/CMakeLists.txt b/toonz/sources/sound/CMakeLists.txt
index 126fe95..3b6c1fe 100644
--- a/toonz/sources/sound/CMakeLists.txt
+++ b/toonz/sources/sound/CMakeLists.txt
@@ -12,7 +12,7 @@ set(SOURCES
aiff/tsio_aiff.cpp
raw/tsio_raw.cpp)
-add_library(sound SHARED ${HEADERS} ${SOURCES})
+add_library(sound STATIC ${HEADERS} ${SOURCES})
add_definitions(-DSOUND_EXPORTS)
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libsound.dylib")
diff --git a/toonz/sources/stdfx/CMakeLists.txt b/toonz/sources/stdfx/CMakeLists.txt
index f483c10..9982a2b 100644
--- a/toonz/sources/stdfx/CMakeLists.txt
+++ b/toonz/sources/stdfx/CMakeLists.txt
@@ -244,7 +244,7 @@ set(SOURCES
iwa_noise1234.cpp
iwa_pnperspectivefx.cpp)
-add_library(tnzstdfx SHARED ${HEADERS} ${SOURCES} ${OBJCSOURCES})
+add_library(tnzstdfx STATIC ${HEADERS} ${SOURCES} ${OBJCSOURCES})
add_definitions(-D_USRDLL -DTNZSTDFX_EXPORTS)
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtnzstdfx.dylib")
diff --git a/toonz/sources/tnzbase/CMakeLists.txt b/toonz/sources/tnzbase/CMakeLists.txt
index 059dba6..2ef7f36 100644
--- a/toonz/sources/tnzbase/CMakeLists.txt
+++ b/toonz/sources/tnzbase/CMakeLists.txt
@@ -156,7 +156,7 @@ endif()
qt5_wrap_cpp(SOURCES ${MOC_HEADERS})
-add_library(tnzbase SHARED ${HEADERS} ${SOURCES} ${OBJCSOURCES})
+add_library(tnzbase STATIC ${HEADERS} ${SOURCES} ${OBJCSOURCES})
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtnzbase.dylib")
diff --git a/toonz/sources/tnzcore/CMakeLists.txt b/toonz/sources/tnzcore/CMakeLists.txt
index 738e524..9ae8059 100644
--- a/toonz/sources/tnzcore/CMakeLists.txt
+++ b/toonz/sources/tnzcore/CMakeLists.txt
@@ -266,7 +266,7 @@ add_translation(tnzcore ${HEADERS} ${SOURCES})
qt5_wrap_cpp(SOURCES ${MOC_HEADERS})
-add_library(tnzcore SHARED ${HEADERS} ${SOURCES})
+add_library(tnzcore STATIC ${HEADERS} ${SOURCES})
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtnzcore.${LIB_SUFFIX}")
diff --git a/toonz/sources/tnzext/CMakeLists.txt b/toonz/sources/tnzext/CMakeLists.txt
index 4c5e0a3..3090de7 100644
--- a/toonz/sources/tnzext/CMakeLists.txt
+++ b/toonz/sources/tnzext/CMakeLists.txt
@@ -72,7 +72,7 @@ if(WIN32 AND PLATFORM EQUAL 32)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
endif()
-add_library(tnzext SHARED ${HEADERS} ${SOURCES} ${OBJCSOURCES})
+add_library(tnzext STATIC ${HEADERS} ${SOURCES} ${OBJCSOURCES})
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtnzext.${LIB_SUFFIX}")
diff --git a/toonz/sources/tnztools/CMakeLists.txt b/toonz/sources/tnztools/CMakeLists.txt
index 848ab77..d033fb9 100644
--- a/toonz/sources/tnztools/CMakeLists.txt
+++ b/toonz/sources/tnztools/CMakeLists.txt
@@ -98,7 +98,7 @@ add_translation(tnztools ${HEADERS} ${SOURCES})
qt5_wrap_cpp(SOURCES ${MOC_HEADERS})
-add_library(tnztools SHARED ${HEADERS} ${SOURCES} ${RESOURCES})
+add_library(tnztools STATIC ${HEADERS} ${SOURCES} ${RESOURCES})
add_definitions(-DTNZTOOLS_EXPORTS)
if (APPLE)
diff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txt
index e501ef5..19bb4c5 100644
--- a/toonz/sources/toonz/CMakeLists.txt
+++ b/toonz/sources/toonz/CMakeLists.txt
@@ -378,7 +378,7 @@ elseif(UNIX)
set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES} ${OPENBLAS_LIB})
- target_link_libraries(OpenToonz_${VERSION} Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml Qt5::Script Qt5::Widgets Qt5::PrintSupport ${GL_LIB} ${GLUT_LIB} ${GLU_LIB} ${EXTRA_LIBS})
+ target_link_libraries(OpenToonz_${VERSION} dl GLEW Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml Qt5::Script Qt5::Widgets Qt5::PrintSupport ${GL_LIB} ${GLUT_LIB} ${GLU_LIB} ${EXTRA_LIBS})
endif()
if (APPLE OR UNIX)
diff --git a/toonz/sources/toonzfarm/tfarm/CMakeLists.txt b/toonz/sources/toonzfarm/tfarm/CMakeLists.txt
index 699b79b..8f6e66b 100644
--- a/toonz/sources/toonzfarm/tfarm/CMakeLists.txt
+++ b/toonz/sources/toonzfarm/tfarm/CMakeLists.txt
@@ -20,7 +20,7 @@ set(SOURCES
ttcpipclient.cpp
ttcpipserver.cpp)
-add_library(tfarm SHARED ${HEADERS} ${SOURCES})
+add_library(tfarm STATIC ${HEADERS} ${SOURCES})
add_definitions(-DTFARM_EXPORTS)
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtfarm.${LIB_SUFFIX}")
diff --git a/toonz/sources/toonzlib/CMakeLists.txt b/toonz/sources/toonzlib/CMakeLists.txt
index 2b97e0f..79a1e49 100644
--- a/toonz/sources/toonzlib/CMakeLists.txt
+++ b/toonz/sources/toonzlib/CMakeLists.txt
@@ -319,7 +319,7 @@ add_translation(toonzlib ${HEADERS} ${SOURCES})
qt5_wrap_cpp(SOURCES ${MOC_HEADERS})
-add_library(toonzlib SHARED ${HEADERS} ${SOURCES})
+add_library(toonzlib STATIC ${HEADERS} ${SOURCES})
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtoonzlib.${LIB_SUFFIX}")
endif (APPLE)
diff --git a/toonz/sources/toonzlib/imagepainter.cpp b/toonz/sources/toonzlib/imagepainter.cpp
index 8b3d6a3..c64fb26 100644
--- a/toonz/sources/toonzlib/imagepainter.cpp
+++ b/toonz/sources/toonzlib/imagepainter.cpp
@@ -20,9 +20,9 @@
using namespace ImagePainter;
-TEnv::IntVar FlipBookWhiteBgToggle("FlipBookWhiteBgToggle", 1);
-TEnv::IntVar FlipBookBlackBgToggle("FlipBookBlackBgToggle", 0);
-TEnv::IntVar FlipBookCheckBgToggle("FlipBookCheckBgToggle", 0);
+static TEnv::IntVar FlipBookWhiteBgToggle("FlipBookWhiteBgToggle", 1);
+static TEnv::IntVar FlipBookBlackBgToggle("FlipBookBlackBgToggle", 0);
+static TEnv::IntVar FlipBookCheckBgToggle("FlipBookCheckBgToggle", 0);
namespace
{
diff --git a/toonz/sources/toonzqt/CMakeLists.txt b/toonz/sources/toonzqt/CMakeLists.txt
index 7672910..0aefa8a 100644
--- a/toonz/sources/toonzqt/CMakeLists.txt
+++ b/toonz/sources/toonzqt/CMakeLists.txt
@@ -210,7 +210,7 @@ qt5_add_resources(SOURCES ${RESOURCES})
qt5_wrap_cpp(SOURCES ${MOC_HEADERS} OPTIONS ${incs})
-add_library(toonzqt SHARED ${HEADERS} ${SOURCES} ${RESOURCES})
+add_library(toonzqt STATIC ${HEADERS} ${SOURCES} ${RESOURCES})
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtoonzqt.${LIB_SUFFIX}")
endif (APPLE)
diff --git a/toonz/sources/toonzqt/spreadsheetviewer.cpp b/toonz/sources/toonzqt/spreadsheetviewer.cpp
index 7a9a4c1..f309cb6 100644
--- a/toonz/sources/toonzqt/spreadsheetviewer.cpp
+++ b/toonz/sources/toonzqt/spreadsheetviewer.cpp
@@ -592,7 +592,7 @@ void SpreadsheetViewer::setAutoPanSpeed(const QPoint &speed)
//-----------------------------------------------------------------------------
-int getAutoPanSpeed(int pixels)
+static int getAutoPanSpeed(int pixels)
{
int f = 40;
return tmin(100, (f - 1 + pixels * f) / 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment