File: Create-a-shared-library.patch

package info (click to toggle)
gnudatalanguage 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,832 kB
  • sloc: cpp: 198,435; ansic: 47,740; sh: 691; python: 474; makefile: 149; xml: 69; f90: 28
file content (130 lines) | stat: -rw-r--r-- 5,199 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
From: Ole Streicher <olebole@debian.org>
Date: Sun, 24 Jan 2016 12:00:00 +0000
Subject: Create a shared library

Create a shared library to link to gdl executable and Python extension
The library is called libgnudatalanguage.so to avoid confusion with the
libgdl from the GNOME project.

Forwarded: https://sourceforge.net/p/gnudatalanguage/patches/95/
---
 CMakeLists.txt     |  4 +---
 src/CMakeLists.txt | 41 +++++++++++++++++++++++++----------------
 src/pythongdl.cpp  | 10 ++++++++++
 3 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f004270..7efff4b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -949,9 +949,7 @@ if (TARGET version)
   add_dependencies(gdl version)
 endif()
 
-if(NOT PYTHON_MODULE)
-    add_subdirectory(testsuite)
-endif(NOT PYTHON_MODULE)
+add_subdirectory(testsuite)
 
 install(FILES ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/README DESTINATION ${CMAKE_INSTALL_PREFIX}/${GDL_DATA_DIR})
 install(FILES ${CMAKE_SOURCE_DIR}/doc/gdl.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e755f08..7b55a48 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -228,12 +228,14 @@ add_subdirectory(dlm)
 include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/antlr ${CMAKE_BINARY_DIR}/src ${CMAKE_SOURCE_DIR}/src/whereami/src ${CMAKE_BINARY_DIR})
 link_directories(${LINK_DIRECTORIES})
 
+add_library(gnudatalanguage SHARED ${SOURCES})
+SET_TARGET_PROPERTIES(gnudatalanguage PROPERTIES SOVERSION 0)
 if(PYTHON_MODULE) #GDL.so
-	add_library(gdl SHARED ${SOURCES})
-	SET_TARGET_PROPERTIES(gdl PROPERTIES PREFIX "")
-	SET_TARGET_PROPERTIES(gdl PROPERTIES OUTPUT_NAME GDL)
-	SET_TARGET_PROPERTIES(gdl PROPERTIES NO_SONAME TRUE)
-        SET_TARGET_PROPERTIES(gdl PROPERTIES SUFFIX ".so") # e.g. Mac defaults to .dylib which is not looked for by Python
+	add_library(pythongdl SHARED pythongdl.cpp)
+	SET_TARGET_PROPERTIES(pythongdl PROPERTIES PREFIX "")
+	SET_TARGET_PROPERTIES(pythongdl PROPERTIES OUTPUT_NAME GDL)
+	SET_TARGET_PROPERTIES(pythongdl PROPERTIES NO_SONAME TRUE)
+	target_link_libraries(pythongdl gnudatalanguage)
 else(PYTHON_MODULE) #GDL.so
 ## should permit gdl (exe) to export its symbols, necessary for linkimage and DLM
 ## BUT DOES NOT WORK LIKE THAT!!
@@ -244,24 +246,31 @@ else(PYTHON_MODULE) #GDL.so
 #   set_target_properties(gdl PROPERTIES CXX_VISIBILITY_PRESET hidden)
 #   set_target_properties(gdl PROPERTIES C_VISIBILITY_PRESET hidden)
 endif(PYTHON_MODULE)
+add_executable(gdl gdl.cpp)
+target_link_libraries(gdl gnudatalanguage)
+if (OPENMP)
+	target_link_libraries(gdl -fopenmp)
+endif (OPENMP)
+if (READLINE)
+	target_link_libraries(gdl readline)
+endif (READLINE)
 
 if(USE_OPENMP)
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
 endif(USE_OPENMP)
 
-add_dependencies(gdl plplot antlr whereami) # be sure that antlr is built before gdl
-target_link_libraries(gdl plplot antlr whereami) # link antlr against gdl. added librt for mmap (unix only, not osx, apparently)
+add_dependencies(gnudatalanguage plplot antlr whereami) # be sure that antlr is built before gdl
+target_link_libraries(gnudatalanguage plplot antlr whereami) # link antlr against gdl. added librt for mmap (unix only, not osx, apparently)
 if(TARGET Eigen3::Eigen)
-	target_link_libraries(gdl Eigen3::Eigen)
+	target_link_libraries(gnudatalanguage Eigen3::Eigen)
 endif()
 if (MINGW)
-target_link_libraries(gdl ws2_32)
+target_link_libraries(gnudatalanguage ws2_32)
 endif (MINGW)
 if (NOT APPLE AND NOT OSX AND NOT MINGW)
-target_link_libraries(gdl rt) # link antlr against gdl. added librt for mmap (unix only, not osx, apparently)
+target_link_libraries(gnudatalanguage rt) # link antlr against gdl. added librt for mmap (unix only, not osx, apparently)
 endif (NOT APPLE AND NOT OSX AND NOT MINGW)
-
-target_link_libraries(gdl ${LIBRARIES})
+target_link_libraries(gnudatalanguage ${LIBRARIES})
 
 add_definitions(-DHAVE_CONFIG_H)
 
@@ -284,11 +293,11 @@ if(PYTHON_MODULE)
 	file( TO_CMAKE_PATH "${PYTHON_SITE_DIR}" PYTHON_SITE_DIR )
 	string( REGEX REPLACE "^${PYTHON_PREFIX}/" ""
 	       PYTHON_SITE_DIR "${PYTHON_SITE_DIR}")
-	install(TARGETS gdl DESTINATION ${PYTHON_SITE_DIR})
-else(PYTHON_MODULE)
-	install(TARGETS gdl DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
-	set_target_properties(gdl PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+	install(TARGETS pythongdl DESTINATION ${PYTHON_SITE_DIR})
 endif(PYTHON_MODULE)
+install(TARGETS gdl DESTINATION bin)
+set_target_properties(gdl PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+install(TARGETS gnudatalanguage DESTINATION lib)
 
 
 if (NOT APPLE AND NOT OSX AND NOT MINGW)
diff --git a/src/pythongdl.cpp b/src/pythongdl.cpp
index b02fb75..833673d 100644
--- a/src/pythongdl.cpp
+++ b/src/pythongdl.cpp
@@ -44,6 +44,16 @@
 
 void LibInit(); // defined in libinit.cpp
 
+//initialize wxWidgets system
+#ifdef HAVE_LIBWXWIDGETS
+#include "gdlwidget.hpp"
+#ifndef __WXMAC__ 
+wxIMPLEMENT_APP_NO_MAIN( wxAppGDL);
+#else
+wxIMPLEMENT_APP_NO_MAIN( wxApp);
+#endif
+#endif
+
 using namespace std;
 
 // everything is executed within this interpreter