Added cmake support, deleted Autoconf/Automake stuff and made an easy-to-use process

This commit is contained in:
tlegrand 2007-09-13 13:36:13 +00:00
commit 292f9cfd2a
3 changed files with 93 additions and 11 deletions

View file

@ -4,21 +4,52 @@
### 1) Include the sources
######################################################################################
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${MyStruct_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src/do)
######################################################################################
######################################################################################
### 2) Define your target
### 2) Specify where CMake can find the libraries
######################################################################################
IF(NOT WIN32 OR CYGWIN)
LINK_DIRECTORIES(${EO_BINARY_DIR}/lib)
ENDIF(NOT WIN32 OR CYGWIN)
# especially for Visual Studio
IF(WIN32 AND NOT CYGWIN)
LINK_DIRECTORIES(${EO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE})
ENDIF(WIN32 AND NOT CYGWIN)
######################################################################################
######################################################################################
### 3) Define your targets
######################################################################################
ADD_EXECUTABLE(MyStructEA MyStructEA.cpp)
######################################################################################
######################################################################################
### 3) Windows advanced config - especially for Microsoft Visual Studio 8
### 4) Link the librairies for the targets
######################################################################################
TARGET_LINK_LIBRARIES(MyStructEA eo eoutils ga es)
######################################################################################
######################################################################################
### 6) Windows advanced config - especially for Microsoft Visual Studio 8
######################################################################################
IF(CMAKE_CXX_COMPILER MATCHES cl)

View file

@ -14,7 +14,27 @@ ENABLE_LANGUAGE(CXX)
######################################################################################
### 2) Where must cmake go now ?
### 2) We need to know where EO is installed
######################################################################################
IF(NOT EO_SOURCE_DIR)
SET( EO_SOURCE_DIR
EO_SRC_DIR CACHE STRING
"EO source directory"
FORCE)
ENDIF(NOT EO_SOURCE_DIR)
IF(NOT EO_BINARY_DIR)
SET( EO_BINARY_DIR
EO_BIN_DIR CACHE STRING
"EO binary directory"
FORCE)
ENDIF(NOT EO_BINARY_DIR)
######################################################################################
######################################################################################
### 3) Where must cmake go now ?
######################################################################################
SUBDIRS(src)

View file

@ -3,7 +3,7 @@
# Script to create a completely new EO project from templates
#
# Originally by Marc Schoenauer
# Copyright (C) 2006 Jochen Küpper <jochen@fhi-berlin.mpg.de>
# Copyright (C) 2006 Jochen Kpper <jochen@fhi-berlin.mpg.de>
if ($PWD:t != Templates) then
echo "You must start this shell script from the EO Template directory"
@ -23,7 +23,7 @@ echo " "
if ($#argv == 1) then
set TargetDir = /tmp/$1
else
set TargetDir = /tmp/$2
set TargetDir = $2
endif
if ( -d $TargetDir ) then
echo "Warning: The target directory does exist already."
@ -55,6 +55,30 @@ echo "Creating build-support files for application $1 in $TargetDir"
sed s/MyStruct/$1/g configure.ac.tmpl > $TargetDir/configure.ac
sed s/MyStruct/$1/g Makefile.am.top-tmpl > $TargetDir/Makefile.am
sed s/MyStruct/$1/g Makefile.am.src-tmpl > $TargetDir/src/Makefile.am
##### Build a ready-to-use CMake config
# need paths
set eo_src_var = 'EO_SRC_DIR'
echo "$PWD" > temp.txt
sed -e "s/\//\\\//g" temp.txt > temp2.txt
set safe_eo_path = `cat temp2.txt`
set safe_eo_path = "$safe_eo_path\/..\/.."
set eo_bin_var = 'EO_BIN_DIR'
set eo_src_path = "$safe_eo_path"
set eo_bin_path = "$safe_eo_path\/build"
sed -e "s/MyStruct/$1/g" -e "s/$eo_src_var/$eo_src_path/g" -e "s/$eo_bin_var/$eo_bin_path/g" CMakeLists.txt.top-tmpl > $TargetDir/CMakeLists.txt
sed -e "s/MyStruct/$1/g" CMakeLists.txt.src-tmpl > $TargetDir/src/CMakeLists.txt
# remove temp dirs
rm -f temp.txt temp2.txt
#####
sed s/MyStruct/$1/g README.tmpl > $TargetDir/README
touch $TargetDir/AUTHORS
touch $TargetDir/COPYING
@ -67,12 +91,19 @@ echo "Start building the new project"
# building new project
#cd $TargetDir
#aclocal || exit
#autoheader || exit
#automake --add-missing --copy --gnu || exit ### forget uncompatible option: --force-missing
#autoconf || exit
#./configure || exit
#make || exit
# New: building new project using CMake
cd $TargetDir
aclocal || exit
autoheader || exit
automake --add-missing --copy --force-missing --gnu || exit
autoconf || exit
./configure || exit
#mkdir build
#cd build
cmake . || exit
make || exit