diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | ChangeLog.manual | 4 | ||||
-rw-r--r-- | Docs/cmake-indent.vim | 2 | ||||
-rw-r--r-- | Modules/CPack.cmake | 16 | ||||
-rw-r--r-- | Modules/CTest.cmake | 28 | ||||
-rw-r--r-- | Modules/FindQt3.cmake | 4 | ||||
-rw-r--r-- | Modules/NSIS.template.in | 7 | ||||
-rw-r--r-- | Modules/UseEcos.cmake | 202 | ||||
-rw-r--r-- | Source/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Source/cmGlobalKdevelopGenerator.cxx | 20 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 15 | ||||
-rw-r--r-- | Source/kwsys/Terminal.c | 398 | ||||
-rw-r--r-- | Source/kwsys/Terminal.h.in | 157 | ||||
-rw-r--r-- | Source/kwsys/testTerminal.c | 31 | ||||
-rw-r--r-- | Tests/Java/CMakeLists.txt | 24 |
15 files changed, 869 insertions, 45 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bc1d8c5..fdb955a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -261,6 +261,7 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") # sure there is at least one set of four (4) backlasshes. SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\CMakeInstall.bmp") SET(CPACK_PACKAGE_EXECUTABLES "CMakeSetup" "CMake") + SET(CPACK_NSIS_MODIFY_PATH ON) ELSE(WIN32 AND NOT UNIX) SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake") ENDIF(WIN32 AND NOT UNIX) diff --git a/ChangeLog.manual b/ChangeLog.manual index ec2b9d0..cd6a16b 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,5 +1,9 @@ Changes in CMake 2.4.1 +* Kdevelop generator handles CMakeFiles directory better + +* add correct depend information for fluid + * allow the cache to be saved even if a fatal error occurs * fix bug in relative path subdir and add_subdirectoy commands diff --git a/Docs/cmake-indent.vim b/Docs/cmake-indent.vim index d0711d9..a1ad832 100644 --- a/Docs/cmake-indent.vim +++ b/Docs/cmake-indent.vim @@ -56,7 +56,7 @@ fun! CMakeGetIndent(lnum) \ or . '[^()\\#"]' . or . '\\.' . '\)*' let cmake_indent_comment_line = '^\s*' . cmake_regex_comment - let cmake_indent_blank_regex = '^\s*$') + let cmake_indent_blank_regex = '^\s*$' let cmake_indent_open_regex = '^\s*' . cmake_regex_identifier . \ '\s*(' . cmake_regex_arguments . \ '\(' . cmake_regex_comment . '\)\?$' diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 0f84c8c..25785a0 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -52,9 +52,19 @@ IF(CPACK_NSIS_MODIFY_PATH) SET(CPACK_NSIS_MODIFY_PATH ON) ENDIF(CPACK_NSIS_MODIFY_PATH) +SET(__cpack_system_name ${CMAKE_SYSTEM_NAME}) +IF(${__cpack_system_name} MATCHES Windows) + IF(CMAKE_CL_64) + SET(__cpack_system_name win64) + ELSE(CMAKE_CL_64) + SET(__cpack_system_name win32) + ENDIF(CMAKE_CL_64) +ENDIF(${__cpack_system_name} MATCHES Windows) +cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}") + # <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype> cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}") + "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${CPACK_SYSTEM_NAME}") cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}") cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY @@ -89,7 +99,7 @@ ENDIF(NOT CPACK_GENERATOR) cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/") cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") -cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CMAKE_SYSTEM_NAME}") +cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}") cpack_encode_variables() CONFIGURE_FILE("${cpack_input_file}" @@ -98,7 +108,7 @@ CONFIGURE_FILE("${cpack_input_file}" # Generate source file cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR};/") -cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CMAKE_SYSTEM_NAME}-Source") +cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source") cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-Source") cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 6a8977c..76f2568 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -6,9 +6,9 @@ OPTION(BUILD_TESTING "Build the testing tree." ON) IF(BUILD_TESTING) # Setup some auxilary macros MACRO(SET_IF_NOT_SET var val) - IF(NOT "${${var}}") + IF(NOT DEFINED "${var}") SET("${var}" "${val}") - ENDIF(NOT "${${var}}") + ENDIF(NOT DEFINED "${var}") ENDMACRO(SET_IF_NOT_SET) MACRO(SET_IF_SET var val) @@ -21,6 +21,18 @@ IF(BUILD_TESTING) # Make sure testing is enabled ENABLE_TESTING() + IF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + INCLUDE("${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + SET_IF_SET(NIGHTLY_START_TIME "${CTEST_NIGHTLY_START_TIME}") + SET_IF_SET(DROP_METHOD "${CTEST_DROP_METHOD}") + SET_IF_SET(DROP_SITE "${CTEST_DROP_SITE}") + SET_IF_SET(DROP_SITE_USER "${CTEST_DROP_SITE_USER}") + SET_IF_SET(DROP_SITE_PASSWORD "${CTEST_DROP_SITE_PASWORD}") + SET_IF_SET(DROP_SITE_MODE "${CTEST_DROP_SITE_MODE}") + SET_IF_SET(DROP_LOCATION "${CTEST_DROP_LOCATION}") + SET_IF_SET(TRIGGER_SITE "${CTEST_TRIGGER_SITE}") + ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + # the project can have a DartConfig.cmake file IF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") INCLUDE("${PROJECT_SOURCE_DIR}/DartConfig.cmake") @@ -55,17 +67,7 @@ IF(BUILD_TESTING) #SET (USE_DOXYGEN "Off") #SET (DOXYGEN_URL "" ) ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") - IF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") - INCLUDE("${PROJECT_SOURCE_DIR}/CTestConfig.cmake") - SET_IF_SET(NIGHTLY_START_TIME "${CTEST_NIGHTLY_START_TIME}") - SET_IF_SET(DROP_METHOD "${CTEST_DROP_METHOD}") - SET_IF_SET(DROP_SITE "${CTEST_DROP_SITE}") - SET_IF_SET(DROP_SITE_USER "${CTEST_DROP_SITE_USER}") - SET_IF_SET(DROP_SITE_PASSWORD "${CTEST_DROP_SITE_PASWORD}") - SET_IF_SET(DROP_SITE_MODE "${CTEST_DROP_SITE_MODE}") - SET_IF_SET(DROP_LOCATION "${CTEST_DROP_LOCATION}") - SET_IF_SET(TRIGGER_SITE "${CTEST_TRIGGER_SITE}") - ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT") # make program just needs to use CMAKE_MAKE_PROGRAM which is required # to be defined by cmake diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 41facd4..93034f0 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -48,11 +48,11 @@ IF(QT_INCLUDE_DIR) #extract the version string from qglobal.h FILE(READ ${QT_INCLUDE_DIR}/qglobal.h QGLOBAL_H) STRING(REGEX MATCH "#define[\t ]+QT_VERSION_STR[\t ]+\"([0-9]+.[0-9]+.[0-9]+)\"" QGLOBAL_H "${QGLOBAL_H}") - STRING(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+)\".*" "\\1" QGLOBAL_H "${QGLOBAL_H}") + STRING(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+)\".*" "\\1" qt_version_str "${QGLOBAL_H}") # Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the # version X.Y.Z, so we need to remove the dots from version - STRING(REGEX REPLACE "\\." "" qt_version_str_lib "${QGLOBAL_H}") + STRING(REGEX REPLACE "\\." "" qt_version_str_lib "${qt_version_str}") ELSE(QT_INCLUDE_DIR) ENDIF(QT_INCLUDE_DIR) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 8ed84d4..e93a144 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -134,6 +134,7 @@ Function AddToPath Goto AddToPath_done AddToPath_NT: + MessageBox MB_OK 'Add to path "$0"' ReadRegStr $1 SHCTX "Environment" "PATH" StrCpy $2 $1 1 -1 # copy last char StrCmp $2 ";" 0 +2 # if last char == ; @@ -202,6 +203,7 @@ Function un.RemoveFromPath Goto unRemoveFromPath_done unRemoveFromPath_NT: + MessageBox MB_OK 'Remove from path "$0"' ReadRegStr $1 SHCTX "Environment" "PATH" StrCpy $5 $1 1 -1 # copy last char StrCmp $5 ";" +2 # if last char != ; @@ -362,6 +364,10 @@ Section "Installer Section" InstSection ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" \ + "DisplayName" "@CPACK_PACKAGE_INSTALL_DIRECTORY@ -- @CPACK_PACKAGE_DESCRIPTION_SUMMARY@" +WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" \ + "UninstallString" "$INSTDIR\Uninstall.exe" !insertmacro MUI_STARTMENU_WRITE_BEGIN Application @@ -416,6 +422,7 @@ Section "Uninstall" ;Remove the uninstaller itself. Delete "$INSTDIR\Uninstall.exe" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" ;Remove the installation directory if it is empty. RMDir "$INSTDIR" diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake new file mode 100644 index 0000000..a61c484 --- /dev/null +++ b/Modules/UseEcos.cmake @@ -0,0 +1,202 @@ +# - This module defines variables and macros required to build eCos application. +# This file contains the following macros: +# ECOS_ADD_INCLUDE_DIRECTORIES() - add the eCos include dirs +# ECOS_USE_ARM_ELF_TOOLS() - enable the ARM ELF toolchain for the directory where it is called +# ECOS_USE_PPC_EABI_TOOLS() - enable the PowerPC toolchain for the directory where it is called +# ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an executable for eCos +# ECOS_ADJUST_DIRECTORY(source1 ... sourceN ) +# +# It contains the following variables: +# ECOS_DEFINITIONS +# ECOSCONFIG_EXECUTABLE +# for internal use only: +# ECOS_ADD_TARGET_LIB + +INCLUDE(AddFileDependencies) + + +#first check that ecosconfig is available +FIND_PROGRAM(ECOSCONFIG_EXECUTABLE NAMES ecosconfig) +IF(NOT ECOSCONFIG_EXECUTABLE) + MESSAGE(SEND_ERROR "ecosconfig was not found. Either include it in the system path or set it manually using ccmake.") +ELSE(NOT ECOSCONFIG_EXECUTABLE) + MESSAGE(STATUS "Found ecosconfig: ${ECOSCONFIG_EXECUTABLE}") +ENDIF(NOT ECOSCONFIG_EXECUTABLE) + +#check that ECOS_REPOSITORY is set correctly +IF (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db) + MESSAGE(SEND_ERROR "The environment variable ECOS_REPOSITORY is not set correctly. Set it to the directory which contains the file ecos.db") +ELSE (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db) + MESSAGE(STATUS "ECOS_REPOSITORY is set to $ENV{ECOS_REPOSITORY}") +ENDIF (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db) + + +#add the globale include-diretories +#usage: ECOS_ADD_INCLUDE_DIRECTORIES() +MACRO(ECOS_ADD_INCLUDE_DIRECTORIES) +#check for ProjectSources.txt one level higher + IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../) + ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/) + ENDIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt) + +#the ecos include directory + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/ecos/install/include/) + +ENDMACRO(ECOS_ADD_INCLUDE_DIRECTORIES) + + +#we want to compile for the xscale processor, in this case the following macro has to be called +#usage: ECOS_USE_ARM_ELF_TOOLS() +MACRO (ECOS_USE_ARM_ELF_TOOLS) + SET(CMAKE_CXX_COMPILER "arm-elf-c++") + SET(CMAKE_COMPILER_IS_GNUCXX 1) + SET(CMAKE_C_COMPILER "arm-elf-gcc") + SET(CMAKE_AR "arm-elf-ar") + SET(CMAKE_RANLIB "arm-elf-ranlib") +#for linking + SET(ECOS_LD_MCPU "-mcpu=xscale") +#for compiling + ADD_DEFINITIONS(-mcpu=xscale -mapcs-frame) +#for the obj-tools + SET(ECOS_ARCH_PREFIX "arm-elf-") +ENDMACRO (ECOS_USE_ARM_ELF_TOOLS) + +#usage: ECOS_USE_PPC_EABI_TOOLS() +MACRO (ECOS_USE_PPC_EABI_TOOLS) + SET(CMAKE_CXX_COMPILER "powerpc-eabi-c++") + SET(CMAKE_COMPILER_IS_GNUCXX 1) + SET(CMAKE_C_COMPILER "powerpc-eabi-gcc") + SET(CMAKE_AR "powerpc-eabi-ar") + SET(CMAKE_RANLIB "powerpc-eabi-ranlib") +#for linking + SET(ECOS_LD_MCPU "") +#for compiling + ADD_DEFINITIONS() +#for the obj-tools + SET(ECOS_ARCH_PREFIX "powerpc-eabi-") +ENDMACRO (ECOS_USE_PPC_EABI_TOOLS) + + +#since the actual sources are located one level upwards +#a "../" has to be prepended in front of every source file +#call the following macro to achieve this, the first parameter +#is the name of the new list of source files with adjusted paths, +#followed by all source files +#usage: ECOS_ADJUST_DIRECTORY(adjusted_SRCS ${my_srcs}) +MACRO(ECOS_ADJUST_DIRECTORY _target_FILES ) + FOREACH (_current_FILE ${ARGN}) + IF (${_current_FILE} MATCHES "^/.+") # don't adjust for absolute paths + SET(tmp ${_current_FILE}) + ELSE (${_current_FILE} MATCHES "^/.+") + SET(tmp ${CMAKE_CURRENT_SOURCE_DIR}/../${_current_FILE}) + GET_FILENAME_COMPONENT(tmp ${tmp} ABSOLUTE) + ENDIF (${_current_FILE} MATCHES "^/.+") + SET(${_target_FILES} ${${_target_FILES}} ${tmp}) + ENDFOREACH (_current_FILE) +ENDMACRO(ECOS_ADJUST_DIRECTORY) + +#creates the dependancy from all source files on the ecos target.ld, +#adds the command for compiling ecos and adds target.ld to the make_clean_files +MACRO(ECOS_ADD_TARGET_LIB) +#sources depend on target.ld + FOREACH (_current_FILE ${ARGN}) + ADD_FILE_DEPENDENCIES(${_current_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/ecos/install/lib/target.ld) + ENDFOREACH (_current_FILE) + +#use a variable for the make_clean_files since later on even more files are added + SET(ECOS_ADD_MAKE_CLEAN_FILES ${ECOS_ADD_MAKE_CLEAN_FILES};ecos/install/lib/target.ld) + SET_DIRECTORY_PROPERTIES( + PROPERTIES + ADDITIONAL_MAKE_CLEAN_FILES "${ECOS_ADD_MAKE_CLEAN_FILES}" ) + + ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ecos/install/lib/target.ld + COMMAND sh + ARGS -c \"make -C ecos || exit -1\; if [ -e ecos/install/lib/target.ld ] \; then touch ecos/install/lib/target.ld\; fi\" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ecos/makefile + ) + + ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ecos/makefile + COMMAND sh + ARGS -c \" cd ecos\; ${ECOSCONFIG_EXECUTABLE} tree || exit -1\;\" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ecos/ecos.ecc + ) + + ADD_CUSTOM_TARGET( ecos make -C ${CMAKE_CURRENT_SOURCE_DIR}/ecos/ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ecos/makefile ) +ENDMACRO(ECOS_ADD_TARGET_LIB) + + +#macro for creating an executable ecos application +#the first parameter is the name of the executable, +#the second is the list of all source files (where the path +#has been adjusted beforehand by calling ECOS_ADJUST_DIRECTORY() +#usage: ECOS_ADD_EXECUTABLE(my_app ${adjusted_SRCS}) +MACRO(ECOS_ADD_EXECUTABLE _exe_NAME ) + #definitions, valid for all ecos projects + #the optimization and "-g" for debugging has to be enabled + #in the project-specific CMakeLists.txt + ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1) + SET(ECOS_DEFINITIONS -Wall -Wno-long-long -pipe -fno-builtin) + + SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes") + SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual -fno-rtti -Wctor-dtor-privacy -fno-strict-aliasing -fno-exceptions") + +#the executable depends on ecos target.ld + ECOS_ADD_TARGET_LIB(${ARGN}) + +#special link commands for ecos-executables + SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_SOURCE_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") + SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_SOURCE_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") + + ADD_EXECUTABLE(${_exe_NAME} ${ARGN}) + +#under win32 the ".exe" suffix is appended to the binary name, copy it so that it exists also without the prefix +#otherwise the following custom commands don't work + IF(WIN32) + ADD_CUSTOM_COMMAND(TARGET ${_exe_NAME} POST_BUILD COMMAND cp ARGS ${_exe_NAME}.exe ${_exe_NAME}_ ) + ADD_CUSTOM_COMMAND(TARGET ${_exe_NAME} POST_BUILD COMMAND mv ARGS ${_exe_NAME}_ ${_exe_NAME} ) + ENDIF(WIN32) + +#create a binary file + ADD_CUSTOM_COMMAND( + TARGET ${_exe_NAME} + POST_BUILD + COMMAND ${ECOS_ARCH_PREFIX}objcopy + ARGS -O binary ${_exe_NAME} ${_exe_NAME}.bin + ) + +#and an srec file + ADD_CUSTOM_COMMAND( + TARGET ${_exe_NAME} + POST_BUILD + COMMAND ${ECOS_ARCH_PREFIX}objcopy + ARGS -O srec ${_exe_NAME} ${_exe_NAME}.srec + ) + +#add the created files to the make_clean_files + SET(ECOS_ADD_MAKE_CLEAN_FILES ${ECOS_ADD_MAKE_CLEAN_FILES};${_exe_NAME};${_exe_NAME}.bin;${_exe_NAME}.srec;${_exe_NAME}.lst;) + + SET_DIRECTORY_PROPERTIES( + PROPERTIES + ADDITIONAL_MAKE_CLEAN_FILES "${ECOS_ADD_MAKE_CLEAN_FILES}" + ) + +#cd $1; ls -a | grep --invert-match -e "\(.*CVS\)\|\(.*ecos\.ecc\)\|\(.*\.cvsignore\)\|\(\.\.\?\)" | xargs rm -rf; touch ecos.ecc + ADD_CUSTOM_TARGET(ecosclean sh -c \"cd ${CMAKE_CURRENT_SOURCE_DIR}/ecos\; ls -a | grep --invert-match -e \\\"\\\(.*CVS\\\)\\|\\\(.*ecos\\.ecc\\\)\\|\\\(.*\\.cvsignore\\\)\\|\\\(^\\.\\.\\?\\\)\\\" |xargs rm -rf\; touch ecos.ecc \") + ADD_CUSTOM_TARGET(normalclean ${CMAKE_MAKE_PROGRAM} clean -C ${CMAKE_CURRENT_SOURCE_DIR}) + ADD_DEPENDENCIES (ecosclean normalclean) + + ADD_DEPENDENCIES(ecosclean clean) + + + ADD_CUSTOM_TARGET( listing + COMMAND echo -e \"\\n--- Symbols sorted by address ---\\n\" > ${_exe_NAME}.lst + COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -n ${_exe_NAME} >> ${_exe_NAME}.lst + COMMAND echo -e \"\\n--- Symbols sorted by size ---\\n\" >> ${_exe_NAME}.lst + COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -r --size-sort ${_exe_NAME} >> ${_exe_NAME}.lst + COMMAND echo -e \"\\n--- Full assembly listing ---\\n\" >> ${_exe_NAME}.lst + COMMAND ${ECOS_ARCH_PREFIX}objdump -S -x -d -C ${_exe_NAME} >> ${_exe_NAME}.lst ) + +ENDMACRO(ECOS_ADD_EXECUTABLE) + diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6b7ac0f..26b8668 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -215,11 +215,6 @@ ENDIF (WIN32) ADD_LIBRARY(CMakeLib ${SRCS}) TARGET_LINK_LIBRARIES(CMakeLib cmsys ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES} ${CMAKE_TAR_LIBRARIES}) -# On UNIX platforms we need the dl libraries for loading plugins. -IF(UNIX) - TARGET_LINK_LIBRARIES(CMakeLib ${CMAKE_DL_LIBS}) -ENDIF(UNIX) - # On Apple we need Carbon IF(APPLE) TARGET_LINK_LIBRARIES(CMakeLib "-framework Carbon") diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 527aea5..37e4542 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -68,8 +68,9 @@ void cmGlobalKdevelopGenerator::Generate() std::string projectName=mf->GetProjectName(); std::string cmakeFilePattern("CMakeLists.txt;*.cmake;"); std::string fileToOpen; + std::vector<cmLocalGenerator*>& lgs= it->second; // create the project.kdevelop.filelist file - if(!this->CreateFilelistFile(it->second[0], it->second, + if(!this->CreateFilelistFile(it->second[0], lgs, outputDir, projectDir, projectName, cmakeFilePattern, fileToOpen)) { @@ -79,7 +80,11 @@ void cmGlobalKdevelopGenerator::Generate() //try to find the name of an executable so we have something to //run from kdevelop for now just pick the first executable found std::string executable; - cmTargets& targets=mf->GetTargets(); + for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin(); + lg!=lgs.end(); lg++) + { + cmMakefile* makefile=(*lg)->GetMakefile(); + cmTargets& targets=makefile->GetTargets(); for (cmTargets::iterator ti = targets.begin(); ti != targets.end(); ti++) { @@ -89,6 +94,11 @@ void cmGlobalKdevelopGenerator::Generate() break; } } + if (!executable.empty()) + { + break; + } + } // now create a project file this->CreateProjectFile(outputDir, projectDir, projectName, executable, cmakeFilePattern, fileToOpen); @@ -121,7 +131,7 @@ bool cmGlobalKdevelopGenerator tmp=*lt; cmSystemTools::ReplaceString(tmp, projectDir.c_str(), ""); // make sure the file is part of this source tree - if (tmp[0]!='/') + if ((tmp[0]!='/') && (strstr(tmp.c_str(), "CMakeFiles/")==0)) { files.insert(tmp); tmp=cmSystemTools::GetFilenameName(tmp); @@ -146,7 +156,7 @@ bool cmGlobalKdevelopGenerator { tmp=(*si)->GetFullPath(); cmSystemTools::ReplaceString(tmp, projectDir.c_str(), ""); - if (tmp[0]!='/') + if ((tmp[0]!='/') && (strstr(tmp.c_str(), "CMakeFiles/")==0)) { files.insert(tmp); } @@ -156,7 +166,7 @@ bool cmGlobalKdevelopGenerator { tmp=*lt; cmSystemTools::ReplaceString(tmp, projectDir.c_str(), ""); - if (tmp[0]!='/') + if ((tmp[0]!='/') && (strstr(tmp.c_str(), "CMakeFiles/")==0)) { files.insert(tmp.c_str()); } diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index b68a9bf..6ab76b4 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2652,11 +2652,6 @@ int OldWindowsGetLongPath(kwsys_stl::string const& shortPath, int PortableGetLongPathName(const char* pathIn, kwsys_stl::string & longPath) { - kwsys_stl::string shortPath; - if(!SystemTools::GetShortPath(pathIn, shortPath)) - { - return 0; - } HMODULE lh = LoadLibrary("Kernel32.dll"); if(lh) { @@ -2666,7 +2661,7 @@ int PortableGetLongPathName(const char* pathIn, typedef DWORD (WINAPI * GetLongFunctionPtr) (LPCSTR,LPSTR,DWORD); GetLongFunctionPtr func = (GetLongFunctionPtr)proc; char buffer[MAX_PATH+1]; - int len = (*func)(shortPath.c_str(), buffer, MAX_PATH+1); + int len = (*func)(pathIn, buffer, MAX_PATH+1); if(len == 0 || len > MAX_PATH+1) { FreeLibrary(lh); @@ -2678,7 +2673,7 @@ int PortableGetLongPathName(const char* pathIn, } FreeLibrary(lh); } - return OldWindowsGetLongPath(shortPath.c_str(), longPath); + return OldWindowsGetLongPath(pathIn, longPath); } #endif @@ -2790,7 +2785,13 @@ SystemTools::JoinPath(const kwsys_stl::vector<kwsys_stl::string>& components) bool SystemTools::ComparePath(const char* c1, const char* c2) { #if defined(_WIN32) || defined(__APPLE__) +# ifdef _MSC_VER + return _stricmp(c1, c2) == 0; +# elif defined(__APPLE__) || defined(__GNUC__) + return strcasecmp(c1, c2) == 0; +#else return SystemTools::Strucmp(c1, c2) == 0; +# endif #else return strcmp(c1, c2) == 0; #endif diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c new file mode 100644 index 0000000..0837e10 --- /dev/null +++ b/Source/kwsys/Terminal.c @@ -0,0 +1,398 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + + Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "kwsysPrivate.h" +#include KWSYS_HEADER(Terminal.h) + +/* Work-around CMake dependency scanning limitation. This must + duplicate the above list of headers. */ +#if 0 +# include "Terminal.h.in" +#endif + +/*--------------------------------------------------------------------------*/ +/* Configure support for this platform. */ +#if defined(_WIN32) || defined(__CYGWIN__) +# define KWSYS_TERMINAL_SUPPORT_CONSOLE +#endif +#if !defined(_WIN32) +# define KWSYS_TERMINAL_ISATTY_WORKS +#endif + +/*--------------------------------------------------------------------------*/ +/* Include needed system APIs. */ + +#include <stdlib.h> /* getenv */ +#include <string.h> /* strcmp */ +#include <stdarg.h> /* va_list */ + +#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE) +# include <windows.h> /* SetConsoleTextAttribute */ +# include <io.h> /* _get_osfhandle */ +#endif + +#if defined(KWSYS_TERMINAL_ISATTY_WORKS) +# include <unistd.h> /* isatty */ +#else +# include <sys/stat.h> /* fstat */ +#endif + +/*--------------------------------------------------------------------------*/ +static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100, + int default_tty); +static void kwsysTerminalSetVT100Color(FILE* stream, int color); +#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE) +static HANDLE kwsysTerminalGetStreamHandle(FILE* stream); +static void kwsysTerminalSetConsoleColor(HANDLE hOut, + CONSOLE_SCREEN_BUFFER_INFO* hOutInfo, + FILE* stream, + int color); +#endif + +/*--------------------------------------------------------------------------*/ +void kwsysTerminal_cfprintf(int color, FILE* stream, const char* format, ...) +{ + /* Setup the stream with the given color if possible. */ + int pipeIsConsole = 0; + int pipeIsVT100 = 0; + int default_vt100 = color & kwsysTerminal_Color_AssumeVT100; + int default_tty = color & kwsysTerminal_Color_AssumeTTY; +#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE) + CONSOLE_SCREEN_BUFFER_INFO hOutInfo; + HANDLE hOut = kwsysTerminalGetStreamHandle(stream); + if(GetConsoleScreenBufferInfo(hOut, &hOutInfo)) + { + pipeIsConsole = 1; + kwsysTerminalSetConsoleColor(hOut, &hOutInfo, stream, color); + } +#endif + if(!pipeIsConsole && kwsysTerminalStreamIsVT100(stream, + default_vt100, default_tty)) + { + pipeIsVT100 = 1; + kwsysTerminalSetVT100Color(stream, color); + } + + /* Format the text into the stream. */ + { + va_list var_args; + va_start(var_args, format); + vfprintf(stream, format, var_args); + va_end(var_args); + } + + /* Restore the normal color state for the stream. */ +#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE) + if(pipeIsConsole) + { + kwsysTerminalSetConsoleColor(hOut, &hOutInfo, stream, + kwsysTerminal_Color_Normal); + } +#endif + if(pipeIsVT100) + { + kwsysTerminalSetVT100Color(stream, kwsysTerminal_Color_Normal); + } +} + +/*--------------------------------------------------------------------------*/ +/* Detect cases when a stream is definately not interactive. */ +#if !defined(KWSYS_TERMINAL_ISATTY_WORKS) +static int kwsysTerminalStreamIsNotInteractive(FILE* stream) +{ + /* The given stream is definately not interactive if it is a regular + file. */ + struct stat stream_stat; + if(fstat(fileno(stream), &stream_stat) == 0) + { + if(stream_stat.st_mode & S_IFREG) + { + return 1; + } + } + return 0; +} +#endif + +/*--------------------------------------------------------------------------*/ +/* List of terminal names known to support VT100 color escape sequences. */ +static const char* kwsysTerminalVT100Names[] = +{ + "Eterm", + "ansi", + "color-xterm", + "con132x25", + "con132x30", + "con132x43", + "con132x60", + "con80x25", + "con80x28", + "con80x30", + "con80x43", + "con80x50", + "con80x60", + "console", + "konsole", + "linux", + "msys", + "rxvt", + "vt100", + "xterm", + "xterm-color", + 0 +}; + +/*--------------------------------------------------------------------------*/ +/* Detect whether a stream is displayed in a VT100-compatible terminal. */ +static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100, + int default_tty) +{ + /* Check for a valid terminal. */ + if(!default_vt100) + { + const char** t = 0; + const char* term = getenv("TERM"); + if(term) + { + for(t = kwsysTerminalVT100Names; *t && strcmp(term, *t) != 0; ++t) {} + } + if(!(t && *t)) + { + return 0; + } + } + +#if defined(KWSYS_TERMINAL_ISATTY_WORKS) + /* Make sure the stream is a tty. */ + (void)default_tty; + return isatty(fileno(stream))? 1:0; +#else + /* Check for cases in which the stream is definately not a tty. */ + if(kwsysTerminalStreamIsNotInteractive(stream)) + { + return 0; + } + + /* Use the provided default for whether this is a tty. */ + return default_tty; +#endif +} + +/*--------------------------------------------------------------------------*/ +/* VT100 escape sequence strings. */ +#define KWSYS_TERMINAL_VT100_NORMAL "\33[0m" +#define KWSYS_TERMINAL_VT100_BOLD "\33[1m" +#define KWSYS_TERMINAL_VT100_UNDERLINE "\33[4m" +#define KWSYS_TERMINAL_VT100_BLINK "\33[5m" +#define KWSYS_TERMINAL_VT100_INVERSE "\33[7m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_BLACK "\33[30m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_RED "\33[31m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_GREEN "\33[32m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW "\33[33m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_BLUE "\33[34m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA "\33[35m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_CYAN "\33[36m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_WHITE "\33[37m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_BLACK "\33[40m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_RED "\33[41m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_GREEN "\33[42m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW "\33[43m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_BLUE "\33[44m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA "\33[45m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN "\33[46m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE "\33[47m" + +/*--------------------------------------------------------------------------*/ +/* Write VT100 escape sequences to the stream for the given color. */ +static void kwsysTerminalSetVT100Color(FILE* stream, int color) +{ + if(color == kwsysTerminal_Color_Normal) + { + fprintf(stream, KWSYS_TERMINAL_VT100_NORMAL); + return; + } + + switch(color & kwsysTerminal_Color_ForegroundMask) + { + case kwsysTerminal_Color_Normal: + fprintf(stream, KWSYS_TERMINAL_VT100_NORMAL); + break; + case kwsysTerminal_Color_ForegroundBlack: + fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_BLACK); + break; + case kwsysTerminal_Color_ForegroundRed: + fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_RED); + break; + case kwsysTerminal_Color_ForegroundGreen: + fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_GREEN); + break; + case kwsysTerminal_Color_ForegroundYellow: + fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW); + break; + case kwsysTerminal_Color_ForegroundBlue: + fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_BLUE); + break; + case kwsysTerminal_Color_ForegroundMagenta: + fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA); + break; + case kwsysTerminal_Color_ForegroundCyan: + fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_CYAN); + break; + case kwsysTerminal_Color_ForegroundWhite: + fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_WHITE); + break; + } + switch(color & kwsysTerminal_Color_BackgroundMask) + { + case kwsysTerminal_Color_BackgroundBlack: + fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_BLACK); + break; + case kwsysTerminal_Color_BackgroundRed: + fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_RED); + break; + case kwsysTerminal_Color_BackgroundGreen: + fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_GREEN); + break; + case kwsysTerminal_Color_BackgroundYellow: + fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW); + break; + case kwsysTerminal_Color_BackgroundBlue: + fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_BLUE); + break; + case kwsysTerminal_Color_BackgroundMagenta: + fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA); + break; + case kwsysTerminal_Color_BackgroundCyan: + fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_CYAN); + break; + case kwsysTerminal_Color_BackgroundWhite: + fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_WHITE); + break; + } + if(color & kwsysTerminal_Color_ForegroundBold) + { + fprintf(stream, KWSYS_TERMINAL_VT100_BOLD); + } +} + +/*--------------------------------------------------------------------------*/ +#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE) + +# define KWSYS_TERMINAL_MASK_FOREGROUND \ + (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY) +# define KWSYS_TERMINAL_MASK_BACKGROUND \ + (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY) + +/* Get the Windows handle for a FILE stream. */ +static HANDLE kwsysTerminalGetStreamHandle(FILE* stream) +{ + /* Get the C-library file descriptor from the stream. */ + int fd = fileno(stream); + +# if defined(__CYGWIN__) + /* Cygwin seems to have an extra pipe level. If the file descriptor + corresponds to stdout or stderr then obtain the matching windows + handle directly. */ + if(fd == fileno(stdout)) + { + return GetStdHandle(STD_OUTPUT_HANDLE); + } + else if(fd == fileno(stderr)) + { + return GetStdHandle(STD_ERROR_HANDLE); + } +# endif + + /* Get the underlying Windows handle for the descriptor. */ + return (HANDLE)_get_osfhandle(fd); +} + +/* Set color attributes in a Windows console. */ +static void kwsysTerminalSetConsoleColor(HANDLE hOut, + CONSOLE_SCREEN_BUFFER_INFO* hOutInfo, + FILE* stream, + int color) +{ + WORD attributes = 0; + switch(color & kwsysTerminal_Color_ForegroundMask) + { + case kwsysTerminal_Color_Normal: + attributes |= hOutInfo->wAttributes & KWSYS_TERMINAL_MASK_FOREGROUND; + break; + case kwsysTerminal_Color_ForegroundBlack: + attributes |= 0; + break; + case kwsysTerminal_Color_ForegroundRed: + attributes |= FOREGROUND_RED; + break; + case kwsysTerminal_Color_ForegroundGreen: + attributes |= FOREGROUND_GREEN; + break; + case kwsysTerminal_Color_ForegroundYellow: + attributes |= FOREGROUND_RED | FOREGROUND_GREEN; + break; + case kwsysTerminal_Color_ForegroundBlue: + attributes |= FOREGROUND_BLUE; + break; + case kwsysTerminal_Color_ForegroundMagenta: + attributes |= FOREGROUND_RED | FOREGROUND_BLUE; + break; + case kwsysTerminal_Color_ForegroundCyan: + attributes |= FOREGROUND_BLUE | FOREGROUND_GREEN; + break; + case kwsysTerminal_Color_ForegroundWhite: + attributes |= FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; + break; + } + switch(color & kwsysTerminal_Color_BackgroundMask) + { + case kwsysTerminal_Color_Normal: + attributes |= hOutInfo->wAttributes & KWSYS_TERMINAL_MASK_BACKGROUND; + break; + case kwsysTerminal_Color_BackgroundBlack: + attributes |= 0; + break; + case kwsysTerminal_Color_BackgroundRed: + attributes |= BACKGROUND_RED; + break; + case kwsysTerminal_Color_BackgroundGreen: + attributes |= BACKGROUND_GREEN; + break; + case kwsysTerminal_Color_BackgroundYellow: + attributes |= BACKGROUND_RED | BACKGROUND_GREEN; + break; + case kwsysTerminal_Color_BackgroundBlue: + attributes |= BACKGROUND_BLUE; + break; + case kwsysTerminal_Color_BackgroundMagenta: + attributes |= BACKGROUND_RED | BACKGROUND_BLUE; + break; + case kwsysTerminal_Color_BackgroundCyan: + attributes |= BACKGROUND_BLUE | BACKGROUND_GREEN; + break; + case kwsysTerminal_Color_BackgroundWhite: + attributes |= BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED; + break; + } + if(color & kwsysTerminal_Color_ForegroundBold) + { + attributes |= FOREGROUND_INTENSITY; + } + if(color & kwsysTerminal_Color_BackgroundBold) + { + attributes |= BACKGROUND_INTENSITY; + } + fflush(stream); + SetConsoleTextAttribute(hOut, attributes); +} +#endif diff --git a/Source/kwsys/Terminal.h.in b/Source/kwsys/Terminal.h.in new file mode 100644 index 0000000..8ca0a65 --- /dev/null +++ b/Source/kwsys/Terminal.h.in @@ -0,0 +1,157 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + + Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef @KWSYS_NAMESPACE@_Terminal_h +#define @KWSYS_NAMESPACE@_Terminal_h + +#include <@KWSYS_NAMESPACE@/Configure.h> + +#include <stdio.h> /* For file stream type FILE. */ + +/* Redefine all public interface symbol names to be in the proper + namespace. These macros are used internally to kwsys only, and are + not visible to user code. Use kwsysHeaderDump.pl to reproduce + these macros after making changes to the interface. */ +#if !defined(KWSYS_NAMESPACE) +# define kwsys_ns(x) @KWSYS_NAMESPACE@##x +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +#endif +#define kwsysTerminal_cfprintf kwsys_ns(Terminal_cfprintf) +#define kwsysTerminal_Color_e kwsys_ns(Terminal_Color_e) +#define kwsysTerminal_Color_Normal kwsys_ns(Terminal_Color_Normal) +#define kwsysTerminal_Color_ForegroundBlack kwsys_ns(Terminal_Color_ForegroundBlack) +#define kwsysTerminal_Color_ForegroundRed kwsys_ns(Terminal_Color_ForegroundRed) +#define kwsysTerminal_Color_ForegroundGreen kwsys_ns(Terminal_Color_ForegroundGreen) +#define kwsysTerminal_Color_ForegroundYellow kwsys_ns(Terminal_Color_ForegroundYellow) +#define kwsysTerminal_Color_ForegroundBlue kwsys_ns(Terminal_Color_ForegroundBlue) +#define kwsysTerminal_Color_ForegroundMagenta kwsys_ns(Terminal_Color_ForegroundMagenta) +#define kwsysTerminal_Color_ForegroundCyan kwsys_ns(Terminal_Color_ForegroundCyan) +#define kwsysTerminal_Color_ForegroundWhite kwsys_ns(Terminal_Color_ForegroundWhite) +#define kwsysTerminal_Color_ForegroundMask kwsys_ns(Terminal_Color_ForegroundMask) +#define kwsysTerminal_Color_BackgroundBlack kwsys_ns(Terminal_Color_BackgroundBlack) +#define kwsysTerminal_Color_BackgroundRed kwsys_ns(Terminal_Color_BackgroundRed) +#define kwsysTerminal_Color_BackgroundGreen kwsys_ns(Terminal_Color_BackgroundGreen) +#define kwsysTerminal_Color_BackgroundYellow kwsys_ns(Terminal_Color_BackgroundYellow) +#define kwsysTerminal_Color_BackgroundBlue kwsys_ns(Terminal_Color_BackgroundBlue) +#define kwsysTerminal_Color_BackgroundMagenta kwsys_ns(Terminal_Color_BackgroundMagenta) +#define kwsysTerminal_Color_BackgroundCyan kwsys_ns(Terminal_Color_BackgroundCyan) +#define kwsysTerminal_Color_BackgroundWhite kwsys_ns(Terminal_Color_BackgroundWhite) +#define kwsysTerminal_Color_BackgroundMask kwsys_ns(Terminal_Color_BackgroundMask) +#define kwsysTerminal_Color_ForegroundBold kwsys_ns(Terminal_Color_ForegroundBold) +#define kwsysTerminal_Color_BackgroundBold kwsys_ns(Terminal_Color_BackgroundBold) +#define kwsysTerminal_Color_AssumeTTY kwsys_ns(Terminal_Color_AssumeTTY) +#define kwsysTerminal_Color_AssumeVT100 kwsys_ns(Terminal_Color_AssumeVT100) +#define kwsysTerminal_Color_AttributeMask kwsys_ns(Terminal_Color_AttributeMask) + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/** + * Write colored and formatted text to a stream. Color is used only + * for streams supporting it. The color specification is constructed + * by bitwise-OR-ing enumeration values. At most one foreground and + * one background value may be given. + * + * Whether the a stream supports color is usually automatically + * detected, but with two exceptions: + * + * - When the stream is displayed in a terminal supporting VT100 + * color but using an intermediate pipe for communication the + * detection of a tty fails. (This typically occurs for a shell + * running in an rxvt terminal in MSYS.) If the caller knows this + * to be the case, the attribute Color_AssumeTTY may be included in + * the color specification. + * + * - When the stream is displayed in a terminal whose TERM + * environment variable is not set or is set to a value that is not + * known to support VT100 colors. If the caller knows this to be + * the case, the attribute Color_AssumeVT100 may be included in the + * color specification. + */ +kwsysEXPORT void kwsysTerminal_cfprintf(int color, FILE* stream, + const char* format, ...); +enum kwsysTerminal_Color_e +{ + /* Normal Text */ + kwsysTerminal_Color_Normal = 0, + + /* Foreground Color */ + kwsysTerminal_Color_ForegroundBlack = 0x1, + kwsysTerminal_Color_ForegroundRed = 0x2, + kwsysTerminal_Color_ForegroundGreen = 0x3, + kwsysTerminal_Color_ForegroundYellow = 0x4, + kwsysTerminal_Color_ForegroundBlue = 0x5, + kwsysTerminal_Color_ForegroundMagenta = 0x6, + kwsysTerminal_Color_ForegroundCyan = 0x7, + kwsysTerminal_Color_ForegroundWhite = 0x8, + kwsysTerminal_Color_ForegroundMask = 0xF, + + /* Background Color */ + kwsysTerminal_Color_BackgroundBlack = 0x10, + kwsysTerminal_Color_BackgroundRed = 0x20, + kwsysTerminal_Color_BackgroundGreen = 0x30, + kwsysTerminal_Color_BackgroundYellow = 0x40, + kwsysTerminal_Color_BackgroundBlue = 0x50, + kwsysTerminal_Color_BackgroundMagenta = 0x60, + kwsysTerminal_Color_BackgroundCyan = 0x70, + kwsysTerminal_Color_BackgroundWhite = 0x80, + kwsysTerminal_Color_BackgroundMask = 0xF0, + + /* Attributes */ + kwsysTerminal_Color_ForegroundBold = 0x100, + kwsysTerminal_Color_BackgroundBold = 0x200, + kwsysTerminal_Color_AssumeTTY = 0x400, + kwsysTerminal_Color_AssumeVT100 = 0x800, + kwsysTerminal_Color_AttributeMask = 0xF00 +}; + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +/* If we are building a kwsys .c or .cxx file, let it use these macros. + Otherwise, undefine them to keep the namespace clean. */ +#if !defined(KWSYS_NAMESPACE) +# undef kwsys_ns +# undef kwsysEXPORT +# undef kwsysTerminal_cfprintf +# undef kwsysTerminal_Color_e +# undef kwsysTerminal_Color_Normal +# undef kwsysTerminal_Color_ForegroundBlack +# undef kwsysTerminal_Color_ForegroundRed +# undef kwsysTerminal_Color_ForegroundGreen +# undef kwsysTerminal_Color_ForegroundYellow +# undef kwsysTerminal_Color_ForegroundBlue +# undef kwsysTerminal_Color_ForegroundMagenta +# undef kwsysTerminal_Color_ForegroundCyan +# undef kwsysTerminal_Color_ForegroundWhite +# undef kwsysTerminal_Color_ForegroundMask +# undef kwsysTerminal_Color_BackgroundBlack +# undef kwsysTerminal_Color_BackgroundRed +# undef kwsysTerminal_Color_BackgroundGreen +# undef kwsysTerminal_Color_BackgroundYellow +# undef kwsysTerminal_Color_BackgroundBlue +# undef kwsysTerminal_Color_BackgroundMagenta +# undef kwsysTerminal_Color_BackgroundCyan +# undef kwsysTerminal_Color_BackgroundWhite +# undef kwsysTerminal_Color_BackgroundMask +# undef kwsysTerminal_Color_ForegroundBold +# undef kwsysTerminal_Color_BackgroundBold +# undef kwsysTerminal_Color_AssumeTTY +# undef kwsysTerminal_Color_AssumeVT100 +# undef kwsysTerminal_Color_AttributeMask +#endif + +#endif diff --git a/Source/kwsys/testTerminal.c b/Source/kwsys/testTerminal.c new file mode 100644 index 0000000..fc04bbc --- /dev/null +++ b/Source/kwsys/testTerminal.c @@ -0,0 +1,31 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + + Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "kwsysPrivate.h" +#include KWSYS_HEADER(Terminal.h) + +/* Work-around CMake dependency scanning limitation. This must + duplicate the above list of headers. */ +#if 0 +# include "Terminal.h.in" +#endif + +int main() +{ + kwsysTerminal_cfprintf(kwsysTerminal_Color_ForegroundYellow | + kwsysTerminal_Color_BackgroundBlue | + kwsysTerminal_Color_AssumeTTY, + stdout, "Hello %s!", "World"); + fprintf(stdout, "\n"); + return 0; +} diff --git a/Tests/Java/CMakeLists.txt b/Tests/Java/CMakeLists.txt index 8acfbb8..2bff10d 100644 --- a/Tests/Java/CMakeLists.txt +++ b/Tests/Java/CMakeLists.txt @@ -1,6 +1,11 @@ PROJECT(hello Java) SET(CMAKE_VERBOSE_MAKEFILE 1) + SET(OLD_CUSTOM_COMMAND_WAY ) +message("${hello_SOURCE_DIR} STREQUAL ${hello_BINARY_DIR}") +IF("${hello_SOURCE_DIR}" STREQUAL "${hello_BINARY_DIR}") + SET(OLD_CUSTOM_COMMAND_WAY 1) +ENDIF("${hello_SOURCE_DIR}" STREQUAL "${hello_BINARY_DIR}") IF(NOT OLD_CUSTOM_COMMAND_WAY) INCLUDE_DIRECTORIES(${hello_SOURCE_DIR} ${hello_BINARY_DIR} ) @@ -12,19 +17,20 @@ IF(OLD_CUSTOM_COMMAND_WAY) ADD_CUSTOM_COMMAND( OUTPUT ${hello_BINARY_DIR}/A.class MAIN_DEPENDENCY ${hello_SOURCE_DIR}/A.java - COMMAND ${CMAKE_Java_COMPILER} ARGS -d ${hello_BINARY_DIR} ${hello_SOURCE_DIR}/A.java) + COMMAND ${CMAKE_Java_COMPILER} ARGS -classpath . -d ${hello_BINARY_DIR} ${hello_SOURCE_DIR}/A.java) ADD_CUSTOM_COMMAND( OUTPUT ${hello_BINARY_DIR}/HelloWorld.class MAIN_DEPENDENCY ${hello_SOURCE_DIR}/HelloWorld.java - COMMAND ${CMAKE_Java_COMPILER} ARGS -d ${hello_BINARY_DIR} ${hello_SOURCE_DIR}/HelloWorld.java) - - ADD_CUSTOM_TARGET(foo.jar ALL - DEPENDS ${hello_BINARY_DIR}/A.class ${hello_BINARY_DIR}/HelloWorld.class) - - ADD_CUSTOM_COMMAND( TARGET foo.jar - PRE_BUILD + DEPENDS ${hello_BINARY_DIR}/A.class + COMMAND ${CMAKE_Java_COMPILER} ARGS -classpath . -d ${hello_BINARY_DIR} ${hello_SOURCE_DIR}/HelloWorld.java) + ADD_CUSTOM_COMMAND( + OUTPUT ${hello_BINARY_DIR}/hello.jar + DEPENDS ${hello_BINARY_DIR}/A.class ${hello_BINARY_DIR}/HelloWorld.class COMMAND ${CMAKE_COMMAND} ARGS -E chdir ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_Java_ARCHIVE} - -cvf foo.jar *.class) + -cvf hello.jar *.class) + + ADD_CUSTOM_TARGET(hello.jar ALL + DEPENDS ${hello_BINARY_DIR}/hello.jar) ENDIF(OLD_CUSTOM_COMMAND_WAY) |