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 131 132 133 134 135 136 137 138 139
|
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 | 42 ++++++++++++++++++++++++------------------
src/plplot/src/CMakeLists.txt | 7 +------
src/pythongdl.cpp | 10 ++++++++++
4 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 47d2ab2..1b2d5ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -984,9 +984,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 0275df1..78798ad 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -222,31 +222,37 @@ add_subdirectory(plplot)
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
-else(PYTHON_MODULE) #GDL.so
- set(SOURCES ${SOURCES} gdl.cpp)
- add_executable(gdl ${SOURCES})
+ 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)
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 (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)
@@ -269,11 +275,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)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/pro/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${GDL_DATA_DIR}/lib
PATTERN CVS EXCLUDE
diff --git a/src/plplot/src/CMakeLists.txt b/src/plplot/src/CMakeLists.txt
index 2fa32ba..443bb25 100644
--- a/src/plplot/src/CMakeLists.txt
+++ b/src/plplot/src/CMakeLists.txt
@@ -176,9 +176,4 @@ message("pc_libplplot_COMPILE_FLAGS = ${pc_libplplot_COMPILE_FLAGS}")
#aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} PLPLOTSOURCES)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/plplot ${CMAKE_SOURCE_DIR}/src/plplot/include)
-if(PYTHON_MODULE)
- add_library(plplot SHARED ${plplot_LIB_SRCS})
- install(TARGETS plplot DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
-else(PYTHON_MODULE)
- add_library(plplot STATIC ${plplot_LIB_SRCS})
-endif(PYTHON_MODULE)
+add_library(plplot STATIC ${plplot_LIB_SRCS})
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
|