|
From: <ai...@us...> - 2013-12-04 06:43:42
|
Revision: 12808
http://sourceforge.net/p/plplot/code/12808
Author: airwin
Date: 2013-12-04 06:43:38 +0000 (Wed, 04 Dec 2013)
Log Message:
-----------
Implement CMake logic to handle dependencies correctly for the new
epa_build add_subdirectory paradigm.
Tested by: Alan W. Irwin <ai...@us...> on Linux
using epa_build with -DBUILD_THE_BUILD_TOOLS=ON cmake option and
the build_tk target with the build_tk dependency on build_tcl
correctly taken care of.
N.B. This is a good start showing the dependent build case works, but
there is still a lot of editing to do to get build configurations
other than Tcl and Tk compatible with the new paradigm.
Modified Paths:
--------------
trunk/cmake/epa_build/CMakeLists.txt
trunk/cmake/epa_build/tk/CMakeLists.txt
Modified: trunk/cmake/epa_build/CMakeLists.txt
===================================================================
--- trunk/cmake/epa_build/CMakeLists.txt 2013-12-03 23:56:24 UTC (rev 12807)
+++ trunk/cmake/epa_build/CMakeLists.txt 2013-12-04 06:43:38 UTC (rev 12808)
@@ -166,7 +166,7 @@
_EPA_visited_subdirectories_LIST
_EPA_processed_subdirectories_LIST
_EPA_needed_subdirectories_LIST
- _EPA_build_target_LIST
+ _EPA_build_targets_LIST
_EPA_PATH
_source_PATH
_IF_RETURN
@@ -179,11 +179,10 @@
#message(STATUS "DEBUG: ${_EPA_visited_subdirectories_LIST} = ${${_EPA_visited_subdirectories_LIST}}")
#message(STATUS "DEBUG: ${_EPA_processed_subdirectories_LIST} = ${${_EPA_processed_subdirectories_LIST}}")
#message(STATUS "DEBUG: ${_EPA_needed_subdirectories_LIST} = ${${_EPA_needed_subdirectories_LIST}}")
- #message(STATUS "DEBUG: ${_EPA_build_target_LIST} = ${${_EPA_build_target_LIST}}")
+ #message(STATUS "DEBUG: ${_EPA_build_targets_LIST} = ${${_EPA_build_targets_LIST}}")
#message(STATUS "DEBUG: ${_EPA_PATH} = ${${_EPA_PATH}}")
#message(STATUS "DEBUG: ${_source_PATH} = ${${_source_PATH}}")
#message(STATUS "DEBUG: ${_IF_RETURN} = ${${_IF_RETURN}}")
- list(APPEND ${_EPA_visited_subdirectories_LIST} ${${_PACKAGE}})
# Remove dependencies that should be ignored.
if(${_dependencies_LIST} AND ${_ignored_dependencies_LIST})
@@ -205,11 +204,17 @@
list(REMOVE_ITEM remaining_dependencies_LIST ${${_EPA_processed_subdirectories_LIST}})
endif(remaining_dependencies_LIST AND ${_EPA_processed_subdirectories_LIST})
- if(remaining_dependencies_LIST)
+ if(0 AND remaining_dependencies_LIST)
list(FIND ${_EPA_visited_subdirectories_LIST} ${${_PACKAGE}} index)
if(index GREATER -1)
message(FATAL_ERROR "Circular dependency: ${_PACKAGE} = ${${_PACKAGE}} has been visited before without subsequently resolving all dependencies.")
endif(index GREATER -1)
+
+ # Mark this subdirectory as being visited so that the above circular
+ # dependency check will work if the next visit still has remaining
+ # dependencies.
+ list(APPEND ${_EPA_visited_subdirectories_LIST} ${${_PACKAGE}})
+
# Put the remaining dependencies at the top of the list so they
# will be processed before the current subdirectory.
list(APPEND ${_EPA_needed_subdirectories_LIST} ${remaining_dependencies_LIST})
@@ -222,8 +227,15 @@
# parent subdirectory should make immediate return to top-level directory.
set(${_IF_RETURN} ON PARENT_SCOPE)
return()
- endif(remaining_dependencies_LIST)
+ endif(0 AND remaining_dependencies_LIST)
+ foreach(build_configuration ${remaining_dependencies_LIST})
+ add_subdirectory(
+ ${CMAKE_SOURCE_DIR}/${build_configuration}
+ ${CMAKE_BINARY_DIR}/${build_configuration}
+ )
+ endforeach(build_configuration ${remaining_dependencies_LIST})
+
# Add this subdirectory to the list of subdirectories that have
# already been processed by the top-level CMakeLists.txt logic.
list(APPEND ${_EPA_processed_subdirectories_LIST} ${${_PACKAGE}})
@@ -233,7 +245,7 @@
list(APPEND ${_dependencies_targets} build_${build_configuration})
endforeach(build_configuration ${${_dependences_LIST}})
- list(APPEND ${_EPA_build_target_LIST} build_${${_PACKAGE}})
+ list(APPEND ${_EPA_build_targets_LIST} build_${${_PACKAGE}})
# Data that is related to the PATH that must be used.
if(MSYS_PLATFORM)
@@ -245,13 +257,17 @@
endif(MSYS_PLATFORM)
#message(STATUS "DEBUG: (modified for ${${_PACKAGE}}) ${_EPA_PATH} = ${${_EPA_PATH}}")
+ # Mark this subdirectory as visited for no logical purpose other
+ # than to be less confusing for debugging.
+ list(APPEND ${_EPA_visited_subdirectories_LIST} ${${_PACKAGE}})
+
# Propagate changed output arguments to parent scope of function.
set(${_dependencies_LIST} ${${_dependencies_LIST}} PARENT_SCOPE)
set(${_dependencies_targets} ${${_dependencies_targets}} PARENT_SCOPE)
set(${_EPA_visited_subdirectories_LIST} ${${_EPA_visited_subdirectories_LIST}} PARENT_SCOPE)
set(${_EPA_processed_subdirectories_LIST} ${${_EPA_processed_subdirectories_LIST}} PARENT_SCOPE)
set(${_EPA_needed_subdirectories_LIST} ${${_EPA_needed_subdirectories_LIST}} PARENT_SCOPE)
- set(${_EPA_build_target_LIST} ${${_EPA_build_target_LIST}} PARENT_SCOPE)
+ set(${_EPA_build_targets_LIST} ${${_EPA_build_targets_LIST}} PARENT_SCOPE)
set(${_EPA_PATH} ${${_EPA_PATH}} PARENT_SCOPE)
set(${_source_PATH} ${${_source_PATH}} PARENT_SCOPE)
# Parent subdirectory should continue processing rather than immediately
@@ -385,7 +401,7 @@
#pkg-config
##subversion
#swig
- tcl
+ tk
# itcl version 4 is integrated into tcl
# itk version 4 is not integrated into tk (or tcl).
#itk
@@ -425,7 +441,9 @@
# This updates EPA_needed_subdirectories_LIST,
# EPA_processed_subdirectories_LIST, and EPA_build_targets_LIST.
add_subdirectory(${subdirectory})
- list(REMOVE_ITEM EPA_needed_subdirectories_LIST ${EPA_processed_subdirectories_LIST})
+ if(EPA_processed_subdirectories_LIST)
+ list(REMOVE_ITEM EPA_needed_subdirectories_LIST ${EPA_processed_subdirectories_LIST})
+ endif(EPA_processed_subdirectories_LIST)
message(STATUS "DEBUG: visited ${subdirectory}")
message(STATUS "DEBUG: EPA_needed_subdirectories_LIST = ${EPA_needed_subdirectories_LIST}")
message(STATUS "DEBUG: EPA_visited_subdirectories_LIST = ${EPA_visited_subdirectories_LIST}")
Modified: trunk/cmake/epa_build/tk/CMakeLists.txt
===================================================================
--- trunk/cmake/epa_build/tk/CMakeLists.txt 2013-12-03 23:56:24 UTC (rev 12807)
+++ trunk/cmake/epa_build/tk/CMakeLists.txt 2013-12-04 06:43:38 UTC (rev 12808)
@@ -1,6 +1,7 @@
# tk/CMakeLists.txt
-# CMakeLists.txt file to configure the build of tk.
+# Configure the build of tk.
+
# Copyright (C) 2013 Alan W. Irwin
# This file is free software; you can redistribute it and/or
@@ -17,50 +18,42 @@
# License along with this file; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-# The top-level CMakeLists.txt file that includes this file should
-# have run "include(ExternalProject)" and set EPA_BASE variable (and
-# corresponding directory property) as well as various EPA variables
-# used below that configure how the External_Project functions
-# operate.
-
# These build configuration details for Tk adapted from information in
# <http://www.linuxfromscratch.org/blfs/view/svn/general/tk.html>.
-# Protect against configuring a build twice in one CMake call
-if(tk_configured)
- return()
-endif(tk_configured)
-set(tk_configured ON)
+set(PACKAGE tk)
# List of dependencies (most of which are build tools) which should be
# ignored.
-set(EPA_ignored_dependencies_LIST ${extra_ignored_dependencies_list})
+set(ignored_dependencies_LIST ${extra_ignored_dependencies_list})
-set(tk_dependencies_LIST tcl)
-# Remove dependencies that should be ignored.
-if(tk_dependencies_LIST)
- list(REMOVE_ITEM tk_dependencies_LIST ${EPA_ignored_dependencies_LIST})
-endif(tk_dependencies_LIST)
+set(dependencies_LIST tcl)
-set(tk_dependencies_targets)
-foreach(build_configuration ${tk_dependencies_LIST})
- if(EXISTS ${CMAKE_SOURCE_DIR}/${build_configuration}/CMakeLists.txt)
- include(${build_configuration}/CMakeLists.txt)
- list(APPEND tk_dependencies_targets build_${build_configuration})
- else(EXISTS ${CMAKE_SOURCE_DIR}/${build_configuration}/CMakeLists.txt)
- message(STATUS "Warning: A build_configuration for ${build_configuration} does not exist so it is assumed this dependency of tk has been installed another way.")
- endif(EXISTS ${CMAKE_SOURCE_DIR}/${build_configuration}/CMakeLists.txt)
-endforeach(build_configuration ${tk_dependences_LIST})
+# Do boilerplate tasks that must be done for each different project
+# that is configured as part of epa_build.
+epa_boilerplate(
+ ignored_dependencies_LIST
+ PACKAGE
+ dependencies_LIST
+ dependencies_targets
+ EPA_visited_subdirectories_LIST
+ EPA_processed_subdirectories_LIST
+ EPA_needed_subdirectories_LIST
+ EPA_build_targets_LIST
+ EPA_PATH
+ source_PATH
+ IF_RETURN
+ )
-# This can be safely done only after above includes.
-set(PACKAGE tk)
+# Propagate list changes to parent scope.
+set(EPA_visited_subdirectories_LIST ${EPA_visited_subdirectories_LIST} PARENT_SCOPE)
+set(EPA_processed_subdirectories_LIST ${EPA_processed_subdirectories_LIST} PARENT_SCOPE)
+set(EPA_needed_subdirectories_LIST ${EPA_needed_subdirectories_LIST} PARENT_SCOPE)
+set(EPA_build_targets_LIST ${EPA_build_targets_LIST} PARENT_SCOPE)
-# Data that is related to downloads.
-# Note that TCL_TK_VERSION and TCL_TK_LIBVERSION variables supplied
-# by tcl/CMakeLists.txt which is included above.
-set(URL http://downloads.sourceforge.net/project/tcl/Tcl/${TCL_TK_VERSION}/tk${TCL_TK_VERSION}-src.tar.gz)
-set(${PACKAGE}_DOWNLOAD_HASH_TYPE MD5)
-set(${PACKAGE}_DOWNLOAD_HASH 63f21c3a0e0cefbd854b4eb29b129ac6)
+if(IF_RETURN)
+ return()
+endif(IF_RETURN)
# Data that is related to the PATH that must be used.
# N.B. note below that we always use the unix subdirectory of the
@@ -70,28 +63,32 @@
# version of configure may be good enough for our needs for all
# platforms.
if(MSYS_PLATFORM)
- #set(EPA_PATH_NODLL "${EPA_PATH}")
- #set(EPA_PATH "${EPA_BASE}/Build/build_${PACKAGE}/dll;${EPA_PATH_NODLL}")
- determine_msys_path(EPA_PATH "${EPA_PATH}")
- # Must have all elements of env command in MSYS platform form
- determine_msys_path(source_PATH "${EPA_BASE}/Source/build_${PACKAGE}/unix")
- set(${PACKAGE}_SET_CFLAGS "CFLAGS=$ENV{CFLAGS}")
+ set(source_PATH ${source_PATH}\unix)
else(MSYS_PLATFORM)
- set(source_PATH "${EPA_BASE}/Source/build_${PACKAGE}/unix")
- set(${PACKAGE}_SET_CFLAGS "CFLAGS=$ENV{CFLAGS}")
+ set(source_PATH ${source_PATH}/unix)
endif(MSYS_PLATFORM)
-#message(STATUS "modified EPA_PATH for ${PACKAGE} = ${EPA_PATH}")
+set(CFLAGS "$ENV{CFLAGS}")
+# Drop -fvisibility=hidden since that option may not work for this package.
+string(REGEX REPLACE "-fvisibility=hidden" "" CFLAGS "${CFLAGS}")
+
+# Data that is related to downloads.
+set(TCL_TK_VERSION 8.6.1)
+string(REGEX REPLACE "\\.[0-9]$" "" TCL_TK_LIBVERSION ${TCL_TK_VERSION})
+set(URL http://downloads.sourceforge.net/project/tcl/Tcl/${TCL_TK_VERSION}/tk${TCL_TK_VERSION}-src.tar.gz)
+set(DOWNLOAD_HASH_TYPE MD5)
+set(DOWNLOAD_HASH 63f21c3a0e0cefbd854b4eb29b129ac6)
+
if(EPA_HAVE_64_BIT_OS)
- set(TK_ENABLE_64_BIT --enable-64bit)
+ set(ENABLE_64_BIT --enable-64bit)
endif(EPA_HAVE_64_BIT_OS)
ExternalProject_Add(
build_${PACKAGE}
- DEPENDS ${${PACKAGE}_dependencies_targets}
+ DEPENDS ${dependencies_targets}
URL ${URL}
- URL_HASH ${${PACKAGE}_DOWNLOAD_HASH_TYPE}=${${PACKAGE}_DOWNLOAD_HASH}
- CONFIGURE_COMMAND ${ENV_EXECUTABLE} PATH=${EPA_PATH} ${${PACKAGE}_SET_CFLAGS} CPPFLAGS=-I${EPA_CMAKE_INSTALL_PREFIX}/include ${source_PATH}/${EPA_CONFIGURE_COMMAND} --mandir=${EPA_CMAKE_INSTALL_PREFIX}/share/man ${TK_ENABLE_64_BIT}
+ URL_HASH ${DOWNLOAD_HASH_TYPE}=${DOWNLOAD_HASH}
+ CONFIGURE_COMMAND ${ENV_EXECUTABLE} PATH=${EPA_PATH} "CFLAGS=${CFLAGS}" CPPFLAGS=-I${EPA_CMAKE_INSTALL_PREFIX}/include ${source_PATH}/${EPA_CONFIGURE_COMMAND} --mandir=${EPA_CMAKE_INSTALL_PREFIX}/share/man ${ENABLE_64_BIT}
BUILD_COMMAND ${ENV_EXECUTABLE} PATH=${EPA_PATH} ${EPA_PARALLEL_MAKE_COMMAND}
INSTALL_COMMAND ${ENV_EXECUTABLE} PATH=${EPA_PATH} ${EPA_PARALLEL_MAKE_COMMAND} install
)
@@ -116,8 +113,3 @@
COMMAND ${CHMOD_EXECUTABLE} -v ${SO_NUMERICAL_PERMISSIONS} ${EPA_CMAKE_INSTALL_PREFIX}/lib/libtk${TCL_TK_LIBVERSION}.so
APPEND
)
-
-list(APPEND build_target_LIST build_${PACKAGE})
-# Restore EPA_PATH to original state.
-set(EPA_PATH "${EPA_ORIGINAL_NATIVE_PATH}")
-#message(STATUS "${PACKAGE} restored original EPA_PATH = ${EPA_PATH}")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|