[cmake] Build tkdnd with CMake and correct Tcl/Tk version

This commit is contained in:
Matthias Hochsteger 2018-11-30 13:40:30 +01:00
parent f3950af799
commit ed494caa44
2 changed files with 60 additions and 109 deletions

View File

@ -27,85 +27,35 @@ if(APPLE)
set(TCL_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/src/project_tcl) set(TCL_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/src/project_tcl)
set(TK_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/src/project_tk) set(TK_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/src/project_tk)
set(TCL_INCLUDE_PATH ${TCL_DIR}/generic;${TCL_DIR}/macosx) set(TCL_INCLUDE_PATH "${TCL_DIR}/generic;${TCL_DIR}/macosx")
set(TK_INCLUDE_PATH ${TK_DIR}/generic;${TK_DIR}/macosx;${TK_DIR}/xlib) set(TK_INCLUDE_PATH "${TK_DIR}/generic;${TK_DIR}/macosx;${TK_DIR}/xlib")
find_package(TCL 8.6 REQUIRED) string(REPLACE ";" "$<SEMICOLON>" TCL_INC "${TCL_INCLUDE_PATH}")
list(APPEND NETGEN_DEPENDENCIES project_tcl project_tk) string(REPLACE ";" "$<SEMICOLON>" TK_INC "${TK_INCLUDE_PATH}")
else()
find_package(TCL 8.5 REQUIRED)
endif()
# set(HOME $ENV{HOME})
# set(tcl_prefix ${CMAKE_INSTALL_PREFIX}/../../)
# ExternalProject_Add(project_tcl
# URL "http://sourceforge.net/projects/tcl/files/Tcl/8.6.4/tcl8.6.4-src.tar.gz"
# URL_MD5 d7cbb91f1ded1919370a30edd1534304
# DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
# UPDATE_COMMAND "" # Disable update
# CONFIGURE_COMMAND ../project_tcl/macosx/configure --enable-threads --enable-framework --prefix=${tcl_prefix} --libdir=${tcl_prefix}/Contents/Frameworks --bindir=${tcl_prefix}/Contents/Frameworks/Tcl.framework/bin
# BUILD_COMMAND make -j4 binaries libraries
# INSTALL_COMMAND make install-binaries install-headers install-libraries install-private-headers
# LOG_DOWNLOAD 1
# LOG_BUILD 1
# LOG_CONFIGURE 1
# LOG_INSTALL 1
# )
#
# ExternalProject_Add(project_tk
# DEPENDS project_tcl
# URL "http://sourceforge.net/projects/tcl/files/Tcl/8.6.4/tk8.6.4-src.tar.gz"
# URL_MD5 261754d7dc2a582f00e35547777e1fea
# DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
# UPDATE_COMMAND "" # Disable update
# CONFIGURE_COMMAND ../project_tk/macosx/configure --enable-aqua=yes --enable-threads --enable-framework --prefix=${tcl_prefix} --libdir=${tcl_prefix}/Contents/Frameworks --bindir=${tcl_prefix}/Contents/Frameworks/Tcl.framework/bin --with-tcl=${tcl_prefix}/Contents/Frameworks/Tcl.framework
# BUILD_COMMAND make -j4 binaries libraries
# INSTALL_COMMAND make install-binaries install-headers install-libraries install-private-headers
# LOG_DOWNLOAD 1
# LOG_BUILD 1
# LOG_CONFIGURE 1
# LOG_INSTALL 1
# )
#
# ExternalProject_Add(project_tkdnd
# URL "https://sourceforge.net/projects/tkdnd/files/OS%20X%20Binaries/TkDND%202.8/tkdnd2.8-OSX-MountainLion.tar.gz"
# URL_MD5 2dbb471b1d66c5f391f3c3c5b71548fb
# DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
# BUILD_IN_SOURCE 1
# CONFIGURE_COMMAND ""
# BUILD_COMMAND ""
# INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${CMAKE_INSTALL_PREFIX}/../MacOS
# LOG_DOWNLOAD 1
# LOG_CONFIGURE 1
# LOG_BUILD 1
# LOG_INSTALL 1
# )
#
# list(APPEND NETGEN_DEPENDENCIES project_tcl project_tk project_tkdnd)
# list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}../Frameworks)
# set(TCL_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/../Frameworks/Tcl.framework/Headers)
# set(TCL_LIBRARY ${CMAKE_INSTALL_PREFIX}/../Frameworks/Tcl.framework)
# set(TK_LIBRARY ${CMAKE_INSTALL_PREFIX}/../Frameworks/Tk.framework)
# set(TK_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/../Frameworks/Tk.framework/Headers)
#
ExternalProject_Add(project_tkdnd ExternalProject_Add(project_tkdnd
URL "http://sourceforge.net/projects/tkdnd/files/TkDND/TkDND%202.8/tkdnd2.8-src.tar.gz" URL "http://sourceforge.net/projects/tkdnd/files/TkDND/TkDND%202.8/tkdnd2.8-src.tar.gz"
URL_MD5 a6d47a996ea957416469b12965d4db91 URL_MD5 a6d47a996ea957416469b12965d4db91
DEPENDS project_tcl project_tk
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/tkdnd_macosx.patch PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/tkdnd_macosx.patch
UPDATE_COMMAND "" # Disable update UPDATE_COMMAND "" # Disable update
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_INSTALL_PREFIX}/Contents/MacOS --libdir=${CMAKE_INSTALL_PREFIX}/Contents/MacOS CMAKE_ARGS
BUILD_COMMAND make -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/Contents/MacOS
INSTALL_COMMAND make install -DTCL_INCLUDE_PATH=${TCL_INC}
-DTK_INCLUDE_PATH=${TK_INC}
-DTK_LIBRARY=${TK_LIBRARY}
-DTCL_LIBRARY=${TCL_LIBRARY}
LOG_DOWNLOAD 1 LOG_DOWNLOAD 1
LOG_CONFIGURE 1 LOG_CONFIGURE 1
LOG_BUILD 1 LOG_BUILD 1
LOG_INSTALL 1 LOG_INSTALL 1
) )
list(APPEND NETGEN_DEPENDENCIES project_tkdnd) list(APPEND NETGEN_DEPENDENCIES project_tkdnd)
else()
find_package(TCL 8.5 REQUIRED)
endif()
elseif(WIN32) elseif(WIN32)

View File

@ -1,35 +1,36 @@
diff -Naur orig/tkdnd2.8/configure changed/tkdnd2.8/configure diff --git a/CMakeLists.txt b/CMakeLists.txt
--- tkdnd2.8/configure 2015-05-13 19:24:32.000000000 +0200 index 4eb497c..c6424fc 100644
+++ tkdnd2.8/configure 2016-02-22 15:26:37.000000000 +0100 --- a/CMakeLists.txt
@@ -6145,7 +6145,7 @@ +++ b/CMakeLists.txt
@@ -43,17 +43,17 @@ IF ( WIN32 )
ELSE ( WIN32 )
## Unix and OS X...
- PKG_CFLAGS="$PKG_CFLAGS -DMAC_TK_COCOA -std=gnu99 -x objective-c -fobjc-gc" IF ( APPLE )
+ PKG_CFLAGS="$PKG_CFLAGS -DMAC_TK_COCOA -std=gnu99 -x objective-c" - SET ( CMAKE_OSX_ARCHITECTURES "x86_64;i386" )
+ SET ( CMAKE_OSX_ARCHITECTURES "x86_64")
FIND_LIBRARY ( COCOA_LIBRARY Cocoa )
INCLUDE_DIRECTORIES ( macosx )
diff -Naur orig/tkdnd2.8/configure.in changed/tkdnd2.8/configure.in - INCLUDE_DIRECTORIES ( /Library/Frameworks/Tk.framework/Versions/8.6/PrivateHeaders )
--- tkdnd2.8/configure.in 2015-05-13 19:24:32.000000000 +0200 - INCLUDE_DIRECTORIES ( /System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/tk-private )
+++ tkdnd2.8/configure.in 2016-02-22 15:26:44.000000000 +0100 - INCLUDE_DIRECTORIES ( /System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/tk-private )
@@ -126,7 +126,7 @@ +# INCLUDE_DIRECTORIES ( /Library/Frameworks/Tk.framework/Versions/8.6/PrivateHeaders )
+# INCLUDE_DIRECTORIES ( /System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/tk-private )
if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then +# INCLUDE_DIRECTORIES ( /System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/tk-private )
TEA_ADD_SOURCES([macosx/macdnd.m]) ADD_DEFINITIONS ( -DMAC_TK_COCOA -DMAC_OSX_TK)
- TEA_ADD_CFLAGS([-DMAC_TK_COCOA -std=gnu99 -x objective-c -fobjc-gc]) ADD_DEFINITIONS ( -DMAC_OSX_TK )
+ TEA_ADD_CFLAGS([-DMAC_TK_COCOA -std=gnu99 -x objective-c]) ADD_DEFINITIONS ( -std=gnu99 )
TEA_ADD_LIBS([-framework Cocoa -framework Carbon]) ADD_DEFINITIONS ( -x objective-c )
fi - ADD_DEFINITIONS ( -fobjc-gc )
+# ADD_DEFINITIONS ( -fobjc-gc )
diff -Naur orig/tkdnd2.8/macosx/macdnd.m changed/tkdnd2.8/macosx/macdnd.m ADD_DEFINITIONS ( -fno-objc-arc )
--- tkdnd2.8/macosx/macdnd.m 2015-07-06 21:49:14.000000000 +0200 # ADD_DEFINITIONS ( -fobjc-arc )
+++ tkdnd2.8/macosx/macdnd.m 2016-02-22 15:27:04.000000000 +0100 LINK_LIBRARIES ( ${COCOA_LIBRARY} )
@@ -16,6 +16,7 @@ @@ -125,7 +125,7 @@ SET ( CP ${CMAKE_COMMAND} -E copy )
#import <tcl.h> ## Locate Tcl/Tk
#import <tk.h> ## ===========================================================================
#import <tkInt.h> MESSAGE ( STATUS "Searching for Tcl/Tk..." )
+#undef panic -FIND_PACKAGE ( TCL REQUIRED )
#import <tkMacOSXInt.h> +#FIND_PACKAGE ( TCL REQUIRED )
#import <Cocoa/Cocoa.h> FIND_PACKAGE ( TclStub REQUIRED )
## Tcl/Tk info (useful for debug purposes)...