ENH: Enabled bootstrapping with MinGW from an MSYS prompt.

This commit is contained in:
Brad King 2006-01-31 18:50:16 -05:00
parent 0dbe4edcfc
commit 576d8b41cb
2 changed files with 81 additions and 24 deletions

View File

@ -37,17 +37,23 @@
# endif
#endif
#if defined(__MINGW32__) && !defined(CMAKE_BUILD_WITH_CMAKE)
# define CMAKE_BOOT_MINGW
#endif
// include the generator
#if defined(_WIN32) && !defined(__CYGWIN__)
# include "cmGlobalVisualStudio6Generator.h"
# if !defined(__MINGW32__)
# include "cmGlobalVisualStudio7Generator.h"
# include "cmGlobalVisualStudio71Generator.h"
# include "cmGlobalVisualStudio8Generator.h"
# endif
# include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h"
# include "cmGlobalWatcomWMakeGenerator.h"
# if !defined(CMAKE_BOOT_MINGW)
# include "cmGlobalVisualStudio6Generator.h"
# include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h"
# include "cmGlobalWatcomWMakeGenerator.h"
# endif
# include "cmGlobalMSYSMakefileGenerator.h"
# include "cmGlobalMinGWMakefileGenerator.h"
# include "cmWin32ProcessExecution.h"
@ -1243,7 +1249,7 @@ int cmake::Configure()
{
#if defined(__BORLANDC__) && defined(_WIN32)
this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator);
#elif defined(_WIN32) && !defined(__CYGWIN__)
#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
std::string installedCompiler;
std::string mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path]";
cmSystemTools::ExpandRegistryValues(mp);
@ -1593,8 +1599,6 @@ void cmake::AddDefaultCommands()
void cmake::AddDefaultGenerators()
{
#if defined(_WIN32) && !defined(__CYGWIN__)
m_Generators[cmGlobalVisualStudio6Generator::GetActualName()] =
&cmGlobalVisualStudio6Generator::New;
#if !defined(__MINGW32__)
m_Generators[cmGlobalVisualStudio7Generator::GetActualName()] =
&cmGlobalVisualStudio7Generator::New;
@ -1603,12 +1607,16 @@ void cmake::AddDefaultGenerators()
m_Generators[cmGlobalVisualStudio8Generator::GetActualName()] =
&cmGlobalVisualStudio8Generator::New;
#endif
#if !defined(CMAKE_BOOT_MINGW)
m_Generators[cmGlobalVisualStudio6Generator::GetActualName()] =
&cmGlobalVisualStudio6Generator::New;
m_Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] =
&cmGlobalBorlandMakefileGenerator::New;
m_Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] =
&cmGlobalNMakeMakefileGenerator::New;
m_Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] =
&cmGlobalWatcomWMakeGenerator::New;
#endif
m_Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] =
&cmGlobalMSYSMakefileGenerator::New;
m_Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] =

View File

@ -17,6 +17,33 @@
#
#=========================================================================
# Detect system and directory information.
cmake_system=`uname`
cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
cmake_source_dir=`(cd "${cmake_source_dir}";pwd)`
cmake_binary_dir=`pwd`
cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap.cmk"
cmake_data_dir="/share/CMake"
cmake_doc_dir="/doc/CMake"
cmake_man_dir="/man"
cmake_init_file=""
# Determine whether this is a MinGW environment.
if echo "${cmake_system}" | grep MINGW >/dev/null 2>&1; then
cmake_system_mingw=true
else
cmake_system_mingw=false
fi
# Choose the generator to use for bootstrapping.
if ${cmake_system_mingw}; then
# Bootstrapping from an MSYS prompt.
cmake_bootstrap_generator="MSYS Makefiles"
else
# Bootstrapping from a standard UNIX prompt.
cmake_bootstrap_generator="Unix Makefiles"
fi
CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
@ -66,12 +93,31 @@ CMAKE_CXX_SOURCES="\
cmOrderLinkDirectories \
cmSourceGroup"
if ${cmake_system_mingw}; then
CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
cmGlobalMSYSMakefileGenerator \
cmGlobalMinGWMakefileGenerator \
cmWin32ProcessExecution"
fi
CMAKE_C_SOURCES="\
cmListFileLexer \
"
KWSYS_C_SOURCES="\
ProcessUNIX"
if ${cmake_system_mingw}; then
KWSYS_C_SOURCES="\
ProcessWin32"
KWSYS_C_MINGW_SOURCES="\
ProcessFwd9x \
EncodeExecutable"
KWSYS_C_GENERATED_SOURCES="\
cmsysProcessFwd9xEnc"
else
KWSYS_C_SOURCES="\
ProcessUNIX"
KWSYS_C_MINGW_SOURCES=""
KWSYS_C_GENERATED_SOURCES=""
fi
KWSYS_CXX_SOURCES="\
Directory \
@ -92,17 +138,6 @@ KWSYS_IOS_FILES="
iostream \
sstream"
cmake_system=`uname`
cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
cmake_source_dir=`(cd "${cmake_source_dir}";pwd)`
cmake_binary_dir=`pwd`
cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap.cmk"
cmake_data_dir="/share/CMake"
cmake_doc_dir="/doc/CMake"
cmake_man_dir="/man"
cmake_init_file=""
# Display CMake bootstrap usage
cmake_usage()
{
@ -970,7 +1005,7 @@ cmake_compiler_settings_comment="/*
* Sources:
* ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
* kwSys Sources:
* ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
* ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}
*/
"
@ -1056,7 +1091,7 @@ done
# Generate Makefile
dep="cmConfigure.h cmsys/Configure.hxx cmsys/Configure.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
objs=""
for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_GENERATED_SOURCES}; do
objs="${objs} ${a}.o"
done
@ -1095,7 +1130,7 @@ for a in ${CMAKE_C_SOURCES}; do
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
for a in ${KWSYS_C_SOURCES}; do
for a in ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}; do
src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
@ -1105,6 +1140,20 @@ for a in ${KWSYS_CXX_SOURCES}; do
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
if ${cmake_system_mingw}; then
src=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9xEnc.c"`
in=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9x.exe"`
cmd=`cmake_escape "${cmake_bootstrap_dir}/cmsysEncodeExecutable.exe"`
a="cmsysProcessFwd9xEnc"
echo "${cmd} : EncodeExecutable.o" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${LDFLAGS} ${cmake_c_flags} EncodeExecutable.o -o ${cmd}" >> "${cmake_bootstrap_dir}/Makefile"
echo "${in} : ProcessFwd9x.o" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${LDFLAGS} ${cmake_c_flags} ProcessFwd9x.o -o ${in}" >> "${cmake_bootstrap_dir}/Makefile"
echo "${src} : ${cmd} ${in}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmd} ${in} ${src} cmsys ProcessFwd9x" >> "${cmake_bootstrap_dir}/Makefile"
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${cmake_c_flags} -I`cmake_escape \"${cmake_source_dir}/Source/kwsys\"` -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
fi
cat>>"${cmake_bootstrap_dir}/Makefile"<<EOF
rebuild_cache:
cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
@ -1153,7 +1202,7 @@ export CXX
export MAKE
# Run bootstrap CMake to configure real CMake
"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}"
RES=$?
if [ "${RES}" -ne "0" ]; then
cmake_error 11 "Problem while running initial CMake"