View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0008102 | CMake | CMake | public | 2008-11-14 14:27 | 2013-04-17 08:54 | ||||
Reporter | Clemens | ||||||||
Assigned To | |||||||||
Priority | normal | Severity | feature | Reproducibility | N/A | ||||
Status | closed | Resolution | duplicate | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-6 | ||||||||
Target Version | CMake 2.8.11 | Fixed in Version | CMake 2.8.11 | ||||||
Summary | 0008102: CMake support for mobile platforms in Visual Studio 2005/2008 | ||||||||
Description | The patch included adds two new Visual Studio generators (2005 and 2008) to CMake which include platform support for SDKs for mobile devices. This mainly goes conform with the feature request from Andreas Pokorny (0007919) for WinCE support in NMake and uses his WINCE platform files. | ||||||||
Additional Information | The patch is against the original 2.6.2 release sources. Unfortunatly I could not create files named after the files modified, but all files in the archive are in unified diff format. There are a few things I already mentioned in the forum. # The generators include special link flag tables, which I find to be a useful feature also for upcoming releases of Visual Studio. # Because introducing a new generator needs a really deep patch into cmake, the changes should be revised carefully (patched cmake.cxx, CMakefile.cxx etc.). However, we are testing the changes currently on multiple machines and they also work well with PPC2003/SmartPhone2003,WinMobile5,WinMobile6 and WinCE5.0. # In principle the generators parse a file called WCE.VCPlatform.config residing in %STUDIODIR%\VC\vcpackages to get a list of SDKs installed. It also takes a list SDKs to use from a CMakeCache.txt to be copied to the build directory prior to configuration. Such a file might contain the following: CMAKE_SYSTEM_NAME:STRING=WINCE CMAKE_SYSTEM_VERSION:STRING=5.01 PLATFORM_SDKS:STRING=Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I) WM5:STRING=1 for Windows Mobile 5 for example. The generators only filter the platforms specified from all possible ones. However, if no cache file is supplied, it creates a configuration for all platforms installed. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | cmake_2.6.2p_files.zip [^] (33,906 bytes) 2008-11-14 14:27 cmake-2.6.3.patch [^] (121,540 bytes) 2009-02-24 03:45 [Show Content] [Hide Content] Index: Modules/CMakeCCompilerABI.c =================================================================== --- Modules/CMakeCCompilerABI.c (revision 1) +++ Modules/CMakeCCompilerABI.c (working copy) @@ -26,3 +26,16 @@ (void)argv; return require; } + +#ifndef __CLASSIC_C__ +int mainCRTStartup(int argc, char* argv[]) +{ + int require = 0; + require += info_sizeof_dptr[argc]; +#if defined(ABI_ID) + require += info_abi[argc]; +#endif + (void)argv; + return require; +} +#endif Index: Modules/CMakeCXXCompilerABI.cpp =================================================================== --- Modules/CMakeCXXCompilerABI.cpp (revision 1) +++ Modules/CMakeCXXCompilerABI.cpp (working copy) @@ -18,3 +18,14 @@ (void)argv; return require; } + +int mainCRTStartup(int argc, char* argv[]) +{ + int require = 0; + require += info_sizeof_dptr[argc]; +#if defined(ABI_ID) + require += info_abi[argc]; +#endif + (void)argv; + return require; +} Index: Modules/CMakeTestCCompiler.cmake =================================================================== --- Modules/CMakeTestCCompiler.cmake (revision 1) +++ Modules/CMakeTestCCompiler.cmake (working copy) @@ -17,6 +17,8 @@ "#else\n" "int main(int argc, char* argv[])\n" "#endif\n" + "{ return argc-1;}\n\n" + "int mainCRTStartup(int argc, char* argv[])\n" "{ return argc-1;}\n") TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c Index: Modules/CMakeTestCXXCompiler.cmake =================================================================== --- Modules/CMakeTestCXXCompiler.cmake (revision 1) +++ Modules/CMakeTestCXXCompiler.cmake (working copy) @@ -10,7 +10,9 @@ "#ifndef __cplusplus\n" "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n" "#endif\n" - "int main(){return 0;}\n") + "int main(){return 0;}\n\n" + "int mainCRTStartup(int argc, char* argv[])\n" + "{ return argc-1;}\n") TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx OUTPUT_VARIABLE OUTPUT) Index: Modules/Platform/Generic-Windows-cl.cmake =================================================================== --- Modules/Platform/Generic-Windows-cl.cmake (revision 0) +++ Modules/Platform/Generic-Windows-cl.cmake (revision 0) @@ -0,0 +1,355 @@ +# try to load any previously computed information for C on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) +# try to load any previously computed information for CXX on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) + +SET(WIN32 1) + +INCLUDE(Platform/cl) + + +IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") + SET (CMAKE_NO_BUILD_TYPE 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") +IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") + SET (CMAKE_NO_BUILD_TYPE 1) + SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING + "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") + MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES) +ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") +# does the compiler support pdbtype and is it the newer compiler +IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") +IF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + + +# make sure to enable languages after setting configuration types +ENABLE_LANGUAGE(RC) +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") + +# for nmake we need to compute some information about the compiler +# that is being used. +# the compiler may be free command line, 6, 7, or 71, and +# each have properties that must be determined. +# to avoid running these tests with each cmake run, the +# test results are saved in CMakeCPlatform.cmake, a file +# that is automatically copied into try_compile directories +# by the global generator. +SET(MSVC_IDE 1) +IF(CMAKE_GENERATOR MATCHES "Makefiles") + SET(MSVC_IDE 0) + IF(NOT CMAKE_VC_COMPILER_TESTS_RUN) + SET(CMAKE_VC_COMPILER_TESTS 1) + SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") + STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + MESSAGE(STATUS "Check for CL compiler version") + SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) + IF (NOT CMAKE_C_COMPILER) + SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) + ENDIF(NOT CMAKE_C_COMPILER) + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} + ARGS /nologo -EP \"${testNmakeCLVersionFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") + ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + ENDIF(NOT CMAKE_COMPILER_RETURN) + # try to figure out if we are running the free command line + # tools from Microsoft. These tools do not provide debug libraries, + # so the link flags used have to be different. + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2") + SET(testForFreeVCFile + "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx") + STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}") + MESSAGE(STATUS "Check if this is a free VC compiler") + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2 + ARGS /nologo /MD /EHsc + \"${testForFreeVCFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if this is a free VC compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - yes") + SET(CMAKE_USING_VC_FREE_TOOLS 1) + ELSE(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if this is a free VC compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - no") + SET(CMAKE_USING_VC_FREE_TOOLS 0) + ENDIF(CMAKE_COMPILER_RETURN) + + # Testing the machine type of the generated binaries: + FIND_PROGRAM(CMAKE_DUMPBIN + NAMES dumpbin + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/VC/bin" + "/Program Files/Microsoft Visual Studio 8/VC/bin/" + "/Program Files/Microsoft Visual Studio 9/VC/bin/" + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio.NET/VC/bin" + "/Program Files/Microsoft Visual Studio .NET/VC/bin/" + ) + + MESSAGE(STATUS "Check CL platform:") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking CL platform using dumpbin ${CMAKE_DUMPBIN}" ) + IF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Dumpbin found as ${CMAKE_DUMPBIN}\n" ) + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") + SET(testForCLMachineType + "${CMAKE_ROOT}/Modules/CMakeTestCLMachineType.c") + SET(testForCLMachineTypeOutput CMakeTestCLMachineType.obj) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "\n\nRunning cl: ${CMAKE_C_COMPILER} -c \"${testForCLMachineType}\" " ) + EXECUTE_PROCESS(COMMAND "${CMAKE_C_COMPILER}" -c "${testForCLMachineType}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + ERROR_VARIABLE testForCLMachineType_DUMP + OUTPUT_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n\nRunning dumpbin: ${CMAKE_DUMPBIN} /HEADERS ${testForCLMachineType}" ) + EXECUTE_PROCESS(COMMAND "${CMAKE_DUMPBIN}" /HEADERS ${testForCLMachineTypeOutput} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + OUTPUT_VARIABLE testForCLMachineType_DUMPBIN_OUTPUT + ERROR_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n${testForCLMachineType_DUMPBIN_OUTPUT}" ) + STRING(REGEX MATCH "machine \\(([^\\)]*)\\)" DUMPBIN_REGEX_RESULT ${testForCLMachineType_DUMPBIN_OUTPUT}) + SET(CMAKE_CL_MACHINE_TYPE ${CMAKE_MATCH_1}) + + ELSE(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + MESSAGE(Status "Check CL platform: dumpbin.exe was not found - assuimg i386") + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + + ## TODO add further dumpbin machine to visual studio machine type conversion here: + IF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + IF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + IF(NOT CMAKE_FORCE_NON_THUMB) + SET(CMAKE_CL_MACHINE_TYPE THUMB) + ENDIF(NOT CMAKE_FORCE_NON_THUMB) + ENDIF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + + MESSAGE(STATUS "Check CL platform: ${CMAKE_CL_MACHINE_TYPE}" ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "CL platform seems to be:${CMAKE_CL_MACHINE_TYPE}" ) + ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN) +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + +IF(CMAKE_FORCE_WIN64) + SET(CMAKE_CL_MACHINE_TYPE x64) +ENDIF(CMAKE_FORCE_WIN64) + + +# default to Debug builds +IF(MSVC_VERSION GREATER 1310) + # for 2005 make sure the manifest is put in the dll with mt + SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") + # create a C shared library + SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + # create a C shared module just copy the shared library rule + SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") + SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") + SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") + + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") + ENDIF(WINCE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /MANIFEST") +ELSE(MSVC_VERSION GREATER 1310) + IF(CMAKE_USING_VC_FREE_TOOLS) + MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available") + SET(CMAKE_BUILD_TYPE_INIT Release) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + ELSE(CMAKE_USING_VC_FREE_TOOLS) + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + ENDIF(CMAKE_USING_VC_FREE_TOOLS) + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + ENDIF(WINCE) +ENDIF(MSVC_VERSION GREATER 1310) + +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") + +IF(NOT CMAKE_WINDOWS_STACKSIZE) + SET(CMAKE_WINDOWS_STACKSIZE 10000000) ## 10MB is a reasonable default? +ENDIF(NOT CMAKE_WINDOWS_STACKSIZE) + +SET (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:${CMAKE_WINDOWS_STACKSIZE}" ) + +# machine type +IF(CMAKE_GENERATOR MATCHES "Makefiles") +## Setting machine makes only sense when linking cross compiled binaries with makefiles? + IF(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${CMAKE_CL_MACHINE_TYPE}") + ELSE(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:i386") + ENDIF(CMAKE_CL_MACHINE_TYPE) + + # append /ARMPADCODE + IF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /ARMPADCODE ") + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + +ELSE(CMAKE_GENERATOR MATCHES "Makefiles") + + IF(CMAKE_FORCE_WIN64) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:x64") + ENDIF(CMAKE_FORCE_WIN64) + +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + + +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp +# on versions that support it +IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") +ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /INCREMENTAL:YES") +ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) +# for release and minsize release default to no incremental linking +SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") + +# copy the EXE_LINKER flags to SHARED and MODULE linker flags +# shared linker flags +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) +# module linker flags +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) + + +# save computed information for this platform +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + Index: Modules/Platform/Generic-Windows.cmake =================================================================== --- Modules/Platform/Generic-Windows.cmake (revision 0) +++ Modules/Platform/Generic-Windows.cmake (revision 0) @@ -0,0 +1,38 @@ + + +SET(WIN32 1) + +SET(CMAKE_STATIC_LIBRARY_PREFIX "") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +SET(CMAKE_IMPORT_LIBRARY_PREFIX "") +SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +SET(CMAKE_DL_LIBS "") + +SET(CMAKE_FIND_LIBRARY_PREFIXES "") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + +# for borland make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "Borland") + SET(CMAKE_START_TEMP_FILE "@&&|\n") + SET(CMAKE_END_TEMP_FILE "\n|") +ENDIF(CMAKE_GENERATOR MATCHES "Borland") + +# for nmake make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "NMake") + SET(CMAKE_START_TEMP_FILE "@<<\n") + SET(CMAKE_END_TEMP_FILE "\n<<") +ENDIF(CMAKE_GENERATOR MATCHES "NMake") + +INCLUDE(Platform/WindowsPaths) + +# uncomment these out to debug nmake and borland makefiles +#SET(CMAKE_START_TEMP_FILE "") +#SET(CMAKE_END_TEMP_FILE "") +#SET(CMAKE_VERBOSE_MAKEFILE 1) + Index: Modules/Platform/WinCE-cl.cmake =================================================================== --- Modules/Platform/WinCE-cl.cmake (revision 0) +++ Modules/Platform/WinCE-cl.cmake (revision 0) @@ -0,0 +1,17 @@ +MESSAGE(STATUS "+++++ Entering WinCE-CL.cmake") + +SET(WIN32 1) +SET(WINCE 1) + +IF(CMAKE_SYSTEM_VERSION) + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce,${CMAKE_SYSTEM_VERSION}) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce,${CMAKE_SYSTEM_VERSION} /ENTRY:mainACRTStartup") +ELSE(CMAKE_SYSTEM_VERSION) +# according to msdn version would default to 2.00 + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /ENTRY:mainACRTStartup") +ENDIF(CMAKE_SYSTEM_VERSION) + +INCLUDE(Platform/Generic-Windows-cl) + +MESSAGE(STATUS "----- Entering WinCE-CL.cmake") Index: Modules/Platform/WinCE.cmake =================================================================== --- Modules/Platform/WinCE.cmake (revision 0) +++ Modules/Platform/WinCE.cmake (revision 0) @@ -0,0 +1,23 @@ + +MESSAGE(STATUS "+++++ Entering WinCE.cmake") + +SET(WINCE 1) + +INCLUDE(Platform/Generic-Windows) + +IF(CMAKE_SYSTEM_VERSION) + STRING(REGEX REPLACE "([0-9]*)\\.([0-9]*)" "0x\\1\\2" CMAKE_SYSTEM_VERSION_HEX "${CMAKE_SYSTEM_VERSION}" ) +ELSE(CMAKE_SYSTEM_VERSION) + SET(CMAKE_SYSTEM_VERSION_HEX "0x200") +ENDIF(CMAKE_SYSTEM_VERSION) + +ADD_DEFINITIONS( + -DUNDER_CE=${CMAKE_SYSTEM_VERSION_HEX} + -D_WIN32_WCE=${CMAKE_SYSTEM_VERSION_HEX} + -DWIN32 + ) + + + +MESSAGE(STATUS "----- Leaveing WinCE.cmake") + Index: Source/cmake.cxx =================================================================== --- Source/cmake.cxx (revision 1) +++ Source/cmake.cxx (working copy) @@ -65,6 +65,8 @@ # include "cmGlobalVisualStudio71Generator.h" # include "cmGlobalVisualStudio8Generator.h" # include "cmGlobalVisualStudio9Generator.h" +# include "cmGlobalVisualStudio9_SDKGenerator.h" +# include "cmGlobalVisualStudio8_SDKGenerator.h" # include "cmGlobalVisualStudio9Win64Generator.h" # include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" @@ -2414,6 +2416,10 @@ &cmGlobalVisualStudio8Generator::New; this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] = &cmGlobalVisualStudio9Generator::New; + this->Generators[cmGlobalVisualStudio8_SDKGenerator::GetActualName()] = + &cmGlobalVisualStudio8_SDKGenerator::New; + this->Generators[cmGlobalVisualStudio9_SDKGenerator::GetActualName()] = + &cmGlobalVisualStudio9_SDKGenerator::New; this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] = &cmGlobalVisualStudio9Win64Generator::New; this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] = Index: Source/CMakeLists.txt =================================================================== --- Source/CMakeLists.txt (revision 1) +++ Source/CMakeLists.txt (working copy) @@ -264,8 +264,12 @@ cmGlobalVisualStudio7Generator.h cmGlobalVisualStudio8Generator.cxx cmGlobalVisualStudio8Generator.h + cmGlobalVisualStudio8_SDKGenerator.cxx + cmGlobalVisualStudio8_SDKGenerator.h cmGlobalVisualStudio9Generator.cxx cmGlobalVisualStudio9Generator.h + cmGlobalVisualStudio9_SDKGenerator.cxx + cmGlobalVisualStudio9_SDKGenerator.h cmGlobalVisualStudio8Win64Generator.cxx cmGlobalVisualStudio8Win64Generator.h cmGlobalVisualStudio9Win64Generator.cxx Index: Source/cmGlobalVisualStudio71Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio71Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio71Generator.cxx (working copy) @@ -34,6 +34,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion71(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio7Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio7Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio7Generator.cxx (working copy) @@ -139,6 +139,7 @@ { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } @@ -663,8 +664,13 @@ std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations() { return &this->Configurations; -}; +} +std::vector<PlatformDefs> *cmGlobalVisualStudio7Generator::GetPlatforms() +{ + return &this->platforms; +} + //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator ::GetDocumentation(cmDocumentationEntry& entry) const Index: Source/cmGlobalVisualStudio7Generator.h =================================================================== --- Source/cmGlobalVisualStudio7Generator.h (revision 1) +++ Source/cmGlobalVisualStudio7Generator.h (working copy) @@ -22,6 +22,18 @@ class cmTarget; struct cmVS7FlagTable; +typedef struct { + int MajorVer; + int MinorVer; + std::string PlatformDefines; + std::string CEver; + std::string Archfam; + std::string Archfam_; + std::string InstructionSet; + std::string PlatformName; + bool added; +} PlatformDefs; + /** \class cmGlobalVisualStudio7Generator * \brief Write a Unix makefiles. * @@ -81,6 +93,12 @@ */ std::vector<std::string> *GetConfigurations(); + /** + * Get the list of platforms + */ + virtual std::vector<PlatformDefs> *GetPlatforms(); + + ///! Create a GUID or get an existing one. void CreateGUID(const char* name); std::string GetGUID(const char* name); @@ -160,6 +178,8 @@ // Set during OutputSLNFile with the name of the current project. // There is one SLN file per project. std::string CurrentProject; + + std::vector<PlatformDefs> platforms; // List of platforms }; #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" Index: Source/cmGlobalVisualStudio8_SDKGenerator.cxx =================================================================== --- Source/cmGlobalVisualStudio8_SDKGenerator.cxx (revision 0) +++ Source/cmGlobalVisualStudio8_SDKGenerator.cxx (revision 0) @@ -0,0 +1,428 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio8_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmSDKConfigParser::cmSDKConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmSDKConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmSDKConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); + this->platformVec.push_back(defs); + current_platform_valid = true; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmSDKConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmSDKConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_SDKGenerator::cmGlobalVisualStudio8_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; + +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::filterSDKs(std::vector<PlatformDefs>* platformvecptr) +{ + // here we inherit the platform vector from the parent + if(platformvecptr != 0) + { + platforms.clear(); + for(std::vector<PlatformDefs>::iterator it = platformvecptr->begin(); it != platformvecptr->end(); it++) + { + platforms.push_back(*it); + } + return; + } + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + std::vector<PlatformDefs> sdksfound = platforms; + platforms.clear(); + + + cmake * c = this->GetCMakeInstance(); + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; +} + +void cmGlobalVisualStudio8_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "8.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::Configure() +{ + filterSDKs(); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"StringPooling", "GF", "Enable Stringpooling", "true", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + // Compile for special architecture + {"CompileForArchitecture", "QRarch4", "ARM4 without Thumb instructions", "0", 0}, + {"CompileForArchitecture", "QRarch5", "ARM5 without Thumb instructions", "1", 0}, + {"CompileForArchitecture", "QRarch4t", "ARM4 with Thumb instructions", "2", 0}, + {"CompileForArchitecture", "QRarch5t", "ARM5 with Thumb instructions", "3", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraFlagTableVS8() +{ + return cmVS8SDKExtraFlagTable; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", "Posix application output", "8", 0}, // THIS IS ONLY AVAILABLE ON VC 8 + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "9", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS8SDKExtraLinkFlagTable; +} \ No newline at end of file Index: Source/cmGlobalVisualStudio8_SDKGenerator.h =================================================================== --- Source/cmGlobalVisualStudio8_SDKGenerator.h (revision 0) +++ Source/cmGlobalVisualStudio8_SDKGenerator.h (revision 0) @@ -0,0 +1,91 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_SDKGenerator_h +#define cmGlobalVisualStudio8_SDKGenerator_h + +#include "cmGlobalVisualStudio8Generator.h" + +#include "cmXMLParser.h" + +class cmSDKConfigParser : public cmXMLParser +{ +public: + cmSDKConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_SDKGenerator : public cmGlobalVisualStudio8Generator +{ +public: + cmGlobalVisualStudio8_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 (with SDK support)";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + + void filterSDKs(std::vector<PlatformDefs>* platforms = 0); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + + virtual void GetSDKsInstalled(); + + std::string PlatformName; // Win32 or x64 +}; +#endif Index: Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx (revision 0) +++ Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx (revision 0) @@ -0,0 +1,562 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmWindowsMobileConfigParser::cmWindowsMobileConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmWindowsMobileConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); +// if(defs.PlatformName.find("ARMV4") != std::string::npos) { + this->platformVec.push_back(defs); + current_platform_valid = true; +// } else +// current_platform_valid = false; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmWindowsMobileConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_WindowsMobile_Generator::cmGlobalVisualStudio8_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + this->PlatformName = "Undefined Mobile Platform"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +// ouput standard header for dsw file +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 9.00\n"; + fout << "# Visual Studio 2005\n"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC80", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Configure() +{ + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + regkey += std::string("\\Setup\\VS;"); + + std::string base; + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmWindowsMobileConfigParser *parser = new cmWindowsMobileConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + std::vector<PlatformDefs> sdksfound = parser->getPlatforms(); + //platforms = parser->getPlatforms(); + delete parser; + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + cmake * c = this->GetCMakeInstance(); + + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; + + // HERE WE CIRCUMVENT THE NEED FOR A TOOLCHAIN FILE - WE SHOULD CHANGE THIS TO USE A TOOLCHAIN FILE + c->AddCacheEntry("CMAKE_SYSTEM_NAME", "WinCE", "Windows CE Define", 6); // 0 = bool, 3 = string + c->AddCacheEntry("CMAKE_SYSTEM_VERSION", "5.1", "Mobile Platform Version Define", 6); // #5.1 = WM5, 5.2 = WM6 + c->AddCacheEntry("CMAKE_SYSTEM_PROCESSOR", "ARMV4I", "Processor Define", 6); + c->AddCacheEntry("ARM", "1", "System Define", 6); + + c->AddCacheEntry("CMAKE_C_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + c->AddCacheEntry("CMAKE_CXX_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + + c->AddCacheEntry("CMAKE_CROSSCOMPILING","TRUE","Crosscompiling Flag",0); + c->AddCacheEntry("CMAKE_WINCE_STACKSIZE","65536,4096", "Stack Size Definition", 6); + + c->AddCacheEntry("WINCE_HOST_CMAKE_PATH", (base + std::string("/VC/ce")).c_str(),"Path to Visual Studio CE Path",1); + //c->AddCacheEntry("WINCE_SDK_CMAKE_PATH", "C:/Programme/Windows Mobile 5.0 SDK R2/PocketPC","Path to WinCE SDK",1); + //c->AddCacheEntry("WINVS_SDK_CMAKE_PATH", "C:/Programme/Microsoft SDKs/Windows/v6.0A/bin","Path to VS SDK",1); + + char buf[200]; + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_COMPILER", buf, "ARM cxx-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_COMPILER", buf, "ARM c-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_LINKER", buf, "ARM cxx-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_LINKER", buf, "ARM c-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_LINKER", buf, "ARM Linker",2); + sprintf(buf,"%s/bin/x86_arm/armasm.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_ASM_COMPILER", buf , "ARM Assembler",2); + //sprintf(buf,"%s/rc.exe",c->GetCacheDefinition("WINVS_SDK_CMAKE_PATH")); + //c->AddCacheEntry("CMAKE_RC_COMPILER", buf, "Resource Compiler",2); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + // Some VS8 sp0 versions cannot run macros. + // See http://support.microsoft.com/kb/928209 + const char* vc8sp1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926601;"; + const char* vc8exSP1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926748;"; + std::string vc8sp1; + if (!cmSystemTools::ReadRegistryValue(vc8sp1Registry, vc8sp1) && + !cmSystemTools::ReadRegistryValue(vc8exSP1Registry, vc8sp1)) + { + return ""; + } + + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 8.0 macros folder: + path = base + "/VSMacros80"; + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Generate() +{ + // Add a special target on which all other targets depend that + // checks the build system and optionally re-runs CMake. + const char* no_working_directory = 0; + std::vector<std::string> no_depends; + std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; + for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) + { + std::vector<cmLocalGenerator*>& generators = it->second; + if(!generators.empty()) + { + // Add the build-system check target to the first local + // generator of this project. + cmLocalVisualStudio7Generator* lg = + static_cast<cmLocalVisualStudio7Generator*>(generators[0]); + cmMakefile* mf = lg->GetMakefile(); + + // Skip the target if no regeneration is to be done. + if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION")) + { + continue; + } + + std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLines noCommandLines; + mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, + no_working_directory, no_depends, + noCommandLines); + cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + if(!tgt) + { + cmSystemTools::Error("Error adding target " + CMAKE_CHECK_BUILD_SYSTEM_TARGET); + continue; + } + + // Create a list of all stamp files for this project. + std::vector<std::string> stamps; + std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash(); + stampList += "generate.stamp.list"; + { + std::string stampListFile = + generators[0]->GetMakefile()->GetCurrentOutputDirectory(); + stampListFile += "/"; + stampListFile += stampList; + std::string stampFile; + cmGeneratedFileStream fout(stampListFile.c_str()); + for(std::vector<cmLocalGenerator*>::const_iterator + gi = generators.begin(); gi != generators.end(); ++gi) + { + stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory(); + stampFile += "/"; + stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); + stampFile += "generate.stamp"; + stampFile = generators[0]->Convert(stampFile.c_str(), + cmLocalGenerator::START_OUTPUT); + fout << stampFile << "\n"; + stamps.push_back(stampFile); + } + } + + // Add a custom rule to re-run CMake if any input files changed. + { + // Collect the input files used to generate all targets in this + // project. + std::vector<std::string> listFiles; + for(unsigned int j = 0; j < generators.size(); ++j) + { + cmMakefile* lmf = generators[j]->GetMakefile(); + listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(), + lmf->GetListFiles().end()); + } + // Sort the list of input files and remove duplicates. + std::sort(listFiles.begin(), listFiles.end(), + std::less<std::string>()); + std::vector<std::string>::iterator new_end = + std::unique(listFiles.begin(), listFiles.end()); + listFiles.erase(new_end, listFiles.end()); + + // Create a rule to re-run CMake. + std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash(); + stampName += "generate.stamp"; + const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLine commandLine; + commandLine.push_back(dsprule); + std::string argH = "-H"; + argH += lg->Convert(mf->GetHomeDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argH); + std::string argB = "-B"; + argB += lg->Convert(mf->GetHomeOutputDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argB); + commandLine.push_back("--check-stamp-list"); + commandLine.push_back(stampList.c_str()); + commandLine.push_back("--vs-solution-file"); + commandLine.push_back("\"$(SolutionPath)\""); + cmCustomCommandLines commandLines; + commandLines.push_back(commandLine); + + // Add the rule. Note that we cannot use the CMakeLists.txt + // file as the main dependency because it would get + // overwritten by the CreateVCProjBuildRule. + // (this could be avoided with per-target source files) + const char* no_main_dependency = 0; + const char* no_working_directory = 0; + mf->AddCustomCommandToOutput( + stamps, listFiles, + no_main_dependency, commandLines, "Checking Build System", + no_working_directory, true); + std::string ruleName = stamps[0]; + ruleName += ".rule"; + if(cmSourceFile* file = mf->GetSource(ruleName.c_str())) + { + tgt->AddSourceFile(file); + } + else + { + cmSystemTools::Error("Error adding rule for ", stamps[0].c_str()); + } + } + } + } + + // Now perform the main generation. + this->cmGlobalVisualStudio7Generator::Generate(); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8ExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_WindowsMobile_Generator::GetExtraFlagTableVS8() +{ + return cmVS8ExtraFlagTable; +} Index: Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h =================================================================== --- Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h (revision 0) +++ Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h (revision 0) @@ -0,0 +1,101 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_WindowsMobile_Generator_h +#define cmGlobalVisualStudio8_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio71Generator.h" + +#include "cmXMLParser.h" + +class cmWindowsMobileConfigParser : public cmXMLParser +{ +public: + cmWindowsMobileConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_WindowsMobile_Generator : public cmGlobalVisualStudio71Generator +{ +public: + cmGlobalVisualStudio8_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 - Windows Mobile";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + virtual void Generate(); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSLNHeader(std::ostream& fout); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + std::string PlatformName; // Win32 or x64 +}; +#endif Index: Source/cmGlobalVisualStudio8Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio8Generator.cxx (working copy) @@ -36,6 +36,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion8(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } @@ -341,6 +342,10 @@ cmVS7FlagTable::UserValueRequired}, // There is no YX option in the VS8 IDE. + // WHY WAS THIS REMOVED FROM VS7 to VS8? + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + // Exception handling mode. If no entries match, it will be FALSE. {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, Index: Source/cmGlobalVisualStudio8Generator.h =================================================================== --- Source/cmGlobalVisualStudio8Generator.h (revision 1) +++ Source/cmGlobalVisualStudio8Generator.h (working copy) @@ -67,7 +67,7 @@ virtual bool VSLinksDependencies() const { return false; } - static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); Index: Source/cmGlobalVisualStudio8Win64Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8Win64Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio8Win64Generator.cxx (working copy) @@ -34,6 +34,7 @@ lg->SetVersion8(); lg->SetPlatformName(this->PlatformName.c_str()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio9_SDKGenerator.cxx =================================================================== --- Source/cmGlobalVisualStudio9_SDKGenerator.cxx (revision 0) +++ Source/cmGlobalVisualStudio9_SDKGenerator.cxx (revision 0) @@ -0,0 +1,190 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio9_SDKGenerator::cmGlobalVisualStudio9_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS9SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "8", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio9_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS9SDKExtraLinkFlagTable; +} \ No newline at end of file Index: Source/cmGlobalVisualStudio9_SDKGenerator.h =================================================================== --- Source/cmGlobalVisualStudio9_SDKGenerator.h (revision 0) +++ Source/cmGlobalVisualStudio9_SDKGenerator.h (revision 0) @@ -0,0 +1,75 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_SDKGenerator_h +#define cmGlobalVisualStudio9_SDKGenerator_h + +#include "cmGlobalVisualStudio8_SDKGenerator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_SDKGenerator : + public cmGlobalVisualStudio8_SDKGenerator +{ +public: + cmGlobalVisualStudio9_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 (with SDK support)";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + + virtual void GetSDKsInstalled(); +}; +#endif Index: Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx (revision 0) +++ Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx (revision 0) @@ -0,0 +1,102 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + + +cmGlobalVisualStudio9_WindowsMobile_Generator::cmGlobalVisualStudio9_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8_WindowsMobile_Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} Index: Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h =================================================================== --- Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h (revision 0) +++ Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h (revision 0) @@ -0,0 +1,69 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_WindowsMobile_Generator_h +#define cmGlobalVisualStudio9_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_WindowsMobile_Generator : + public cmGlobalVisualStudio8_WindowsMobile_Generator +{ +public: + cmGlobalVisualStudio9_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 - Windows Mobile";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); +}; +#endif Index: Source/cmGlobalVisualStudio9Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio9Generator.cxx (working copy) @@ -46,6 +46,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion9(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio9Win64Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9Win64Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio9Win64Generator.cxx (working copy) @@ -31,6 +31,7 @@ lg->SetVersion9(); lg->SetPlatformName(this->PlatformName.c_str()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmLocalVisualStudio7Generator.cxx =================================================================== --- Source/cmLocalVisualStudio7Generator.cxx (revision 1) +++ Source/cmLocalVisualStudio7Generator.cxx (working copy) @@ -536,9 +536,10 @@ bool& flag_handled); }; -void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, +void cmLocalVisualStudio7Generator::WritePlatformConfiguration(std::ostream& fout, const char* configName, const char *libName, + const char *platformName, cmTarget &target) { const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); @@ -546,9 +547,23 @@ { mfcFlag = "0"; } + + const char* wholeprogoptFlag; + if(strcmp(configName,"Release")==0) + wholeprogoptFlag = this->Makefile->GetDefinition("CMAKE_WHOLEPROGOPT_FLAG_RELEASE"); + else + wholeprogoptFlag = this->Makefile->GetDefinition("CMAKE_WHOLEPROGOPT_FLAG_DEBUG"); + if(!wholeprogoptFlag) + { + wholeprogoptFlag = "0"; + } + fout << "\t\t<Configuration\n" - << "\t\t\tName=\"" << configName << "|" << this->PlatformName << "\"\n" - << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + << "\t\t\tName=\"" << configName << "|" << platformName << "\"\n"; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + fout << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + else + fout << "\t\t\tOutputDirectory=\"" << platformName << "\\" << configName << "\"\n"; // This is an internal type to Visual Studio, it seems that: // 4 == static library // 2 == dll @@ -661,12 +676,15 @@ // target and a subdirectory for the configuration name. std::string intermediateDir = this->GetTargetDirectory(target); intermediateDir += "/"; + if(strcmp(platformName,"Win32") != 0 && strcmp(platformName,"x64") != 0) + intermediateDir += std::string(platformName) + "/"; intermediateDir += configName; fout << "\t\t\tIntermediateDirectory=\"" << this->ConvertToXMLOutputPath(intermediateDir.c_str()) << "\"\n" << "\t\t\tConfigurationType=\"" << configType << "\"\n" << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" + << "\t\t\tWholeProgramOptimization=\"" << wholeprogoptFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; // If unicode is enabled change the character set to unicode, if not @@ -737,9 +755,18 @@ { // We need to specify a program database file name even for // non-debug configurations because VS still creates .idb files. +if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) +{ fout << "\t\t\t\tProgramDataBaseFileName=\"" - << target.GetDirectory(configName) << "/" - << target.GetPDBName(configName) << "\"\n"; + << target.GetDirectory(configName) << "/"; +} +else +{ + fout << "\t\t\t\tProgramDataBaseFileName=\"" + << target.GetDirectory() << "/" << + std::string(platformName) << "/" << std::string(configName) << "/"; +} + fout << target.GetPDBName(configName) << "\"\n"; } fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool tool = "VCCustomBuildTool"; @@ -815,10 +842,28 @@ } this->OutputTargetRules(fout, configName, target, libName); - this->OutputBuildTool(fout, configName, target, targetOptions.IsDebug()); + this->OutputBuildTool(fout, configName, platformName, target, targetOptions.IsDebug()); fout << "\t\t</Configuration>\n"; } +void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, + const char* configName, + const char *libName, + cmTarget &target) +{ + if((this->PlatformName).compare("Mobile Platform") == 0) + { + cmGlobalVisualStudio7Generator *gg = static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator); + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + WritePlatformConfiguration(fout,configName,libName,(j->PlatformName).c_str(),target); + } + else + { + WritePlatformConfiguration(fout,configName,libName,(this->PlatformName).c_str(),target); + } +} + //---------------------------------------------------------------------------- std::string cmLocalVisualStudio7Generator @@ -837,6 +882,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, const char* configName, + const char* platformName, cmTarget &target, bool isDebug) { @@ -879,15 +925,25 @@ extraLinkOptions += " "; extraLinkOptions += targetLinkFlags; } - Options linkOptions(this, this->Version, Options::Linker); + Options linkOptions(this, this->Version, Options::Linker, this->ExtraLinkFlagTable); // MODIFIED BY CLEMENS linkOptions.Parse(extraLinkOptions.c_str()); switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: { std::string targetNameFull = target.GetFullName(configName); - std::string libpath = target.GetDirectory(configName); + std::string libpath; + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { + libpath = target.GetDirectory(configName); libpath += "/"; + } + else + { + libpath = target.GetDirectory(); + libpath += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } libpath += targetNameFull; const char* tool = "VCLibrarianTool"; if(this->FortranProject) @@ -937,15 +993,29 @@ fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " - << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) - << " "; + << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; temp = target.GetDirectory(configName); temp += "/"; + } + else + { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + + fout << "\t\t\t\tAdditionalDependencies=\" "; + this->Internal->OutputLibraries(fout, cli.GetItems()); + fout << "\"\n"; + fout << "\t\t\t\tDelayLoadDLLs=\"$(NOINHERIT)" << "\"\n"; + fout << "\t\t\t\tRandomizedBaseAddress=\"1" << "\"\n"; + fout << "\t\t\t\tDataExecutionPrevention=\"0" << "\"\n"; + } temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -955,8 +1025,17 @@ this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; this->OutputModuleDefinitionFile(fout, target); + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName); temp += "/"; + } + else + { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNamePDB; fout << "\t\t\t\tProgramDataBaseFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -972,8 +1051,17 @@ { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n"; } + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName, true); temp += "/"; + } + else + { + temp = target.GetDirectory("",true); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; @@ -1009,6 +1097,8 @@ } fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. @@ -1017,8 +1107,32 @@ << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; + } else + { + linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); + // Use the NOINHERIT macro to avoid getting VS project default + // libraries which may be set by the user to something bad. + fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " + << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) + << " "; + this->Internal->OutputLibraries(fout, cli.GetItems()); + fout << "\"\n"; + + fout << "\t\t\t\tDelayLoadDLLs=\"$(NOINHERIT)" << "\"\n"; + //fout << "\t\t\t\tSubSystem=\"0" << "\"\n"; + fout << "\t\t\t\tRandomizedBaseAddress=\"1" << "\"\n"; + fout << "\t\t\t\tDataExecutionPrevention=\"0" << "\"\n"; + } + if( strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0 || + strcmp(target.GetName(),"cmTryCompileExec") == 0 ) + // this is stupid hack to keep the try_compile stuff working for other platforms + { temp = target.GetDirectory(configName); temp += "/"; + } else { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -1027,13 +1141,23 @@ fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; - fout << "\t\t\t\tProgramDataBaseFile=\"" - << target.GetDirectory(configName) << "/" << targetNamePDB + fout << "\t\t\t\tProgramDataBaseFile=\""; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { + fout << target.GetDirectory(configName) << "/" << targetNamePDB << "\"\n"; + } + else + { + fout << target.GetDirectory() << "/" << + std::string(platformName) << "/" << std::string(configName) << "/" << targetNamePDB + << "\"\n"; + } if(isDebug) { fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"; } + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) { if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) { fout << "\t\t\t\tSubSystem=\"2\"\n"; @@ -1042,6 +1166,7 @@ { fout << "\t\t\t\tSubSystem=\"1\"\n"; } + } std::string stackVar = "CMAKE_"; stackVar += linkLanguage; stackVar += "_STACK_SIZE"; @@ -1050,8 +1175,18 @@ { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\""; } + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName, true); temp += "/"; + } + else + { + temp = target.GetDirectory("",true); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } + temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; @@ -1379,6 +1514,9 @@ dir_max += config_max; dir_max += "/"; + cmGlobalVisualStudio7Generator * gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + // Loop through each source in the source group. std::string objectName; for(std::vector<const cmSourceFile *>::const_iterator sf = @@ -1432,6 +1570,50 @@ fci = fcinfo.FileConfigMap.begin(); fci != fcinfo.FileConfigMap.end(); ++fci) { + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + { + cmLVS7GFileConfig const& fc = fci->second; + fout << "\t\t\t\t<FileConfiguration\n" + << "\t\t\t\t\tName=\"" << fci->first + << "|" << j->PlatformName << "\""; + if(fc.ExcludedFromBuild) + { + fout << " ExcludedFromBuild=\"true\""; + } + fout << ">\n"; + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n"; + if(!fc.CompileFlags.empty() || + !fc.CompileDefs.empty() || + !fc.CompileDefsConfig.empty()) + { + Options fileOptions(this, this->Version, Options::Compiler, + this->ExtraFlagTable); + fileOptions.Parse(fc.CompileFlags.c_str()); + fileOptions.AddDefines(fc.CompileDefs.c_str()); + fileOptions.AddDefines(fc.CompileDefsConfig.c_str()); + fileOptions.OutputAdditionalOptions(fout, "\t\t\t\t\t", "\n"); + fileOptions.OutputFlagMap(fout, "\t\t\t\t\t"); + fileOptions.OutputPreprocessorDefinitions(fout, + "\t\t\t\t\t", "\n"); + } + if(!fc.AdditionalDeps.empty()) + { + fout << "\t\t\t\t\tAdditionalDependencies=\"" + << fc.AdditionalDeps.c_str() << "\"\n"; + } + if(!fc.ObjectName.empty()) + { + fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" + << fc.ObjectName.c_str() << "\"\n"; + } + fout << "\t\t\t\t\t/>\n" + << "\t\t\t\t</FileConfiguration>\n"; + } + else + { cmLVS7GFileConfig const& fc = fci->second; fout << "\t\t\t\t<FileConfiguration\n" << "\t\t\t\t\tName=\"" << fci->first @@ -1471,6 +1653,7 @@ << "\t\t\t\t</FileConfiguration>\n"; } } + } fout << "\t\t\t</File>\n"; } } @@ -1499,9 +1682,9 @@ // Write the rule for each configuration. std::vector<std::string>::iterator i; - std::vector<std::string> *configs = - static_cast<cmGlobalVisualStudio7Generator *> - (this->GlobalGenerator)->GetConfigurations(); + cmGlobalVisualStudio7Generator * gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + std::vector<std::string> *configs = gg->GetConfigurations(); const char* compileTool = "VCCLCompilerTool"; if(this->FortranProject) { @@ -1514,6 +1697,83 @@ } for(i = configs->begin(); i != configs->end(); ++i) { + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + { + cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; + fout << "\t\t\t\t<FileConfiguration\n"; + fout << "\t\t\t\t\tName=\"" << *i << "|" << j->PlatformName << "\">\n"; + if(!fc.CompileFlags.empty()) + { + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << compileTool << "\"\n" + << "\t\t\t\t\tAdditionalOptions=\"" + << this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n"; + } + + std::string script = + this->ConstructScript(command.GetCommandLines(), + command.GetWorkingDirectory(), + i->c_str(), + command.GetEscapeOldStyle(), + command.GetEscapeAllowMakeVars()); + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << customTool << "\"\n" + << "\t\t\t\t\tDescription=\"" + << this->EscapeForXML(comment.c_str()) << "\"\n" + << "\t\t\t\t\tCommandLine=\"" + << this->EscapeForXML(script.c_str()) << "\"\n" + << "\t\t\t\t\tAdditionalDependencies=\""; + if(command.GetDepends().empty()) + { + // There are no real dependencies. Produce an artificial one to + // make sure the rule runs reliably. + if(!cmSystemTools::FileExists(source)) + { + std::ofstream depout(source); + depout << "Artificial dependency for a custom command.\n"; + } + fout << this->ConvertToXMLOutputPath(source); + } + else + { + // Write out the dependencies for the rule. + for(std::vector<std::string>::const_iterator d = + command.GetDepends().begin(); + d != command.GetDepends().end(); + ++d) + { + // Get the real name of the dependency in case it is a CMake target. + std::string dep = this->GetRealDependency(d->c_str(), i->c_str()); + fout << this->ConvertToXMLOutputPath(dep.c_str()) + << ";"; + } + } + fout << "\"\n"; + fout << "\t\t\t\t\tOutputs=\""; + if(command.GetOutputs().empty()) + { + fout << source << "_force"; + } + else + { + // Write a rule for the output generated by this command. + const char* sep = ""; + for(std::vector<std::string>::const_iterator o = + command.GetOutputs().begin(); + o != command.GetOutputs().end(); + ++o) + { + fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str()); + sep = ";"; + } + } + fout << "\"/>\n"; + fout << "\t\t\t\t</FileConfiguration>\n"; + } + else + { cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; fout << "\t\t\t\t<FileConfiguration\n"; fout << "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n"; @@ -1586,6 +1846,7 @@ fout << "\t\t\t\t</FileConfiguration>\n"; } } +} void cmLocalVisualStudio7Generator::WriteVCProjBeginGroup(std::ostream& fout, @@ -1789,13 +2050,19 @@ } if(projectType) { - fout << "\tProjectType=\"" << projectType << "\"\n"; + fout << "\tProjectType=\"" << projectType << "\">\n"; } fout<< "\tKeyword=\"" << keyword << "\">\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n" - << "\t<Platforms>\n" - << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" - << "\t</Platforms>\n"; + << "\t<Platforms>\n"; + + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + fout << "\t\t<Platform\n\t\t\tName=\"" << j->PlatformName << "\"/>\n"; + else + fout << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"; + fout << "\t</Platforms>\n"; } @@ -1850,9 +2117,15 @@ << "\tSccProvider=\"" << vsProvider << "\"\n"; } fout << "\tKeyword=\"" << keyword << "\">\n" - << "\t<Platforms>\n" - << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" - << "\t</Platforms>\n"; + << "\t<Platforms>\n"; + + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + fout << "\t\t<Platform\n\t\t\tName=\"" << j->PlatformName << "\"/>\n"; + else + fout << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"; + fout << "\t</Platforms>\n"; } Index: Source/cmLocalVisualStudio7Generator.h =================================================================== --- Source/cmLocalVisualStudio7Generator.h (revision 1) +++ Source/cmLocalVisualStudio7Generator.h (working copy) @@ -68,6 +68,8 @@ void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } + void SetExtraLinkFlagTable(cmVS7FlagTable const* table) + { this->ExtraLinkFlagTable = table; } private: typedef cmLocalVisualStudio7GeneratorOptions Options; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; @@ -85,6 +87,11 @@ void WriteVCProjFile(std::ostream& fout, const char *libName, cmTarget &tgt); cmSourceFile* CreateVCProjBuildRule(); + void WritePlatformConfiguration(std::ostream& fout, + const char* configName, + const char *libName, + const char *platformName, + cmTarget &target); void WriteConfigurations(std::ostream& fout, const char *libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, @@ -96,7 +103,7 @@ void OutputTargetRules(std::ostream& fout, const char* configName, cmTarget &target, const char *libName); void OutputBuildTool(std::ostream& fout, const char* configName, - cmTarget& t, bool debug); + const char* platformName, cmTarget& t, bool debug); void OutputLibraryDirectories(std::ostream& fout, std::vector<std::string> const& dirs); void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target); @@ -124,6 +131,7 @@ friend class cmLocalVisualStudio7GeneratorInternals; cmVS7FlagTable const* ExtraFlagTable; + cmVS7FlagTable const* ExtraLinkFlagTable; std::string ModuleDefinitionFile; int Version; bool FortranProject; Index: Source/cmMakefile.cxx =================================================================== --- Source/cmMakefile.cxx (revision 1) +++ Source/cmMakefile.cxx (working copy) @@ -21,6 +21,10 @@ #include "cmSourceFileLocation.h" #include "cmSystemTools.h" #include "cmGlobalGenerator.h" +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) +# include "cmGlobalVisualStudio9_SDKGenerator.h" +# include "cmGlobalVisualStudio8_SDKGenerator.h" +#endif #include "cmLocalGenerator.h" #include "cmCommands.h" #include "cmCacheManager.h" @@ -2740,8 +2744,9 @@ std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND"); cmake cm; cm.SetIsInTryCompile(true); - cmGlobalGenerator *gg = cm.CreateGlobalGenerator - (this->LocalGenerator->GetGlobalGenerator()->GetName()); + cmGlobalGenerator *parentgg = this->LocalGenerator->GetGlobalGenerator(); + std::string parentggname(parentgg->GetName()); + cmGlobalGenerator *gg = cm.CreateGlobalGenerator(parentggname.c_str()); if (!gg) { cmSystemTools::Error( @@ -2750,6 +2755,22 @@ cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; } + // check to update platforms list if it is an SDK based builder +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) + if(parentggname.compare(cmGlobalVisualStudio8_SDKGenerator::GetActualName()) == 0) + { // gg should inherit platform vector from parent + cmGlobalVisualStudio8_SDKGenerator* srcgg = static_cast<cmGlobalVisualStudio8_SDKGenerator*>(parentgg); + cmGlobalVisualStudio8_SDKGenerator* targg = static_cast<cmGlobalVisualStudio8_SDKGenerator*>(gg); + targg->filterSDKs(srcgg->GetPlatforms()); + } + else if(parentggname.compare(cmGlobalVisualStudio9_SDKGenerator::GetActualName()) == 0) + { // gg should inherit platform vector from parent + cmGlobalVisualStudio9_SDKGenerator* srcgg = static_cast<cmGlobalVisualStudio9_SDKGenerator*>(parentgg); + cmGlobalVisualStudio9_SDKGenerator* targg = static_cast<cmGlobalVisualStudio9_SDKGenerator*>(gg); + targg->filterSDKs(srcgg->GetPlatforms()); + } +#endif + cm.SetGlobalGenerator(gg); // do a configure cmake-2.6.3_1.patch [^] (145,143 bytes) 2009-03-30 07:00 [Show Content] [Hide Content] Index: Source/cmGlobalVisualStudio9Win64Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9Win64Generator.cxx +++ Source/cmGlobalVisualStudio9Win64Generator.cxx @@ -31,6 +31,7 @@ lg->SetVersion9(); lg->SetPlatformName(this->PlatformName.c_str()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio7Generator.h =================================================================== --- Source/cmGlobalVisualStudio7Generator.h +++ Source/cmGlobalVisualStudio7Generator.h @@ -22,6 +22,18 @@ class cmTarget; struct cmVS7FlagTable; +typedef struct { + int MajorVer; + int MinorVer; + std::string PlatformDefines; + std::string CEver; + std::string Archfam; + std::string Archfam_; + std::string InstructionSet; + std::string PlatformName; + bool added; +} PlatformDefs; + /** \class cmGlobalVisualStudio7Generator * \brief Write a Unix makefiles. * @@ -81,6 +93,12 @@ */ std::vector<std::string> *GetConfigurations(); + /** + * Get the list of platforms + */ + virtual std::vector<PlatformDefs> *GetPlatforms(); + + ///! Create a GUID or get an existing one. void CreateGUID(const char* name); std::string GetGUID(const char* name); @@ -160,6 +178,8 @@ // Set during OutputSLNFile with the name of the current project. // There is one SLN file per project. std::string CurrentProject; + + std::vector<PlatformDefs> platforms; // List of platforms }; #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" Index: Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx +++ Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx @@ -0,0 +1,102 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + + +cmGlobalVisualStudio9_WindowsMobile_Generator::cmGlobalVisualStudio9_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8_WindowsMobile_Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} Index: Source/cmGlobalVisualStudio9Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9Generator.cxx +++ Source/cmGlobalVisualStudio9Generator.cxx @@ -46,6 +46,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion9(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h =================================================================== --- Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h +++ Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h @@ -0,0 +1,69 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_WindowsMobile_Generator_h +#define cmGlobalVisualStudio9_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_WindowsMobile_Generator : + public cmGlobalVisualStudio8_WindowsMobile_Generator +{ +public: + cmGlobalVisualStudio9_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 - Windows Mobile";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); +}; +#endif Index: Source/cmake.cxx =================================================================== --- Source/cmake.cxx +++ Source/cmake.cxx @@ -65,6 +65,8 @@ # include "cmGlobalVisualStudio71Generator.h" # include "cmGlobalVisualStudio8Generator.h" # include "cmGlobalVisualStudio9Generator.h" +# include "cmGlobalVisualStudio9_SDKGenerator.h" +# include "cmGlobalVisualStudio8_SDKGenerator.h" # include "cmGlobalVisualStudio9Win64Generator.h" # include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" @@ -2414,6 +2416,10 @@ &cmGlobalVisualStudio8Generator::New; this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] = &cmGlobalVisualStudio9Generator::New; + this->Generators[cmGlobalVisualStudio8_SDKGenerator::GetActualName()] = + &cmGlobalVisualStudio8_SDKGenerator::New; + this->Generators[cmGlobalVisualStudio9_SDKGenerator::GetActualName()] = + &cmGlobalVisualStudio9_SDKGenerator::New; this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] = &cmGlobalVisualStudio9Win64Generator::New; this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] = Index: Source/cmGlobalVisualStudio8Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8Generator.cxx +++ Source/cmGlobalVisualStudio8Generator.cxx @@ -36,6 +36,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion8(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } @@ -341,6 +342,10 @@ cmVS7FlagTable::UserValueRequired}, // There is no YX option in the VS8 IDE. + // WHY WAS THIS REMOVED FROM VS7 to VS8? + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + // Exception handling mode. If no entries match, it will be FALSE. {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, Index: Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx +++ Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx @@ -0,0 +1,562 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmWindowsMobileConfigParser::cmWindowsMobileConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmWindowsMobileConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); +// if(defs.PlatformName.find("ARMV4") != std::string::npos) { + this->platformVec.push_back(defs); + current_platform_valid = true; +// } else +// current_platform_valid = false; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmWindowsMobileConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_WindowsMobile_Generator::cmGlobalVisualStudio8_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + this->PlatformName = "Undefined Mobile Platform"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +// ouput standard header for dsw file +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 9.00\n"; + fout << "# Visual Studio 2005\n"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC80", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Configure() +{ + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + regkey += std::string("\\Setup\\VS;"); + + std::string base; + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmWindowsMobileConfigParser *parser = new cmWindowsMobileConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + std::vector<PlatformDefs> sdksfound = parser->getPlatforms(); + //platforms = parser->getPlatforms(); + delete parser; + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + cmake * c = this->GetCMakeInstance(); + + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; + + // HERE WE CIRCUMVENT THE NEED FOR A TOOLCHAIN FILE - WE SHOULD CHANGE THIS TO USE A TOOLCHAIN FILE + c->AddCacheEntry("CMAKE_SYSTEM_NAME", "WinCE", "Windows CE Define", 6); // 0 = bool, 3 = string + c->AddCacheEntry("CMAKE_SYSTEM_VERSION", "5.1", "Mobile Platform Version Define", 6); // #5.1 = WM5, 5.2 = WM6 + c->AddCacheEntry("CMAKE_SYSTEM_PROCESSOR", "ARMV4I", "Processor Define", 6); + c->AddCacheEntry("ARM", "1", "System Define", 6); + + c->AddCacheEntry("CMAKE_C_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + c->AddCacheEntry("CMAKE_CXX_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + + c->AddCacheEntry("CMAKE_CROSSCOMPILING","TRUE","Crosscompiling Flag",0); + c->AddCacheEntry("CMAKE_WINCE_STACKSIZE","65536,4096", "Stack Size Definition", 6); + + c->AddCacheEntry("WINCE_HOST_CMAKE_PATH", (base + std::string("/VC/ce")).c_str(),"Path to Visual Studio CE Path",1); + //c->AddCacheEntry("WINCE_SDK_CMAKE_PATH", "C:/Programme/Windows Mobile 5.0 SDK R2/PocketPC","Path to WinCE SDK",1); + //c->AddCacheEntry("WINVS_SDK_CMAKE_PATH", "C:/Programme/Microsoft SDKs/Windows/v6.0A/bin","Path to VS SDK",1); + + char buf[200]; + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_COMPILER", buf, "ARM cxx-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_COMPILER", buf, "ARM c-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_LINKER", buf, "ARM cxx-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_LINKER", buf, "ARM c-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_LINKER", buf, "ARM Linker",2); + sprintf(buf,"%s/bin/x86_arm/armasm.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_ASM_COMPILER", buf , "ARM Assembler",2); + //sprintf(buf,"%s/rc.exe",c->GetCacheDefinition("WINVS_SDK_CMAKE_PATH")); + //c->AddCacheEntry("CMAKE_RC_COMPILER", buf, "Resource Compiler",2); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + // Some VS8 sp0 versions cannot run macros. + // See http://support.microsoft.com/kb/928209 + const char* vc8sp1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926601;"; + const char* vc8exSP1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926748;"; + std::string vc8sp1; + if (!cmSystemTools::ReadRegistryValue(vc8sp1Registry, vc8sp1) && + !cmSystemTools::ReadRegistryValue(vc8exSP1Registry, vc8sp1)) + { + return ""; + } + + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 8.0 macros folder: + path = base + "/VSMacros80"; + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Generate() +{ + // Add a special target on which all other targets depend that + // checks the build system and optionally re-runs CMake. + const char* no_working_directory = 0; + std::vector<std::string> no_depends; + std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; + for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) + { + std::vector<cmLocalGenerator*>& generators = it->second; + if(!generators.empty()) + { + // Add the build-system check target to the first local + // generator of this project. + cmLocalVisualStudio7Generator* lg = + static_cast<cmLocalVisualStudio7Generator*>(generators[0]); + cmMakefile* mf = lg->GetMakefile(); + + // Skip the target if no regeneration is to be done. + if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION")) + { + continue; + } + + std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLines noCommandLines; + mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, + no_working_directory, no_depends, + noCommandLines); + cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + if(!tgt) + { + cmSystemTools::Error("Error adding target " + CMAKE_CHECK_BUILD_SYSTEM_TARGET); + continue; + } + + // Create a list of all stamp files for this project. + std::vector<std::string> stamps; + std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash(); + stampList += "generate.stamp.list"; + { + std::string stampListFile = + generators[0]->GetMakefile()->GetCurrentOutputDirectory(); + stampListFile += "/"; + stampListFile += stampList; + std::string stampFile; + cmGeneratedFileStream fout(stampListFile.c_str()); + for(std::vector<cmLocalGenerator*>::const_iterator + gi = generators.begin(); gi != generators.end(); ++gi) + { + stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory(); + stampFile += "/"; + stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); + stampFile += "generate.stamp"; + stampFile = generators[0]->Convert(stampFile.c_str(), + cmLocalGenerator::START_OUTPUT); + fout << stampFile << "\n"; + stamps.push_back(stampFile); + } + } + + // Add a custom rule to re-run CMake if any input files changed. + { + // Collect the input files used to generate all targets in this + // project. + std::vector<std::string> listFiles; + for(unsigned int j = 0; j < generators.size(); ++j) + { + cmMakefile* lmf = generators[j]->GetMakefile(); + listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(), + lmf->GetListFiles().end()); + } + // Sort the list of input files and remove duplicates. + std::sort(listFiles.begin(), listFiles.end(), + std::less<std::string>()); + std::vector<std::string>::iterator new_end = + std::unique(listFiles.begin(), listFiles.end()); + listFiles.erase(new_end, listFiles.end()); + + // Create a rule to re-run CMake. + std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash(); + stampName += "generate.stamp"; + const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLine commandLine; + commandLine.push_back(dsprule); + std::string argH = "-H"; + argH += lg->Convert(mf->GetHomeDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argH); + std::string argB = "-B"; + argB += lg->Convert(mf->GetHomeOutputDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argB); + commandLine.push_back("--check-stamp-list"); + commandLine.push_back(stampList.c_str()); + commandLine.push_back("--vs-solution-file"); + commandLine.push_back("\"$(SolutionPath)\""); + cmCustomCommandLines commandLines; + commandLines.push_back(commandLine); + + // Add the rule. Note that we cannot use the CMakeLists.txt + // file as the main dependency because it would get + // overwritten by the CreateVCProjBuildRule. + // (this could be avoided with per-target source files) + const char* no_main_dependency = 0; + const char* no_working_directory = 0; + mf->AddCustomCommandToOutput( + stamps, listFiles, + no_main_dependency, commandLines, "Checking Build System", + no_working_directory, true); + std::string ruleName = stamps[0]; + ruleName += ".rule"; + if(cmSourceFile* file = mf->GetSource(ruleName.c_str())) + { + tgt->AddSourceFile(file); + } + else + { + cmSystemTools::Error("Error adding rule for ", stamps[0].c_str()); + } + } + } + } + + // Now perform the main generation. + this->cmGlobalVisualStudio7Generator::Generate(); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8ExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_WindowsMobile_Generator::GetExtraFlagTableVS8() +{ + return cmVS8ExtraFlagTable; +} Index: Source/cmGlobalVisualStudio8_SDKGenerator.cxx =================================================================== --- Source/cmGlobalVisualStudio8_SDKGenerator.cxx +++ Source/cmGlobalVisualStudio8_SDKGenerator.cxx @@ -0,0 +1,428 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio8_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmSDKConfigParser::cmSDKConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmSDKConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmSDKConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); + this->platformVec.push_back(defs); + current_platform_valid = true; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmSDKConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmSDKConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_SDKGenerator::cmGlobalVisualStudio8_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; + +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::filterSDKs(std::vector<PlatformDefs>* platformvecptr) +{ + // here we inherit the platform vector from the parent + if(platformvecptr != 0) + { + platforms.clear(); + for(std::vector<PlatformDefs>::iterator it = platformvecptr->begin(); it != platformvecptr->end(); it++) + { + platforms.push_back(*it); + } + return; + } + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + std::vector<PlatformDefs> sdksfound = platforms; + platforms.clear(); + + + cmake * c = this->GetCMakeInstance(); + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; +} + +void cmGlobalVisualStudio8_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "8.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::Configure() +{ + filterSDKs(); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"StringPooling", "GF", "Enable Stringpooling", "true", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + // Compile for special architecture + {"CompileForArchitecture", "QRarch4", "ARM4 without Thumb instructions", "0", 0}, + {"CompileForArchitecture", "QRarch5", "ARM5 without Thumb instructions", "1", 0}, + {"CompileForArchitecture", "QRarch4t", "ARM4 with Thumb instructions", "2", 0}, + {"CompileForArchitecture", "QRarch5t", "ARM5 with Thumb instructions", "3", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraFlagTableVS8() +{ + return cmVS8SDKExtraFlagTable; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", "Posix application output", "8", 0}, // THIS IS ONLY AVAILABLE ON VC 8 + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "9", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS8SDKExtraLinkFlagTable; +} \ No newline at end of file Index: Source/cmMakefile.cxx =================================================================== --- Source/cmMakefile.cxx +++ Source/cmMakefile.cxx @@ -21,6 +21,10 @@ #include "cmSourceFileLocation.h" #include "cmSystemTools.h" #include "cmGlobalGenerator.h" +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) +# include "cmGlobalVisualStudio9_SDKGenerator.h" +# include "cmGlobalVisualStudio8_SDKGenerator.h" +#endif #include "cmLocalGenerator.h" #include "cmCommands.h" #include "cmCacheManager.h" @@ -2740,8 +2744,9 @@ std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND"); cmake cm; cm.SetIsInTryCompile(true); - cmGlobalGenerator *gg = cm.CreateGlobalGenerator - (this->LocalGenerator->GetGlobalGenerator()->GetName()); + cmGlobalGenerator *parentgg = this->LocalGenerator->GetGlobalGenerator(); + std::string parentggname(parentgg->GetName()); + cmGlobalGenerator *gg = cm.CreateGlobalGenerator(parentggname.c_str()); if (!gg) { cmSystemTools::Error( @@ -2750,6 +2755,22 @@ cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; } + // check to update platforms list if it is an SDK based builder +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) + if(parentggname.compare(cmGlobalVisualStudio8_SDKGenerator::GetActualName()) == 0) + { // gg should inherit platform vector from parent + cmGlobalVisualStudio8_SDKGenerator* srcgg = static_cast<cmGlobalVisualStudio8_SDKGenerator*>(parentgg); + cmGlobalVisualStudio8_SDKGenerator* targg = static_cast<cmGlobalVisualStudio8_SDKGenerator*>(gg); + targg->filterSDKs(srcgg->GetPlatforms()); + } + else if(parentggname.compare(cmGlobalVisualStudio9_SDKGenerator::GetActualName()) == 0) + { // gg should inherit platform vector from parent + cmGlobalVisualStudio9_SDKGenerator* srcgg = static_cast<cmGlobalVisualStudio9_SDKGenerator*>(parentgg); + cmGlobalVisualStudio9_SDKGenerator* targg = static_cast<cmGlobalVisualStudio9_SDKGenerator*>(gg); + targg->filterSDKs(srcgg->GetPlatforms()); + } +#endif + cm.SetGlobalGenerator(gg); // do a configure Index: Source/cmLocalVisualStudio7Generator.cxx =================================================================== --- Source/cmLocalVisualStudio7Generator.cxx +++ Source/cmLocalVisualStudio7Generator.cxx @@ -536,9 +536,10 @@ bool& flag_handled); }; -void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, +void cmLocalVisualStudio7Generator::WritePlatformConfiguration(std::ostream& fout, const char* configName, const char *libName, + const char *platformName, cmTarget &target) { const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); @@ -546,9 +547,23 @@ { mfcFlag = "0"; } + + const char* wholeprogoptFlag; + if(strcmp(configName,"Release")==0) + wholeprogoptFlag = this->Makefile->GetDefinition("CMAKE_WHOLEPROGOPT_FLAG_RELEASE"); + else + wholeprogoptFlag = this->Makefile->GetDefinition("CMAKE_WHOLEPROGOPT_FLAG_DEBUG"); + if(!wholeprogoptFlag) + { + wholeprogoptFlag = "0"; + } + fout << "\t\t<Configuration\n" - << "\t\t\tName=\"" << configName << "|" << this->PlatformName << "\"\n" - << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + << "\t\t\tName=\"" << configName << "|" << platformName << "\"\n"; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + fout << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + else + fout << "\t\t\tOutputDirectory=\"" << platformName << "\\" << configName << "\"\n"; // This is an internal type to Visual Studio, it seems that: // 4 == static library // 2 == dll @@ -661,12 +676,15 @@ // target and a subdirectory for the configuration name. std::string intermediateDir = this->GetTargetDirectory(target); intermediateDir += "/"; + if(strcmp(platformName,"Win32") != 0 && strcmp(platformName,"x64") != 0) + intermediateDir += std::string(platformName) + "/"; intermediateDir += configName; fout << "\t\t\tIntermediateDirectory=\"" << this->ConvertToXMLOutputPath(intermediateDir.c_str()) << "\"\n" << "\t\t\tConfigurationType=\"" << configType << "\"\n" << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" + << "\t\t\tWholeProgramOptimization=\"" << wholeprogoptFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; // If unicode is enabled change the character set to unicode, if not @@ -737,9 +755,18 @@ { // We need to specify a program database file name even for // non-debug configurations because VS still creates .idb files. +if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) +{ fout << "\t\t\t\tProgramDataBaseFileName=\"" - << target.GetDirectory(configName) << "/" - << target.GetPDBName(configName) << "\"\n"; + << target.GetDirectory(configName) << "/"; +} +else +{ + fout << "\t\t\t\tProgramDataBaseFileName=\"" + << target.GetDirectory() << "/" << + std::string(platformName) << "/" << std::string(configName) << "/"; +} + fout << target.GetPDBName(configName) << "\"\n"; } fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool tool = "VCCustomBuildTool"; @@ -815,10 +842,28 @@ } this->OutputTargetRules(fout, configName, target, libName); - this->OutputBuildTool(fout, configName, target, targetOptions.IsDebug()); + this->OutputBuildTool(fout, configName, platformName, target, targetOptions.IsDebug()); fout << "\t\t</Configuration>\n"; } +void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, + const char* configName, + const char *libName, + cmTarget &target) +{ + if((this->PlatformName).compare("Mobile Platform") == 0) + { + cmGlobalVisualStudio7Generator *gg = static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator); + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + WritePlatformConfiguration(fout,configName,libName,(j->PlatformName).c_str(),target); + } + else + { + WritePlatformConfiguration(fout,configName,libName,(this->PlatformName).c_str(),target); + } +} + //---------------------------------------------------------------------------- std::string cmLocalVisualStudio7Generator @@ -837,6 +882,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, const char* configName, + const char* platformName, cmTarget &target, bool isDebug) { @@ -879,15 +925,25 @@ extraLinkOptions += " "; extraLinkOptions += targetLinkFlags; } - Options linkOptions(this, this->Version, Options::Linker); + Options linkOptions(this, this->Version, Options::Linker, this->ExtraLinkFlagTable); // MODIFIED BY CLEMENS linkOptions.Parse(extraLinkOptions.c_str()); switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: { std::string targetNameFull = target.GetFullName(configName); - std::string libpath = target.GetDirectory(configName); + std::string libpath; + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { + libpath = target.GetDirectory(configName); libpath += "/"; + } + else + { + libpath = target.GetDirectory(); + libpath += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } libpath += targetNameFull; const char* tool = "VCLibrarianTool"; if(this->FortranProject) @@ -937,15 +993,29 @@ fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " - << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) - << " "; + << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; temp = target.GetDirectory(configName); temp += "/"; + } + else + { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + + fout << "\t\t\t\tAdditionalDependencies=\" "; + this->Internal->OutputLibraries(fout, cli.GetItems()); + fout << "\"\n"; + fout << "\t\t\t\tDelayLoadDLLs=\"$(NOINHERIT)" << "\"\n"; + fout << "\t\t\t\tRandomizedBaseAddress=\"1" << "\"\n"; + fout << "\t\t\t\tDataExecutionPrevention=\"0" << "\"\n"; + } temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -955,8 +1025,17 @@ this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; this->OutputModuleDefinitionFile(fout, target); + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName); temp += "/"; + } + else + { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNamePDB; fout << "\t\t\t\tProgramDataBaseFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -972,8 +1051,17 @@ { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n"; } + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName, true); temp += "/"; + } + else + { + temp = target.GetDirectory("",true); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; @@ -1009,6 +1097,8 @@ } fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. @@ -1017,8 +1107,32 @@ << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; + } else + { + linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); + // Use the NOINHERIT macro to avoid getting VS project default + // libraries which may be set by the user to something bad. + fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " + << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) + << " "; + this->Internal->OutputLibraries(fout, cli.GetItems()); + fout << "\"\n"; + + fout << "\t\t\t\tDelayLoadDLLs=\"$(NOINHERIT)" << "\"\n"; + //fout << "\t\t\t\tSubSystem=\"0" << "\"\n"; + fout << "\t\t\t\tRandomizedBaseAddress=\"1" << "\"\n"; + fout << "\t\t\t\tDataExecutionPrevention=\"0" << "\"\n"; + } + if( strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0 || + strcmp(target.GetName(),"cmTryCompileExec") == 0 ) + // this is stupid hack to keep the try_compile stuff working for other platforms + { temp = target.GetDirectory(configName); temp += "/"; + } else { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -1027,13 +1141,23 @@ fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; - fout << "\t\t\t\tProgramDataBaseFile=\"" - << target.GetDirectory(configName) << "/" << targetNamePDB + fout << "\t\t\t\tProgramDataBaseFile=\""; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { + fout << target.GetDirectory(configName) << "/" << targetNamePDB << "\"\n"; + } + else + { + fout << target.GetDirectory() << "/" << + std::string(platformName) << "/" << std::string(configName) << "/" << targetNamePDB + << "\"\n"; + } if(isDebug) { fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"; } + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) { if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) { fout << "\t\t\t\tSubSystem=\"2\"\n"; @@ -1042,6 +1166,7 @@ { fout << "\t\t\t\tSubSystem=\"1\"\n"; } + } std::string stackVar = "CMAKE_"; stackVar += linkLanguage; stackVar += "_STACK_SIZE"; @@ -1050,8 +1175,18 @@ { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\""; } + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName, true); temp += "/"; + } + else + { + temp = target.GetDirectory("",true); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } + temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; @@ -1379,6 +1514,9 @@ dir_max += config_max; dir_max += "/"; + cmGlobalVisualStudio7Generator * gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + // Loop through each source in the source group. std::string objectName; for(std::vector<const cmSourceFile *>::const_iterator sf = @@ -1432,6 +1570,50 @@ fci = fcinfo.FileConfigMap.begin(); fci != fcinfo.FileConfigMap.end(); ++fci) { + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + { + cmLVS7GFileConfig const& fc = fci->second; + fout << "\t\t\t\t<FileConfiguration\n" + << "\t\t\t\t\tName=\"" << fci->first + << "|" << j->PlatformName << "\""; + if(fc.ExcludedFromBuild) + { + fout << " ExcludedFromBuild=\"true\""; + } + fout << ">\n"; + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n"; + if(!fc.CompileFlags.empty() || + !fc.CompileDefs.empty() || + !fc.CompileDefsConfig.empty()) + { + Options fileOptions(this, this->Version, Options::Compiler, + this->ExtraFlagTable); + fileOptions.Parse(fc.CompileFlags.c_str()); + fileOptions.AddDefines(fc.CompileDefs.c_str()); + fileOptions.AddDefines(fc.CompileDefsConfig.c_str()); + fileOptions.OutputAdditionalOptions(fout, "\t\t\t\t\t", "\n"); + fileOptions.OutputFlagMap(fout, "\t\t\t\t\t"); + fileOptions.OutputPreprocessorDefinitions(fout, + "\t\t\t\t\t", "\n"); + } + if(!fc.AdditionalDeps.empty()) + { + fout << "\t\t\t\t\tAdditionalDependencies=\"" + << fc.AdditionalDeps.c_str() << "\"\n"; + } + if(!fc.ObjectName.empty()) + { + fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" + << fc.ObjectName.c_str() << "\"\n"; + } + fout << "\t\t\t\t\t/>\n" + << "\t\t\t\t</FileConfiguration>\n"; + } + else + { cmLVS7GFileConfig const& fc = fci->second; fout << "\t\t\t\t<FileConfiguration\n" << "\t\t\t\t\tName=\"" << fci->first @@ -1471,6 +1653,7 @@ << "\t\t\t\t</FileConfiguration>\n"; } } + } fout << "\t\t\t</File>\n"; } } @@ -1499,9 +1682,9 @@ // Write the rule for each configuration. std::vector<std::string>::iterator i; - std::vector<std::string> *configs = - static_cast<cmGlobalVisualStudio7Generator *> - (this->GlobalGenerator)->GetConfigurations(); + cmGlobalVisualStudio7Generator * gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + std::vector<std::string> *configs = gg->GetConfigurations(); const char* compileTool = "VCCLCompilerTool"; if(this->FortranProject) { @@ -1514,6 +1697,83 @@ } for(i = configs->begin(); i != configs->end(); ++i) { + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + { + cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; + fout << "\t\t\t\t<FileConfiguration\n"; + fout << "\t\t\t\t\tName=\"" << *i << "|" << j->PlatformName << "\">\n"; + if(!fc.CompileFlags.empty()) + { + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << compileTool << "\"\n" + << "\t\t\t\t\tAdditionalOptions=\"" + << this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n"; + } + + std::string script = + this->ConstructScript(command.GetCommandLines(), + command.GetWorkingDirectory(), + i->c_str(), + command.GetEscapeOldStyle(), + command.GetEscapeAllowMakeVars()); + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << customTool << "\"\n" + << "\t\t\t\t\tDescription=\"" + << this->EscapeForXML(comment.c_str()) << "\"\n" + << "\t\t\t\t\tCommandLine=\"" + << this->EscapeForXML(script.c_str()) << "\"\n" + << "\t\t\t\t\tAdditionalDependencies=\""; + if(command.GetDepends().empty()) + { + // There are no real dependencies. Produce an artificial one to + // make sure the rule runs reliably. + if(!cmSystemTools::FileExists(source)) + { + std::ofstream depout(source); + depout << "Artificial dependency for a custom command.\n"; + } + fout << this->ConvertToXMLOutputPath(source); + } + else + { + // Write out the dependencies for the rule. + for(std::vector<std::string>::const_iterator d = + command.GetDepends().begin(); + d != command.GetDepends().end(); + ++d) + { + // Get the real name of the dependency in case it is a CMake target. + std::string dep = this->GetRealDependency(d->c_str(), i->c_str()); + fout << this->ConvertToXMLOutputPath(dep.c_str()) + << ";"; + } + } + fout << "\"\n"; + fout << "\t\t\t\t\tOutputs=\""; + if(command.GetOutputs().empty()) + { + fout << source << "_force"; + } + else + { + // Write a rule for the output generated by this command. + const char* sep = ""; + for(std::vector<std::string>::const_iterator o = + command.GetOutputs().begin(); + o != command.GetOutputs().end(); + ++o) + { + fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str()); + sep = ";"; + } + } + fout << "\"/>\n"; + fout << "\t\t\t\t</FileConfiguration>\n"; + } + else + { cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; fout << "\t\t\t\t<FileConfiguration\n"; fout << "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n"; @@ -1586,6 +1846,7 @@ fout << "\t\t\t\t</FileConfiguration>\n"; } } +} void cmLocalVisualStudio7Generator::WriteVCProjBeginGroup(std::ostream& fout, @@ -1789,13 +2050,19 @@ } if(projectType) { - fout << "\tProjectType=\"" << projectType << "\"\n"; + fout << "\tProjectType=\"" << projectType << "\">\n"; } fout<< "\tKeyword=\"" << keyword << "\">\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n" - << "\t<Platforms>\n" - << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" - << "\t</Platforms>\n"; + << "\t<Platforms>\n"; + + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + fout << "\t\t<Platform\n\t\t\tName=\"" << j->PlatformName << "\"/>\n"; + else + fout << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"; + fout << "\t</Platforms>\n"; } @@ -1850,9 +2117,15 @@ << "\tSccProvider=\"" << vsProvider << "\"\n"; } fout << "\tKeyword=\"" << keyword << "\">\n" - << "\t<Platforms>\n" - << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" - << "\t</Platforms>\n"; + << "\t<Platforms>\n"; + + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + fout << "\t\t<Platform\n\t\t\tName=\"" << j->PlatformName << "\"/>\n"; + else + fout << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"; + fout << "\t</Platforms>\n"; } Index: Source/cmGlobalVisualStudio7Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio7Generator.cxx +++ Source/cmGlobalVisualStudio7Generator.cxx @@ -139,6 +139,7 @@ { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } @@ -663,8 +664,13 @@ std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations() { return &this->Configurations; -}; +} +std::vector<PlatformDefs> *cmGlobalVisualStudio7Generator::GetPlatforms() +{ + return &this->platforms; +} + //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator ::GetDocumentation(cmDocumentationEntry& entry) const Index: Source/cmGlobalVisualStudio9_SDKGenerator.cxx =================================================================== --- Source/cmGlobalVisualStudio9_SDKGenerator.cxx +++ Source/cmGlobalVisualStudio9_SDKGenerator.cxx @@ -0,0 +1,190 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio9_SDKGenerator::cmGlobalVisualStudio9_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS9SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "8", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio9_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS9SDKExtraLinkFlagTable; +} \ No newline at end of file Index: Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h =================================================================== --- Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h +++ Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h @@ -0,0 +1,101 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_WindowsMobile_Generator_h +#define cmGlobalVisualStudio8_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio71Generator.h" + +#include "cmXMLParser.h" + +class cmWindowsMobileConfigParser : public cmXMLParser +{ +public: + cmWindowsMobileConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_WindowsMobile_Generator : public cmGlobalVisualStudio71Generator +{ +public: + cmGlobalVisualStudio8_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 - Windows Mobile";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + virtual void Generate(); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSLNHeader(std::ostream& fout); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + std::string PlatformName; // Win32 or x64 +}; +#endif Index: Source/cmGlobalVisualStudio71Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio71Generator.cxx +++ Source/cmGlobalVisualStudio71Generator.cxx @@ -34,6 +34,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion71(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio9_SDKGenerator.h =================================================================== --- Source/cmGlobalVisualStudio9_SDKGenerator.h +++ Source/cmGlobalVisualStudio9_SDKGenerator.h @@ -0,0 +1,75 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_SDKGenerator_h +#define cmGlobalVisualStudio9_SDKGenerator_h + +#include "cmGlobalVisualStudio8_SDKGenerator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_SDKGenerator : + public cmGlobalVisualStudio8_SDKGenerator +{ +public: + cmGlobalVisualStudio9_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 (with SDK support)";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + + virtual void GetSDKsInstalled(); +}; +#endif Index: Source/CMakeLists.txt =================================================================== --- Source/CMakeLists.txt +++ Source/CMakeLists.txt @@ -264,8 +264,12 @@ cmGlobalVisualStudio7Generator.h cmGlobalVisualStudio8Generator.cxx cmGlobalVisualStudio8Generator.h + cmGlobalVisualStudio8_SDKGenerator.cxx + cmGlobalVisualStudio8_SDKGenerator.h cmGlobalVisualStudio9Generator.cxx cmGlobalVisualStudio9Generator.h + cmGlobalVisualStudio9_SDKGenerator.cxx + cmGlobalVisualStudio9_SDKGenerator.h cmGlobalVisualStudio8Win64Generator.cxx cmGlobalVisualStudio8Win64Generator.h cmGlobalVisualStudio9Win64Generator.cxx Index: Source/cmGlobalVisualStudio8Generator.h =================================================================== --- Source/cmGlobalVisualStudio8Generator.h +++ Source/cmGlobalVisualStudio8Generator.h @@ -67,7 +67,7 @@ virtual bool VSLinksDependencies() const { return false; } - static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); Index: Source/cmGlobalVisualStudio8_SDKGenerator.h =================================================================== --- Source/cmGlobalVisualStudio8_SDKGenerator.h +++ Source/cmGlobalVisualStudio8_SDKGenerator.h @@ -0,0 +1,91 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_SDKGenerator_h +#define cmGlobalVisualStudio8_SDKGenerator_h + +#include "cmGlobalVisualStudio8Generator.h" + +#include "cmXMLParser.h" + +class cmSDKConfigParser : public cmXMLParser +{ +public: + cmSDKConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_SDKGenerator : public cmGlobalVisualStudio8Generator +{ +public: + cmGlobalVisualStudio8_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 (with SDK support)";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + + void filterSDKs(std::vector<PlatformDefs>* platforms = 0); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + + virtual void GetSDKsInstalled(); + + std::string PlatformName; // Win32 or x64 +}; +#endif Index: Source/cmGlobalVisualStudio8Win64Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8Win64Generator.cxx +++ Source/cmGlobalVisualStudio8Win64Generator.cxx @@ -34,6 +34,7 @@ lg->SetVersion8(); lg->SetPlatformName(this->PlatformName.c_str()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmLocalVisualStudio7Generator.h =================================================================== --- Source/cmLocalVisualStudio7Generator.h +++ Source/cmLocalVisualStudio7Generator.h @@ -68,6 +68,8 @@ void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } + void SetExtraLinkFlagTable(cmVS7FlagTable const* table) + { this->ExtraLinkFlagTable = table; } private: typedef cmLocalVisualStudio7GeneratorOptions Options; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; @@ -85,6 +87,11 @@ void WriteVCProjFile(std::ostream& fout, const char *libName, cmTarget &tgt); cmSourceFile* CreateVCProjBuildRule(); + void WritePlatformConfiguration(std::ostream& fout, + const char* configName, + const char *libName, + const char *platformName, + cmTarget &target); void WriteConfigurations(std::ostream& fout, const char *libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, @@ -96,7 +103,7 @@ void OutputTargetRules(std::ostream& fout, const char* configName, cmTarget &target, const char *libName); void OutputBuildTool(std::ostream& fout, const char* configName, - cmTarget& t, bool debug); + const char* platformName, cmTarget& t, bool debug); void OutputLibraryDirectories(std::ostream& fout, std::vector<std::string> const& dirs); void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target); @@ -124,6 +131,7 @@ friend class cmLocalVisualStudio7GeneratorInternals; cmVS7FlagTable const* ExtraFlagTable; + cmVS7FlagTable const* ExtraLinkFlagTable; std::string ModuleDefinitionFile; int Version; bool FortranProject; Index: Tests/SimplePPC2003/GetCompilerVersion.cmake =================================================================== --- Tests/SimplePPC2003/GetCompilerVersion.cmake +++ Tests/SimplePPC2003/GetCompilerVersion.cmake @@ -0,0 +1,95 @@ + +FIND_PROGRAM(CMAKE_VCVARS + NAMES vcvarsall.bat + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/VC" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC" + ) + +# Testing the machine type of the generated binaries: +FIND_PROGRAM(CMAKE_TEST_COMPILER + NAMES cl.exe + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/VC/bin" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + ) + +SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") +STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + +EXEC_PROGRAM("\"${CMAKE_VCVARS}\" && \"${CMAKE_TEST_COMPILER}\" /nologo -EP \"${testNmakeCLVersionFile}\"" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + +IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") +ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") +ENDIF(NOT CMAKE_COMPILER_RETURN) \ No newline at end of file Index: Tests/SimplePPC2003/stdafx.h =================================================================== --- Tests/SimplePPC2003/stdafx.h +++ Tests/SimplePPC2003/stdafx.h @@ -0,0 +1,62 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#pragma comment(linker, "/nodefaultlib:libc.lib") +#pragma comment(linker, "/nodefaultlib:libcd.lib") + +// NOTE - this value is not strongly correlated to the Windows CE OS version being targeted +#define WINVER _WIN32_WCE + +#include <ceconfig.h> +#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) +#define SHELL_AYGSHELL +#endif + +#ifdef _CE_DCOM +#define _ATL_APARTMENT_THREADED +#endif + +#include <windows.h> +#include <commctrl.h> + +#include <aygshell.h> +#pragma comment(lib, "aygshell.lib") + + +// Windows Header Files: +#include <windows.h> + +// C RunTime Header Files +#include <stdlib.h> +#include <malloc.h> +#include <memory.h> +#include <tchar.h> + +#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) +#ifndef _DEVICE_RESOLUTION_AWARE +#define _DEVICE_RESOLUTION_AWARE +#endif +#endif + +#ifdef _DEVICE_RESOLUTION_AWARE +#include "DeviceResolutionAware.h" +#endif + +#if _WIN32_WCE < 0x500 && ( defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) ) + #pragma comment(lib, "ccrtrtti.lib") + #ifdef _X86_ + #if defined(_DEBUG) + #pragma comment(lib, "libcmtx86d.lib") + #else + #pragma comment(lib, "libcmtx86.lib") + #endif + #endif +#endif + +#include <altcecrt.h> + +// TODO: reference additional headers your program requires here Index: Tests/SimplePPC2003/resourceppc.h =================================================================== --- Tests/SimplePPC2003/resourceppc.h +++ Tests/SimplePPC2003/resourceppc.h @@ -0,0 +1,34 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by SimplePPC2003ppc.rc +// + +#define IDS_APP_TITLE 1 +#define IDC_SIMPLEPPC2003 2 +#define IDI_SIMPLEPPC2003 101 +#define IDR_MENU 102 +#define IDS_OK 103 +#define IDS_HELP 104 +#define IDD_ABOUTBOX 105 +#define IDD_ABOUTBOX_WIDE 106 +#define IDC_STATIC_1 201 +#define IDC_STATIC_2 202 +#define IDC_STATIC_3 203 +#define IDM_OK 40000 +#define IDM_HELP 40001 +#define IDM_HELP_ABOUT 40002 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif Index: Tests/SimplePPC2003/SimplePPC2003.cpp =================================================================== --- Tests/SimplePPC2003/SimplePPC2003.cpp +++ Tests/SimplePPC2003/SimplePPC2003.cpp @@ -0,0 +1,259 @@ +// SimplePPC2003.cpp : Defines the entry point for the application. +// + +#include "stdafx.h" +#include "SimplePPC2003.h" + + +#define MAX_LOADSTRING 100 + +// Global Variables: +HINSTANCE g_hInst; // current instance +HWND g_hWndMenuBar; // menu bar handle + +// Forward declarations of functions included in this code module: +ATOM MyRegisterClass(HINSTANCE, LPTSTR); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); + +int WINAPI WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Perform application initialization: + if (!InitInstance(hInstance, nCmdShow)) + { + return FALSE; + } + + HACCEL hAccelTable; + hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SIMPLEPPC2003)); + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return (int) msg.wParam; +} + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +// COMMENTS: +// +ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SIMPLEPPC2003)); + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = 0; + wc.lpszClassName = szWindowClass; + + return RegisterClass(&wc); +} + +// +// FUNCTION: InitInstance(HINSTANCE, int) +// +// PURPOSE: Saves instance handle and creates main window +// +// COMMENTS: +// +// In this function, we save the instance handle in a global variable and +// create and display the main program window. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[MAX_LOADSTRING]; // title bar text + TCHAR szWindowClass[MAX_LOADSTRING]; // main window class name + + g_hInst = hInstance; // Store instance handle in our global variable + + // SHInitExtraControls should be called once during your application's initialization to initialize any + // of the device specific controls such as CAPEDIT and SIPPREF. + SHInitExtraControls(); + + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadString(hInstance, IDC_SIMPLEPPC2003, szWindowClass, MAX_LOADSTRING); + + //If it is already running, then focus on the window, and exit + hWnd = FindWindow(szWindowClass, szTitle); + if (hWnd) + { + // set focus to foremost child window + // The "| 0x00000001" is used to bring any owned windows to the foreground and + // activate them. + SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001)); + return 0; + } + + if (!MyRegisterClass(hInstance, szWindowClass)) + { + return FALSE; + } + + hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + // When the main window is created using CW_USEDEFAULT the height of the menubar (if one + // is created is not taken into account). So we resize the window after creating it + // if a menubar is present + if (g_hWndMenuBar) + { + RECT rc; + RECT rcMenuBar; + + GetWindowRect(hWnd, &rc); + GetWindowRect(g_hWndMenuBar, &rcMenuBar); + rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top); + + MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE); + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + + return TRUE; +} + +// +// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// PURPOSE: Processes messages for the main window. +// +// WM_COMMAND - process the application menu +// WM_PAINT - Paint the main window +// WM_DESTROY - post a quit message and return +// +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + + static SHACTIVATEINFO s_sai; + + switch (message) + { + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) + { + case IDM_HELP_ABOUT: + DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); + break; + case IDM_OK: + SendMessage (hWnd, WM_CLOSE, 0, 0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + case WM_CREATE: + SHMENUBARINFO mbi; + + memset(&mbi, 0, sizeof(SHMENUBARINFO)); + mbi.cbSize = sizeof(SHMENUBARINFO); + mbi.hwndParent = hWnd; + mbi.nToolBarId = IDR_MENU; + mbi.hInstRes = g_hInst; + + if (!SHCreateMenuBar(&mbi)) + { + g_hWndMenuBar = NULL; + } + else + { + g_hWndMenuBar = mbi.hwndMB; + } + + // Initialize the shell activate info structure + memset(&s_sai, 0, sizeof (s_sai)); + s_sai.cbSize = sizeof (s_sai); + break; + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + + // TODO: Add any drawing code here... + + EndPaint(hWnd, &ps); + break; + case WM_DESTROY: + CommandBar_Destroy(g_hWndMenuBar); + PostQuitMessage(0); + break; + + case WM_ACTIVATE: + // Notify shell of our activate message + SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); + break; + case WM_SETTINGCHANGE: + SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + +// Message handler for about box. +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + { + // Create a Done button and size it. + SHINITDLGINFO shidi; + shidi.dwMask = SHIDIM_FLAGS; + shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU; + shidi.hDlg = hDlg; + SHInitDialog(&shidi); + } + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) + { + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + } + break; + + case WM_CLOSE: + EndDialog(hDlg, message); + return TRUE; + + } + return (INT_PTR)FALSE; +} Index: Tests/SimplePPC2003/CMakeCache.txt.in =================================================================== --- Tests/SimplePPC2003/CMakeCache.txt.in +++ Tests/SimplePPC2003/CMakeCache.txt.in @@ -0,0 +1,5 @@ +//SDK to use +CMAKE_GENERATOR:INTERNAL=Visual Studio 9 2008 (with SDK support) +CMAKE_SYSTEM_NAME:STRING=WINCE +CMAKE_SYSTEM_VERSION:STRING=4.20 +PLATFORM_SDKS:STRING=Pocket PC 2003 (ARMV4) \ No newline at end of file Index: Tests/SimplePPC2003/SimplePPC2003.h =================================================================== --- Tests/SimplePPC2003/SimplePPC2003.h +++ Tests/SimplePPC2003/SimplePPC2003.h @@ -0,0 +1,2 @@ +#pragma once +#include "resourceppc.h" Index: Tests/SimplePPC2003/SimplePPC2003ppc.rc =================================================================== --- Tests/SimplePPC2003/SimplePPC2003ppc.rc +++ Tests/SimplePPC2003/SimplePPC2003ppc.rc @@ -0,0 +1,170 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resourceppc.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#include "resdefce.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +//IDI_SIMPLEPPC2003 ICON "SimplePPC2003.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "Help" + BEGIN + MENUITEM "About", IDM_HELP_ABOUT + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_SIMPLEPPC2003 ACCELERATORS +BEGIN + "A", IDM_HELP_ABOUT, VIRTKEY, CONTROL, NOINVERT + "Q", IDM_OK, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG 0, 0, 156, 129 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_CAPTIONOKBTN +CAPTION "About SimplePPC2003" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SIMPLEPPC2003,IDC_STATIC_1,12,12,21,20,SS_REALSIZEIMAGE + LTEXT "SimplePPC2003 Version 1.0",IDC_STATIC_2,12,36,70,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC_3,12,48,66,8 +END + +IDD_ABOUTBOX_WIDE DIALOG 0, 0, 210, 129 +STYLE WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_CAPTIONOKBTN +CAPTION "About SimplePPC2003" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SIMPLEPPC2003,IDC_STATIC_1,12,12,21,20,SS_REALSIZEIMAGE + LTEXT "SimplePPC2003 Version 1.0",IDC_STATIC_2,48,12,66,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC_3,48,24,66,8 +END + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 149 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END + + IDD_ABOUTBOX_WIDE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END +END +#endif // APSTUDIO_INVOKED + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// +1 TEXTINCLUDE +BEGIN + "resourceppc.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#include ""resdefce.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""SimplePPC2003ppc.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// +STRINGTABLE +BEGIN + IDC_SIMPLEPPC2003 "SIMPLEPPC2003" + IDS_APP_TITLE "SimplePPC2003" + IDS_OK "OK" + IDS_HELP "HELP" +END + +#endif +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "SimplePPC2003ppc.rc2" // non-Microsoft Visual C++ edited resources +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED Index: Tests/SimplePPC2003/SimplePPC2003ppc.rc2 =================================================================== --- Tests/SimplePPC2003/SimplePPC2003ppc.rc2 +++ Tests/SimplePPC2003/SimplePPC2003ppc.rc2 @@ -0,0 +1,35 @@ +// +// SimplePPC2003PPC.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// +HI_RES_AWARE CEUX {1} // turn off the emulation layer + // Remove this resource to enable pixel- + // doubling on platforms that support it +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// +// SHMENUBAR +// + +IDR_MENU SHMENUBAR DISCARDABLE +BEGIN + IDR_MENU, + 2, + + I_IMAGENONE, IDM_OK, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, + IDS_OK, 0, NOMENU, + + I_IMAGENONE, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, + IDS_HELP, 0, 0, +END + Index: Tests/SimplePPC2003/stdafx.cpp =================================================================== --- Tests/SimplePPC2003/stdafx.cpp +++ Tests/SimplePPC2003/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimplePPC2003.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file Index: Tests/SimplePPC2003/CMakeLists.txt =================================================================== --- Tests/SimplePPC2003/CMakeLists.txt +++ Tests/SimplePPC2003/CMakeLists.txt @@ -0,0 +1,14 @@ +# a simple test case for compiling a PPC 2003 project +PROJECT(SimplePPC2003) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(RESOURCEFILES resourceppc.h SimplePPC2003ppc.rc SimplePPC2003ppc.rc2) +SET(SOURCEFILES SimplePPC2003.cpp stdafx.cpp) +SET(HEADERFILES stdafx.h SimplePPC2003.h) + +ADD_DEFINITIONS(-DWINCE -D$(ARCHFAM) -D$(_ARCHFAM_) -D_UNICODE -DUNICODE -D_USRDLL ) + +ADD_EXECUTABLE(SimplePPC2003 ${RESOURCEFILES} ${SOURCEFILES} ${HEADERFILES}) + +SET_TARGET_PROPERTIES(SimplePPC2003 PROPERTIES LINK_FLAGS /machine:ARM) \ No newline at end of file Index: Tests/CMakeLists.txt =================================================================== --- Tests/CMakeLists.txt +++ Tests/CMakeLists.txt @@ -65,6 +65,19 @@ SET(CMAKE_LONG_TEST_TIMEOUT 1500) ENDIF(CMAKE_LONG_TEST_TIMEOUT LESS 1500) + CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/SimplePPC2003/CMakeCache.txt.in" + "${CMake_BINARY_DIR}/Tests/SimplePPC2003/CMakeCache.txt" COPYONLY + ) + ADD_TEST(SimplePPC2003 ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/SimplePPC2003" + "${CMake_BINARY_DIR}/Tests/SimplePPC2003" + --build-two-config + --build-generator "Visual Studio 9 2008 (with SDK support)" + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-project SimplePPC2003) + # add a bunch of standard build-and-test style tests ADD_TEST_MACRO(CommandLineTest CommandLineTest) ADD_TEST_MACRO(FindPackageTest FindPackageTest) @@ -429,6 +442,7 @@ --test-command Tutorial 25.0) ENDFOREACH(STP) + ADD_TEST(testing ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Testing" Index: Modules/CMakeCCompilerABI.c =================================================================== --- Modules/CMakeCCompilerABI.c +++ Modules/CMakeCCompilerABI.c @@ -26,3 +26,16 @@ (void)argv; return require; } + +#ifndef __CLASSIC_C__ +int mainCRTStartup(int argc, char* argv[]) +{ + int require = 0; + require += info_sizeof_dptr[argc]; +#if defined(ABI_ID) + require += info_abi[argc]; +#endif + (void)argv; + return require; +} +#endif Index: Modules/CMakeTestCXXCompiler.cmake =================================================================== --- Modules/CMakeTestCXXCompiler.cmake +++ Modules/CMakeTestCXXCompiler.cmake @@ -10,7 +10,12 @@ "#ifndef __cplusplus\n" "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n" "#endif\n" - "int main(){return 0;}\n") + "int main(){return 0;}\n\n" + "#if defined(_MSC_VER)\n" + "int mainCRTStartup(int argc, char* argv[])\n" + "{ return argc-1;}\n" + "#endif //MSC_VER \n" + ) TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx OUTPUT_VARIABLE OUTPUT) Index: Modules/CMakeCXXCompilerABI.cpp =================================================================== --- Modules/CMakeCXXCompilerABI.cpp +++ Modules/CMakeCXXCompilerABI.cpp @@ -18,3 +18,14 @@ (void)argv; return require; } + +int mainCRTStartup(int argc, char* argv[]) +{ + int require = 0; + require += info_sizeof_dptr[argc]; +#if defined(ABI_ID) + require += info_abi[argc]; +#endif + (void)argv; + return require; +} Index: Modules/Platform/Generic-Windows-cl.cmake =================================================================== --- Modules/Platform/Generic-Windows-cl.cmake +++ Modules/Platform/Generic-Windows-cl.cmake @@ -0,0 +1,355 @@ +# try to load any previously computed information for C on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) +# try to load any previously computed information for CXX on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) + +SET(WIN32 1) + +INCLUDE(Platform/cl) + + +IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") + SET (CMAKE_NO_BUILD_TYPE 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") +IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") + SET (CMAKE_NO_BUILD_TYPE 1) + SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING + "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") + MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES) +ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") +# does the compiler support pdbtype and is it the newer compiler +IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") +IF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + + +# make sure to enable languages after setting configuration types +ENABLE_LANGUAGE(RC) +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") + +# for nmake we need to compute some information about the compiler +# that is being used. +# the compiler may be free command line, 6, 7, or 71, and +# each have properties that must be determined. +# to avoid running these tests with each cmake run, the +# test results are saved in CMakeCPlatform.cmake, a file +# that is automatically copied into try_compile directories +# by the global generator. +SET(MSVC_IDE 1) +IF(CMAKE_GENERATOR MATCHES "Makefiles") + SET(MSVC_IDE 0) + IF(NOT CMAKE_VC_COMPILER_TESTS_RUN) + SET(CMAKE_VC_COMPILER_TESTS 1) + SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") + STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + MESSAGE(STATUS "Check for CL compiler version") + SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) + IF (NOT CMAKE_C_COMPILER) + SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) + ENDIF(NOT CMAKE_C_COMPILER) + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} + ARGS /nologo -EP \"${testNmakeCLVersionFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") + ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + ENDIF(NOT CMAKE_COMPILER_RETURN) + # try to figure out if we are running the free command line + # tools from Microsoft. These tools do not provide debug libraries, + # so the link flags used have to be different. + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2") + SET(testForFreeVCFile + "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx") + STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}") + MESSAGE(STATUS "Check if this is a free VC compiler") + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2 + ARGS /nologo /MD /EHsc + \"${testForFreeVCFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if this is a free VC compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - yes") + SET(CMAKE_USING_VC_FREE_TOOLS 1) + ELSE(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if this is a free VC compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - no") + SET(CMAKE_USING_VC_FREE_TOOLS 0) + ENDIF(CMAKE_COMPILER_RETURN) + + # Testing the machine type of the generated binaries: + FIND_PROGRAM(CMAKE_DUMPBIN + NAMES dumpbin + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/VC/bin" + "/Program Files/Microsoft Visual Studio 8/VC/bin/" + "/Program Files/Microsoft Visual Studio 9/VC/bin/" + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio.NET/VC/bin" + "/Program Files/Microsoft Visual Studio .NET/VC/bin/" + ) + + MESSAGE(STATUS "Check CL platform:") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking CL platform using dumpbin ${CMAKE_DUMPBIN}" ) + IF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Dumpbin found as ${CMAKE_DUMPBIN}\n" ) + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") + SET(testForCLMachineType + "${CMAKE_ROOT}/Modules/CMakeTestCLMachineType.c") + SET(testForCLMachineTypeOutput CMakeTestCLMachineType.obj) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "\n\nRunning cl: ${CMAKE_C_COMPILER} -c \"${testForCLMachineType}\" " ) + EXECUTE_PROCESS(COMMAND "${CMAKE_C_COMPILER}" -c "${testForCLMachineType}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + ERROR_VARIABLE testForCLMachineType_DUMP + OUTPUT_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n\nRunning dumpbin: ${CMAKE_DUMPBIN} /HEADERS ${testForCLMachineType}" ) + EXECUTE_PROCESS(COMMAND "${CMAKE_DUMPBIN}" /HEADERS ${testForCLMachineTypeOutput} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + OUTPUT_VARIABLE testForCLMachineType_DUMPBIN_OUTPUT + ERROR_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n${testForCLMachineType_DUMPBIN_OUTPUT}" ) + STRING(REGEX MATCH "machine \\(([^\\)]*)\\)" DUMPBIN_REGEX_RESULT ${testForCLMachineType_DUMPBIN_OUTPUT}) + SET(CMAKE_CL_MACHINE_TYPE ${CMAKE_MATCH_1}) + + ELSE(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + MESSAGE(Status "Check CL platform: dumpbin.exe was not found - assuimg i386") + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + + ## TODO add further dumpbin machine to visual studio machine type conversion here: + IF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + IF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + IF(NOT CMAKE_FORCE_NON_THUMB) + SET(CMAKE_CL_MACHINE_TYPE THUMB) + ENDIF(NOT CMAKE_FORCE_NON_THUMB) + ENDIF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + + MESSAGE(STATUS "Check CL platform: ${CMAKE_CL_MACHINE_TYPE}" ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "CL platform seems to be:${CMAKE_CL_MACHINE_TYPE}" ) + ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN) +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + +IF(CMAKE_FORCE_WIN64) + SET(CMAKE_CL_MACHINE_TYPE x64) +ENDIF(CMAKE_FORCE_WIN64) + + +# default to Debug builds +IF(MSVC_VERSION GREATER 1310) + # for 2005 make sure the manifest is put in the dll with mt + SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") + # create a C shared library + SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + # create a C shared module just copy the shared library rule + SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") + SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") + SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") + + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") + ENDIF(WINCE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /MANIFEST") +ELSE(MSVC_VERSION GREATER 1310) + IF(CMAKE_USING_VC_FREE_TOOLS) + MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available") + SET(CMAKE_BUILD_TYPE_INIT Release) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + ELSE(CMAKE_USING_VC_FREE_TOOLS) + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + ENDIF(CMAKE_USING_VC_FREE_TOOLS) + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + ENDIF(WINCE) +ENDIF(MSVC_VERSION GREATER 1310) + +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") + +IF(NOT CMAKE_WINDOWS_STACKSIZE) + SET(CMAKE_WINDOWS_STACKSIZE 10000000) ## 10MB is a reasonable default? +ENDIF(NOT CMAKE_WINDOWS_STACKSIZE) + +SET (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:${CMAKE_WINDOWS_STACKSIZE}" ) + +# machine type +IF(CMAKE_GENERATOR MATCHES "Makefiles") +## Setting machine makes only sense when linking cross compiled binaries with makefiles? + IF(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${CMAKE_CL_MACHINE_TYPE}") + ELSE(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:i386") + ENDIF(CMAKE_CL_MACHINE_TYPE) + + # append /ARMPADCODE + IF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /ARMPADCODE ") + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + +ELSE(CMAKE_GENERATOR MATCHES "Makefiles") + + IF(CMAKE_FORCE_WIN64) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:x64") + ENDIF(CMAKE_FORCE_WIN64) + +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + + +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp +# on versions that support it +IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") +ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /INCREMENTAL:YES") +ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) +# for release and minsize release default to no incremental linking +SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") + +# copy the EXE_LINKER flags to SHARED and MODULE linker flags +# shared linker flags +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) +# module linker flags +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) + + +# save computed information for this platform +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + Index: Modules/Platform/WinCE-cl.cmake =================================================================== --- Modules/Platform/WinCE-cl.cmake +++ Modules/Platform/WinCE-cl.cmake @@ -0,0 +1,17 @@ +MESSAGE(STATUS "+++++ Entering WinCE-CL.cmake") + +SET(WIN32 1) +SET(WINCE 1) + +IF(CMAKE_SYSTEM_VERSION) + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce,${CMAKE_SYSTEM_VERSION}) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce,${CMAKE_SYSTEM_VERSION} /ENTRY:mainACRTStartup") +ELSE(CMAKE_SYSTEM_VERSION) +# according to msdn version would default to 2.00 + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /ENTRY:mainACRTStartup") +ENDIF(CMAKE_SYSTEM_VERSION) + +INCLUDE(Platform/Generic-Windows-cl) + +MESSAGE(STATUS "----- Entering WinCE-CL.cmake") Index: Modules/Platform/Generic-Windows.cmake =================================================================== --- Modules/Platform/Generic-Windows.cmake +++ Modules/Platform/Generic-Windows.cmake @@ -0,0 +1,38 @@ + + +SET(WIN32 1) + +SET(CMAKE_STATIC_LIBRARY_PREFIX "") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +SET(CMAKE_IMPORT_LIBRARY_PREFIX "") +SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +SET(CMAKE_DL_LIBS "") + +SET(CMAKE_FIND_LIBRARY_PREFIXES "") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + +# for borland make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "Borland") + SET(CMAKE_START_TEMP_FILE "@&&|\n") + SET(CMAKE_END_TEMP_FILE "\n|") +ENDIF(CMAKE_GENERATOR MATCHES "Borland") + +# for nmake make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "NMake") + SET(CMAKE_START_TEMP_FILE "@<<\n") + SET(CMAKE_END_TEMP_FILE "\n<<") +ENDIF(CMAKE_GENERATOR MATCHES "NMake") + +INCLUDE(Platform/WindowsPaths) + +# uncomment these out to debug nmake and borland makefiles +#SET(CMAKE_START_TEMP_FILE "") +#SET(CMAKE_END_TEMP_FILE "") +#SET(CMAKE_VERBOSE_MAKEFILE 1) + Index: Modules/Platform/WinCE.cmake =================================================================== --- Modules/Platform/WinCE.cmake +++ Modules/Platform/WinCE.cmake @@ -0,0 +1,23 @@ + +MESSAGE(STATUS "+++++ Entering WinCE.cmake") + +SET(WINCE 1) + +INCLUDE(Platform/Generic-Windows) + +IF(CMAKE_SYSTEM_VERSION) + STRING(REGEX REPLACE "([0-9]*)\\.([0-9]*)" "0x\\1\\2" CMAKE_SYSTEM_VERSION_HEX "${CMAKE_SYSTEM_VERSION}" ) +ELSE(CMAKE_SYSTEM_VERSION) + SET(CMAKE_SYSTEM_VERSION_HEX "0x200") +ENDIF(CMAKE_SYSTEM_VERSION) + +ADD_DEFINITIONS( + -DUNDER_CE=${CMAKE_SYSTEM_VERSION_HEX} + -D_WIN32_WCE=${CMAKE_SYSTEM_VERSION_HEX} + -DWIN32 + ) + + + +MESSAGE(STATUS "----- Leaveing WinCE.cmake") + Index: Modules/CMakeTestCCompiler.cmake =================================================================== --- Modules/CMakeTestCCompiler.cmake +++ Modules/CMakeTestCCompiler.cmake @@ -17,7 +17,13 @@ "#else\n" "int main(int argc, char* argv[])\n" "#endif\n" - "{ return argc-1;}\n") + "{ return argc-1;}\n\n" + "#if defined(_MSC_VER)\n" + "int mainCRTStartup(int argc, char* argv[])\n" + "{ return argc-1;}\n" + "#endif //MSC_VER \n" + ) + TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c OUTPUT_VARIABLE OUTPUT) cmake-2.6.4.diff [^] (146,075 bytes) 2009-05-02 07:02 [Show Content] [Hide Content] Index: Modules/CMakeCCompilerABI.c =================================================================== --- Modules/CMakeCCompilerABI.c (revision 1) +++ Modules/CMakeCCompilerABI.c (working copy) @@ -26,3 +26,16 @@ (void)argv; return require; } + +#ifndef __CLASSIC_C__ +int mainCRTStartup(int argc, char* argv[]) +{ + int require = 0; + require += info_sizeof_dptr[argc]; +#if defined(ABI_ID) + require += info_abi[argc]; +#endif + (void)argv; + return require; +} +#endif Index: Modules/CMakeCXXCompilerABI.cpp =================================================================== --- Modules/CMakeCXXCompilerABI.cpp (revision 1) +++ Modules/CMakeCXXCompilerABI.cpp (working copy) @@ -18,3 +18,14 @@ (void)argv; return require; } + +int mainCRTStartup(int argc, char* argv[]) +{ + int require = 0; + require += info_sizeof_dptr[argc]; +#if defined(ABI_ID) + require += info_abi[argc]; +#endif + (void)argv; + return require; +} Index: Modules/CMakeTestCCompiler.cmake =================================================================== --- Modules/CMakeTestCCompiler.cmake (revision 1) +++ Modules/CMakeTestCCompiler.cmake (working copy) @@ -17,7 +17,13 @@ "#else\n" "int main(int argc, char* argv[])\n" "#endif\n" - "{ return argc-1;}\n") + "{ return argc-1;}\n\n" + "#if defined(_MSC_VER)\n" + "int mainCRTStartup(int argc, char* argv[])\n" + "{ return argc-1;}\n" + "#endif //MSC_VER \n" + ) + TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c OUTPUT_VARIABLE OUTPUT) Index: Modules/CMakeTestCXXCompiler.cmake =================================================================== --- Modules/CMakeTestCXXCompiler.cmake (revision 1) +++ Modules/CMakeTestCXXCompiler.cmake (working copy) @@ -10,7 +10,12 @@ "#ifndef __cplusplus\n" "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n" "#endif\n" - "int main(){return 0;}\n") + "int main(){return 0;}\n\n" + "#if defined(_MSC_VER)\n" + "int mainCRTStartup(int argc, char* argv[])\n" + "{ return argc-1;}\n" + "#endif //MSC_VER \n" + ) TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx OUTPUT_VARIABLE OUTPUT) Index: Modules/Platform/Generic-Windows-cl.cmake =================================================================== --- Modules/Platform/Generic-Windows-cl.cmake (revision 0) +++ Modules/Platform/Generic-Windows-cl.cmake (revision 0) @@ -0,0 +1,355 @@ +# try to load any previously computed information for C on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) +# try to load any previously computed information for CXX on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) + +SET(WIN32 1) + +INCLUDE(Platform/cl) + + +IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") + SET (CMAKE_NO_BUILD_TYPE 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") +IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") + SET (CMAKE_NO_BUILD_TYPE 1) + SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING + "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") + MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES) +ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") +# does the compiler support pdbtype and is it the newer compiler +IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") +IF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + + +# make sure to enable languages after setting configuration types +ENABLE_LANGUAGE(RC) +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") + +# for nmake we need to compute some information about the compiler +# that is being used. +# the compiler may be free command line, 6, 7, or 71, and +# each have properties that must be determined. +# to avoid running these tests with each cmake run, the +# test results are saved in CMakeCPlatform.cmake, a file +# that is automatically copied into try_compile directories +# by the global generator. +SET(MSVC_IDE 1) +IF(CMAKE_GENERATOR MATCHES "Makefiles") + SET(MSVC_IDE 0) + IF(NOT CMAKE_VC_COMPILER_TESTS_RUN) + SET(CMAKE_VC_COMPILER_TESTS 1) + SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") + STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + MESSAGE(STATUS "Check for CL compiler version") + SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) + IF (NOT CMAKE_C_COMPILER) + SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) + ENDIF(NOT CMAKE_C_COMPILER) + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} + ARGS /nologo -EP \"${testNmakeCLVersionFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") + ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + ENDIF(NOT CMAKE_COMPILER_RETURN) + # try to figure out if we are running the free command line + # tools from Microsoft. These tools do not provide debug libraries, + # so the link flags used have to be different. + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2") + SET(testForFreeVCFile + "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx") + STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}") + MESSAGE(STATUS "Check if this is a free VC compiler") + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2 + ARGS /nologo /MD /EHsc + \"${testForFreeVCFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if this is a free VC compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - yes") + SET(CMAKE_USING_VC_FREE_TOOLS 1) + ELSE(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if this is a free VC compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - no") + SET(CMAKE_USING_VC_FREE_TOOLS 0) + ENDIF(CMAKE_COMPILER_RETURN) + + # Testing the machine type of the generated binaries: + FIND_PROGRAM(CMAKE_DUMPBIN + NAMES dumpbin + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/VC/bin" + "/Program Files/Microsoft Visual Studio 8/VC/bin/" + "/Program Files/Microsoft Visual Studio 9/VC/bin/" + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio.NET/VC/bin" + "/Program Files/Microsoft Visual Studio .NET/VC/bin/" + ) + + MESSAGE(STATUS "Check CL platform:") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking CL platform using dumpbin ${CMAKE_DUMPBIN}" ) + IF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Dumpbin found as ${CMAKE_DUMPBIN}\n" ) + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") + SET(testForCLMachineType + "${CMAKE_ROOT}/Modules/CMakeTestCLMachineType.c") + SET(testForCLMachineTypeOutput CMakeTestCLMachineType.obj) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "\n\nRunning cl: ${CMAKE_C_COMPILER} -c \"${testForCLMachineType}\" " ) + EXECUTE_PROCESS(COMMAND "${CMAKE_C_COMPILER}" -c "${testForCLMachineType}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + ERROR_VARIABLE testForCLMachineType_DUMP + OUTPUT_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n\nRunning dumpbin: ${CMAKE_DUMPBIN} /HEADERS ${testForCLMachineType}" ) + EXECUTE_PROCESS(COMMAND "${CMAKE_DUMPBIN}" /HEADERS ${testForCLMachineTypeOutput} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + OUTPUT_VARIABLE testForCLMachineType_DUMPBIN_OUTPUT + ERROR_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n${testForCLMachineType_DUMPBIN_OUTPUT}" ) + STRING(REGEX MATCH "machine \\(([^\\)]*)\\)" DUMPBIN_REGEX_RESULT ${testForCLMachineType_DUMPBIN_OUTPUT}) + SET(CMAKE_CL_MACHINE_TYPE ${CMAKE_MATCH_1}) + + ELSE(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + MESSAGE(Status "Check CL platform: dumpbin.exe was not found - assuimg i386") + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + + ## TODO add further dumpbin machine to visual studio machine type conversion here: + IF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + IF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + IF(NOT CMAKE_FORCE_NON_THUMB) + SET(CMAKE_CL_MACHINE_TYPE THUMB) + ENDIF(NOT CMAKE_FORCE_NON_THUMB) + ENDIF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + + MESSAGE(STATUS "Check CL platform: ${CMAKE_CL_MACHINE_TYPE}" ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "CL platform seems to be:${CMAKE_CL_MACHINE_TYPE}" ) + ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN) +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + +IF(CMAKE_FORCE_WIN64) + SET(CMAKE_CL_MACHINE_TYPE x64) +ENDIF(CMAKE_FORCE_WIN64) + + +# default to Debug builds +IF(MSVC_VERSION GREATER 1310) + # for 2005 make sure the manifest is put in the dll with mt + SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") + # create a C shared library + SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + # create a C shared module just copy the shared library rule + SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") + SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") + SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") + + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") + ENDIF(WINCE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /MANIFEST") +ELSE(MSVC_VERSION GREATER 1310) + IF(CMAKE_USING_VC_FREE_TOOLS) + MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available") + SET(CMAKE_BUILD_TYPE_INIT Release) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + ELSE(CMAKE_USING_VC_FREE_TOOLS) + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + ENDIF(CMAKE_USING_VC_FREE_TOOLS) + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + ENDIF(WINCE) +ENDIF(MSVC_VERSION GREATER 1310) + +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") + +IF(NOT CMAKE_WINDOWS_STACKSIZE) + SET(CMAKE_WINDOWS_STACKSIZE 10000000) ## 10MB is a reasonable default? +ENDIF(NOT CMAKE_WINDOWS_STACKSIZE) + +SET (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:${CMAKE_WINDOWS_STACKSIZE}" ) + +# machine type +IF(CMAKE_GENERATOR MATCHES "Makefiles") +## Setting machine makes only sense when linking cross compiled binaries with makefiles? + IF(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${CMAKE_CL_MACHINE_TYPE}") + ELSE(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:i386") + ENDIF(CMAKE_CL_MACHINE_TYPE) + + # append /ARMPADCODE + IF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /ARMPADCODE ") + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + +ELSE(CMAKE_GENERATOR MATCHES "Makefiles") + + IF(CMAKE_FORCE_WIN64) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:x64") + ENDIF(CMAKE_FORCE_WIN64) + +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + + +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp +# on versions that support it +IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") +ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /INCREMENTAL:YES") +ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) +# for release and minsize release default to no incremental linking +SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") + +# copy the EXE_LINKER flags to SHARED and MODULE linker flags +# shared linker flags +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) +# module linker flags +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) + + +# save computed information for this platform +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + Index: Modules/Platform/Generic-Windows.cmake =================================================================== --- Modules/Platform/Generic-Windows.cmake (revision 0) +++ Modules/Platform/Generic-Windows.cmake (revision 0) @@ -0,0 +1,38 @@ + + +SET(WIN32 1) + +SET(CMAKE_STATIC_LIBRARY_PREFIX "") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +SET(CMAKE_IMPORT_LIBRARY_PREFIX "") +SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +SET(CMAKE_DL_LIBS "") + +SET(CMAKE_FIND_LIBRARY_PREFIXES "") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + +# for borland make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "Borland") + SET(CMAKE_START_TEMP_FILE "@&&|\n") + SET(CMAKE_END_TEMP_FILE "\n|") +ENDIF(CMAKE_GENERATOR MATCHES "Borland") + +# for nmake make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "NMake") + SET(CMAKE_START_TEMP_FILE "@<<\n") + SET(CMAKE_END_TEMP_FILE "\n<<") +ENDIF(CMAKE_GENERATOR MATCHES "NMake") + +INCLUDE(Platform/WindowsPaths) + +# uncomment these out to debug nmake and borland makefiles +#SET(CMAKE_START_TEMP_FILE "") +#SET(CMAKE_END_TEMP_FILE "") +#SET(CMAKE_VERBOSE_MAKEFILE 1) + Index: Modules/Platform/WinCE-cl.cmake =================================================================== --- Modules/Platform/WinCE-cl.cmake (revision 0) +++ Modules/Platform/WinCE-cl.cmake (revision 0) @@ -0,0 +1,17 @@ +MESSAGE(STATUS "+++++ Entering WinCE-CL.cmake") + +SET(WIN32 1) +SET(WINCE 1) + +IF(CMAKE_SYSTEM_VERSION) + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce,${CMAKE_SYSTEM_VERSION}) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce,${CMAKE_SYSTEM_VERSION} /ENTRY:mainACRTStartup") +ELSE(CMAKE_SYSTEM_VERSION) +# according to msdn version would default to 2.00 + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /ENTRY:mainACRTStartup") +ENDIF(CMAKE_SYSTEM_VERSION) + +INCLUDE(Platform/Generic-Windows-cl) + +MESSAGE(STATUS "----- Entering WinCE-CL.cmake") Index: Modules/Platform/WinCE.cmake =================================================================== --- Modules/Platform/WinCE.cmake (revision 0) +++ Modules/Platform/WinCE.cmake (revision 0) @@ -0,0 +1,23 @@ + +MESSAGE(STATUS "+++++ Entering WinCE.cmake") + +SET(WINCE 1) + +INCLUDE(Platform/Generic-Windows) + +IF(CMAKE_SYSTEM_VERSION) + STRING(REGEX REPLACE "([0-9]*)\\.([0-9]*)" "0x\\1\\2" CMAKE_SYSTEM_VERSION_HEX "${CMAKE_SYSTEM_VERSION}" ) +ELSE(CMAKE_SYSTEM_VERSION) + SET(CMAKE_SYSTEM_VERSION_HEX "0x200") +ENDIF(CMAKE_SYSTEM_VERSION) + +ADD_DEFINITIONS( + -DUNDER_CE=${CMAKE_SYSTEM_VERSION_HEX} + -D_WIN32_WCE=${CMAKE_SYSTEM_VERSION_HEX} + -DWIN32 + ) + + + +MESSAGE(STATUS "----- Leaveing WinCE.cmake") + Index: Source/cmake.cxx =================================================================== --- Source/cmake.cxx (revision 1) +++ Source/cmake.cxx (working copy) @@ -65,6 +65,8 @@ # include "cmGlobalVisualStudio71Generator.h" # include "cmGlobalVisualStudio8Generator.h" # include "cmGlobalVisualStudio9Generator.h" +# include "cmGlobalVisualStudio9_SDKGenerator.h" +# include "cmGlobalVisualStudio8_SDKGenerator.h" # include "cmGlobalVisualStudio9Win64Generator.h" # include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" @@ -2420,6 +2422,10 @@ &cmGlobalVisualStudio8Generator::New; this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] = &cmGlobalVisualStudio9Generator::New; + this->Generators[cmGlobalVisualStudio8_SDKGenerator::GetActualName()] = + &cmGlobalVisualStudio8_SDKGenerator::New; + this->Generators[cmGlobalVisualStudio9_SDKGenerator::GetActualName()] = + &cmGlobalVisualStudio9_SDKGenerator::New; this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] = &cmGlobalVisualStudio9Win64Generator::New; this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] = Index: Source/CMakeLists.txt =================================================================== --- Source/CMakeLists.txt (revision 1) +++ Source/CMakeLists.txt (working copy) @@ -264,8 +264,12 @@ cmGlobalVisualStudio7Generator.h cmGlobalVisualStudio8Generator.cxx cmGlobalVisualStudio8Generator.h + cmGlobalVisualStudio8_SDKGenerator.cxx + cmGlobalVisualStudio8_SDKGenerator.h cmGlobalVisualStudio9Generator.cxx cmGlobalVisualStudio9Generator.h + cmGlobalVisualStudio9_SDKGenerator.cxx + cmGlobalVisualStudio9_SDKGenerator.h cmGlobalVisualStudio8Win64Generator.cxx cmGlobalVisualStudio8Win64Generator.h cmGlobalVisualStudio9Win64Generator.cxx Index: Source/cmGlobalVisualStudio71Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio71Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio71Generator.cxx (working copy) @@ -34,6 +34,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion71(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio7Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio7Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio7Generator.cxx (working copy) @@ -139,6 +139,7 @@ { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } @@ -663,8 +664,13 @@ std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations() { return &this->Configurations; -}; +} +std::vector<PlatformDefs> *cmGlobalVisualStudio7Generator::GetPlatforms() +{ + return &this->platforms; +} + //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator ::GetDocumentation(cmDocumentationEntry& entry) const Index: Source/cmGlobalVisualStudio7Generator.h =================================================================== --- Source/cmGlobalVisualStudio7Generator.h (revision 1) +++ Source/cmGlobalVisualStudio7Generator.h (working copy) @@ -22,6 +22,18 @@ class cmTarget; struct cmVS7FlagTable; +typedef struct { + int MajorVer; + int MinorVer; + std::string PlatformDefines; + std::string CEver; + std::string Archfam; + std::string Archfam_; + std::string InstructionSet; + std::string PlatformName; + bool added; +} PlatformDefs; + /** \class cmGlobalVisualStudio7Generator * \brief Write a Unix makefiles. * @@ -81,6 +93,12 @@ */ std::vector<std::string> *GetConfigurations(); + /** + * Get the list of platforms + */ + virtual std::vector<PlatformDefs> *GetPlatforms(); + + ///! Create a GUID or get an existing one. void CreateGUID(const char* name); std::string GetGUID(const char* name); @@ -160,6 +178,8 @@ // Set during OutputSLNFile with the name of the current project. // There is one SLN file per project. std::string CurrentProject; + + std::vector<PlatformDefs> platforms; // List of platforms }; #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" Index: Source/cmGlobalVisualStudio8_SDKGenerator.cxx =================================================================== --- Source/cmGlobalVisualStudio8_SDKGenerator.cxx (revision 0) +++ Source/cmGlobalVisualStudio8_SDKGenerator.cxx (revision 0) @@ -0,0 +1,428 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio8_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmSDKConfigParser::cmSDKConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmSDKConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmSDKConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); + this->platformVec.push_back(defs); + current_platform_valid = true; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmSDKConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmSDKConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_SDKGenerator::cmGlobalVisualStudio8_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; + +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::filterSDKs(std::vector<PlatformDefs>* platformvecptr) +{ + // here we inherit the platform vector from the parent + if(platformvecptr != 0) + { + platforms.clear(); + for(std::vector<PlatformDefs>::iterator it = platformvecptr->begin(); it != platformvecptr->end(); it++) + { + platforms.push_back(*it); + } + return; + } + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + std::vector<PlatformDefs> sdksfound = platforms; + platforms.clear(); + + + cmake * c = this->GetCMakeInstance(); + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; +} + +void cmGlobalVisualStudio8_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "8.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::Configure() +{ + filterSDKs(); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"StringPooling", "GF", "Enable Stringpooling", "true", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + // Compile for special architecture + {"CompileForArchitecture", "QRarch4", "ARM4 without Thumb instructions", "0", 0}, + {"CompileForArchitecture", "QRarch5", "ARM5 without Thumb instructions", "1", 0}, + {"CompileForArchitecture", "QRarch4t", "ARM4 with Thumb instructions", "2", 0}, + {"CompileForArchitecture", "QRarch5t", "ARM5 with Thumb instructions", "3", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraFlagTableVS8() +{ + return cmVS8SDKExtraFlagTable; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", "Posix application output", "8", 0}, // THIS IS ONLY AVAILABLE ON VC 8 + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "9", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS8SDKExtraLinkFlagTable; +} Index: Source/cmGlobalVisualStudio8_SDKGenerator.h =================================================================== --- Source/cmGlobalVisualStudio8_SDKGenerator.h (revision 0) +++ Source/cmGlobalVisualStudio8_SDKGenerator.h (revision 0) @@ -0,0 +1,91 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_SDKGenerator_h +#define cmGlobalVisualStudio8_SDKGenerator_h + +#include "cmGlobalVisualStudio8Generator.h" + +#include "cmXMLParser.h" + +class cmSDKConfigParser : public cmXMLParser +{ +public: + cmSDKConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_SDKGenerator : public cmGlobalVisualStudio8Generator +{ +public: + cmGlobalVisualStudio8_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 (with SDK support)";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + + void filterSDKs(std::vector<PlatformDefs>* platforms = 0); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + + virtual void GetSDKsInstalled(); + + std::string PlatformName; // Win32 or x64 +}; +#endif Index: Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx (revision 0) +++ Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx (revision 0) @@ -0,0 +1,562 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmWindowsMobileConfigParser::cmWindowsMobileConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmWindowsMobileConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); +// if(defs.PlatformName.find("ARMV4") != std::string::npos) { + this->platformVec.push_back(defs); + current_platform_valid = true; +// } else +// current_platform_valid = false; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmWindowsMobileConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_WindowsMobile_Generator::cmGlobalVisualStudio8_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + this->PlatformName = "Undefined Mobile Platform"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +// ouput standard header for dsw file +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 9.00\n"; + fout << "# Visual Studio 2005\n"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC80", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Configure() +{ + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + regkey += std::string("\\Setup\\VS;"); + + std::string base; + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmWindowsMobileConfigParser *parser = new cmWindowsMobileConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + std::vector<PlatformDefs> sdksfound = parser->getPlatforms(); + //platforms = parser->getPlatforms(); + delete parser; + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + cmake * c = this->GetCMakeInstance(); + + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; + + // HERE WE CIRCUMVENT THE NEED FOR A TOOLCHAIN FILE - WE SHOULD CHANGE THIS TO USE A TOOLCHAIN FILE + c->AddCacheEntry("CMAKE_SYSTEM_NAME", "WinCE", "Windows CE Define", 6); // 0 = bool, 3 = string + c->AddCacheEntry("CMAKE_SYSTEM_VERSION", "5.1", "Mobile Platform Version Define", 6); // #5.1 = WM5, 5.2 = WM6 + c->AddCacheEntry("CMAKE_SYSTEM_PROCESSOR", "ARMV4I", "Processor Define", 6); + c->AddCacheEntry("ARM", "1", "System Define", 6); + + c->AddCacheEntry("CMAKE_C_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + c->AddCacheEntry("CMAKE_CXX_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + + c->AddCacheEntry("CMAKE_CROSSCOMPILING","TRUE","Crosscompiling Flag",0); + c->AddCacheEntry("CMAKE_WINCE_STACKSIZE","65536,4096", "Stack Size Definition", 6); + + c->AddCacheEntry("WINCE_HOST_CMAKE_PATH", (base + std::string("/VC/ce")).c_str(),"Path to Visual Studio CE Path",1); + //c->AddCacheEntry("WINCE_SDK_CMAKE_PATH", "C:/Programme/Windows Mobile 5.0 SDK R2/PocketPC","Path to WinCE SDK",1); + //c->AddCacheEntry("WINVS_SDK_CMAKE_PATH", "C:/Programme/Microsoft SDKs/Windows/v6.0A/bin","Path to VS SDK",1); + + char buf[200]; + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_COMPILER", buf, "ARM cxx-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_COMPILER", buf, "ARM c-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_LINKER", buf, "ARM cxx-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_LINKER", buf, "ARM c-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_LINKER", buf, "ARM Linker",2); + sprintf(buf,"%s/bin/x86_arm/armasm.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_ASM_COMPILER", buf , "ARM Assembler",2); + //sprintf(buf,"%s/rc.exe",c->GetCacheDefinition("WINVS_SDK_CMAKE_PATH")); + //c->AddCacheEntry("CMAKE_RC_COMPILER", buf, "Resource Compiler",2); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + // Some VS8 sp0 versions cannot run macros. + // See http://support.microsoft.com/kb/928209 + const char* vc8sp1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926601;"; + const char* vc8exSP1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926748;"; + std::string vc8sp1; + if (!cmSystemTools::ReadRegistryValue(vc8sp1Registry, vc8sp1) && + !cmSystemTools::ReadRegistryValue(vc8exSP1Registry, vc8sp1)) + { + return ""; + } + + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 8.0 macros folder: + path = base + "/VSMacros80"; + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Generate() +{ + // Add a special target on which all other targets depend that + // checks the build system and optionally re-runs CMake. + const char* no_working_directory = 0; + std::vector<std::string> no_depends; + std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; + for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) + { + std::vector<cmLocalGenerator*>& generators = it->second; + if(!generators.empty()) + { + // Add the build-system check target to the first local + // generator of this project. + cmLocalVisualStudio7Generator* lg = + static_cast<cmLocalVisualStudio7Generator*>(generators[0]); + cmMakefile* mf = lg->GetMakefile(); + + // Skip the target if no regeneration is to be done. + if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION")) + { + continue; + } + + std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLines noCommandLines; + mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, + no_working_directory, no_depends, + noCommandLines); + cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + if(!tgt) + { + cmSystemTools::Error("Error adding target " + CMAKE_CHECK_BUILD_SYSTEM_TARGET); + continue; + } + + // Create a list of all stamp files for this project. + std::vector<std::string> stamps; + std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash(); + stampList += "generate.stamp.list"; + { + std::string stampListFile = + generators[0]->GetMakefile()->GetCurrentOutputDirectory(); + stampListFile += "/"; + stampListFile += stampList; + std::string stampFile; + cmGeneratedFileStream fout(stampListFile.c_str()); + for(std::vector<cmLocalGenerator*>::const_iterator + gi = generators.begin(); gi != generators.end(); ++gi) + { + stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory(); + stampFile += "/"; + stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); + stampFile += "generate.stamp"; + stampFile = generators[0]->Convert(stampFile.c_str(), + cmLocalGenerator::START_OUTPUT); + fout << stampFile << "\n"; + stamps.push_back(stampFile); + } + } + + // Add a custom rule to re-run CMake if any input files changed. + { + // Collect the input files used to generate all targets in this + // project. + std::vector<std::string> listFiles; + for(unsigned int j = 0; j < generators.size(); ++j) + { + cmMakefile* lmf = generators[j]->GetMakefile(); + listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(), + lmf->GetListFiles().end()); + } + // Sort the list of input files and remove duplicates. + std::sort(listFiles.begin(), listFiles.end(), + std::less<std::string>()); + std::vector<std::string>::iterator new_end = + std::unique(listFiles.begin(), listFiles.end()); + listFiles.erase(new_end, listFiles.end()); + + // Create a rule to re-run CMake. + std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash(); + stampName += "generate.stamp"; + const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLine commandLine; + commandLine.push_back(dsprule); + std::string argH = "-H"; + argH += lg->Convert(mf->GetHomeDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argH); + std::string argB = "-B"; + argB += lg->Convert(mf->GetHomeOutputDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argB); + commandLine.push_back("--check-stamp-list"); + commandLine.push_back(stampList.c_str()); + commandLine.push_back("--vs-solution-file"); + commandLine.push_back("\"$(SolutionPath)\""); + cmCustomCommandLines commandLines; + commandLines.push_back(commandLine); + + // Add the rule. Note that we cannot use the CMakeLists.txt + // file as the main dependency because it would get + // overwritten by the CreateVCProjBuildRule. + // (this could be avoided with per-target source files) + const char* no_main_dependency = 0; + const char* no_working_directory = 0; + mf->AddCustomCommandToOutput( + stamps, listFiles, + no_main_dependency, commandLines, "Checking Build System", + no_working_directory, true); + std::string ruleName = stamps[0]; + ruleName += ".rule"; + if(cmSourceFile* file = mf->GetSource(ruleName.c_str())) + { + tgt->AddSourceFile(file); + } + else + { + cmSystemTools::Error("Error adding rule for ", stamps[0].c_str()); + } + } + } + } + + // Now perform the main generation. + this->cmGlobalVisualStudio7Generator::Generate(); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8ExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_WindowsMobile_Generator::GetExtraFlagTableVS8() +{ + return cmVS8ExtraFlagTable; +} Index: Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h =================================================================== --- Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h (revision 0) +++ Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h (revision 0) @@ -0,0 +1,101 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_WindowsMobile_Generator_h +#define cmGlobalVisualStudio8_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio71Generator.h" + +#include "cmXMLParser.h" + +class cmWindowsMobileConfigParser : public cmXMLParser +{ +public: + cmWindowsMobileConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_WindowsMobile_Generator : public cmGlobalVisualStudio71Generator +{ +public: + cmGlobalVisualStudio8_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 - Windows Mobile";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + virtual void Generate(); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSLNHeader(std::ostream& fout); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + std::string PlatformName; // Win32 or x64 +}; +#endif Index: Source/cmGlobalVisualStudio8Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio8Generator.cxx (working copy) @@ -36,6 +36,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion8(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } @@ -341,6 +342,10 @@ cmVS7FlagTable::UserValueRequired}, // There is no YX option in the VS8 IDE. + // WHY WAS THIS REMOVED FROM VS7 to VS8? + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + // Exception handling mode. If no entries match, it will be FALSE. {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, Index: Source/cmGlobalVisualStudio8Generator.h =================================================================== --- Source/cmGlobalVisualStudio8Generator.h (revision 1) +++ Source/cmGlobalVisualStudio8Generator.h (working copy) @@ -67,7 +67,7 @@ virtual bool VSLinksDependencies() const { return false; } - static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); Index: Source/cmGlobalVisualStudio8Win64Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8Win64Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio8Win64Generator.cxx (working copy) @@ -34,6 +34,7 @@ lg->SetVersion8(); lg->SetPlatformName(this->PlatformName.c_str()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio9_SDKGenerator.cxx =================================================================== --- Source/cmGlobalVisualStudio9_SDKGenerator.cxx (revision 0) +++ Source/cmGlobalVisualStudio9_SDKGenerator.cxx (revision 0) @@ -0,0 +1,190 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio9_SDKGenerator::cmGlobalVisualStudio9_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS9SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "8", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio9_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS9SDKExtraLinkFlagTable; +} Index: Source/cmGlobalVisualStudio9_SDKGenerator.h =================================================================== --- Source/cmGlobalVisualStudio9_SDKGenerator.h (revision 0) +++ Source/cmGlobalVisualStudio9_SDKGenerator.h (revision 0) @@ -0,0 +1,75 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_SDKGenerator_h +#define cmGlobalVisualStudio9_SDKGenerator_h + +#include "cmGlobalVisualStudio8_SDKGenerator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_SDKGenerator : + public cmGlobalVisualStudio8_SDKGenerator +{ +public: + cmGlobalVisualStudio9_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 (with SDK support)";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + + virtual void GetSDKsInstalled(); +}; +#endif Index: Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx (revision 0) +++ Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx (revision 0) @@ -0,0 +1,102 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + + +cmGlobalVisualStudio9_WindowsMobile_Generator::cmGlobalVisualStudio9_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8_WindowsMobile_Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} Index: Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h =================================================================== --- Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h (revision 0) +++ Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h (revision 0) @@ -0,0 +1,69 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_WindowsMobile_Generator_h +#define cmGlobalVisualStudio9_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_WindowsMobile_Generator : + public cmGlobalVisualStudio8_WindowsMobile_Generator +{ +public: + cmGlobalVisualStudio9_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 - Windows Mobile";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); +}; +#endif Index: Source/cmGlobalVisualStudio9Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio9Generator.cxx (working copy) @@ -46,6 +46,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion9(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio9Win64Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9Win64Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio9Win64Generator.cxx (working copy) @@ -31,6 +31,7 @@ lg->SetVersion9(); lg->SetPlatformName(this->PlatformName.c_str()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmLocalVisualStudio7Generator.cxx =================================================================== --- Source/cmLocalVisualStudio7Generator.cxx (revision 1) +++ Source/cmLocalVisualStudio7Generator.cxx (working copy) @@ -536,9 +536,10 @@ bool& flag_handled); }; -void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, +void cmLocalVisualStudio7Generator::WritePlatformConfiguration(std::ostream& fout, const char* configName, const char *libName, + const char *platformName, cmTarget &target) { const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); @@ -546,9 +547,23 @@ { mfcFlag = "0"; } + + const char* wholeprogoptFlag; + if(strcmp(configName,"Release")==0) + wholeprogoptFlag = this->Makefile->GetDefinition("CMAKE_WHOLEPROGOPT_FLAG_RELEASE"); + else + wholeprogoptFlag = this->Makefile->GetDefinition("CMAKE_WHOLEPROGOPT_FLAG_DEBUG"); + if(!wholeprogoptFlag) + { + wholeprogoptFlag = "0"; + } + fout << "\t\t<Configuration\n" - << "\t\t\tName=\"" << configName << "|" << this->PlatformName << "\"\n" - << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + << "\t\t\tName=\"" << configName << "|" << platformName << "\"\n"; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + fout << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + else + fout << "\t\t\tOutputDirectory=\"" << platformName << "\\" << configName << "\"\n"; // This is an internal type to Visual Studio, it seems that: // 4 == static library // 2 == dll @@ -661,12 +676,15 @@ // target and a subdirectory for the configuration name. std::string intermediateDir = this->GetTargetDirectory(target); intermediateDir += "/"; + if(strcmp(platformName,"Win32") != 0 && strcmp(platformName,"x64") != 0) + intermediateDir += std::string(platformName) + "/"; intermediateDir += configName; fout << "\t\t\tIntermediateDirectory=\"" << this->ConvertToXMLOutputPath(intermediateDir.c_str()) << "\"\n" << "\t\t\tConfigurationType=\"" << configType << "\"\n" << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" + << "\t\t\tWholeProgramOptimization=\"" << wholeprogoptFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; // If unicode is enabled change the character set to unicode, if not @@ -737,9 +755,18 @@ { // We need to specify a program database file name even for // non-debug configurations because VS still creates .idb files. +if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) +{ fout << "\t\t\t\tProgramDataBaseFileName=\"" - << target.GetDirectory(configName) << "/" - << target.GetPDBName(configName) << "\"\n"; + << target.GetDirectory(configName) << "/"; +} +else +{ + fout << "\t\t\t\tProgramDataBaseFileName=\"" + << target.GetDirectory() << "/" << + std::string(platformName) << "/" << std::string(configName) << "/"; +} + fout << target.GetPDBName(configName) << "\"\n"; } fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool tool = "VCCustomBuildTool"; @@ -815,10 +842,28 @@ } this->OutputTargetRules(fout, configName, target, libName); - this->OutputBuildTool(fout, configName, target, targetOptions.IsDebug()); + this->OutputBuildTool(fout, configName, platformName, target, targetOptions.IsDebug()); fout << "\t\t</Configuration>\n"; } +void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, + const char* configName, + const char *libName, + cmTarget &target) +{ + if((this->PlatformName).compare("Mobile Platform") == 0) + { + cmGlobalVisualStudio7Generator *gg = static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator); + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + WritePlatformConfiguration(fout,configName,libName,(j->PlatformName).c_str(),target); + } + else + { + WritePlatformConfiguration(fout,configName,libName,(this->PlatformName).c_str(),target); + } +} + //---------------------------------------------------------------------------- std::string cmLocalVisualStudio7Generator @@ -837,6 +882,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, const char* configName, + const char* platformName, cmTarget &target, bool isDebug) { @@ -879,15 +925,25 @@ extraLinkOptions += " "; extraLinkOptions += targetLinkFlags; } - Options linkOptions(this, this->Version, Options::Linker); + Options linkOptions(this, this->Version, Options::Linker, this->ExtraLinkFlagTable); // MODIFIED BY CLEMENS linkOptions.Parse(extraLinkOptions.c_str()); switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: { std::string targetNameFull = target.GetFullName(configName); - std::string libpath = target.GetDirectory(configName); + std::string libpath; + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { + libpath = target.GetDirectory(configName); libpath += "/"; + } + else + { + libpath = target.GetDirectory(); + libpath += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } libpath += targetNameFull; const char* tool = "VCLibrarianTool"; if(this->FortranProject) @@ -937,15 +993,29 @@ fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " - << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) - << " "; + << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; temp = target.GetDirectory(configName); temp += "/"; + } + else + { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + + fout << "\t\t\t\tAdditionalDependencies=\" "; + this->Internal->OutputLibraries(fout, cli.GetItems()); + fout << "\"\n"; + fout << "\t\t\t\tDelayLoadDLLs=\"$(NOINHERIT)" << "\"\n"; + fout << "\t\t\t\tRandomizedBaseAddress=\"1" << "\"\n"; + fout << "\t\t\t\tDataExecutionPrevention=\"0" << "\"\n"; + } temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -955,8 +1025,17 @@ this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; this->OutputModuleDefinitionFile(fout, target); + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName); temp += "/"; + } + else + { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNamePDB; fout << "\t\t\t\tProgramDataBaseFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -972,8 +1051,17 @@ { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n"; } + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName, true); temp += "/"; + } + else + { + temp = target.GetDirectory("",true); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; @@ -1009,6 +1097,8 @@ } fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. @@ -1017,8 +1107,32 @@ << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; + } else + { + linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); + // Use the NOINHERIT macro to avoid getting VS project default + // libraries which may be set by the user to something bad. + fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " + << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) + << " "; + this->Internal->OutputLibraries(fout, cli.GetItems()); + fout << "\"\n"; + + fout << "\t\t\t\tDelayLoadDLLs=\"$(NOINHERIT)" << "\"\n"; + //fout << "\t\t\t\tSubSystem=\"0" << "\"\n"; + fout << "\t\t\t\tRandomizedBaseAddress=\"1" << "\"\n"; + fout << "\t\t\t\tDataExecutionPrevention=\"0" << "\"\n"; + } + if( strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0 || + strcmp(target.GetName(),"cmTryCompileExec") == 0 ) + // this is stupid hack to keep the try_compile stuff working for other platforms + { temp = target.GetDirectory(configName); temp += "/"; + } else { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -1027,13 +1141,23 @@ fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; - fout << "\t\t\t\tProgramDataBaseFile=\"" - << target.GetDirectory(configName) << "/" << targetNamePDB + fout << "\t\t\t\tProgramDataBaseFile=\""; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { + fout << target.GetDirectory(configName) << "/" << targetNamePDB << "\"\n"; + } + else + { + fout << target.GetDirectory() << "/" << + std::string(platformName) << "/" << std::string(configName) << "/" << targetNamePDB + << "\"\n"; + } if(isDebug) { fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"; } + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) { if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) { fout << "\t\t\t\tSubSystem=\"2\"\n"; @@ -1042,6 +1166,7 @@ { fout << "\t\t\t\tSubSystem=\"1\"\n"; } + } std::string stackVar = "CMAKE_"; stackVar += linkLanguage; stackVar += "_STACK_SIZE"; @@ -1050,8 +1175,18 @@ { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\""; } + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName, true); temp += "/"; + } + else + { + temp = target.GetDirectory("",true); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } + temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; @@ -1379,6 +1514,9 @@ dir_max += config_max; dir_max += "/"; + cmGlobalVisualStudio7Generator * gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + // Loop through each source in the source group. std::string objectName; for(std::vector<const cmSourceFile *>::const_iterator sf = @@ -1432,6 +1570,50 @@ fci = fcinfo.FileConfigMap.begin(); fci != fcinfo.FileConfigMap.end(); ++fci) { + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + { + cmLVS7GFileConfig const& fc = fci->second; + fout << "\t\t\t\t<FileConfiguration\n" + << "\t\t\t\t\tName=\"" << fci->first + << "|" << j->PlatformName << "\""; + if(fc.ExcludedFromBuild) + { + fout << " ExcludedFromBuild=\"true\""; + } + fout << ">\n"; + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n"; + if(!fc.CompileFlags.empty() || + !fc.CompileDefs.empty() || + !fc.CompileDefsConfig.empty()) + { + Options fileOptions(this, this->Version, Options::Compiler, + this->ExtraFlagTable); + fileOptions.Parse(fc.CompileFlags.c_str()); + fileOptions.AddDefines(fc.CompileDefs.c_str()); + fileOptions.AddDefines(fc.CompileDefsConfig.c_str()); + fileOptions.OutputAdditionalOptions(fout, "\t\t\t\t\t", "\n"); + fileOptions.OutputFlagMap(fout, "\t\t\t\t\t"); + fileOptions.OutputPreprocessorDefinitions(fout, + "\t\t\t\t\t", "\n"); + } + if(!fc.AdditionalDeps.empty()) + { + fout << "\t\t\t\t\tAdditionalDependencies=\"" + << fc.AdditionalDeps.c_str() << "\"\n"; + } + if(!fc.ObjectName.empty()) + { + fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" + << fc.ObjectName.c_str() << "\"\n"; + } + fout << "\t\t\t\t\t/>\n" + << "\t\t\t\t</FileConfiguration>\n"; + } + else + { cmLVS7GFileConfig const& fc = fci->second; fout << "\t\t\t\t<FileConfiguration\n" << "\t\t\t\t\tName=\"" << fci->first @@ -1471,6 +1653,7 @@ << "\t\t\t\t</FileConfiguration>\n"; } } + } fout << "\t\t\t</File>\n"; } } @@ -1499,9 +1682,9 @@ // Write the rule for each configuration. std::vector<std::string>::iterator i; - std::vector<std::string> *configs = - static_cast<cmGlobalVisualStudio7Generator *> - (this->GlobalGenerator)->GetConfigurations(); + cmGlobalVisualStudio7Generator * gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + std::vector<std::string> *configs = gg->GetConfigurations(); const char* compileTool = "VCCLCompilerTool"; if(this->FortranProject) { @@ -1514,6 +1697,83 @@ } for(i = configs->begin(); i != configs->end(); ++i) { + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + { + cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; + fout << "\t\t\t\t<FileConfiguration\n"; + fout << "\t\t\t\t\tName=\"" << *i << "|" << j->PlatformName << "\">\n"; + if(!fc.CompileFlags.empty()) + { + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << compileTool << "\"\n" + << "\t\t\t\t\tAdditionalOptions=\"" + << this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n"; + } + + std::string script = + this->ConstructScript(command.GetCommandLines(), + command.GetWorkingDirectory(), + i->c_str(), + command.GetEscapeOldStyle(), + command.GetEscapeAllowMakeVars()); + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << customTool << "\"\n" + << "\t\t\t\t\tDescription=\"" + << this->EscapeForXML(comment.c_str()) << "\"\n" + << "\t\t\t\t\tCommandLine=\"" + << this->EscapeForXML(script.c_str()) << "\"\n" + << "\t\t\t\t\tAdditionalDependencies=\""; + if(command.GetDepends().empty()) + { + // There are no real dependencies. Produce an artificial one to + // make sure the rule runs reliably. + if(!cmSystemTools::FileExists(source)) + { + std::ofstream depout(source); + depout << "Artificial dependency for a custom command.\n"; + } + fout << this->ConvertToXMLOutputPath(source); + } + else + { + // Write out the dependencies for the rule. + for(std::vector<std::string>::const_iterator d = + command.GetDepends().begin(); + d != command.GetDepends().end(); + ++d) + { + // Get the real name of the dependency in case it is a CMake target. + std::string dep = this->GetRealDependency(d->c_str(), i->c_str()); + fout << this->ConvertToXMLOutputPath(dep.c_str()) + << ";"; + } + } + fout << "\"\n"; + fout << "\t\t\t\t\tOutputs=\""; + if(command.GetOutputs().empty()) + { + fout << source << "_force"; + } + else + { + // Write a rule for the output generated by this command. + const char* sep = ""; + for(std::vector<std::string>::const_iterator o = + command.GetOutputs().begin(); + o != command.GetOutputs().end(); + ++o) + { + fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str()); + sep = ";"; + } + } + fout << "\"/>\n"; + fout << "\t\t\t\t</FileConfiguration>\n"; + } + else + { cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; fout << "\t\t\t\t<FileConfiguration\n"; fout << "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n"; @@ -1586,6 +1846,7 @@ fout << "\t\t\t\t</FileConfiguration>\n"; } } +} void cmLocalVisualStudio7Generator::WriteVCProjBeginGroup(std::ostream& fout, @@ -1789,13 +2050,19 @@ } if(projectType) { - fout << "\tProjectType=\"" << projectType << "\"\n"; + fout << "\tProjectType=\"" << projectType << "\">\n"; } fout<< "\tKeyword=\"" << keyword << "\">\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n" - << "\t<Platforms>\n" - << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" - << "\t</Platforms>\n"; + << "\t<Platforms>\n"; + + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + fout << "\t\t<Platform\n\t\t\tName=\"" << j->PlatformName << "\"/>\n"; + else + fout << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"; + fout << "\t</Platforms>\n"; } @@ -1850,9 +2117,15 @@ << "\tSccProvider=\"" << vsProvider << "\"\n"; } fout << "\tKeyword=\"" << keyword << "\">\n" - << "\t<Platforms>\n" - << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" - << "\t</Platforms>\n"; + << "\t<Platforms>\n"; + + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + fout << "\t\t<Platform\n\t\t\tName=\"" << j->PlatformName << "\"/>\n"; + else + fout << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"; + fout << "\t</Platforms>\n"; } Index: Source/cmLocalVisualStudio7Generator.h =================================================================== --- Source/cmLocalVisualStudio7Generator.h (revision 1) +++ Source/cmLocalVisualStudio7Generator.h (working copy) @@ -68,6 +68,8 @@ void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } + void SetExtraLinkFlagTable(cmVS7FlagTable const* table) + { this->ExtraLinkFlagTable = table; } private: typedef cmLocalVisualStudio7GeneratorOptions Options; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; @@ -85,6 +87,11 @@ void WriteVCProjFile(std::ostream& fout, const char *libName, cmTarget &tgt); cmSourceFile* CreateVCProjBuildRule(); + void WritePlatformConfiguration(std::ostream& fout, + const char* configName, + const char *libName, + const char *platformName, + cmTarget &target); void WriteConfigurations(std::ostream& fout, const char *libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, @@ -96,7 +103,7 @@ void OutputTargetRules(std::ostream& fout, const char* configName, cmTarget &target, const char *libName); void OutputBuildTool(std::ostream& fout, const char* configName, - cmTarget& t, bool debug); + const char* platformName, cmTarget& t, bool debug); void OutputLibraryDirectories(std::ostream& fout, std::vector<std::string> const& dirs); void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target); @@ -124,6 +131,7 @@ friend class cmLocalVisualStudio7GeneratorInternals; cmVS7FlagTable const* ExtraFlagTable; + cmVS7FlagTable const* ExtraLinkFlagTable; std::string ModuleDefinitionFile; int Version; bool FortranProject; Index: Source/cmMakefile.cxx =================================================================== --- Source/cmMakefile.cxx (revision 1) +++ Source/cmMakefile.cxx (working copy) @@ -21,6 +21,10 @@ #include "cmSourceFileLocation.h" #include "cmSystemTools.h" #include "cmGlobalGenerator.h" +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) +# include "cmGlobalVisualStudio9_SDKGenerator.h" +# include "cmGlobalVisualStudio8_SDKGenerator.h" +#endif #include "cmLocalGenerator.h" #include "cmCommands.h" #include "cmCacheManager.h" @@ -2755,8 +2759,9 @@ std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND"); cmake cm; cm.SetIsInTryCompile(true); - cmGlobalGenerator *gg = cm.CreateGlobalGenerator - (this->LocalGenerator->GetGlobalGenerator()->GetName()); + cmGlobalGenerator *parentgg = this->LocalGenerator->GetGlobalGenerator(); + std::string parentggname(parentgg->GetName()); + cmGlobalGenerator *gg = cm.CreateGlobalGenerator(parentggname.c_str()); if (!gg) { cmSystemTools::Error( @@ -2765,6 +2770,21 @@ cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; } + // check to update platforms list if it is an SDK based builder +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) + if(parentggname.compare(cmGlobalVisualStudio8_SDKGenerator::GetActualName()) == 0) + { // gg should inherit platform vector from parent + cmGlobalVisualStudio8_SDKGenerator* srcgg = static_cast<cmGlobalVisualStudio8_SDKGenerator*>(parentgg); + cmGlobalVisualStudio8_SDKGenerator* targg = static_cast<cmGlobalVisualStudio8_SDKGenerator*>(gg); + targg->filterSDKs(srcgg->GetPlatforms()); + } + else if(parentggname.compare(cmGlobalVisualStudio9_SDKGenerator::GetActualName()) == 0) + { // gg should inherit platform vector from parent + cmGlobalVisualStudio9_SDKGenerator* srcgg = static_cast<cmGlobalVisualStudio9_SDKGenerator*>(parentgg); + cmGlobalVisualStudio9_SDKGenerator* targg = static_cast<cmGlobalVisualStudio9_SDKGenerator*>(gg); + targg->filterSDKs(srcgg->GetPlatforms()); + } +#endif cm.SetGlobalGenerator(gg); // do a configure Index: Tests/CMakeLists.txt =================================================================== --- Tests/CMakeLists.txt (revision 1) +++ Tests/CMakeLists.txt (working copy) @@ -65,6 +65,19 @@ SET(CMAKE_LONG_TEST_TIMEOUT 1500) ENDIF(CMAKE_LONG_TEST_TIMEOUT LESS 1500) + CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/SimplePPC2003/CMakeCache.txt.in" + "${CMake_BINARY_DIR}/Tests/SimplePPC2003/CMakeCache.txt" COPYONLY + ) + ADD_TEST(SimplePPC2003 ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/SimplePPC2003" + "${CMake_BINARY_DIR}/Tests/SimplePPC2003" + --build-two-config + --build-generator "Visual Studio 9 2008 (with SDK support)" + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-project SimplePPC2003) + # add a bunch of standard build-and-test style tests ADD_TEST_MACRO(CommandLineTest CommandLineTest) ADD_TEST_MACRO(FindPackageTest FindPackageTest) @@ -429,6 +442,7 @@ --test-command Tutorial 25.0) ENDFOREACH(STP) + ADD_TEST(testing ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Testing" Index: Tests/SimplePPC2003/CMakeCache.txt.in =================================================================== --- Tests/SimplePPC2003/CMakeCache.txt.in (revision 0) +++ Tests/SimplePPC2003/CMakeCache.txt.in (revision 0) @@ -0,0 +1,5 @@ +//SDK to use +CMAKE_GENERATOR:INTERNAL=Visual Studio 9 2008 (with SDK support) +CMAKE_SYSTEM_NAME:STRING=WINCE +CMAKE_SYSTEM_VERSION:STRING=4.20 +PLATFORM_SDKS:STRING=Pocket PC 2003 (ARMV4) Index: Tests/SimplePPC2003/CMakeLists.txt =================================================================== --- Tests/SimplePPC2003/CMakeLists.txt (revision 0) +++ Tests/SimplePPC2003/CMakeLists.txt (revision 0) @@ -0,0 +1,14 @@ +# a simple test case for compiling a PPC 2003 project +PROJECT(SimplePPC2003) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(RESOURCEFILES resourceppc.h SimplePPC2003ppc.rc SimplePPC2003ppc.rc2) +SET(SOURCEFILES SimplePPC2003.cpp stdafx.cpp) +SET(HEADERFILES stdafx.h SimplePPC2003.h) + +ADD_DEFINITIONS(-DWINCE -D$(ARCHFAM) -D$(_ARCHFAM_) -D_UNICODE -DUNICODE -D_USRDLL ) + +ADD_EXECUTABLE(SimplePPC2003 ${RESOURCEFILES} ${SOURCEFILES} ${HEADERFILES}) + +SET_TARGET_PROPERTIES(SimplePPC2003 PROPERTIES LINK_FLAGS /machine:ARM) Index: Tests/SimplePPC2003/GetCompilerVersion.cmake =================================================================== --- Tests/SimplePPC2003/GetCompilerVersion.cmake (revision 0) +++ Tests/SimplePPC2003/GetCompilerVersion.cmake (revision 0) @@ -0,0 +1,95 @@ + +FIND_PROGRAM(CMAKE_VCVARS + NAMES vcvarsall.bat + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/VC" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC" + ) + +# Testing the machine type of the generated binaries: +FIND_PROGRAM(CMAKE_TEST_COMPILER + NAMES cl.exe + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/VC/bin" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + ) + +SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") +STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + +EXEC_PROGRAM("\"${CMAKE_VCVARS}\" && \"${CMAKE_TEST_COMPILER}\" /nologo -EP \"${testNmakeCLVersionFile}\"" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + +IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") +ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") +ENDIF(NOT CMAKE_COMPILER_RETURN) Index: Tests/SimplePPC2003/resourceppc.h =================================================================== --- Tests/SimplePPC2003/resourceppc.h (revision 0) +++ Tests/SimplePPC2003/resourceppc.h (revision 0) @@ -0,0 +1,34 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by SimplePPC2003ppc.rc +// + +#define IDS_APP_TITLE 1 +#define IDC_SIMPLEPPC2003 2 +#define IDI_SIMPLEPPC2003 101 +#define IDR_MENU 102 +#define IDS_OK 103 +#define IDS_HELP 104 +#define IDD_ABOUTBOX 105 +#define IDD_ABOUTBOX_WIDE 106 +#define IDC_STATIC_1 201 +#define IDC_STATIC_2 202 +#define IDC_STATIC_3 203 +#define IDM_OK 40000 +#define IDM_HELP 40001 +#define IDM_HELP_ABOUT 40002 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif Index: Tests/SimplePPC2003/SimplePPC2003.cpp =================================================================== --- Tests/SimplePPC2003/SimplePPC2003.cpp (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003.cpp (revision 0) @@ -0,0 +1,259 @@ +// SimplePPC2003.cpp : Defines the entry point for the application. +// + +#include "stdafx.h" +#include "SimplePPC2003.h" + + +#define MAX_LOADSTRING 100 + +// Global Variables: +HINSTANCE g_hInst; // current instance +HWND g_hWndMenuBar; // menu bar handle + +// Forward declarations of functions included in this code module: +ATOM MyRegisterClass(HINSTANCE, LPTSTR); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); + +int WINAPI WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Perform application initialization: + if (!InitInstance(hInstance, nCmdShow)) + { + return FALSE; + } + + HACCEL hAccelTable; + hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SIMPLEPPC2003)); + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return (int) msg.wParam; +} + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +// COMMENTS: +// +ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SIMPLEPPC2003)); + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = 0; + wc.lpszClassName = szWindowClass; + + return RegisterClass(&wc); +} + +// +// FUNCTION: InitInstance(HINSTANCE, int) +// +// PURPOSE: Saves instance handle and creates main window +// +// COMMENTS: +// +// In this function, we save the instance handle in a global variable and +// create and display the main program window. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[MAX_LOADSTRING]; // title bar text + TCHAR szWindowClass[MAX_LOADSTRING]; // main window class name + + g_hInst = hInstance; // Store instance handle in our global variable + + // SHInitExtraControls should be called once during your application's initialization to initialize any + // of the device specific controls such as CAPEDIT and SIPPREF. + SHInitExtraControls(); + + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadString(hInstance, IDC_SIMPLEPPC2003, szWindowClass, MAX_LOADSTRING); + + //If it is already running, then focus on the window, and exit + hWnd = FindWindow(szWindowClass, szTitle); + if (hWnd) + { + // set focus to foremost child window + // The "| 0x00000001" is used to bring any owned windows to the foreground and + // activate them. + SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001)); + return 0; + } + + if (!MyRegisterClass(hInstance, szWindowClass)) + { + return FALSE; + } + + hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + // When the main window is created using CW_USEDEFAULT the height of the menubar (if one + // is created is not taken into account). So we resize the window after creating it + // if a menubar is present + if (g_hWndMenuBar) + { + RECT rc; + RECT rcMenuBar; + + GetWindowRect(hWnd, &rc); + GetWindowRect(g_hWndMenuBar, &rcMenuBar); + rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top); + + MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE); + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + + return TRUE; +} + +// +// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// PURPOSE: Processes messages for the main window. +// +// WM_COMMAND - process the application menu +// WM_PAINT - Paint the main window +// WM_DESTROY - post a quit message and return +// +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + + static SHACTIVATEINFO s_sai; + + switch (message) + { + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) + { + case IDM_HELP_ABOUT: + DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); + break; + case IDM_OK: + SendMessage (hWnd, WM_CLOSE, 0, 0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + case WM_CREATE: + SHMENUBARINFO mbi; + + memset(&mbi, 0, sizeof(SHMENUBARINFO)); + mbi.cbSize = sizeof(SHMENUBARINFO); + mbi.hwndParent = hWnd; + mbi.nToolBarId = IDR_MENU; + mbi.hInstRes = g_hInst; + + if (!SHCreateMenuBar(&mbi)) + { + g_hWndMenuBar = NULL; + } + else + { + g_hWndMenuBar = mbi.hwndMB; + } + + // Initialize the shell activate info structure + memset(&s_sai, 0, sizeof (s_sai)); + s_sai.cbSize = sizeof (s_sai); + break; + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + + // TODO: Add any drawing code here... + + EndPaint(hWnd, &ps); + break; + case WM_DESTROY: + CommandBar_Destroy(g_hWndMenuBar); + PostQuitMessage(0); + break; + + case WM_ACTIVATE: + // Notify shell of our activate message + SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); + break; + case WM_SETTINGCHANGE: + SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + +// Message handler for about box. +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + { + // Create a Done button and size it. + SHINITDLGINFO shidi; + shidi.dwMask = SHIDIM_FLAGS; + shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU; + shidi.hDlg = hDlg; + SHInitDialog(&shidi); + } + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) + { + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + } + break; + + case WM_CLOSE: + EndDialog(hDlg, message); + return TRUE; + + } + return (INT_PTR)FALSE; +} Index: Tests/SimplePPC2003/SimplePPC2003.h =================================================================== --- Tests/SimplePPC2003/SimplePPC2003.h (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003.h (revision 0) @@ -0,0 +1,2 @@ +#pragma once +#include "resourceppc.h" Index: Tests/SimplePPC2003/SimplePPC2003ppc.rc =================================================================== --- Tests/SimplePPC2003/SimplePPC2003ppc.rc (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003ppc.rc (revision 0) @@ -0,0 +1,170 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resourceppc.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#include "resdefce.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +//IDI_SIMPLEPPC2003 ICON "SimplePPC2003.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "Help" + BEGIN + MENUITEM "About", IDM_HELP_ABOUT + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_SIMPLEPPC2003 ACCELERATORS +BEGIN + "A", IDM_HELP_ABOUT, VIRTKEY, CONTROL, NOINVERT + "Q", IDM_OK, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG 0, 0, 156, 129 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_CAPTIONOKBTN +CAPTION "About SimplePPC2003" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SIMPLEPPC2003,IDC_STATIC_1,12,12,21,20,SS_REALSIZEIMAGE + LTEXT "SimplePPC2003 Version 1.0",IDC_STATIC_2,12,36,70,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC_3,12,48,66,8 +END + +IDD_ABOUTBOX_WIDE DIALOG 0, 0, 210, 129 +STYLE WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_CAPTIONOKBTN +CAPTION "About SimplePPC2003" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SIMPLEPPC2003,IDC_STATIC_1,12,12,21,20,SS_REALSIZEIMAGE + LTEXT "SimplePPC2003 Version 1.0",IDC_STATIC_2,48,12,66,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC_3,48,24,66,8 +END + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 149 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END + + IDD_ABOUTBOX_WIDE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END +END +#endif // APSTUDIO_INVOKED + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// +1 TEXTINCLUDE +BEGIN + "resourceppc.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#include ""resdefce.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""SimplePPC2003ppc.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// +STRINGTABLE +BEGIN + IDC_SIMPLEPPC2003 "SIMPLEPPC2003" + IDS_APP_TITLE "SimplePPC2003" + IDS_OK "OK" + IDS_HELP "HELP" +END + +#endif +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "SimplePPC2003ppc.rc2" // non-Microsoft Visual C++ edited resources +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED Index: Tests/SimplePPC2003/SimplePPC2003ppc.rc2 =================================================================== --- Tests/SimplePPC2003/SimplePPC2003ppc.rc2 (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003ppc.rc2 (revision 0) @@ -0,0 +1,35 @@ +// +// SimplePPC2003PPC.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// +HI_RES_AWARE CEUX {1} // turn off the emulation layer + // Remove this resource to enable pixel- + // doubling on platforms that support it +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// +// SHMENUBAR +// + +IDR_MENU SHMENUBAR DISCARDABLE +BEGIN + IDR_MENU, + 2, + + I_IMAGENONE, IDM_OK, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, + IDS_OK, 0, NOMENU, + + I_IMAGENONE, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, + IDS_HELP, 0, 0, +END + Index: Tests/SimplePPC2003/stdafx.cpp =================================================================== --- Tests/SimplePPC2003/stdafx.cpp (revision 0) +++ Tests/SimplePPC2003/stdafx.cpp (revision 0) @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimplePPC2003.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file Index: Tests/SimplePPC2003/stdafx.h =================================================================== --- Tests/SimplePPC2003/stdafx.h (revision 0) +++ Tests/SimplePPC2003/stdafx.h (revision 0) @@ -0,0 +1,62 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#pragma comment(linker, "/nodefaultlib:libc.lib") +#pragma comment(linker, "/nodefaultlib:libcd.lib") + +// NOTE - this value is not strongly correlated to the Windows CE OS version being targeted +#define WINVER _WIN32_WCE + +#include <ceconfig.h> +#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) +#define SHELL_AYGSHELL +#endif + +#ifdef _CE_DCOM +#define _ATL_APARTMENT_THREADED +#endif + +#include <windows.h> +#include <commctrl.h> + +#include <aygshell.h> +#pragma comment(lib, "aygshell.lib") + + +// Windows Header Files: +#include <windows.h> + +// C RunTime Header Files +#include <stdlib.h> +#include <malloc.h> +#include <memory.h> +#include <tchar.h> + +#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) +#ifndef _DEVICE_RESOLUTION_AWARE +#define _DEVICE_RESOLUTION_AWARE +#endif +#endif + +#ifdef _DEVICE_RESOLUTION_AWARE +#include "DeviceResolutionAware.h" +#endif + +#if _WIN32_WCE < 0x500 && ( defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) ) + #pragma comment(lib, "ccrtrtti.lib") + #ifdef _X86_ + #if defined(_DEBUG) + #pragma comment(lib, "libcmtx86d.lib") + #else + #pragma comment(lib, "libcmtx86.lib") + #endif + #endif +#endif + +#include <altcecrt.h> + +// TODO: reference additional headers your program requires here cmake-2.6.4_new.diff [^] (254,782 bytes) 2009-06-04 08:10 [Show Content] [Hide Content] Index: Modules/CMakeCCompilerABI.c =================================================================== --- Modules/CMakeCCompilerABI.c (revision 1) +++ Modules/CMakeCCompilerABI.c (working copy) @@ -26,3 +26,16 @@ (void)argv; return require; } + +#ifndef __CLASSIC_C__ +int mainCRTStartup(int argc, char* argv[]) +{ + int require = 0; + require += info_sizeof_dptr[argc]; +#if defined(ABI_ID) + require += info_abi[argc]; +#endif + (void)argv; + return require; +} +#endif Index: Modules/CMakeCXXCompilerABI.cpp =================================================================== --- Modules/CMakeCXXCompilerABI.cpp (revision 1) +++ Modules/CMakeCXXCompilerABI.cpp (working copy) @@ -18,3 +18,14 @@ (void)argv; return require; } + +int mainCRTStartup(int argc, char* argv[]) +{ + int require = 0; + require += info_sizeof_dptr[argc]; +#if defined(ABI_ID) + require += info_abi[argc]; +#endif + (void)argv; + return require; +} Index: Modules/CMakeTestCCompiler.cmake =================================================================== --- Modules/CMakeTestCCompiler.cmake (revision 1) +++ Modules/CMakeTestCCompiler.cmake (working copy) @@ -17,7 +17,13 @@ "#else\n" "int main(int argc, char* argv[])\n" "#endif\n" - "{ return argc-1;}\n") + "{ return argc-1;}\n\n" + "#if defined(_MSC_VER)\n" + "int mainCRTStartup(int argc, char* argv[])\n" + "{ return argc-1;}\n" + "#endif //MSC_VER \n" + ) + TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c OUTPUT_VARIABLE OUTPUT) Index: Modules/CMakeTestCXXCompiler.cmake =================================================================== --- Modules/CMakeTestCXXCompiler.cmake (revision 1) +++ Modules/CMakeTestCXXCompiler.cmake (working copy) @@ -10,7 +10,12 @@ "#ifndef __cplusplus\n" "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n" "#endif\n" - "int main(){return 0;}\n") + "int main(){return 0;}\n\n" + "#if defined(_MSC_VER)\n" + "int mainCRTStartup(int argc, char* argv[])\n" + "{ return argc-1;}\n" + "#endif //MSC_VER \n" + ) TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx OUTPUT_VARIABLE OUTPUT) Index: Modules/FindMatlab.cmake =================================================================== --- Modules/FindMatlab.cmake (revision 1) +++ Modules/FindMatlab.cmake (working copy) @@ -21,9 +21,41 @@ # Same here, there are also: bcc50 and bcc51 directories SET(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/bcc54") ELSE(${CMAKE_GENERATOR} MATCHES "Borland") - IF(MATLAB_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}") - ENDIF(MATLAB_FIND_REQUIRED) + IF( ${CMAKE_GENERATOR} MATCHES "Visual Studio 8" OR + ${CMAKE_GENERATOR} MATCHES "Visual Studio 9") + FIND_FILE(MATLAB_EXECUTABLE + NAMES matlab.exe + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.5;MATLABROOT]/bin + [HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.6;MATLABROOT]/bin + [HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.7;MATLABROOT]/bin + ) + IF(NOT MATLAB_EXECUTABLE) + MESSAGE(FATAL_ERROR "Matlab was not found!") + ENDIF(NOT MATLAB_EXECUTABLE) + + GET_FILENAME_COMPONENT(MATLAB_PATH ${MATLAB_EXECUTABLE} PATH) + + SET(MATLAB_ROOT "${MATLAB_PATH}/../extern/lib/win32/microsoft") + SET(MATLAB_BITS 32) + IF(EXISTS ${MATLAB_ROOT}) + FIND_LIBRARY(TESTLIB + libmex + PATHS + ${MATLAB_ROOT} + ) + IF(NOT TESTLIB) + MESSAGE(STATUS "32-bit Matlab libraries not found. Searching for 64-bit...") + SET(MATLAB_ROOT "${MATLAB_PATH}/../extern/lib/win64/microsoft") + SET(MATLAB_BITS 64) + ENDIF(NOT TESTLIB) + ELSE(EXISTS ${MATLAB_ROOT}) + MESSAGE(STATUS "32-bit libraries not found. Searching for 64-bit...") + SET(MATLAB_ROOT "${MATLAB_PATH}/../extern/lib/win64/microsoft") + SET(MATLAB_BITS 64) + ENDIF(EXISTS ${MATLAB_ROOT}) + ENDIF( ${CMAKE_GENERATOR} MATCHES "Visual Studio 8" OR + ${CMAKE_GENERATOR} MATCHES "Visual Studio 9") ENDIF(${CMAKE_GENERATOR} MATCHES "Borland") ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 7") ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") @@ -42,7 +74,7 @@ FIND_PATH(MATLAB_INCLUDE_DIR "mex.h" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/include" + "${MATLAB_PATH}/../extern/include" ) ELSE( WIN32 ) IF(CMAKE_SIZEOF_VOID_P EQUAL 4) @@ -104,5 +136,6 @@ MATLAB_INCLUDE_DIR MATLAB_FOUND MATLAB_ROOT + MATLAB_BITS ) Index: Modules/Platform/Generic-Windows-cl.cmake =================================================================== --- Modules/Platform/Generic-Windows-cl.cmake (revision 0) +++ Modules/Platform/Generic-Windows-cl.cmake (revision 0) @@ -0,0 +1,710 @@ +# try to load any previously computed information for C on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) +# try to load any previously computed information for CXX on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) + +SET(WIN32 1) + +INCLUDE(Platform/cl) + + +IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") + SET (CMAKE_NO_BUILD_TYPE 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") +IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") + SET (CMAKE_NO_BUILD_TYPE 1) + SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING + "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") + MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES) +ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") +# does the compiler support pdbtype and is it the newer compiler +IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") +IF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + + +# make sure to enable languages after setting configuration types +ENABLE_LANGUAGE(RC) +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") + +# for nmake we need to compute some information about the compiler +# that is being used. +# the compiler may be free command line, 6, 7, or 71, and +# each have properties that must be determined. +# to avoid running these tests with each cmake run, the +# test results are saved in CMakeCPlatform.cmake, a file +# that is automatically copied into try_compile directories +# by the global generator. +SET(MSVC_IDE 1) +IF(CMAKE_GENERATOR MATCHES "Makefiles") + SET(MSVC_IDE 0) + IF(NOT CMAKE_VC_COMPILER_TESTS_RUN) + SET(CMAKE_VC_COMPILER_TESTS 1) + SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") + STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + MESSAGE(STATUS "Check for CL compiler version") + SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) + IF (NOT CMAKE_C_COMPILER) + SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) + ENDIF(NOT CMAKE_C_COMPILER) + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} + ARGS /nologo -EP \"${testNmakeCLVersionFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") + ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + ENDIF(NOT CMAKE_COMPILER_RETURN) + # try to figure out if we are running the free command line + # tools from Microsoft. These tools do not provide debug libraries, + # so the link flags used have to be different. + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2") + SET(testForFreeVCFile + "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx") + STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}") + MESSAGE(STATUS "Check if this is a free VC compiler") + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2 + ARGS /nologo /MD /EHsc + \"${testForFreeVCFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if this is a free VC compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - yes") + SET(CMAKE_USING_VC_FREE_TOOLS 1) + ELSE(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if this is a free VC compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - no") + SET(CMAKE_USING_VC_FREE_TOOLS 0) + ENDIF(CMAKE_COMPILER_RETURN) + + # Testing the machine type of the generated binaries: + FIND_PROGRAM(CMAKE_DUMPBIN + NAMES dumpbin + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/VC/bin" + "/Program Files/Microsoft Visual Studio 8/VC/bin/" + "/Program Files/Microsoft Visual Studio 9/VC/bin/" + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio.NET/VC/bin" + "/Program Files/Microsoft Visual Studio .NET/VC/bin/" + ) + + MESSAGE(STATUS "Check CL platform:") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking CL platform using dumpbin ${CMAKE_DUMPBIN}" ) + IF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Dumpbin found as ${CMAKE_DUMPBIN}\n" ) + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") + SET(testForCLMachineType + "${CMAKE_ROOT}/Modules/CMakeTestCLMachineType.c") + SET(testForCLMachineTypeOutput CMakeTestCLMachineType.obj) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "\n\nRunning cl: ${CMAKE_C_COMPILER} -c \"${testForCLMachineType}\" " ) + EXECUTE_PROCESS(COMMAND "${CMAKE_C_COMPILER}" -c "${testForCLMachineType}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + ERROR_VARIABLE testForCLMachineType_DUMP + OUTPUT_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n\nRunning dumpbin: ${CMAKE_DUMPBIN} /HEADERS ${testForCLMachineType}" ) + EXECUTE_PROCESS(COMMAND "${CMAKE_DUMPBIN}" /HEADERS ${testForCLMachineTypeOutput} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + OUTPUT_VARIABLE testForCLMachineType_DUMPBIN_OUTPUT + ERROR_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n${testForCLMachineType_DUMPBIN_OUTPUT}" ) + STRING(REGEX MATCH "machine \\(([^\\)]*)\\)" DUMPBIN_REGEX_RESULT ${testForCLMachineType_DUMPBIN_OUTPUT}) + SET(CMAKE_CL_MACHINE_TYPE ${CMAKE_MATCH_1}) + + ELSE(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + MESSAGE(Status "Check CL platform: dumpbin.exe was not found - assuimg i386") + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + + ## TODO add further dumpbin machine to visual studio machine type conversion here: + IF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + IF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + IF(NOT CMAKE_FORCE_NON_THUMB) + SET(CMAKE_CL_MACHINE_TYPE THUMB) + ENDIF(NOT CMAKE_FORCE_NON_THUMB) + ENDIF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + + MESSAGE(STATUS "Check CL platform: ${CMAKE_CL_MACHINE_TYPE}" ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "CL platform seems to be:${CMAKE_CL_MACHINE_TYPE}" ) + ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN) +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + +IF(CMAKE_FORCE_WIN64) + SET(CMAKE_CL_MACHINE_TYPE x64) +ENDIF(CMAKE_FORCE_WIN64) + + +# default to Debug builds +IF(MSVC_VERSION GREATER 1310) + # for 2005 make sure the manifest is put in the dll with mt + SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") + # create a C shared library + SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + # create a C shared module just copy the shared library rule + SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") + SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") + SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") + + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") + ENDIF(WINCE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /MANIFEST") +ELSE(MSVC_VERSION GREATER 1310) + IF(CMAKE_USING_VC_FREE_TOOLS) + MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available") + SET(CMAKE_BUILD_TYPE_INIT Release) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + ELSE(CMAKE_USING_VC_FREE_TOOLS) + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + ENDIF(CMAKE_USING_VC_FREE_TOOLS) + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + ENDIF(WINCE) +ENDIF(MSVC_VERSION GREATER 1310) + +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") + +IF(NOT CMAKE_WINDOWS_STACKSIZE) + SET(CMAKE_WINDOWS_STACKSIZE 10000000) ## 10MB is a reasonable default? +ENDIF(NOT CMAKE_WINDOWS_STACKSIZE) + +SET (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:${CMAKE_WINDOWS_STACKSIZE}" ) + +# machine type +IF(CMAKE_GENERATOR MATCHES "Makefiles") +## Setting machine makes only sense when linking cross compiled binaries with makefiles? + IF(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${CMAKE_CL_MACHINE_TYPE}") + ELSE(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:i386") + ENDIF(CMAKE_CL_MACHINE_TYPE) + + # append /ARMPADCODE + IF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /ARMPADCODE ") + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + +ELSE(CMAKE_GENERATOR MATCHES "Makefiles") + + IF(CMAKE_FORCE_WIN64) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:x64") + ENDIF(CMAKE_FORCE_WIN64) + +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + + +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp +# on versions that support it +IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") +ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /INCREMENTAL:YES") +ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) +# for release and minsize release default to no incremental linking +SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") + +# copy the EXE_LINKER flags to SHARED and MODULE linker flags +# shared linker flags +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) +# module linker flags +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) + + +# save computed information for this platform +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + +# try to load any previously computed information for C on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) +# try to load any previously computed information for CXX on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) + +SET(WIN32 1) + +INCLUDE(Platform/cl) + + +IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") + SET (CMAKE_NO_BUILD_TYPE 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") +IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") + SET (CMAKE_NO_BUILD_TYPE 1) + SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING + "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") + MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES) +ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") +# does the compiler support pdbtype and is it the newer compiler +IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") +IF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + + +# make sure to enable languages after setting configuration types +ENABLE_LANGUAGE(RC) +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") + +# for nmake we need to compute some information about the compiler +# that is being used. +# the compiler may be free command line, 6, 7, or 71, and +# each have properties that must be determined. +# to avoid running these tests with each cmake run, the +# test results are saved in CMakeCPlatform.cmake, a file +# that is automatically copied into try_compile directories +# by the global generator. +SET(MSVC_IDE 1) +IF(CMAKE_GENERATOR MATCHES "Makefiles") + SET(MSVC_IDE 0) + IF(NOT CMAKE_VC_COMPILER_TESTS_RUN) + SET(CMAKE_VC_COMPILER_TESTS 1) + SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") + STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + MESSAGE(STATUS "Check for CL compiler version") + SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) + IF (NOT CMAKE_C_COMPILER) + SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) + ENDIF(NOT CMAKE_C_COMPILER) + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} + ARGS /nologo -EP \"${testNmakeCLVersionFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") + ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + ENDIF(NOT CMAKE_COMPILER_RETURN) + # try to figure out if we are running the free command line + # tools from Microsoft. These tools do not provide debug libraries, + # so the link flags used have to be different. + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2") + SET(testForFreeVCFile + "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx") + STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}") + MESSAGE(STATUS "Check if this is a free VC compiler") + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2 + ARGS /nologo /MD /EHsc + \"${testForFreeVCFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if this is a free VC compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - yes") + SET(CMAKE_USING_VC_FREE_TOOLS 1) + ELSE(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if this is a free VC compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - no") + SET(CMAKE_USING_VC_FREE_TOOLS 0) + ENDIF(CMAKE_COMPILER_RETURN) + + # Testing the machine type of the generated binaries: + FIND_PROGRAM(CMAKE_DUMPBIN + NAMES dumpbin + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/VC/bin" + "/Program Files/Microsoft Visual Studio 8/VC/bin/" + "/Program Files/Microsoft Visual Studio 9/VC/bin/" + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio.NET/VC/bin" + "/Program Files/Microsoft Visual Studio .NET/VC/bin/" + ) + + MESSAGE(STATUS "Check CL platform:") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking CL platform using dumpbin ${CMAKE_DUMPBIN}" ) + IF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Dumpbin found as ${CMAKE_DUMPBIN}\n" ) + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") + SET(testForCLMachineType + "${CMAKE_ROOT}/Modules/CMakeTestCLMachineType.c") + SET(testForCLMachineTypeOutput CMakeTestCLMachineType.obj) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "\n\nRunning cl: ${CMAKE_C_COMPILER} -c \"${testForCLMachineType}\" " ) + EXECUTE_PROCESS(COMMAND "${CMAKE_C_COMPILER}" -c "${testForCLMachineType}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + ERROR_VARIABLE testForCLMachineType_DUMP + OUTPUT_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n\nRunning dumpbin: ${CMAKE_DUMPBIN} /HEADERS ${testForCLMachineType}" ) + EXECUTE_PROCESS(COMMAND "${CMAKE_DUMPBIN}" /HEADERS ${testForCLMachineTypeOutput} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + OUTPUT_VARIABLE testForCLMachineType_DUMPBIN_OUTPUT + ERROR_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n${testForCLMachineType_DUMPBIN_OUTPUT}" ) + STRING(REGEX MATCH "machine \\(([^\\)]*)\\)" DUMPBIN_REGEX_RESULT ${testForCLMachineType_DUMPBIN_OUTPUT}) + SET(CMAKE_CL_MACHINE_TYPE ${CMAKE_MATCH_1}) + + ELSE(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + MESSAGE(Status "Check CL platform: dumpbin.exe was not found - assuimg i386") + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + + ## TODO add further dumpbin machine to visual studio machine type conversion here: + IF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + IF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + IF(NOT CMAKE_FORCE_NON_THUMB) + SET(CMAKE_CL_MACHINE_TYPE THUMB) + ENDIF(NOT CMAKE_FORCE_NON_THUMB) + ENDIF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + + MESSAGE(STATUS "Check CL platform: ${CMAKE_CL_MACHINE_TYPE}" ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "CL platform seems to be:${CMAKE_CL_MACHINE_TYPE}" ) + ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN) +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + +IF(CMAKE_FORCE_WIN64) + SET(CMAKE_CL_MACHINE_TYPE x64) +ENDIF(CMAKE_FORCE_WIN64) + + +# default to Debug builds +IF(MSVC_VERSION GREATER 1310) + # for 2005 make sure the manifest is put in the dll with mt + SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") + # create a C shared library + SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + # create a C shared module just copy the shared library rule + SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") + SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") + SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") + + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") + ENDIF(WINCE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /MANIFEST") +ELSE(MSVC_VERSION GREATER 1310) + IF(CMAKE_USING_VC_FREE_TOOLS) + MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available") + SET(CMAKE_BUILD_TYPE_INIT Release) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + ELSE(CMAKE_USING_VC_FREE_TOOLS) + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + ENDIF(CMAKE_USING_VC_FREE_TOOLS) + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + ENDIF(WINCE) +ENDIF(MSVC_VERSION GREATER 1310) + +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") + +IF(NOT CMAKE_WINDOWS_STACKSIZE) + SET(CMAKE_WINDOWS_STACKSIZE 10000000) ## 10MB is a reasonable default? +ENDIF(NOT CMAKE_WINDOWS_STACKSIZE) + +SET (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:${CMAKE_WINDOWS_STACKSIZE}" ) + +# machine type +IF(CMAKE_GENERATOR MATCHES "Makefiles") +## Setting machine makes only sense when linking cross compiled binaries with makefiles? + IF(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${CMAKE_CL_MACHINE_TYPE}") + ELSE(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:i386") + ENDIF(CMAKE_CL_MACHINE_TYPE) + + # append /ARMPADCODE + IF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /ARMPADCODE ") + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + +ELSE(CMAKE_GENERATOR MATCHES "Makefiles") + + IF(CMAKE_FORCE_WIN64) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:x64") + ENDIF(CMAKE_FORCE_WIN64) + +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + + +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp +# on versions that support it +IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") +ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /INCREMENTAL:YES") +ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) +# for release and minsize release default to no incremental linking +SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") + +# copy the EXE_LINKER flags to SHARED and MODULE linker flags +# shared linker flags +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) +# module linker flags +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) + + +# save computed information for this platform +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + Index: Modules/Platform/Generic-Windows.cmake =================================================================== --- Modules/Platform/Generic-Windows.cmake (revision 0) +++ Modules/Platform/Generic-Windows.cmake (revision 0) @@ -0,0 +1,76 @@ + + +SET(WIN32 1) + +SET(CMAKE_STATIC_LIBRARY_PREFIX "") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +SET(CMAKE_IMPORT_LIBRARY_PREFIX "") +SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +SET(CMAKE_DL_LIBS "") + +SET(CMAKE_FIND_LIBRARY_PREFIXES "") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + +# for borland make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "Borland") + SET(CMAKE_START_TEMP_FILE "@&&|\n") + SET(CMAKE_END_TEMP_FILE "\n|") +ENDIF(CMAKE_GENERATOR MATCHES "Borland") + +# for nmake make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "NMake") + SET(CMAKE_START_TEMP_FILE "@<<\n") + SET(CMAKE_END_TEMP_FILE "\n<<") +ENDIF(CMAKE_GENERATOR MATCHES "NMake") + +INCLUDE(Platform/WindowsPaths) + +# uncomment these out to debug nmake and borland makefiles +#SET(CMAKE_START_TEMP_FILE "") +#SET(CMAKE_END_TEMP_FILE "") +#SET(CMAKE_VERBOSE_MAKEFILE 1) + + + +SET(WIN32 1) + +SET(CMAKE_STATIC_LIBRARY_PREFIX "") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +SET(CMAKE_IMPORT_LIBRARY_PREFIX "") +SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +SET(CMAKE_DL_LIBS "") + +SET(CMAKE_FIND_LIBRARY_PREFIXES "") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + +# for borland make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "Borland") + SET(CMAKE_START_TEMP_FILE "@&&|\n") + SET(CMAKE_END_TEMP_FILE "\n|") +ENDIF(CMAKE_GENERATOR MATCHES "Borland") + +# for nmake make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "NMake") + SET(CMAKE_START_TEMP_FILE "@<<\n") + SET(CMAKE_END_TEMP_FILE "\n<<") +ENDIF(CMAKE_GENERATOR MATCHES "NMake") + +INCLUDE(Platform/WindowsPaths) + +# uncomment these out to debug nmake and borland makefiles +#SET(CMAKE_START_TEMP_FILE "") +#SET(CMAKE_END_TEMP_FILE "") +#SET(CMAKE_VERBOSE_MAKEFILE 1) + Index: Modules/Platform/WinCE-cl.cmake =================================================================== --- Modules/Platform/WinCE-cl.cmake (revision 0) +++ Modules/Platform/WinCE-cl.cmake (revision 0) @@ -0,0 +1,34 @@ +MESSAGE(STATUS "+++++ Entering WinCE-CL.cmake") + +SET(WIN32 1) +SET(WINCE 1) + +IF(CMAKE_SYSTEM_VERSION) + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce,${CMAKE_SYSTEM_VERSION}) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce,${CMAKE_SYSTEM_VERSION} /ENTRY:mainACRTStartup") +ELSE(CMAKE_SYSTEM_VERSION) +# according to msdn version would default to 2.00 + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /ENTRY:mainACRTStartup") +ENDIF(CMAKE_SYSTEM_VERSION) + +INCLUDE(Platform/Generic-Windows-cl) + +MESSAGE(STATUS "----- Entering WinCE-CL.cmake") +MESSAGE(STATUS "+++++ Entering WinCE-CL.cmake") + +SET(WIN32 1) +SET(WINCE 1) + +IF(CMAKE_SYSTEM_VERSION) + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce,${CMAKE_SYSTEM_VERSION}) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce,${CMAKE_SYSTEM_VERSION} /ENTRY:mainACRTStartup") +ELSE(CMAKE_SYSTEM_VERSION) +# according to msdn version would default to 2.00 + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /ENTRY:mainACRTStartup") +ENDIF(CMAKE_SYSTEM_VERSION) + +INCLUDE(Platform/Generic-Windows-cl) + +MESSAGE(STATUS "----- Entering WinCE-CL.cmake") Index: Modules/Platform/WinCE.cmake =================================================================== --- Modules/Platform/WinCE.cmake (revision 0) +++ Modules/Platform/WinCE.cmake (revision 0) @@ -0,0 +1,46 @@ + +MESSAGE(STATUS "+++++ Entering WinCE.cmake") + +SET(WINCE 1) + +INCLUDE(Platform/Generic-Windows) + +IF(CMAKE_SYSTEM_VERSION) + STRING(REGEX REPLACE "([0-9]*)\\.([0-9]*)" "0x\\1\\2" CMAKE_SYSTEM_VERSION_HEX "${CMAKE_SYSTEM_VERSION}" ) +ELSE(CMAKE_SYSTEM_VERSION) + SET(CMAKE_SYSTEM_VERSION_HEX "0x200") +ENDIF(CMAKE_SYSTEM_VERSION) + +ADD_DEFINITIONS( + -DUNDER_CE=${CMAKE_SYSTEM_VERSION_HEX} + -D_WIN32_WCE=${CMAKE_SYSTEM_VERSION_HEX} + -DWIN32 + ) + + + +MESSAGE(STATUS "----- Leaveing WinCE.cmake") + + +MESSAGE(STATUS "+++++ Entering WinCE.cmake") + +SET(WINCE 1) + +INCLUDE(Platform/Generic-Windows) + +IF(CMAKE_SYSTEM_VERSION) + STRING(REGEX REPLACE "([0-9]*)\\.([0-9]*)" "0x\\1\\2" CMAKE_SYSTEM_VERSION_HEX "${CMAKE_SYSTEM_VERSION}" ) +ELSE(CMAKE_SYSTEM_VERSION) + SET(CMAKE_SYSTEM_VERSION_HEX "0x200") +ENDIF(CMAKE_SYSTEM_VERSION) + +ADD_DEFINITIONS( + -DUNDER_CE=${CMAKE_SYSTEM_VERSION_HEX} + -D_WIN32_WCE=${CMAKE_SYSTEM_VERSION_HEX} + -DWIN32 + ) + + + +MESSAGE(STATUS "----- Leaveing WinCE.cmake") + Index: Source/cmake.cxx =================================================================== --- Source/cmake.cxx (revision 1) +++ Source/cmake.cxx (working copy) @@ -65,6 +65,8 @@ # include "cmGlobalVisualStudio71Generator.h" # include "cmGlobalVisualStudio8Generator.h" # include "cmGlobalVisualStudio9Generator.h" +# include "cmGlobalVisualStudio9_SDKGenerator.h" +# include "cmGlobalVisualStudio8_SDKGenerator.h" # include "cmGlobalVisualStudio9Win64Generator.h" # include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" @@ -2420,6 +2422,10 @@ &cmGlobalVisualStudio8Generator::New; this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] = &cmGlobalVisualStudio9Generator::New; + this->Generators[cmGlobalVisualStudio8_SDKGenerator::GetActualName()] = + &cmGlobalVisualStudio8_SDKGenerator::New; + this->Generators[cmGlobalVisualStudio9_SDKGenerator::GetActualName()] = + &cmGlobalVisualStudio9_SDKGenerator::New; this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] = &cmGlobalVisualStudio9Win64Generator::New; this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] = Index: Source/CMakeLists.txt =================================================================== --- Source/CMakeLists.txt (revision 1) +++ Source/CMakeLists.txt (working copy) @@ -264,8 +264,12 @@ cmGlobalVisualStudio7Generator.h cmGlobalVisualStudio8Generator.cxx cmGlobalVisualStudio8Generator.h + cmGlobalVisualStudio8_SDKGenerator.cxx + cmGlobalVisualStudio8_SDKGenerator.h cmGlobalVisualStudio9Generator.cxx cmGlobalVisualStudio9Generator.h + cmGlobalVisualStudio9_SDKGenerator.cxx + cmGlobalVisualStudio9_SDKGenerator.h cmGlobalVisualStudio8Win64Generator.cxx cmGlobalVisualStudio8Win64Generator.h cmGlobalVisualStudio9Win64Generator.cxx Index: Source/cmGlobalVisualStudio71Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio71Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio71Generator.cxx (working copy) @@ -34,6 +34,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion71(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio7Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio7Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio7Generator.cxx (working copy) @@ -139,6 +139,7 @@ { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } @@ -663,8 +664,13 @@ std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations() { return &this->Configurations; -}; +} +std::vector<PlatformDefs> *cmGlobalVisualStudio7Generator::GetPlatforms() +{ + return &this->platforms; +} + //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator ::GetDocumentation(cmDocumentationEntry& entry) const Index: Source/cmGlobalVisualStudio7Generator.h =================================================================== --- Source/cmGlobalVisualStudio7Generator.h (revision 1) +++ Source/cmGlobalVisualStudio7Generator.h (working copy) @@ -22,6 +22,18 @@ class cmTarget; struct cmVS7FlagTable; +typedef struct { + int MajorVer; + int MinorVer; + std::string PlatformDefines; + std::string CEver; + std::string Archfam; + std::string Archfam_; + std::string InstructionSet; + std::string PlatformName; + bool added; +} PlatformDefs; + /** \class cmGlobalVisualStudio7Generator * \brief Write a Unix makefiles. * @@ -81,6 +93,12 @@ */ std::vector<std::string> *GetConfigurations(); + /** + * Get the list of platforms + */ + virtual std::vector<PlatformDefs> *GetPlatforms(); + + ///! Create a GUID or get an existing one. void CreateGUID(const char* name); std::string GetGUID(const char* name); @@ -160,6 +178,8 @@ // Set during OutputSLNFile with the name of the current project. // There is one SLN file per project. std::string CurrentProject; + + std::vector<PlatformDefs> platforms; // List of platforms }; #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" Index: Source/cmGlobalVisualStudio8_SDKGenerator.cxx =================================================================== --- Source/cmGlobalVisualStudio8_SDKGenerator.cxx (revision 0) +++ Source/cmGlobalVisualStudio8_SDKGenerator.cxx (revision 0) @@ -0,0 +1,861 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio8_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmSDKConfigParser::cmSDKConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmSDKConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmSDKConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); + this->platformVec.push_back(defs); + current_platform_valid = true; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmSDKConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmSDKConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_SDKGenerator::cmGlobalVisualStudio8_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; + +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::filterSDKs(std::vector<PlatformDefs>* platformvecptr) +{ + // here we inherit the platform vector from the parent + if(platformvecptr != 0) + { + platforms.clear(); + for(std::vector<PlatformDefs>::iterator it = platformvecptr->begin(); it != platformvecptr->end(); it++) + { + platforms.push_back(*it); + } + return; + } + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + std::vector<PlatformDefs> sdksfound = platforms; + platforms.clear(); + + + cmake * c = this->GetCMakeInstance(); + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; +} + +void cmGlobalVisualStudio8_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "8.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::Configure() +{ + filterSDKs(); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"StringPooling", "GF", "Enable Stringpooling", "true", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + // Compile for special architecture + {"CompileForArchitecture", "QRarch4", "ARM4 without Thumb instructions", "0", 0}, + {"CompileForArchitecture", "QRarch5", "ARM5 without Thumb instructions", "1", 0}, + {"CompileForArchitecture", "QRarch4t", "ARM4 with Thumb instructions", "2", 0}, + {"CompileForArchitecture", "QRarch5t", "ARM5 with Thumb instructions", "3", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraFlagTableVS8() +{ + return cmVS8SDKExtraFlagTable; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", "Posix application output", "8", 0}, // THIS IS ONLY AVAILABLE ON VC 8 + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "9", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS8SDKExtraLinkFlagTable; +} +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio8_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmSDKConfigParser::cmSDKConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmSDKConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) // if nothing is contained in the string, then a bad pointer is returned! + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) // if nothing is contained in the string, then a bad pointer is returned! + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) // if nothing is contained in the string, then a bad pointer is returned! + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) // if nothing is contained in the string, then a bad pointer is returned! + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) // if nothing is contained in the string, then a bad pointer is returned! + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmSDKConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); + this->platformVec.push_back(defs); + current_platform_valid = true; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmSDKConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmSDKConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_SDKGenerator::cmGlobalVisualStudio8_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; + +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::filterSDKs(std::vector<PlatformDefs>* platformvecptr) +{ + // here we inherit the platform vector from the parent + if(platformvecptr != 0) + { + platforms.clear(); + for(std::vector<PlatformDefs>::iterator it = platformvecptr->begin(); it != platformvecptr->end(); it++) + { + platforms.push_back(*it); + } + return; + } + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + std::vector<PlatformDefs> sdksfound = platforms; + platforms.clear(); + + + cmake * c = this->GetCMakeInstance(); + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; +} + +void cmGlobalVisualStudio8_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "8.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::Configure() +{ + filterSDKs(); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"StringPooling", "GF", "Enable Stringpooling", "true", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + // Compile for special architecture + {"CompileForArchitecture", "QRarch4", "ARM4 without Thumb instructions", "0", 0}, + {"CompileForArchitecture", "QRarch5", "ARM5 without Thumb instructions", "1", 0}, + {"CompileForArchitecture", "QRarch4t", "ARM4 with Thumb instructions", "2", 0}, + {"CompileForArchitecture", "QRarch5t", "ARM5 with Thumb instructions", "3", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraFlagTableVS8() +{ + return cmVS8SDKExtraFlagTable; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", "Posix application output", "8", 0}, // THIS IS ONLY AVAILABLE ON VC 8 + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "9", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS8SDKExtraLinkFlagTable; +} Index: Source/cmGlobalVisualStudio8_SDKGenerator.h =================================================================== --- Source/cmGlobalVisualStudio8_SDKGenerator.h (revision 0) +++ Source/cmGlobalVisualStudio8_SDKGenerator.h (revision 0) @@ -0,0 +1,182 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_SDKGenerator_h +#define cmGlobalVisualStudio8_SDKGenerator_h + +#include "cmGlobalVisualStudio8Generator.h" + +#include "cmXMLParser.h" + +class cmSDKConfigParser : public cmXMLParser +{ +public: + cmSDKConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_SDKGenerator : public cmGlobalVisualStudio8Generator +{ +public: + cmGlobalVisualStudio8_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 (with SDK support)";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + + void filterSDKs(std::vector<PlatformDefs>* platforms = 0); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + + virtual void GetSDKsInstalled(); + + std::string PlatformName; // Win32 or x64 +}; +#endif +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_SDKGenerator_h +#define cmGlobalVisualStudio8_SDKGenerator_h + +#include "cmGlobalVisualStudio8Generator.h" + +#include "cmXMLParser.h" + +class cmSDKConfigParser : public cmXMLParser +{ +public: + cmSDKConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_SDKGenerator : public cmGlobalVisualStudio8Generator +{ +public: + cmGlobalVisualStudio8_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 (with SDK support)";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + + void filterSDKs(std::vector<PlatformDefs>* platforms = 0); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + + virtual void GetSDKsInstalled(); + + std::string PlatformName; // Win32 or x64 +}; +#endif Index: Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx (revision 0) +++ Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx (revision 0) @@ -0,0 +1,1129 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmWindowsMobileConfigParser::cmWindowsMobileConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmWindowsMobileConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); +// if(defs.PlatformName.find("ARMV4") != std::string::npos) { + this->platformVec.push_back(defs); + current_platform_valid = true; +// } else +// current_platform_valid = false; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmWindowsMobileConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_WindowsMobile_Generator::cmGlobalVisualStudio8_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + this->PlatformName = "Undefined Mobile Platform"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +// ouput standard header for dsw file +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 9.00\n"; + fout << "# Visual Studio 2005\n"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC80", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Configure() +{ + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + regkey += std::string("\\Setup\\VS;"); + + std::string base; + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmWindowsMobileConfigParser *parser = new cmWindowsMobileConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + std::vector<PlatformDefs> sdksfound = parser->getPlatforms(); + //platforms = parser->getPlatforms(); + delete parser; + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + cmake * c = this->GetCMakeInstance(); + + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; + + // HERE WE CIRCUMVENT THE NEED FOR A TOOLCHAIN FILE - WE SHOULD CHANGE THIS TO USE A TOOLCHAIN FILE + c->AddCacheEntry("CMAKE_SYSTEM_NAME", "WinCE", "Windows CE Define", 6); // 0 = bool, 3 = string + c->AddCacheEntry("CMAKE_SYSTEM_VERSION", "5.1", "Mobile Platform Version Define", 6); // #5.1 = WM5, 5.2 = WM6 + c->AddCacheEntry("CMAKE_SYSTEM_PROCESSOR", "ARMV4I", "Processor Define", 6); + c->AddCacheEntry("ARM", "1", "System Define", 6); + + c->AddCacheEntry("CMAKE_C_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + c->AddCacheEntry("CMAKE_CXX_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + + c->AddCacheEntry("CMAKE_CROSSCOMPILING","TRUE","Crosscompiling Flag",0); + c->AddCacheEntry("CMAKE_WINCE_STACKSIZE","65536,4096", "Stack Size Definition", 6); + + c->AddCacheEntry("WINCE_HOST_CMAKE_PATH", (base + std::string("/VC/ce")).c_str(),"Path to Visual Studio CE Path",1); + //c->AddCacheEntry("WINCE_SDK_CMAKE_PATH", "C:/Programme/Windows Mobile 5.0 SDK R2/PocketPC","Path to WinCE SDK",1); + //c->AddCacheEntry("WINVS_SDK_CMAKE_PATH", "C:/Programme/Microsoft SDKs/Windows/v6.0A/bin","Path to VS SDK",1); + + char buf[200]; + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_COMPILER", buf, "ARM cxx-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_COMPILER", buf, "ARM c-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_LINKER", buf, "ARM cxx-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_LINKER", buf, "ARM c-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_LINKER", buf, "ARM Linker",2); + sprintf(buf,"%s/bin/x86_arm/armasm.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_ASM_COMPILER", buf , "ARM Assembler",2); + //sprintf(buf,"%s/rc.exe",c->GetCacheDefinition("WINVS_SDK_CMAKE_PATH")); + //c->AddCacheEntry("CMAKE_RC_COMPILER", buf, "Resource Compiler",2); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + // Some VS8 sp0 versions cannot run macros. + // See http://support.microsoft.com/kb/928209 + const char* vc8sp1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926601;"; + const char* vc8exSP1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926748;"; + std::string vc8sp1; + if (!cmSystemTools::ReadRegistryValue(vc8sp1Registry, vc8sp1) && + !cmSystemTools::ReadRegistryValue(vc8exSP1Registry, vc8sp1)) + { + return ""; + } + + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 8.0 macros folder: + path = base + "/VSMacros80"; + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Generate() +{ + // Add a special target on which all other targets depend that + // checks the build system and optionally re-runs CMake. + const char* no_working_directory = 0; + std::vector<std::string> no_depends; + std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; + for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) + { + std::vector<cmLocalGenerator*>& generators = it->second; + if(!generators.empty()) + { + // Add the build-system check target to the first local + // generator of this project. + cmLocalVisualStudio7Generator* lg = + static_cast<cmLocalVisualStudio7Generator*>(generators[0]); + cmMakefile* mf = lg->GetMakefile(); + + // Skip the target if no regeneration is to be done. + if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION")) + { + continue; + } + + std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLines noCommandLines; + mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, + no_working_directory, no_depends, + noCommandLines); + cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + if(!tgt) + { + cmSystemTools::Error("Error adding target " + CMAKE_CHECK_BUILD_SYSTEM_TARGET); + continue; + } + + // Create a list of all stamp files for this project. + std::vector<std::string> stamps; + std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash(); + stampList += "generate.stamp.list"; + { + std::string stampListFile = + generators[0]->GetMakefile()->GetCurrentOutputDirectory(); + stampListFile += "/"; + stampListFile += stampList; + std::string stampFile; + cmGeneratedFileStream fout(stampListFile.c_str()); + for(std::vector<cmLocalGenerator*>::const_iterator + gi = generators.begin(); gi != generators.end(); ++gi) + { + stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory(); + stampFile += "/"; + stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); + stampFile += "generate.stamp"; + stampFile = generators[0]->Convert(stampFile.c_str(), + cmLocalGenerator::START_OUTPUT); + fout << stampFile << "\n"; + stamps.push_back(stampFile); + } + } + + // Add a custom rule to re-run CMake if any input files changed. + { + // Collect the input files used to generate all targets in this + // project. + std::vector<std::string> listFiles; + for(unsigned int j = 0; j < generators.size(); ++j) + { + cmMakefile* lmf = generators[j]->GetMakefile(); + listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(), + lmf->GetListFiles().end()); + } + // Sort the list of input files and remove duplicates. + std::sort(listFiles.begin(), listFiles.end(), + std::less<std::string>()); + std::vector<std::string>::iterator new_end = + std::unique(listFiles.begin(), listFiles.end()); + listFiles.erase(new_end, listFiles.end()); + + // Create a rule to re-run CMake. + std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash(); + stampName += "generate.stamp"; + const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLine commandLine; + commandLine.push_back(dsprule); + std::string argH = "-H"; + argH += lg->Convert(mf->GetHomeDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argH); + std::string argB = "-B"; + argB += lg->Convert(mf->GetHomeOutputDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argB); + commandLine.push_back("--check-stamp-list"); + commandLine.push_back(stampList.c_str()); + commandLine.push_back("--vs-solution-file"); + commandLine.push_back("\"$(SolutionPath)\""); + cmCustomCommandLines commandLines; + commandLines.push_back(commandLine); + + // Add the rule. Note that we cannot use the CMakeLists.txt + // file as the main dependency because it would get + // overwritten by the CreateVCProjBuildRule. + // (this could be avoided with per-target source files) + const char* no_main_dependency = 0; + const char* no_working_directory = 0; + mf->AddCustomCommandToOutput( + stamps, listFiles, + no_main_dependency, commandLines, "Checking Build System", + no_working_directory, true); + std::string ruleName = stamps[0]; + ruleName += ".rule"; + if(cmSourceFile* file = mf->GetSource(ruleName.c_str())) + { + tgt->AddSourceFile(file); + } + else + { + cmSystemTools::Error("Error adding rule for ", stamps[0].c_str()); + } + } + } + } + + // Now perform the main generation. + this->cmGlobalVisualStudio7Generator::Generate(); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8ExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_WindowsMobile_Generator::GetExtraFlagTableVS8() +{ + return cmVS8ExtraFlagTable; +} +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmWindowsMobileConfigParser::cmWindowsMobileConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmWindowsMobileConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); +// if(defs.PlatformName.find("ARMV4") != std::string::npos) { + this->platformVec.push_back(defs); + current_platform_valid = true; +// } else +// current_platform_valid = false; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmWindowsMobileConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_WindowsMobile_Generator::cmGlobalVisualStudio8_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + this->PlatformName = "Undefined Mobile Platform"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +// ouput standard header for dsw file +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 9.00\n"; + fout << "# Visual Studio 2005\n"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC80", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Configure() +{ + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + regkey += std::string("\\Setup\\VS;"); + + std::string base; + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmWindowsMobileConfigParser *parser = new cmWindowsMobileConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + std::vector<PlatformDefs> sdksfound = parser->getPlatforms(); + //platforms = parser->getPlatforms(); + delete parser; + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + cmake * c = this->GetCMakeInstance(); + + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; + + // HERE WE CIRCUMVENT THE NEED FOR A TOOLCHAIN FILE - WE SHOULD CHANGE THIS TO USE A TOOLCHAIN FILE + c->AddCacheEntry("CMAKE_SYSTEM_NAME", "WinCE", "Windows CE Define", 6); // 0 = bool, 3 = string + c->AddCacheEntry("CMAKE_SYSTEM_VERSION", "5.1", "Mobile Platform Version Define", 6); // #5.1 = WM5, 5.2 = WM6 + c->AddCacheEntry("CMAKE_SYSTEM_PROCESSOR", "ARMV4I", "Processor Define", 6); + c->AddCacheEntry("ARM", "1", "System Define", 6); + + c->AddCacheEntry("CMAKE_C_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + c->AddCacheEntry("CMAKE_CXX_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + + c->AddCacheEntry("CMAKE_CROSSCOMPILING","TRUE","Crosscompiling Flag",0); + c->AddCacheEntry("CMAKE_WINCE_STACKSIZE","65536,4096", "Stack Size Definition", 6); + + c->AddCacheEntry("WINCE_HOST_CMAKE_PATH", (base + std::string("/VC/ce")).c_str(),"Path to Visual Studio CE Path",1); + //c->AddCacheEntry("WINCE_SDK_CMAKE_PATH", "C:/Programme/Windows Mobile 5.0 SDK R2/PocketPC","Path to WinCE SDK",1); + //c->AddCacheEntry("WINVS_SDK_CMAKE_PATH", "C:/Programme/Microsoft SDKs/Windows/v6.0A/bin","Path to VS SDK",1); + + char buf[200]; + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_COMPILER", buf, "ARM cxx-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_COMPILER", buf, "ARM c-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_LINKER", buf, "ARM cxx-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_LINKER", buf, "ARM c-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_LINKER", buf, "ARM Linker",2); + sprintf(buf,"%s/bin/x86_arm/armasm.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_ASM_COMPILER", buf , "ARM Assembler",2); + //sprintf(buf,"%s/rc.exe",c->GetCacheDefinition("WINVS_SDK_CMAKE_PATH")); + //c->AddCacheEntry("CMAKE_RC_COMPILER", buf, "Resource Compiler",2); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + // Some VS8 sp0 versions cannot run macros. + // See http://support.microsoft.com/kb/928209 + const char* vc8sp1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926601;"; + const char* vc8exSP1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926748;"; + std::string vc8sp1; + if (!cmSystemTools::ReadRegistryValue(vc8sp1Registry, vc8sp1) && + !cmSystemTools::ReadRegistryValue(vc8exSP1Registry, vc8sp1)) + { + return ""; + } + + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 8.0 macros folder: + path = base + "/VSMacros80"; + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Generate() +{ + // Add a special target on which all other targets depend that + // checks the build system and optionally re-runs CMake. + const char* no_working_directory = 0; + std::vector<std::string> no_depends; + std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; + for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) + { + std::vector<cmLocalGenerator*>& generators = it->second; + if(!generators.empty()) + { + // Add the build-system check target to the first local + // generator of this project. + cmLocalVisualStudio7Generator* lg = + static_cast<cmLocalVisualStudio7Generator*>(generators[0]); + cmMakefile* mf = lg->GetMakefile(); + + // Skip the target if no regeneration is to be done. + if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION")) + { + continue; + } + + std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLines noCommandLines; + mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, + no_working_directory, no_depends, + noCommandLines); + cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + if(!tgt) + { + cmSystemTools::Error("Error adding target " + CMAKE_CHECK_BUILD_SYSTEM_TARGET); + continue; + } + + // Create a list of all stamp files for this project. + std::vector<std::string> stamps; + std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash(); + stampList += "generate.stamp.list"; + { + std::string stampListFile = + generators[0]->GetMakefile()->GetCurrentOutputDirectory(); + stampListFile += "/"; + stampListFile += stampList; + std::string stampFile; + cmGeneratedFileStream fout(stampListFile.c_str()); + for(std::vector<cmLocalGenerator*>::const_iterator + gi = generators.begin(); gi != generators.end(); ++gi) + { + stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory(); + stampFile += "/"; + stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); + stampFile += "generate.stamp"; + stampFile = generators[0]->Convert(stampFile.c_str(), + cmLocalGenerator::START_OUTPUT); + fout << stampFile << "\n"; + stamps.push_back(stampFile); + } + } + + // Add a custom rule to re-run CMake if any input files changed. + { + // Collect the input files used to generate all targets in this + // project. + std::vector<std::string> listFiles; + for(unsigned int j = 0; j < generators.size(); ++j) + { + cmMakefile* lmf = generators[j]->GetMakefile(); + listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(), + lmf->GetListFiles().end()); + } + // Sort the list of input files and remove duplicates. + std::sort(listFiles.begin(), listFiles.end(), + std::less<std::string>()); + std::vector<std::string>::iterator new_end = + std::unique(listFiles.begin(), listFiles.end()); + listFiles.erase(new_end, listFiles.end()); + + // Create a rule to re-run CMake. + std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash(); + stampName += "generate.stamp"; + const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLine commandLine; + commandLine.push_back(dsprule); + std::string argH = "-H"; + argH += lg->Convert(mf->GetHomeDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argH); + std::string argB = "-B"; + argB += lg->Convert(mf->GetHomeOutputDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argB); + commandLine.push_back("--check-stamp-list"); + commandLine.push_back(stampList.c_str()); + commandLine.push_back("--vs-solution-file"); + commandLine.push_back("\"$(SolutionPath)\""); + cmCustomCommandLines commandLines; + commandLines.push_back(commandLine); + + // Add the rule. Note that we cannot use the CMakeLists.txt + // file as the main dependency because it would get + // overwritten by the CreateVCProjBuildRule. + // (this could be avoided with per-target source files) + const char* no_main_dependency = 0; + const char* no_working_directory = 0; + mf->AddCustomCommandToOutput( + stamps, listFiles, + no_main_dependency, commandLines, "Checking Build System", + no_working_directory, true); + std::string ruleName = stamps[0]; + ruleName += ".rule"; + if(cmSourceFile* file = mf->GetSource(ruleName.c_str())) + { + tgt->AddSourceFile(file); + } + else + { + cmSystemTools::Error("Error adding rule for ", stamps[0].c_str()); + } + } + } + } + + // Now perform the main generation. + this->cmGlobalVisualStudio7Generator::Generate(); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8ExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_WindowsMobile_Generator::GetExtraFlagTableVS8() +{ + return cmVS8ExtraFlagTable; +} Index: Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h =================================================================== --- Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h (revision 0) +++ Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h (revision 0) @@ -0,0 +1,202 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_WindowsMobile_Generator_h +#define cmGlobalVisualStudio8_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio71Generator.h" + +#include "cmXMLParser.h" + +class cmWindowsMobileConfigParser : public cmXMLParser +{ +public: + cmWindowsMobileConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_WindowsMobile_Generator : public cmGlobalVisualStudio71Generator +{ +public: + cmGlobalVisualStudio8_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 - Windows Mobile";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + virtual void Generate(); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSLNHeader(std::ostream& fout); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + std::string PlatformName; // Win32 or x64 +}; +#endif +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_WindowsMobile_Generator_h +#define cmGlobalVisualStudio8_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio71Generator.h" + +#include "cmXMLParser.h" + +class cmWindowsMobileConfigParser : public cmXMLParser +{ +public: + cmWindowsMobileConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_WindowsMobile_Generator : public cmGlobalVisualStudio71Generator +{ +public: + cmGlobalVisualStudio8_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 - Windows Mobile";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + virtual void Generate(); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSLNHeader(std::ostream& fout); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + std::string PlatformName; // Win32 or x64 +}; +#endif Index: Source/cmGlobalVisualStudio8Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio8Generator.cxx (working copy) @@ -36,6 +36,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion8(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } @@ -341,6 +342,10 @@ cmVS7FlagTable::UserValueRequired}, // There is no YX option in the VS8 IDE. + // WHY WAS THIS REMOVED FROM VS7 to VS8? + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + // Exception handling mode. If no entries match, it will be FALSE. {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, Index: Source/cmGlobalVisualStudio8Generator.h =================================================================== --- Source/cmGlobalVisualStudio8Generator.h (revision 1) +++ Source/cmGlobalVisualStudio8Generator.h (working copy) @@ -67,7 +67,7 @@ virtual bool VSLinksDependencies() const { return false; } - static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); Index: Source/cmGlobalVisualStudio8Win64Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8Win64Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio8Win64Generator.cxx (working copy) @@ -34,6 +34,7 @@ lg->SetVersion8(); lg->SetPlatformName(this->PlatformName.c_str()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio9_SDKGenerator.cxx =================================================================== --- Source/cmGlobalVisualStudio9_SDKGenerator.cxx (revision 0) +++ Source/cmGlobalVisualStudio9_SDKGenerator.cxx (revision 0) @@ -0,0 +1,380 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio9_SDKGenerator::cmGlobalVisualStudio9_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS9SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "8", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio9_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS9SDKExtraLinkFlagTable; +} +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio9_SDKGenerator::cmGlobalVisualStudio9_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS9SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "8", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio9_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS9SDKExtraLinkFlagTable; +} Index: Source/cmGlobalVisualStudio9_SDKGenerator.h =================================================================== --- Source/cmGlobalVisualStudio9_SDKGenerator.h (revision 0) +++ Source/cmGlobalVisualStudio9_SDKGenerator.h (revision 0) @@ -0,0 +1,150 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_SDKGenerator_h +#define cmGlobalVisualStudio9_SDKGenerator_h + +#include "cmGlobalVisualStudio8_SDKGenerator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_SDKGenerator : + public cmGlobalVisualStudio8_SDKGenerator +{ +public: + cmGlobalVisualStudio9_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 (with SDK support)";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + + virtual void GetSDKsInstalled(); +}; +#endif +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_SDKGenerator_h +#define cmGlobalVisualStudio9_SDKGenerator_h + +#include "cmGlobalVisualStudio8_SDKGenerator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_SDKGenerator : + public cmGlobalVisualStudio8_SDKGenerator +{ +public: + cmGlobalVisualStudio9_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 (with SDK support)";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + + virtual void GetSDKsInstalled(); +}; +#endif Index: Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx (revision 0) +++ Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx (revision 0) @@ -0,0 +1,204 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + + +cmGlobalVisualStudio9_WindowsMobile_Generator::cmGlobalVisualStudio9_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8_WindowsMobile_Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + + +cmGlobalVisualStudio9_WindowsMobile_Generator::cmGlobalVisualStudio9_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8_WindowsMobile_Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} Index: Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h =================================================================== --- Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h (revision 0) +++ Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h (revision 0) @@ -0,0 +1,138 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_WindowsMobile_Generator_h +#define cmGlobalVisualStudio9_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_WindowsMobile_Generator : + public cmGlobalVisualStudio8_WindowsMobile_Generator +{ +public: + cmGlobalVisualStudio9_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 - Windows Mobile";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); +}; +#endif +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_WindowsMobile_Generator_h +#define cmGlobalVisualStudio9_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_WindowsMobile_Generator : + public cmGlobalVisualStudio8_WindowsMobile_Generator +{ +public: + cmGlobalVisualStudio9_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 - Windows Mobile";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); +}; +#endif Index: Source/cmGlobalVisualStudio9Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio9Generator.cxx (working copy) @@ -46,6 +46,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion9(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio9Win64Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9Win64Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio9Win64Generator.cxx (working copy) @@ -31,6 +31,7 @@ lg->SetVersion9(); lg->SetPlatformName(this->PlatformName.c_str()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmLocalVisualStudio7Generator.cxx =================================================================== --- Source/cmLocalVisualStudio7Generator.cxx (revision 1) +++ Source/cmLocalVisualStudio7Generator.cxx (working copy) @@ -536,9 +536,10 @@ bool& flag_handled); }; -void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, +void cmLocalVisualStudio7Generator::WritePlatformConfiguration(std::ostream& fout, const char* configName, const char *libName, + const char *platformName, cmTarget &target) { const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); @@ -546,9 +547,23 @@ { mfcFlag = "0"; } + + const char* wholeprogoptFlag; + if(strcmp(configName,"Release")==0) + wholeprogoptFlag = this->Makefile->GetDefinition("CMAKE_WHOLEPROGOPT_FLAG_RELEASE"); + else + wholeprogoptFlag = this->Makefile->GetDefinition("CMAKE_WHOLEPROGOPT_FLAG_DEBUG"); + if(!wholeprogoptFlag) + { + wholeprogoptFlag = "0"; + } + fout << "\t\t<Configuration\n" - << "\t\t\tName=\"" << configName << "|" << this->PlatformName << "\"\n" - << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + << "\t\t\tName=\"" << configName << "|" << platformName << "\"\n"; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + fout << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + else + fout << "\t\t\tOutputDirectory=\"" << platformName << "\\" << configName << "\"\n"; // This is an internal type to Visual Studio, it seems that: // 4 == static library // 2 == dll @@ -661,12 +676,15 @@ // target and a subdirectory for the configuration name. std::string intermediateDir = this->GetTargetDirectory(target); intermediateDir += "/"; + if(strcmp(platformName,"Win32") != 0 && strcmp(platformName,"x64") != 0) + intermediateDir += std::string(platformName) + "/"; intermediateDir += configName; fout << "\t\t\tIntermediateDirectory=\"" << this->ConvertToXMLOutputPath(intermediateDir.c_str()) << "\"\n" << "\t\t\tConfigurationType=\"" << configType << "\"\n" << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" + << "\t\t\tWholeProgramOptimization=\"" << wholeprogoptFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; // If unicode is enabled change the character set to unicode, if not @@ -737,9 +755,18 @@ { // We need to specify a program database file name even for // non-debug configurations because VS still creates .idb files. +if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) +{ fout << "\t\t\t\tProgramDataBaseFileName=\"" - << target.GetDirectory(configName) << "/" - << target.GetPDBName(configName) << "\"\n"; + << target.GetDirectory(configName) << "/"; +} +else +{ + fout << "\t\t\t\tProgramDataBaseFileName=\"" + << target.GetDirectory() << "/" << + std::string(platformName) << "/" << std::string(configName) << "/"; +} + fout << target.GetPDBName(configName) << "\"\n"; } fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool tool = "VCCustomBuildTool"; @@ -815,10 +842,28 @@ } this->OutputTargetRules(fout, configName, target, libName); - this->OutputBuildTool(fout, configName, target, targetOptions.IsDebug()); + this->OutputBuildTool(fout, configName, platformName, target, targetOptions.IsDebug()); fout << "\t\t</Configuration>\n"; } +void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, + const char* configName, + const char *libName, + cmTarget &target) +{ + if((this->PlatformName).compare("Mobile Platform") == 0) + { + cmGlobalVisualStudio7Generator *gg = static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator); + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + WritePlatformConfiguration(fout,configName,libName,(j->PlatformName).c_str(),target); + } + else + { + WritePlatformConfiguration(fout,configName,libName,(this->PlatformName).c_str(),target); + } +} + //---------------------------------------------------------------------------- std::string cmLocalVisualStudio7Generator @@ -837,6 +882,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, const char* configName, + const char* platformName, cmTarget &target, bool isDebug) { @@ -879,15 +925,25 @@ extraLinkOptions += " "; extraLinkOptions += targetLinkFlags; } - Options linkOptions(this, this->Version, Options::Linker); + Options linkOptions(this, this->Version, Options::Linker, this->ExtraLinkFlagTable); // MODIFIED BY CLEMENS linkOptions.Parse(extraLinkOptions.c_str()); switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: { std::string targetNameFull = target.GetFullName(configName); - std::string libpath = target.GetDirectory(configName); + std::string libpath; + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { + libpath = target.GetDirectory(configName); libpath += "/"; + } + else + { + libpath = target.GetDirectory(); + libpath += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } libpath += targetNameFull; const char* tool = "VCLibrarianTool"; if(this->FortranProject) @@ -937,15 +993,29 @@ fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " - << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) - << " "; + << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; temp = target.GetDirectory(configName); temp += "/"; + } + else + { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + + fout << "\t\t\t\tAdditionalDependencies=\" "; + this->Internal->OutputLibraries(fout, cli.GetItems()); + fout << "\"\n"; + fout << "\t\t\t\tDelayLoadDLLs=\"$(NOINHERIT)" << "\"\n"; + fout << "\t\t\t\tRandomizedBaseAddress=\"1" << "\"\n"; + fout << "\t\t\t\tDataExecutionPrevention=\"0" << "\"\n"; + } temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -955,8 +1025,17 @@ this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; this->OutputModuleDefinitionFile(fout, target); + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName); temp += "/"; + } + else + { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNamePDB; fout << "\t\t\t\tProgramDataBaseFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -972,8 +1051,17 @@ { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n"; } + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName, true); temp += "/"; + } + else + { + temp = target.GetDirectory("",true); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; @@ -1009,6 +1097,8 @@ } fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. @@ -1017,8 +1107,32 @@ << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; + } else + { + linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); + // Use the NOINHERIT macro to avoid getting VS project default + // libraries which may be set by the user to something bad. + fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " + << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) + << " "; + this->Internal->OutputLibraries(fout, cli.GetItems()); + fout << "\"\n"; + + fout << "\t\t\t\tDelayLoadDLLs=\"$(NOINHERIT)" << "\"\n"; + //fout << "\t\t\t\tSubSystem=\"0" << "\"\n"; + fout << "\t\t\t\tRandomizedBaseAddress=\"1" << "\"\n"; + fout << "\t\t\t\tDataExecutionPrevention=\"0" << "\"\n"; + } + if( strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0 || + strcmp(target.GetName(),"cmTryCompileExec") == 0 ) + // this is stupid hack to keep the try_compile stuff working for other platforms + { temp = target.GetDirectory(configName); temp += "/"; + } else { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -1027,13 +1141,23 @@ fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; - fout << "\t\t\t\tProgramDataBaseFile=\"" - << target.GetDirectory(configName) << "/" << targetNamePDB + fout << "\t\t\t\tProgramDataBaseFile=\""; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { + fout << target.GetDirectory(configName) << "/" << targetNamePDB << "\"\n"; + } + else + { + fout << target.GetDirectory() << "/" << + std::string(platformName) << "/" << std::string(configName) << "/" << targetNamePDB + << "\"\n"; + } if(isDebug) { fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"; } + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) { if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) { fout << "\t\t\t\tSubSystem=\"2\"\n"; @@ -1042,6 +1166,7 @@ { fout << "\t\t\t\tSubSystem=\"1\"\n"; } + } std::string stackVar = "CMAKE_"; stackVar += linkLanguage; stackVar += "_STACK_SIZE"; @@ -1050,8 +1175,18 @@ { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\""; } + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName, true); temp += "/"; + } + else + { + temp = target.GetDirectory("",true); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } + temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; @@ -1379,6 +1514,9 @@ dir_max += config_max; dir_max += "/"; + cmGlobalVisualStudio7Generator * gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + // Loop through each source in the source group. std::string objectName; for(std::vector<const cmSourceFile *>::const_iterator sf = @@ -1432,6 +1570,50 @@ fci = fcinfo.FileConfigMap.begin(); fci != fcinfo.FileConfigMap.end(); ++fci) { + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + { + cmLVS7GFileConfig const& fc = fci->second; + fout << "\t\t\t\t<FileConfiguration\n" + << "\t\t\t\t\tName=\"" << fci->first + << "|" << j->PlatformName << "\""; + if(fc.ExcludedFromBuild) + { + fout << " ExcludedFromBuild=\"true\""; + } + fout << ">\n"; + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n"; + if(!fc.CompileFlags.empty() || + !fc.CompileDefs.empty() || + !fc.CompileDefsConfig.empty()) + { + Options fileOptions(this, this->Version, Options::Compiler, + this->ExtraFlagTable); + fileOptions.Parse(fc.CompileFlags.c_str()); + fileOptions.AddDefines(fc.CompileDefs.c_str()); + fileOptions.AddDefines(fc.CompileDefsConfig.c_str()); + fileOptions.OutputAdditionalOptions(fout, "\t\t\t\t\t", "\n"); + fileOptions.OutputFlagMap(fout, "\t\t\t\t\t"); + fileOptions.OutputPreprocessorDefinitions(fout, + "\t\t\t\t\t", "\n"); + } + if(!fc.AdditionalDeps.empty()) + { + fout << "\t\t\t\t\tAdditionalDependencies=\"" + << fc.AdditionalDeps.c_str() << "\"\n"; + } + if(!fc.ObjectName.empty()) + { + fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" + << fc.ObjectName.c_str() << "\"\n"; + } + fout << "\t\t\t\t\t/>\n" + << "\t\t\t\t</FileConfiguration>\n"; + } + else + { cmLVS7GFileConfig const& fc = fci->second; fout << "\t\t\t\t<FileConfiguration\n" << "\t\t\t\t\tName=\"" << fci->first @@ -1471,6 +1653,7 @@ << "\t\t\t\t</FileConfiguration>\n"; } } + } fout << "\t\t\t</File>\n"; } } @@ -1499,9 +1682,9 @@ // Write the rule for each configuration. std::vector<std::string>::iterator i; - std::vector<std::string> *configs = - static_cast<cmGlobalVisualStudio7Generator *> - (this->GlobalGenerator)->GetConfigurations(); + cmGlobalVisualStudio7Generator * gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + std::vector<std::string> *configs = gg->GetConfigurations(); const char* compileTool = "VCCLCompilerTool"; if(this->FortranProject) { @@ -1514,6 +1697,83 @@ } for(i = configs->begin(); i != configs->end(); ++i) { + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + { + cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; + fout << "\t\t\t\t<FileConfiguration\n"; + fout << "\t\t\t\t\tName=\"" << *i << "|" << j->PlatformName << "\">\n"; + if(!fc.CompileFlags.empty()) + { + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << compileTool << "\"\n" + << "\t\t\t\t\tAdditionalOptions=\"" + << this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n"; + } + + std::string script = + this->ConstructScript(command.GetCommandLines(), + command.GetWorkingDirectory(), + i->c_str(), + command.GetEscapeOldStyle(), + command.GetEscapeAllowMakeVars()); + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << customTool << "\"\n" + << "\t\t\t\t\tDescription=\"" + << this->EscapeForXML(comment.c_str()) << "\"\n" + << "\t\t\t\t\tCommandLine=\"" + << this->EscapeForXML(script.c_str()) << "\"\n" + << "\t\t\t\t\tAdditionalDependencies=\""; + if(command.GetDepends().empty()) + { + // There are no real dependencies. Produce an artificial one to + // make sure the rule runs reliably. + if(!cmSystemTools::FileExists(source)) + { + std::ofstream depout(source); + depout << "Artificial dependency for a custom command.\n"; + } + fout << this->ConvertToXMLOutputPath(source); + } + else + { + // Write out the dependencies for the rule. + for(std::vector<std::string>::const_iterator d = + command.GetDepends().begin(); + d != command.GetDepends().end(); + ++d) + { + // Get the real name of the dependency in case it is a CMake target. + std::string dep = this->GetRealDependency(d->c_str(), i->c_str()); + fout << this->ConvertToXMLOutputPath(dep.c_str()) + << ";"; + } + } + fout << "\"\n"; + fout << "\t\t\t\t\tOutputs=\""; + if(command.GetOutputs().empty()) + { + fout << source << "_force"; + } + else + { + // Write a rule for the output generated by this command. + const char* sep = ""; + for(std::vector<std::string>::const_iterator o = + command.GetOutputs().begin(); + o != command.GetOutputs().end(); + ++o) + { + fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str()); + sep = ";"; + } + } + fout << "\"/>\n"; + fout << "\t\t\t\t</FileConfiguration>\n"; + } + else + { cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; fout << "\t\t\t\t<FileConfiguration\n"; fout << "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n"; @@ -1586,6 +1846,7 @@ fout << "\t\t\t\t</FileConfiguration>\n"; } } +} void cmLocalVisualStudio7Generator::WriteVCProjBeginGroup(std::ostream& fout, @@ -1789,13 +2050,19 @@ } if(projectType) { - fout << "\tProjectType=\"" << projectType << "\"\n"; + fout << "\tProjectType=\"" << projectType << "\">\n"; } fout<< "\tKeyword=\"" << keyword << "\">\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n" - << "\t<Platforms>\n" - << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" - << "\t</Platforms>\n"; + << "\t<Platforms>\n"; + + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + fout << "\t\t<Platform\n\t\t\tName=\"" << j->PlatformName << "\"/>\n"; + else + fout << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"; + fout << "\t</Platforms>\n"; } @@ -1850,9 +2117,15 @@ << "\tSccProvider=\"" << vsProvider << "\"\n"; } fout << "\tKeyword=\"" << keyword << "\">\n" - << "\t<Platforms>\n" - << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" - << "\t</Platforms>\n"; + << "\t<Platforms>\n"; + + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + fout << "\t\t<Platform\n\t\t\tName=\"" << j->PlatformName << "\"/>\n"; + else + fout << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"; + fout << "\t</Platforms>\n"; } Index: Source/cmLocalVisualStudio7Generator.h =================================================================== --- Source/cmLocalVisualStudio7Generator.h (revision 1) +++ Source/cmLocalVisualStudio7Generator.h (working copy) @@ -68,6 +68,8 @@ void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } + void SetExtraLinkFlagTable(cmVS7FlagTable const* table) + { this->ExtraLinkFlagTable = table; } private: typedef cmLocalVisualStudio7GeneratorOptions Options; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; @@ -85,6 +87,11 @@ void WriteVCProjFile(std::ostream& fout, const char *libName, cmTarget &tgt); cmSourceFile* CreateVCProjBuildRule(); + void WritePlatformConfiguration(std::ostream& fout, + const char* configName, + const char *libName, + const char *platformName, + cmTarget &target); void WriteConfigurations(std::ostream& fout, const char *libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, @@ -96,7 +103,7 @@ void OutputTargetRules(std::ostream& fout, const char* configName, cmTarget &target, const char *libName); void OutputBuildTool(std::ostream& fout, const char* configName, - cmTarget& t, bool debug); + const char* platformName, cmTarget& t, bool debug); void OutputLibraryDirectories(std::ostream& fout, std::vector<std::string> const& dirs); void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target); @@ -124,6 +131,7 @@ friend class cmLocalVisualStudio7GeneratorInternals; cmVS7FlagTable const* ExtraFlagTable; + cmVS7FlagTable const* ExtraLinkFlagTable; std::string ModuleDefinitionFile; int Version; bool FortranProject; Index: Source/cmMakefile.cxx =================================================================== --- Source/cmMakefile.cxx (revision 1) +++ Source/cmMakefile.cxx (working copy) @@ -21,6 +21,10 @@ #include "cmSourceFileLocation.h" #include "cmSystemTools.h" #include "cmGlobalGenerator.h" +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) +# include "cmGlobalVisualStudio9_SDKGenerator.h" +# include "cmGlobalVisualStudio8_SDKGenerator.h" +#endif #include "cmLocalGenerator.h" #include "cmCommands.h" #include "cmCacheManager.h" @@ -2755,8 +2759,9 @@ std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND"); cmake cm; cm.SetIsInTryCompile(true); - cmGlobalGenerator *gg = cm.CreateGlobalGenerator - (this->LocalGenerator->GetGlobalGenerator()->GetName()); + cmGlobalGenerator *parentgg = this->LocalGenerator->GetGlobalGenerator(); + std::string parentggname(parentgg->GetName()); + cmGlobalGenerator *gg = cm.CreateGlobalGenerator(parentggname.c_str()); if (!gg) { cmSystemTools::Error( @@ -2765,6 +2770,21 @@ cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; } + // check to update platforms list if it is an SDK based builder +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) + if(parentggname.compare(cmGlobalVisualStudio8_SDKGenerator::GetActualName()) == 0) + { // gg should inherit platform vector from parent + cmGlobalVisualStudio8_SDKGenerator* srcgg = static_cast<cmGlobalVisualStudio8_SDKGenerator*>(parentgg); + cmGlobalVisualStudio8_SDKGenerator* targg = static_cast<cmGlobalVisualStudio8_SDKGenerator*>(gg); + targg->filterSDKs(srcgg->GetPlatforms()); + } + else if(parentggname.compare(cmGlobalVisualStudio9_SDKGenerator::GetActualName()) == 0) + { // gg should inherit platform vector from parent + cmGlobalVisualStudio9_SDKGenerator* srcgg = static_cast<cmGlobalVisualStudio9_SDKGenerator*>(parentgg); + cmGlobalVisualStudio9_SDKGenerator* targg = static_cast<cmGlobalVisualStudio9_SDKGenerator*>(gg); + targg->filterSDKs(srcgg->GetPlatforms()); + } +#endif cm.SetGlobalGenerator(gg); // do a configure Index: Source/CTest/cmCTestScriptHandler.cxx =================================================================== --- Source/CTest/cmCTestScriptHandler.cxx (revision 1) +++ Source/CTest/cmCTestScriptHandler.cxx (working copy) @@ -335,6 +335,8 @@ // cmake instance and generators, and then reads in the script int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) { + cmSystemTools::ResetErrorOccuredFlag(); + // if the argument has a , in it then it needs to be broken into the fist // argument (which is the script) and the second argument which will be // passed into the scripts as S_ARG Index: Tests/CMakeLists.txt =================================================================== --- Tests/CMakeLists.txt (revision 1) +++ Tests/CMakeLists.txt (working copy) @@ -65,6 +65,19 @@ SET(CMAKE_LONG_TEST_TIMEOUT 1500) ENDIF(CMAKE_LONG_TEST_TIMEOUT LESS 1500) + CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/SimplePPC2003/CMakeCache.txt.in" + "${CMake_BINARY_DIR}/Tests/SimplePPC2003/CMakeCache.txt" COPYONLY + ) + ADD_TEST(SimplePPC2003 ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/SimplePPC2003" + "${CMake_BINARY_DIR}/Tests/SimplePPC2003" + --build-two-config + --build-generator "Visual Studio 9 2008 (with SDK support)" + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-project SimplePPC2003) + # add a bunch of standard build-and-test style tests ADD_TEST_MACRO(CommandLineTest CommandLineTest) ADD_TEST_MACRO(FindPackageTest FindPackageTest) @@ -429,6 +442,7 @@ --test-command Tutorial 25.0) ENDFOREACH(STP) + ADD_TEST(testing ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Testing" Index: Tests/SimplePPC2003/CMakeCache.txt.in =================================================================== --- Tests/SimplePPC2003/CMakeCache.txt.in (revision 0) +++ Tests/SimplePPC2003/CMakeCache.txt.in (revision 0) @@ -0,0 +1,10 @@ +//SDK to use +CMAKE_GENERATOR:INTERNAL=Visual Studio 9 2008 (with SDK support) +CMAKE_SYSTEM_NAME:STRING=WINCE +CMAKE_SYSTEM_VERSION:STRING=4.20 +PLATFORM_SDKS:STRING=Pocket PC 2003 (ARMV4) +//SDK to use +CMAKE_GENERATOR:INTERNAL=Visual Studio 9 2008 (with SDK support) +CMAKE_SYSTEM_NAME:STRING=WINCE +CMAKE_SYSTEM_VERSION:STRING=4.20 +PLATFORM_SDKS:STRING=Pocket PC 2003 (ARMV4) Index: Tests/SimplePPC2003/CMakeLists.txt =================================================================== --- Tests/SimplePPC2003/CMakeLists.txt (revision 0) +++ Tests/SimplePPC2003/CMakeLists.txt (revision 0) @@ -0,0 +1,28 @@ +# a simple test case for compiling a PPC 2003 project +PROJECT(SimplePPC2003) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(RESOURCEFILES resourceppc.h SimplePPC2003ppc.rc SimplePPC2003ppc.rc2) +SET(SOURCEFILES SimplePPC2003.cpp stdafx.cpp) +SET(HEADERFILES stdafx.h SimplePPC2003.h) + +ADD_DEFINITIONS(-DWINCE -D$(ARCHFAM) -D$(_ARCHFAM_) -D_UNICODE -DUNICODE -D_USRDLL ) + +ADD_EXECUTABLE(SimplePPC2003 ${RESOURCEFILES} ${SOURCEFILES} ${HEADERFILES}) + +SET_TARGET_PROPERTIES(SimplePPC2003 PROPERTIES LINK_FLAGS /machine:ARM) +# a simple test case for compiling a PPC 2003 project +PROJECT(SimplePPC2003) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(RESOURCEFILES resourceppc.h SimplePPC2003ppc.rc SimplePPC2003ppc.rc2) +SET(SOURCEFILES SimplePPC2003.cpp stdafx.cpp) +SET(HEADERFILES stdafx.h SimplePPC2003.h) + +ADD_DEFINITIONS(-DWINCE -D$(ARCHFAM) -D$(_ARCHFAM_) -D_UNICODE -DUNICODE -D_USRDLL ) + +ADD_EXECUTABLE(SimplePPC2003 ${RESOURCEFILES} ${SOURCEFILES} ${HEADERFILES}) + +SET_TARGET_PROPERTIES(SimplePPC2003 PROPERTIES LINK_FLAGS /machine:ARM) Index: Tests/SimplePPC2003/GetCompilerVersion.cmake =================================================================== --- Tests/SimplePPC2003/GetCompilerVersion.cmake (revision 0) +++ Tests/SimplePPC2003/GetCompilerVersion.cmake (revision 0) @@ -0,0 +1,190 @@ + +FIND_PROGRAM(CMAKE_VCVARS + NAMES vcvarsall.bat + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/VC" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC" + ) + +# Testing the machine type of the generated binaries: +FIND_PROGRAM(CMAKE_TEST_COMPILER + NAMES cl.exe + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/VC/bin" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + ) + +SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") +STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + +EXEC_PROGRAM("\"${CMAKE_VCVARS}\" && \"${CMAKE_TEST_COMPILER}\" /nologo -EP \"${testNmakeCLVersionFile}\"" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + +IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") +ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") +ENDIF(NOT CMAKE_COMPILER_RETURN) + +FIND_PROGRAM(CMAKE_VCVARS + NAMES vcvarsall.bat + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/VC" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC" + ) + +# Testing the machine type of the generated binaries: +FIND_PROGRAM(CMAKE_TEST_COMPILER + NAMES cl.exe + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/VC/bin" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + ) + +SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") +STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + +EXEC_PROGRAM("\"${CMAKE_VCVARS}\" && \"${CMAKE_TEST_COMPILER}\" /nologo -EP \"${testNmakeCLVersionFile}\"" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + +IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") +ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") +ENDIF(NOT CMAKE_COMPILER_RETURN) Index: Tests/SimplePPC2003/resourceppc.h =================================================================== --- Tests/SimplePPC2003/resourceppc.h (revision 0) +++ Tests/SimplePPC2003/resourceppc.h (revision 0) @@ -0,0 +1,68 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by SimplePPC2003ppc.rc +// + +#define IDS_APP_TITLE 1 +#define IDC_SIMPLEPPC2003 2 +#define IDI_SIMPLEPPC2003 101 +#define IDR_MENU 102 +#define IDS_OK 103 +#define IDS_HELP 104 +#define IDD_ABOUTBOX 105 +#define IDD_ABOUTBOX_WIDE 106 +#define IDC_STATIC_1 201 +#define IDC_STATIC_2 202 +#define IDC_STATIC_3 203 +#define IDM_OK 40000 +#define IDM_HELP 40001 +#define IDM_HELP_ABOUT 40002 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by SimplePPC2003ppc.rc +// + +#define IDS_APP_TITLE 1 +#define IDC_SIMPLEPPC2003 2 +#define IDI_SIMPLEPPC2003 101 +#define IDR_MENU 102 +#define IDS_OK 103 +#define IDS_HELP 104 +#define IDD_ABOUTBOX 105 +#define IDD_ABOUTBOX_WIDE 106 +#define IDC_STATIC_1 201 +#define IDC_STATIC_2 202 +#define IDC_STATIC_3 203 +#define IDM_OK 40000 +#define IDM_HELP 40001 +#define IDM_HELP_ABOUT 40002 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif Index: Tests/SimplePPC2003/SimplePPC2003.cpp =================================================================== --- Tests/SimplePPC2003/SimplePPC2003.cpp (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003.cpp (revision 0) @@ -0,0 +1,518 @@ +// SimplePPC2003.cpp : Defines the entry point for the application. +// + +#include "stdafx.h" +#include "SimplePPC2003.h" + + +#define MAX_LOADSTRING 100 + +// Global Variables: +HINSTANCE g_hInst; // current instance +HWND g_hWndMenuBar; // menu bar handle + +// Forward declarations of functions included in this code module: +ATOM MyRegisterClass(HINSTANCE, LPTSTR); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); + +int WINAPI WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Perform application initialization: + if (!InitInstance(hInstance, nCmdShow)) + { + return FALSE; + } + + HACCEL hAccelTable; + hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SIMPLEPPC2003)); + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return (int) msg.wParam; +} + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +// COMMENTS: +// +ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SIMPLEPPC2003)); + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = 0; + wc.lpszClassName = szWindowClass; + + return RegisterClass(&wc); +} + +// +// FUNCTION: InitInstance(HINSTANCE, int) +// +// PURPOSE: Saves instance handle and creates main window +// +// COMMENTS: +// +// In this function, we save the instance handle in a global variable and +// create and display the main program window. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[MAX_LOADSTRING]; // title bar text + TCHAR szWindowClass[MAX_LOADSTRING]; // main window class name + + g_hInst = hInstance; // Store instance handle in our global variable + + // SHInitExtraControls should be called once during your application's initialization to initialize any + // of the device specific controls such as CAPEDIT and SIPPREF. + SHInitExtraControls(); + + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadString(hInstance, IDC_SIMPLEPPC2003, szWindowClass, MAX_LOADSTRING); + + //If it is already running, then focus on the window, and exit + hWnd = FindWindow(szWindowClass, szTitle); + if (hWnd) + { + // set focus to foremost child window + // The "| 0x00000001" is used to bring any owned windows to the foreground and + // activate them. + SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001)); + return 0; + } + + if (!MyRegisterClass(hInstance, szWindowClass)) + { + return FALSE; + } + + hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + // When the main window is created using CW_USEDEFAULT the height of the menubar (if one + // is created is not taken into account). So we resize the window after creating it + // if a menubar is present + if (g_hWndMenuBar) + { + RECT rc; + RECT rcMenuBar; + + GetWindowRect(hWnd, &rc); + GetWindowRect(g_hWndMenuBar, &rcMenuBar); + rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top); + + MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE); + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + + return TRUE; +} + +// +// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// PURPOSE: Processes messages for the main window. +// +// WM_COMMAND - process the application menu +// WM_PAINT - Paint the main window +// WM_DESTROY - post a quit message and return +// +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + + static SHACTIVATEINFO s_sai; + + switch (message) + { + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) + { + case IDM_HELP_ABOUT: + DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); + break; + case IDM_OK: + SendMessage (hWnd, WM_CLOSE, 0, 0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + case WM_CREATE: + SHMENUBARINFO mbi; + + memset(&mbi, 0, sizeof(SHMENUBARINFO)); + mbi.cbSize = sizeof(SHMENUBARINFO); + mbi.hwndParent = hWnd; + mbi.nToolBarId = IDR_MENU; + mbi.hInstRes = g_hInst; + + if (!SHCreateMenuBar(&mbi)) + { + g_hWndMenuBar = NULL; + } + else + { + g_hWndMenuBar = mbi.hwndMB; + } + + // Initialize the shell activate info structure + memset(&s_sai, 0, sizeof (s_sai)); + s_sai.cbSize = sizeof (s_sai); + break; + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + + // TODO: Add any drawing code here... + + EndPaint(hWnd, &ps); + break; + case WM_DESTROY: + CommandBar_Destroy(g_hWndMenuBar); + PostQuitMessage(0); + break; + + case WM_ACTIVATE: + // Notify shell of our activate message + SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); + break; + case WM_SETTINGCHANGE: + SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + +// Message handler for about box. +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + { + // Create a Done button and size it. + SHINITDLGINFO shidi; + shidi.dwMask = SHIDIM_FLAGS; + shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU; + shidi.hDlg = hDlg; + SHInitDialog(&shidi); + } + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) + { + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + } + break; + + case WM_CLOSE: + EndDialog(hDlg, message); + return TRUE; + + } + return (INT_PTR)FALSE; +} +// SimplePPC2003.cpp : Defines the entry point for the application. +// + +#include "stdafx.h" +#include "SimplePPC2003.h" + + +#define MAX_LOADSTRING 100 + +// Global Variables: +HINSTANCE g_hInst; // current instance +HWND g_hWndMenuBar; // menu bar handle + +// Forward declarations of functions included in this code module: +ATOM MyRegisterClass(HINSTANCE, LPTSTR); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); + +int WINAPI WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Perform application initialization: + if (!InitInstance(hInstance, nCmdShow)) + { + return FALSE; + } + + HACCEL hAccelTable; + hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SIMPLEPPC2003)); + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return (int) msg.wParam; +} + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +// COMMENTS: +// +ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SIMPLEPPC2003)); + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = 0; + wc.lpszClassName = szWindowClass; + + return RegisterClass(&wc); +} + +// +// FUNCTION: InitInstance(HINSTANCE, int) +// +// PURPOSE: Saves instance handle and creates main window +// +// COMMENTS: +// +// In this function, we save the instance handle in a global variable and +// create and display the main program window. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[MAX_LOADSTRING]; // title bar text + TCHAR szWindowClass[MAX_LOADSTRING]; // main window class name + + g_hInst = hInstance; // Store instance handle in our global variable + + // SHInitExtraControls should be called once during your application's initialization to initialize any + // of the device specific controls such as CAPEDIT and SIPPREF. + SHInitExtraControls(); + + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadString(hInstance, IDC_SIMPLEPPC2003, szWindowClass, MAX_LOADSTRING); + + //If it is already running, then focus on the window, and exit + hWnd = FindWindow(szWindowClass, szTitle); + if (hWnd) + { + // set focus to foremost child window + // The "| 0x00000001" is used to bring any owned windows to the foreground and + // activate them. + SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001)); + return 0; + } + + if (!MyRegisterClass(hInstance, szWindowClass)) + { + return FALSE; + } + + hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + // When the main window is created using CW_USEDEFAULT the height of the menubar (if one + // is created is not taken into account). So we resize the window after creating it + // if a menubar is present + if (g_hWndMenuBar) + { + RECT rc; + RECT rcMenuBar; + + GetWindowRect(hWnd, &rc); + GetWindowRect(g_hWndMenuBar, &rcMenuBar); + rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top); + + MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE); + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + + return TRUE; +} + +// +// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// PURPOSE: Processes messages for the main window. +// +// WM_COMMAND - process the application menu +// WM_PAINT - Paint the main window +// WM_DESTROY - post a quit message and return +// +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + + static SHACTIVATEINFO s_sai; + + switch (message) + { + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) + { + case IDM_HELP_ABOUT: + DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); + break; + case IDM_OK: + SendMessage (hWnd, WM_CLOSE, 0, 0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + case WM_CREATE: + SHMENUBARINFO mbi; + + memset(&mbi, 0, sizeof(SHMENUBARINFO)); + mbi.cbSize = sizeof(SHMENUBARINFO); + mbi.hwndParent = hWnd; + mbi.nToolBarId = IDR_MENU; + mbi.hInstRes = g_hInst; + + if (!SHCreateMenuBar(&mbi)) + { + g_hWndMenuBar = NULL; + } + else + { + g_hWndMenuBar = mbi.hwndMB; + } + + // Initialize the shell activate info structure + memset(&s_sai, 0, sizeof (s_sai)); + s_sai.cbSize = sizeof (s_sai); + break; + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + + // TODO: Add any drawing code here... + + EndPaint(hWnd, &ps); + break; + case WM_DESTROY: + CommandBar_Destroy(g_hWndMenuBar); + PostQuitMessage(0); + break; + + case WM_ACTIVATE: + // Notify shell of our activate message + SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); + break; + case WM_SETTINGCHANGE: + SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + +// Message handler for about box. +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + { + // Create a Done button and size it. + SHINITDLGINFO shidi; + shidi.dwMask = SHIDIM_FLAGS; + shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU; + shidi.hDlg = hDlg; + SHInitDialog(&shidi); + } + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) + { + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + } + break; + + case WM_CLOSE: + EndDialog(hDlg, message); + return TRUE; + + } + return (INT_PTR)FALSE; +} Index: Tests/SimplePPC2003/SimplePPC2003.h =================================================================== --- Tests/SimplePPC2003/SimplePPC2003.h (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003.h (revision 0) @@ -0,0 +1,4 @@ +#pragma once +#include "resourceppc.h" +#pragma once +#include "resourceppc.h" Index: Tests/SimplePPC2003/SimplePPC2003ppc.rc =================================================================== --- Tests/SimplePPC2003/SimplePPC2003ppc.rc (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003ppc.rc (revision 0) @@ -0,0 +1,340 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resourceppc.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#include "resdefce.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +//IDI_SIMPLEPPC2003 ICON "SimplePPC2003.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "Help" + BEGIN + MENUITEM "About", IDM_HELP_ABOUT + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_SIMPLEPPC2003 ACCELERATORS +BEGIN + "A", IDM_HELP_ABOUT, VIRTKEY, CONTROL, NOINVERT + "Q", IDM_OK, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG 0, 0, 156, 129 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_CAPTIONOKBTN +CAPTION "About SimplePPC2003" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SIMPLEPPC2003,IDC_STATIC_1,12,12,21,20,SS_REALSIZEIMAGE + LTEXT "SimplePPC2003 Version 1.0",IDC_STATIC_2,12,36,70,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC_3,12,48,66,8 +END + +IDD_ABOUTBOX_WIDE DIALOG 0, 0, 210, 129 +STYLE WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_CAPTIONOKBTN +CAPTION "About SimplePPC2003" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SIMPLEPPC2003,IDC_STATIC_1,12,12,21,20,SS_REALSIZEIMAGE + LTEXT "SimplePPC2003 Version 1.0",IDC_STATIC_2,48,12,66,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC_3,48,24,66,8 +END + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 149 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END + + IDD_ABOUTBOX_WIDE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END +END +#endif // APSTUDIO_INVOKED + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// +1 TEXTINCLUDE +BEGIN + "resourceppc.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#include ""resdefce.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""SimplePPC2003ppc.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// +STRINGTABLE +BEGIN + IDC_SIMPLEPPC2003 "SIMPLEPPC2003" + IDS_APP_TITLE "SimplePPC2003" + IDS_OK "OK" + IDS_HELP "HELP" +END + +#endif +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "SimplePPC2003ppc.rc2" // non-Microsoft Visual C++ edited resources +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED +//Microsoft Visual C++ generated resource script. +// +#include "resourceppc.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#include "resdefce.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +//IDI_SIMPLEPPC2003 ICON "SimplePPC2003.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "Help" + BEGIN + MENUITEM "About", IDM_HELP_ABOUT + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_SIMPLEPPC2003 ACCELERATORS +BEGIN + "A", IDM_HELP_ABOUT, VIRTKEY, CONTROL, NOINVERT + "Q", IDM_OK, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG 0, 0, 156, 129 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_CAPTIONOKBTN +CAPTION "About SimplePPC2003" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SIMPLEPPC2003,IDC_STATIC_1,12,12,21,20,SS_REALSIZEIMAGE + LTEXT "SimplePPC2003 Version 1.0",IDC_STATIC_2,12,36,70,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC_3,12,48,66,8 +END + +IDD_ABOUTBOX_WIDE DIALOG 0, 0, 210, 129 +STYLE WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_CAPTIONOKBTN +CAPTION "About SimplePPC2003" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SIMPLEPPC2003,IDC_STATIC_1,12,12,21,20,SS_REALSIZEIMAGE + LTEXT "SimplePPC2003 Version 1.0",IDC_STATIC_2,48,12,66,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC_3,48,24,66,8 +END + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 149 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END + + IDD_ABOUTBOX_WIDE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END +END +#endif // APSTUDIO_INVOKED + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// +1 TEXTINCLUDE +BEGIN + "resourceppc.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#include ""resdefce.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""SimplePPC2003ppc.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// +STRINGTABLE +BEGIN + IDC_SIMPLEPPC2003 "SIMPLEPPC2003" + IDS_APP_TITLE "SimplePPC2003" + IDS_OK "OK" + IDS_HELP "HELP" +END + +#endif +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "SimplePPC2003ppc.rc2" // non-Microsoft Visual C++ edited resources +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED Index: Tests/SimplePPC2003/SimplePPC2003ppc.rc2 =================================================================== --- Tests/SimplePPC2003/SimplePPC2003ppc.rc2 (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003ppc.rc2 (revision 0) @@ -0,0 +1,70 @@ +// +// SimplePPC2003PPC.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// +HI_RES_AWARE CEUX {1} // turn off the emulation layer + // Remove this resource to enable pixel- + // doubling on platforms that support it +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// +// SHMENUBAR +// + +IDR_MENU SHMENUBAR DISCARDABLE +BEGIN + IDR_MENU, + 2, + + I_IMAGENONE, IDM_OK, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, + IDS_OK, 0, NOMENU, + + I_IMAGENONE, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, + IDS_HELP, 0, 0, +END + +// +// SimplePPC2003PPC.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// +HI_RES_AWARE CEUX {1} // turn off the emulation layer + // Remove this resource to enable pixel- + // doubling on platforms that support it +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// +// SHMENUBAR +// + +IDR_MENU SHMENUBAR DISCARDABLE +BEGIN + IDR_MENU, + 2, + + I_IMAGENONE, IDM_OK, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, + IDS_OK, 0, NOMENU, + + I_IMAGENONE, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, + IDS_HELP, 0, 0, +END + Index: Tests/SimplePPC2003/stdafx.cpp =================================================================== --- Tests/SimplePPC2003/stdafx.cpp (revision 0) +++ Tests/SimplePPC2003/stdafx.cpp (revision 0) @@ -0,0 +1,16 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimplePPC2003.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file +// stdafx.cpp : source file that includes just the standard includes +// SimplePPC2003.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file Index: Tests/SimplePPC2003/stdafx.h =================================================================== --- Tests/SimplePPC2003/stdafx.h (revision 0) +++ Tests/SimplePPC2003/stdafx.h (revision 0) @@ -0,0 +1,124 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#pragma comment(linker, "/nodefaultlib:libc.lib") +#pragma comment(linker, "/nodefaultlib:libcd.lib") + +// NOTE - this value is not strongly correlated to the Windows CE OS version being targeted +#define WINVER _WIN32_WCE + +#include <ceconfig.h> +#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) +#define SHELL_AYGSHELL +#endif + +#ifdef _CE_DCOM +#define _ATL_APARTMENT_THREADED +#endif + +#include <windows.h> +#include <commctrl.h> + +#include <aygshell.h> +#pragma comment(lib, "aygshell.lib") + + +// Windows Header Files: +#include <windows.h> + +// C RunTime Header Files +#include <stdlib.h> +#include <malloc.h> +#include <memory.h> +#include <tchar.h> + +#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) +#ifndef _DEVICE_RESOLUTION_AWARE +#define _DEVICE_RESOLUTION_AWARE +#endif +#endif + +#ifdef _DEVICE_RESOLUTION_AWARE +#include "DeviceResolutionAware.h" +#endif + +#if _WIN32_WCE < 0x500 && ( defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) ) + #pragma comment(lib, "ccrtrtti.lib") + #ifdef _X86_ + #if defined(_DEBUG) + #pragma comment(lib, "libcmtx86d.lib") + #else + #pragma comment(lib, "libcmtx86.lib") + #endif + #endif +#endif + +#include <altcecrt.h> + +// TODO: reference additional headers your program requires here +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#pragma comment(linker, "/nodefaultlib:libc.lib") +#pragma comment(linker, "/nodefaultlib:libcd.lib") + +// NOTE - this value is not strongly correlated to the Windows CE OS version being targeted +#define WINVER _WIN32_WCE + +#include <ceconfig.h> +#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) +#define SHELL_AYGSHELL +#endif + +#ifdef _CE_DCOM +#define _ATL_APARTMENT_THREADED +#endif + +#include <windows.h> +#include <commctrl.h> + +#include <aygshell.h> +#pragma comment(lib, "aygshell.lib") + + +// Windows Header Files: +#include <windows.h> + +// C RunTime Header Files +#include <stdlib.h> +#include <malloc.h> +#include <memory.h> +#include <tchar.h> + +#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) +#ifndef _DEVICE_RESOLUTION_AWARE +#define _DEVICE_RESOLUTION_AWARE +#endif +#endif + +#ifdef _DEVICE_RESOLUTION_AWARE +#include "DeviceResolutionAware.h" +#endif + +#if _WIN32_WCE < 0x500 && ( defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) ) + #pragma comment(lib, "ccrtrtti.lib") + #ifdef _X86_ + #if defined(_DEBUG) + #pragma comment(lib, "libcmtx86d.lib") + #else + #pragma comment(lib, "libcmtx86.lib") + #endif + #endif +#endif + +#include <altcecrt.h> + +// TODO: reference additional headers your program requires here cmake-2.6.4_new_040609.diff [^] (149,456 bytes) 2009-06-04 08:58 [Show Content] [Hide Content] Index: Modules/CMakeCCompilerABI.c =================================================================== --- Modules/CMakeCCompilerABI.c (revision 1) +++ Modules/CMakeCCompilerABI.c (working copy) @@ -26,3 +26,16 @@ (void)argv; return require; } + +#ifndef __CLASSIC_C__ +int mainCRTStartup(int argc, char* argv[]) +{ + int require = 0; + require += info_sizeof_dptr[argc]; +#if defined(ABI_ID) + require += info_abi[argc]; +#endif + (void)argv; + return require; +} +#endif Index: Modules/CMakeCXXCompilerABI.cpp =================================================================== --- Modules/CMakeCXXCompilerABI.cpp (revision 1) +++ Modules/CMakeCXXCompilerABI.cpp (working copy) @@ -18,3 +18,14 @@ (void)argv; return require; } + +int mainCRTStartup(int argc, char* argv[]) +{ + int require = 0; + require += info_sizeof_dptr[argc]; +#if defined(ABI_ID) + require += info_abi[argc]; +#endif + (void)argv; + return require; +} Index: Modules/CMakeTestCCompiler.cmake =================================================================== --- Modules/CMakeTestCCompiler.cmake (revision 1) +++ Modules/CMakeTestCCompiler.cmake (working copy) @@ -17,7 +17,13 @@ "#else\n" "int main(int argc, char* argv[])\n" "#endif\n" - "{ return argc-1;}\n") + "{ return argc-1;}\n\n" + "#if defined(_MSC_VER)\n" + "int mainCRTStartup(int argc, char* argv[])\n" + "{ return argc-1;}\n" + "#endif //MSC_VER \n" + ) + TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c OUTPUT_VARIABLE OUTPUT) Index: Modules/CMakeTestCXXCompiler.cmake =================================================================== --- Modules/CMakeTestCXXCompiler.cmake (revision 1) +++ Modules/CMakeTestCXXCompiler.cmake (working copy) @@ -10,7 +10,12 @@ "#ifndef __cplusplus\n" "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n" "#endif\n" - "int main(){return 0;}\n") + "int main(){return 0;}\n\n" + "#if defined(_MSC_VER)\n" + "int mainCRTStartup(int argc, char* argv[])\n" + "{ return argc-1;}\n" + "#endif //MSC_VER \n" + ) TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx OUTPUT_VARIABLE OUTPUT) Index: Modules/FindMatlab.cmake =================================================================== --- Modules/FindMatlab.cmake (revision 1) +++ Modules/FindMatlab.cmake (working copy) @@ -21,9 +21,41 @@ # Same here, there are also: bcc50 and bcc51 directories SET(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/bcc54") ELSE(${CMAKE_GENERATOR} MATCHES "Borland") - IF(MATLAB_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}") - ENDIF(MATLAB_FIND_REQUIRED) + IF( ${CMAKE_GENERATOR} MATCHES "Visual Studio 8" OR + ${CMAKE_GENERATOR} MATCHES "Visual Studio 9") + FIND_FILE(MATLAB_EXECUTABLE + NAMES matlab.exe + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.5;MATLABROOT]/bin + [HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.6;MATLABROOT]/bin + [HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.7;MATLABROOT]/bin + ) + IF(NOT MATLAB_EXECUTABLE) + MESSAGE(FATAL_ERROR "Matlab was not found!") + ENDIF(NOT MATLAB_EXECUTABLE) + + GET_FILENAME_COMPONENT(MATLAB_PATH ${MATLAB_EXECUTABLE} PATH) + + SET(MATLAB_ROOT "${MATLAB_PATH}/../extern/lib/win32/microsoft") + SET(MATLAB_BITS 32) + IF(EXISTS ${MATLAB_ROOT}) + FIND_LIBRARY(TESTLIB + libmex + PATHS + ${MATLAB_ROOT} + ) + IF(NOT TESTLIB) + MESSAGE(STATUS "32-bit Matlab libraries not found. Searching for 64-bit...") + SET(MATLAB_ROOT "${MATLAB_PATH}/../extern/lib/win64/microsoft") + SET(MATLAB_BITS 64) + ENDIF(NOT TESTLIB) + ELSE(EXISTS ${MATLAB_ROOT}) + MESSAGE(STATUS "32-bit libraries not found. Searching for 64-bit...") + SET(MATLAB_ROOT "${MATLAB_PATH}/../extern/lib/win64/microsoft") + SET(MATLAB_BITS 64) + ENDIF(EXISTS ${MATLAB_ROOT}) + ENDIF( ${CMAKE_GENERATOR} MATCHES "Visual Studio 8" OR + ${CMAKE_GENERATOR} MATCHES "Visual Studio 9") ENDIF(${CMAKE_GENERATOR} MATCHES "Borland") ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 7") ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") @@ -42,7 +74,7 @@ FIND_PATH(MATLAB_INCLUDE_DIR "mex.h" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/include" + "${MATLAB_PATH}/../extern/include" ) ELSE( WIN32 ) IF(CMAKE_SIZEOF_VOID_P EQUAL 4) @@ -104,5 +136,6 @@ MATLAB_INCLUDE_DIR MATLAB_FOUND MATLAB_ROOT + MATLAB_BITS ) Index: Modules/Platform/Generic-Windows-cl.cmake =================================================================== --- Modules/Platform/Generic-Windows-cl.cmake (revision 0) +++ Modules/Platform/Generic-Windows-cl.cmake (revision 0) @@ -0,0 +1,355 @@ +# try to load any previously computed information for C on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) +# try to load any previously computed information for CXX on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) + +SET(WIN32 1) + +INCLUDE(Platform/cl) + + +IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") + SET (CMAKE_NO_BUILD_TYPE 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") +IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") + SET (CMAKE_NO_BUILD_TYPE 1) + SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING + "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") + MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES) +ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") +# does the compiler support pdbtype and is it the newer compiler +IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") +IF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + + +# make sure to enable languages after setting configuration types +ENABLE_LANGUAGE(RC) +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") + +# for nmake we need to compute some information about the compiler +# that is being used. +# the compiler may be free command line, 6, 7, or 71, and +# each have properties that must be determined. +# to avoid running these tests with each cmake run, the +# test results are saved in CMakeCPlatform.cmake, a file +# that is automatically copied into try_compile directories +# by the global generator. +SET(MSVC_IDE 1) +IF(CMAKE_GENERATOR MATCHES "Makefiles") + SET(MSVC_IDE 0) + IF(NOT CMAKE_VC_COMPILER_TESTS_RUN) + SET(CMAKE_VC_COMPILER_TESTS 1) + SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") + STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + MESSAGE(STATUS "Check for CL compiler version") + SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) + IF (NOT CMAKE_C_COMPILER) + SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) + ENDIF(NOT CMAKE_C_COMPILER) + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} + ARGS /nologo -EP \"${testNmakeCLVersionFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") + ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + ENDIF(NOT CMAKE_COMPILER_RETURN) + # try to figure out if we are running the free command line + # tools from Microsoft. These tools do not provide debug libraries, + # so the link flags used have to be different. + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2") + SET(testForFreeVCFile + "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx") + STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}") + MESSAGE(STATUS "Check if this is a free VC compiler") + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2 + ARGS /nologo /MD /EHsc + \"${testForFreeVCFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if this is a free VC compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - yes") + SET(CMAKE_USING_VC_FREE_TOOLS 1) + ELSE(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if this is a free VC compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - no") + SET(CMAKE_USING_VC_FREE_TOOLS 0) + ENDIF(CMAKE_COMPILER_RETURN) + + # Testing the machine type of the generated binaries: + FIND_PROGRAM(CMAKE_DUMPBIN + NAMES dumpbin + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/VC/bin" + "/Program Files/Microsoft Visual Studio 8/VC/bin/" + "/Program Files/Microsoft Visual Studio 9/VC/bin/" + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio .NET/VC/bin" + "c:/Program Files/Microsoft Visual Studio.NET/VC/bin" + "/Program Files/Microsoft Visual Studio .NET/VC/bin/" + ) + + MESSAGE(STATUS "Check CL platform:") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking CL platform using dumpbin ${CMAKE_DUMPBIN}" ) + IF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Dumpbin found as ${CMAKE_DUMPBIN}\n" ) + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") + SET(testForCLMachineType + "${CMAKE_ROOT}/Modules/CMakeTestCLMachineType.c") + SET(testForCLMachineTypeOutput CMakeTestCLMachineType.obj) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "\n\nRunning cl: ${CMAKE_C_COMPILER} -c \"${testForCLMachineType}\" " ) + EXECUTE_PROCESS(COMMAND "${CMAKE_C_COMPILER}" -c "${testForCLMachineType}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + ERROR_VARIABLE testForCLMachineType_DUMP + OUTPUT_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n\nRunning dumpbin: ${CMAKE_DUMPBIN} /HEADERS ${testForCLMachineType}" ) + EXECUTE_PROCESS(COMMAND "${CMAKE_DUMPBIN}" /HEADERS ${testForCLMachineTypeOutput} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3" + OUTPUT_VARIABLE testForCLMachineType_DUMPBIN_OUTPUT + ERROR_VARIABLE testForCLMachineType_DUMP + ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${testForCLMachineType_DUMP}\n${testForCLMachineType_DUMPBIN_OUTPUT}" ) + STRING(REGEX MATCH "machine \\(([^\\)]*)\\)" DUMPBIN_REGEX_RESULT ${testForCLMachineType_DUMPBIN_OUTPUT}) + SET(CMAKE_CL_MACHINE_TYPE ${CMAKE_MATCH_1}) + + ELSE(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + MESSAGE(Status "Check CL platform: dumpbin.exe was not found - assuimg i386") + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(NOT CMAKE_DUMPBIN STREQUAL CMAKE_DUMPBIN-NOTFOUND) + + ## TODO add further dumpbin machine to visual studio machine type conversion here: + IF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + SET(CMAKE_CL_MACHINE_TYPE i386) + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL x86) + IF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + IF(NOT CMAKE_FORCE_NON_THUMB) + SET(CMAKE_CL_MACHINE_TYPE THUMB) + ENDIF(NOT CMAKE_FORCE_NON_THUMB) + ENDIF(CMAKE_CL_MACHINE_TYPE MATCHES ARM) + + MESSAGE(STATUS "Check CL platform: ${CMAKE_CL_MACHINE_TYPE}" ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "CL platform seems to be:${CMAKE_CL_MACHINE_TYPE}" ) + ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN) +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + +IF(CMAKE_FORCE_WIN64) + SET(CMAKE_CL_MACHINE_TYPE x64) +ENDIF(CMAKE_FORCE_WIN64) + + +# default to Debug builds +IF(MSVC_VERSION GREATER 1310) + # for 2005 make sure the manifest is put in the dll with mt + SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") + # create a C shared library + SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + # create a C shared module just copy the shared library rule + SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") + SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") + SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") + + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") + ENDIF(WINCE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /MANIFEST") +ELSE(MSVC_VERSION GREATER 1310) + IF(CMAKE_USING_VC_FREE_TOOLS) + MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available") + SET(CMAKE_BUILD_TYPE_INIT Release) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + ELSE(CMAKE_USING_VC_FREE_TOOLS) + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + ENDIF(CMAKE_USING_VC_FREE_TOOLS) + IF(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ws2.lib mmtimer.lib") + ELSE(WINCE) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + ENDIF(WINCE) +ENDIF(MSVC_VERSION GREATER 1310) + +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") + +IF(NOT CMAKE_WINDOWS_STACKSIZE) + SET(CMAKE_WINDOWS_STACKSIZE 10000000) ## 10MB is a reasonable default? +ENDIF(NOT CMAKE_WINDOWS_STACKSIZE) + +SET (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:${CMAKE_WINDOWS_STACKSIZE}" ) + +# machine type +IF(CMAKE_GENERATOR MATCHES "Makefiles") +## Setting machine makes only sense when linking cross compiled binaries with makefiles? + IF(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${CMAKE_CL_MACHINE_TYPE}") + ELSE(CMAKE_CL_MACHINE_TYPE) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:i386") + ENDIF(CMAKE_CL_MACHINE_TYPE) + + # append /ARMPADCODE + IF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /ARMPADCODE ") + ENDIF(CMAKE_CL_MACHINE_TYPE STREQUAL thumb) + +ELSE(CMAKE_GENERATOR MATCHES "Makefiles") + + IF(CMAKE_FORCE_WIN64) + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:x64") + ENDIF(CMAKE_FORCE_WIN64) + +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + + +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp +# on versions that support it +IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") +ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /INCREMENTAL:YES") +ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) +# for release and minsize release default to no incremental linking +SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") + +# copy the EXE_LINKER flags to SHARED and MODULE linker flags +# shared linker flags +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) +# module linker flags +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) + + +# save computed information for this platform +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + Index: Modules/Platform/Generic-Windows.cmake =================================================================== --- Modules/Platform/Generic-Windows.cmake (revision 0) +++ Modules/Platform/Generic-Windows.cmake (revision 0) @@ -0,0 +1,38 @@ + + +SET(WIN32 1) + +SET(CMAKE_STATIC_LIBRARY_PREFIX "") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +SET(CMAKE_IMPORT_LIBRARY_PREFIX "") +SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +SET(CMAKE_DL_LIBS "") + +SET(CMAKE_FIND_LIBRARY_PREFIXES "") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + +# for borland make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "Borland") + SET(CMAKE_START_TEMP_FILE "@&&|\n") + SET(CMAKE_END_TEMP_FILE "\n|") +ENDIF(CMAKE_GENERATOR MATCHES "Borland") + +# for nmake make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "NMake") + SET(CMAKE_START_TEMP_FILE "@<<\n") + SET(CMAKE_END_TEMP_FILE "\n<<") +ENDIF(CMAKE_GENERATOR MATCHES "NMake") + +INCLUDE(Platform/WindowsPaths) + +# uncomment these out to debug nmake and borland makefiles +#SET(CMAKE_START_TEMP_FILE "") +#SET(CMAKE_END_TEMP_FILE "") +#SET(CMAKE_VERBOSE_MAKEFILE 1) + Index: Modules/Platform/WinCE-cl.cmake =================================================================== --- Modules/Platform/WinCE-cl.cmake (revision 0) +++ Modules/Platform/WinCE-cl.cmake (revision 0) @@ -0,0 +1,17 @@ +MESSAGE(STATUS "+++++ Entering WinCE-CL.cmake") + +SET(WIN32 1) +SET(WINCE 1) + +IF(CMAKE_SYSTEM_VERSION) + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce,${CMAKE_SYSTEM_VERSION}) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce,${CMAKE_SYSTEM_VERSION} /ENTRY:mainACRTStartup") +ELSE(CMAKE_SYSTEM_VERSION) +# according to msdn version would default to 2.00 + SET(CMAKE_CREATE_WIN32_EXE /subsystem:windowsce) + SET(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /ENTRY:mainACRTStartup") +ENDIF(CMAKE_SYSTEM_VERSION) + +INCLUDE(Platform/Generic-Windows-cl) + +MESSAGE(STATUS "----- Entering WinCE-CL.cmake") Index: Modules/Platform/WinCE.cmake =================================================================== --- Modules/Platform/WinCE.cmake (revision 0) +++ Modules/Platform/WinCE.cmake (revision 0) @@ -0,0 +1,23 @@ + +MESSAGE(STATUS "+++++ Entering WinCE.cmake") + +SET(WINCE 1) + +INCLUDE(Platform/Generic-Windows) + +IF(CMAKE_SYSTEM_VERSION) + STRING(REGEX REPLACE "([0-9]*)\\.([0-9]*)" "0x\\1\\2" CMAKE_SYSTEM_VERSION_HEX "${CMAKE_SYSTEM_VERSION}" ) +ELSE(CMAKE_SYSTEM_VERSION) + SET(CMAKE_SYSTEM_VERSION_HEX "0x200") +ENDIF(CMAKE_SYSTEM_VERSION) + +ADD_DEFINITIONS( + -DUNDER_CE=${CMAKE_SYSTEM_VERSION_HEX} + -D_WIN32_WCE=${CMAKE_SYSTEM_VERSION_HEX} + -DWIN32 + ) + + + +MESSAGE(STATUS "----- Leaveing WinCE.cmake") + Index: Source/cmake.cxx =================================================================== --- Source/cmake.cxx (revision 1) +++ Source/cmake.cxx (working copy) @@ -65,6 +65,8 @@ # include "cmGlobalVisualStudio71Generator.h" # include "cmGlobalVisualStudio8Generator.h" # include "cmGlobalVisualStudio9Generator.h" +# include "cmGlobalVisualStudio9_SDKGenerator.h" +# include "cmGlobalVisualStudio8_SDKGenerator.h" # include "cmGlobalVisualStudio9Win64Generator.h" # include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" @@ -2420,6 +2422,10 @@ &cmGlobalVisualStudio8Generator::New; this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] = &cmGlobalVisualStudio9Generator::New; + this->Generators[cmGlobalVisualStudio8_SDKGenerator::GetActualName()] = + &cmGlobalVisualStudio8_SDKGenerator::New; + this->Generators[cmGlobalVisualStudio9_SDKGenerator::GetActualName()] = + &cmGlobalVisualStudio9_SDKGenerator::New; this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] = &cmGlobalVisualStudio9Win64Generator::New; this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] = Index: Source/CMakeLists.txt =================================================================== --- Source/CMakeLists.txt (revision 1) +++ Source/CMakeLists.txt (working copy) @@ -264,8 +264,12 @@ cmGlobalVisualStudio7Generator.h cmGlobalVisualStudio8Generator.cxx cmGlobalVisualStudio8Generator.h + cmGlobalVisualStudio8_SDKGenerator.cxx + cmGlobalVisualStudio8_SDKGenerator.h cmGlobalVisualStudio9Generator.cxx cmGlobalVisualStudio9Generator.h + cmGlobalVisualStudio9_SDKGenerator.cxx + cmGlobalVisualStudio9_SDKGenerator.h cmGlobalVisualStudio8Win64Generator.cxx cmGlobalVisualStudio8Win64Generator.h cmGlobalVisualStudio9Win64Generator.cxx Index: Source/cmGlobalVisualStudio71Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio71Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio71Generator.cxx (working copy) @@ -34,6 +34,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion71(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio7Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio7Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio7Generator.cxx (working copy) @@ -139,6 +139,7 @@ { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } @@ -663,8 +664,13 @@ std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations() { return &this->Configurations; -}; +} +std::vector<PlatformDefs> *cmGlobalVisualStudio7Generator::GetPlatforms() +{ + return &this->platforms; +} + //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator ::GetDocumentation(cmDocumentationEntry& entry) const Index: Source/cmGlobalVisualStudio7Generator.h =================================================================== --- Source/cmGlobalVisualStudio7Generator.h (revision 1) +++ Source/cmGlobalVisualStudio7Generator.h (working copy) @@ -22,6 +22,18 @@ class cmTarget; struct cmVS7FlagTable; +typedef struct { + int MajorVer; + int MinorVer; + std::string PlatformDefines; + std::string CEver; + std::string Archfam; + std::string Archfam_; + std::string InstructionSet; + std::string PlatformName; + bool added; +} PlatformDefs; + /** \class cmGlobalVisualStudio7Generator * \brief Write a Unix makefiles. * @@ -81,6 +93,12 @@ */ std::vector<std::string> *GetConfigurations(); + /** + * Get the list of platforms + */ + virtual std::vector<PlatformDefs> *GetPlatforms(); + + ///! Create a GUID or get an existing one. void CreateGUID(const char* name); std::string GetGUID(const char* name); @@ -160,6 +178,8 @@ // Set during OutputSLNFile with the name of the current project. // There is one SLN file per project. std::string CurrentProject; + + std::vector<PlatformDefs> platforms; // List of platforms }; #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" Index: Source/cmGlobalVisualStudio8_SDKGenerator.cxx =================================================================== --- Source/cmGlobalVisualStudio8_SDKGenerator.cxx (revision 0) +++ Source/cmGlobalVisualStudio8_SDKGenerator.cxx (revision 0) @@ -0,0 +1,428 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio8_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmSDKConfigParser::cmSDKConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmSDKConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmSDKConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); + this->platformVec.push_back(defs); + current_platform_valid = true; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmSDKConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmSDKConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_SDKGenerator::cmGlobalVisualStudio8_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; + +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::filterSDKs(std::vector<PlatformDefs>* platformvecptr) +{ + // here we inherit the platform vector from the parent + if(platformvecptr != 0) + { + platforms.clear(); + for(std::vector<PlatformDefs>::iterator it = platformvecptr->begin(); it != platformvecptr->end(); it++) + { + platforms.push_back(*it); + } + return; + } + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + std::vector<PlatformDefs> sdksfound = platforms; + platforms.clear(); + + + cmake * c = this->GetCMakeInstance(); + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; +} + +void cmGlobalVisualStudio8_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "8.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::Configure() +{ + filterSDKs(); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_SDKGenerator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_SDKGenerator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"StringPooling", "GF", "Enable Stringpooling", "true", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + // Compile for special architecture + {"CompileForArchitecture", "QRarch4", "ARM4 without Thumb instructions", "0", 0}, + {"CompileForArchitecture", "QRarch5", "ARM5 without Thumb instructions", "1", 0}, + {"CompileForArchitecture", "QRarch4t", "ARM4 with Thumb instructions", "2", 0}, + {"CompileForArchitecture", "QRarch5t", "ARM5 with Thumb instructions", "3", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraFlagTableVS8() +{ + return cmVS8SDKExtraFlagTable; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", "Posix application output", "8", 0}, // THIS IS ONLY AVAILABLE ON VC 8 + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "9", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio8_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS8SDKExtraLinkFlagTable; +} Index: Source/cmGlobalVisualStudio8_SDKGenerator.h =================================================================== --- Source/cmGlobalVisualStudio8_SDKGenerator.h (revision 0) +++ Source/cmGlobalVisualStudio8_SDKGenerator.h (revision 0) @@ -0,0 +1,91 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_SDKGenerator_h +#define cmGlobalVisualStudio8_SDKGenerator_h + +#include "cmGlobalVisualStudio8Generator.h" + +#include "cmXMLParser.h" + +class cmSDKConfigParser : public cmXMLParser +{ +public: + cmSDKConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_SDKGenerator : public cmGlobalVisualStudio8Generator +{ +public: + cmGlobalVisualStudio8_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 (with SDK support)";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + + void filterSDKs(std::vector<PlatformDefs>* platforms = 0); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + + virtual void GetSDKsInstalled(); + + std::string PlatformName; // Win32 or x64 +}; +#endif Index: Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx (revision 0) +++ Source/cmGlobalVisualStudio8_WindowsMobile_Generator.cxx (revision 0) @@ -0,0 +1,567 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-04-02 13:16:04 $ + Version: $Revision: 1.36.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" +#include "cmGeneratedFileStream.h" + +cmWindowsMobileConfigParser::cmWindowsMobileConfigParser() +: cmXMLParser() +{ + current_platform_valid = false; +} + +void cmWindowsMobileConfigParser::StartElement(const char* name, const char** atts) +{ + if ( strcmp(name, "Macro") == 0 ) + { + const char* rev = this->FindAttribute(atts, "Name"); + if (rev) + { + if ( strcmp(rev, "PLATFORMDEFINES") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) + defs->PlatformDefines = std::string(rev); + + } + else if ( strcmp(rev, "CEVER") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) + defs->CEver = std::string(rev); + } + else if ( strcmp(rev, "ARCHFAM") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) + defs->Archfam = std::string(rev); + } + else if ( strcmp(rev, "_ARCHFAM_") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) + defs->Archfam_ = std::string(rev); + } + else if ( strcmp(rev, "INSTRUCTIONSET") == 0 && current_platform_valid) + { + rev = this->FindAttribute(atts, "Value"); + PlatformDefs * defs = &(this->platformVec.back()); + if(rev) + defs->InstructionSet= std::string(rev); + } + } + } + this->CharacterData.erase( + this->CharacterData.begin(), this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::EndElement(const char* name) +{ + if ( strcmp(name, "PlatformName") == 0 ) + { + PlatformDefs defs; defs.added = false; + defs.PlatformName = std::string(this->CharacterData.begin(),this->CharacterData.end()); +// if(defs.PlatformName.find("ARMV4") != std::string::npos) { + this->platformVec.push_back(defs); + current_platform_valid = true; +// } else +// current_platform_valid = false; + } + else if ( strcmp(name, "OSMinorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MinorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + else if ( strcmp(name, "OSMajorVersion") == 0 && current_platform_valid) + { + PlatformDefs * defs = &(this->platformVec.back()); + defs->MajorVer = atoi(std::string(this->CharacterData.begin(),this->CharacterData.end()).c_str()); + } + this->CharacterData.erase(this->CharacterData.begin(), + this->CharacterData.end()); +} + +void cmWindowsMobileConfigParser::CharacterDataHandler(const char* data, int length) +{ + this->CharacterData.insert(this->CharacterData.end(), data, data+length); +} + +const char* cmWindowsMobileConfigParser::FindAttribute( const char** atts, const char* attribute ) +{ + if ( !atts || !attribute ) + { + return 0; + } + const char **atr = atts; + while ( *atr && **atr && **(atr+1) ) + { + if ( strcmp(*atr, attribute) == 0 ) + { + return *(atr+1); + } + atr+=2; + } + return 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio8_WindowsMobile_Generator::cmGlobalVisualStudio8_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + this->PlatformName = "Undefined Mobile Platform"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio8_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion8(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +// ouput standard header for dsw file +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 9.00\n"; + fout << "# Visual Studio 2005\n"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio .NET 2005 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC80", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Configure() +{ + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + regkey += std::string("\\Setup\\VS;"); + + std::string base; + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmWindowsMobileConfigParser *parser = new cmWindowsMobileConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + std::vector<PlatformDefs> sdksfound = parser->getPlatforms(); + //platforms = parser->getPlatforms(); + delete parser; + + // HERE WE FILTER THE PLATFORMS GIVEN AN ALREADY EXISTING CACHE ENTRY! + cmake * c = this->GetCMakeInstance(); + + const char* ptr = c->GetCacheDefinition("PLATFORM_SDKS"); + if(ptr) { + char buf[200]; sprintf(buf,"%s",ptr); + + std::string platforms2use(buf); // "Windows Mobile 5.0 Pocket PC SDK (ARMV4I);Windows Mobile 5.0 Smartphone SDK (ARMV4I)"); + if(platforms2use.size() != 0) { + // now filter based on the list of sdks found + bool breakloop = false; + while(!breakloop) { + int div = platforms2use.find_first_of(";"); + std::string tpn; + if(div < 0) { + breakloop = true; + tpn = platforms2use; + } else if(div == platforms2use.size()-1) + { + breakloop = true; + tpn = platforms2use.substr(0,div); + } + else + { + tpn = platforms2use.substr(0,div); + platforms2use = platforms2use.substr(div+1,platforms2use.size() - div); + } + for(std::vector<PlatformDefs>::iterator it = sdksfound.begin(); it != sdksfound.end(); it++) { + if(tpn.compare(it->PlatformName) == 0 && !it->added) { + PlatformDefs thissdk = *it; + platforms.push_back(thissdk); + it->added = true; + } + } + } + } + } + // simply add all sdks found if no useful SDKs were found + if(platforms.size() == 0) + platforms = sdksfound; + + // HERE WE CIRCUMVENT THE NEED FOR A TOOLCHAIN FILE - WE SHOULD CHANGE THIS TO USE A TOOLCHAIN FILE + c->AddCacheEntry("CMAKE_SYSTEM_NAME", "WinCE", "Windows CE Define", 6); // 0 = bool, 3 = string + c->AddCacheEntry("CMAKE_SYSTEM_VERSION", "5.1", "Mobile Platform Version Define", 6); // #5.1 = WM5, 5.2 = WM6 + c->AddCacheEntry("CMAKE_SYSTEM_PROCESSOR", "ARMV4I", "Processor Define", 6); + c->AddCacheEntry("ARM", "1", "System Define", 6); + + c->AddCacheEntry("CMAKE_C_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + c->AddCacheEntry("CMAKE_CXX_COMPILER_ID", "MSVC", "Compiler ID Define", 6); + + c->AddCacheEntry("CMAKE_CROSSCOMPILING","TRUE","Crosscompiling Flag",0); + c->AddCacheEntry("CMAKE_WINCE_STACKSIZE","65536,4096", "Stack Size Definition", 6); + + c->AddCacheEntry("WINCE_HOST_CMAKE_PATH", (base + std::string("/VC/ce")).c_str(),"Path to Visual Studio CE Path",1); + //c->AddCacheEntry("WINCE_SDK_CMAKE_PATH", "C:/Programme/Windows Mobile 5.0 SDK R2/PocketPC","Path to WinCE SDK",1); + //c->AddCacheEntry("WINVS_SDK_CMAKE_PATH", "C:/Programme/Microsoft SDKs/Windows/v6.0A/bin","Path to VS SDK",1); + + char buf[200]; + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_COMPILER", buf, "ARM cxx-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/cl.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_COMPILER", buf, "ARM c-Compiler",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_CXX_LINKER", buf, "ARM cxx-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_C_LINKER", buf, "ARM c-Linker",2); + sprintf(buf,"%s/bin/x86_arm/link.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_LINKER", buf, "ARM Linker",2); + sprintf(buf,"%s/bin/x86_arm/armasm.exe",c->GetCacheDefinition("WINCE_HOST_CMAKE_PATH")); + c->AddCacheEntry("CMAKE_ASM_COMPILER", buf , "ARM Assembler",2); + //sprintf(buf,"%s/rc.exe",c->GetCacheDefinition("WINVS_SDK_CMAKE_PATH")); + //c->AddCacheEntry("CMAKE_RC_COMPILER", buf, "Resource Compiler",2); + + this->cmGlobalVisualStudio7Generator::Configure(); + this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + // Some VS8 sp0 versions cannot run macros. + // See http://support.microsoft.com/kb/928209 + const char* vc8sp1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926601;"; + const char* vc8exSP1Registry = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\" + "InstalledProducts\\KB926748;"; + std::string vc8sp1; + if (!cmSystemTools::ReadRegistryValue(vc8sp1Registry, vc8sp1) && + !cmSystemTools::ReadRegistryValue(vc8exSP1Registry, vc8sp1)) + { + return ""; + } + + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 8.0 macros folder: + path = base + "/VSMacros80"; + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio8_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::Generate() +{ + // Add a special target on which all other targets depend that + // checks the build system and optionally re-runs CMake. + const char* no_working_directory = 0; + std::vector<std::string> no_depends; + std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; + for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) + { + std::vector<cmLocalGenerator*>& generators = it->second; + if(!generators.empty()) + { + // Add the build-system check target to the first local + // generator of this project. + cmLocalVisualStudio7Generator* lg = + static_cast<cmLocalVisualStudio7Generator*>(generators[0]); + cmMakefile* mf = lg->GetMakefile(); + + // Skip the target if no regeneration is to be done. + if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION")) + { + continue; + } + + std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLines noCommandLines; + mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, + no_working_directory, no_depends, + noCommandLines); + cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + if(!tgt) + { + cmSystemTools::Error("Error adding target " + CMAKE_CHECK_BUILD_SYSTEM_TARGET); + continue; + } + + // Create a list of all stamp files for this project. + std::vector<std::string> stamps; + std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash(); + stampList += "generate.stamp.list"; + { + std::string stampListFile = + generators[0]->GetMakefile()->GetCurrentOutputDirectory(); + stampListFile += "/"; + stampListFile += stampList; + std::string stampFile; + cmGeneratedFileStream fout(stampListFile.c_str()); + for(std::vector<cmLocalGenerator*>::const_iterator + gi = generators.begin(); gi != generators.end(); ++gi) + { + stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory(); + stampFile += "/"; + stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); + stampFile += "generate.stamp"; + stampFile = generators[0]->Convert(stampFile.c_str(), + cmLocalGenerator::START_OUTPUT); + fout << stampFile << "\n"; + stamps.push_back(stampFile); + } + } + + // Add a custom rule to re-run CMake if any input files changed. + { + // Collect the input files used to generate all targets in this + // project. + std::vector<std::string> listFiles; + for(unsigned int j = 0; j < generators.size(); ++j) + { + cmMakefile* lmf = generators[j]->GetMakefile(); + listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(), + lmf->GetListFiles().end()); + } + // Sort the list of input files and remove duplicates. + std::sort(listFiles.begin(), listFiles.end(), + std::less<std::string>()); + std::vector<std::string>::iterator new_end = + std::unique(listFiles.begin(), listFiles.end()); + listFiles.erase(new_end, listFiles.end()); + + // Create a rule to re-run CMake. + std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash(); + stampName += "generate.stamp"; + const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmCustomCommandLine commandLine; + commandLine.push_back(dsprule); + std::string argH = "-H"; + argH += lg->Convert(mf->GetHomeDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argH); + std::string argB = "-B"; + argB += lg->Convert(mf->GetHomeOutputDirectory(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED, true); + commandLine.push_back(argB); + commandLine.push_back("--check-stamp-list"); + commandLine.push_back(stampList.c_str()); + commandLine.push_back("--vs-solution-file"); + commandLine.push_back("\"$(SolutionPath)\""); + cmCustomCommandLines commandLines; + commandLines.push_back(commandLine); + + // Add the rule. Note that we cannot use the CMakeLists.txt + // file as the main dependency because it would get + // overwritten by the CreateVCProjBuildRule. + // (this could be avoided with per-target source files) + const char* no_main_dependency = 0; + const char* no_working_directory = 0; + mf->AddCustomCommandToOutput( + stamps, listFiles, + no_main_dependency, commandLines, "Checking Build System", + no_working_directory, true); + std::string ruleName = stamps[0]; + ruleName += ".rule"; + if(cmSourceFile* file = mf->GetSource(ruleName.c_str())) + { + tgt->AddSourceFile(file); + } + else + { + cmSystemTools::Error("Error adding rule for ", stamps[0].c_str()); + } + } + } + } + + // Now perform the main generation. + this->cmGlobalVisualStudio7Generator::Generate(); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8_WindowsMobile_Generator::WriteSLNFile( + std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators) +{ + // Make all targets depend on their respective project's build + // system check target. + unsigned int i; + for(i = 0; i < generators.size(); ++i) + { + if(this->IsExcluded(root, generators[i])) + { + continue; + } + cmMakefile* mf = generators[i]->GetMakefile(); + cmTargets& tgts = mf->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + { + if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + for(unsigned int j = 0; j < generators.size(); ++j) + { + // Every target in all generators should depend on this target. + cmMakefile* lmf = generators[j]->GetMakefile(); + cmTargets &atgts = lmf->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) + { + al->second.AddUtility(l->first.c_str()); + } + } + } + } + } + + // Now write the solution file. + this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators); +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteSolutionConfigurations(std::ostream& fout) +{ + fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + fout << "\t\t" << *i << "|" << j->PlatformName << " = " << *i << "|" + << j->PlatformName << "\n"; + + //fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|" + // << this->PlatformName << "\n"; + + } + fout << "\tEndGlobalSection\n"; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio8_WindowsMobile_Generator +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild) +{ + std::string guid = this->GetGUID(name); + for(std::vector<std::string>::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + for(std::vector<PlatformDefs>::iterator j = this->platforms.begin(); + j != this->platforms.end(); ++j) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".ActiveCfg = " + << *i << "|" << j->PlatformName << "\n"; + if(partOfDefaultBuild) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << j->PlatformName << ".Build.0 = " + << *i << "|" << j->PlatformName << "\n"; + } + } + } +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS8ExtraFlagTable[] = +{ + {"CallingConvention", "Gd", "cdecl", "0", 0 }, + {"CallingConvention", "Gr", "fastcall", "1", 0 }, + {"CallingConvention", "Gz", "stdcall", "2", 0 }, + + {"Detect64BitPortabilityProblems", "Wp64", + "Detect 64Bit Portability Problems", "true", 0 }, + {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 }, + {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 }, + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + // There is no YX option in the VS8 IDE. + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, + {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0}, + + {0,0,0,0,0} +}; +cmVS7FlagTable const* cmGlobalVisualStudio8_WindowsMobile_Generator::GetExtraFlagTableVS8() +{ + return cmVS8ExtraFlagTable; +} Index: Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h =================================================================== --- Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h (revision 0) +++ Source/cmGlobalVisualStudio8_WindowsMobile_Generator.h (revision 0) @@ -0,0 +1,101 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio8_WindowsMobile.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.13 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio8_WindowsMobile_Generator_h +#define cmGlobalVisualStudio8_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio71Generator.h" + +#include "cmXMLParser.h" + +class cmWindowsMobileConfigParser : public cmXMLParser +{ +public: + cmWindowsMobileConfigParser(); + + std::vector<PlatformDefs> getPlatforms() {return platformVec;}; + +protected: + void StartElement(const char* name, const char** atts); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + const char* FindAttribute( const char** atts, const char* attribute ); +private: + std::vector<char> CharacterData; + std::vector<PlatformDefs> platformVec; + bool current_platform_valid; +}; + + +/** \class cmGlobalVisualStudio8Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio8Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio8_WindowsMobile_Generator : public cmGlobalVisualStudio71Generator +{ +public: + cmGlobalVisualStudio8_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio8_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio8_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 8 2005 - Windows Mobile";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Override Configure and Generate to add the build-system check + * target. + */ + virtual void Configure(); + virtual void Generate(); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + + virtual bool VSLinksDependencies() const { return false; } + + static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + virtual void WriteSLNHeader(std::ostream& fout); + virtual void WriteSolutionConfigurations(std::ostream& fout); + virtual void WriteProjectConfigurations(std::ostream& fout, + const char* name, + bool partOfDefaultBuild); + std::string PlatformName; // Win32 or x64 +}; +#endif Index: Source/cmGlobalVisualStudio8Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio8Generator.cxx (working copy) @@ -36,6 +36,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion8(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } @@ -341,6 +342,10 @@ cmVS7FlagTable::UserValueRequired}, // There is no YX option in the VS8 IDE. + // WHY WAS THIS REMOVED FROM VS7 to VS8? + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + {"WholeProgramOptimization", "GL", "WholeProgramOptimization", "TRUE", 0}, + // Exception handling mode. If no entries match, it will be FALSE. {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0}, {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0}, Index: Source/cmGlobalVisualStudio8Generator.h =================================================================== --- Source/cmGlobalVisualStudio8Generator.h (revision 1) +++ Source/cmGlobalVisualStudio8Generator.h (working copy) @@ -67,7 +67,7 @@ virtual bool VSLinksDependencies() const { return false; } - static cmVS7FlagTable const* GetExtraFlagTableVS8(); + virtual cmVS7FlagTable const* GetExtraFlagTableVS8(); virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); Index: Source/cmGlobalVisualStudio8Win64Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio8Win64Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio8Win64Generator.cxx (working copy) @@ -34,6 +34,7 @@ lg->SetVersion8(); lg->SetPlatformName(this->PlatformName.c_str()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio9_SDKGenerator.cxx =================================================================== --- Source/cmGlobalVisualStudio9_SDKGenerator.cxx (revision 0) +++ Source/cmGlobalVisualStudio9_SDKGenerator.cxx (revision 0) @@ -0,0 +1,190 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_SDKGenerator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio9_SDKGenerator::cmGlobalVisualStudio9_SDKGenerator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; + this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; + GetSDKsInstalled(); + this->PlatformName = "Mobile Platform"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +//---------------------------------------------------------------------------- +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_SDKGenerator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(this->GetExtraLinkFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator::GetSDKsInstalled() +{ + // THIS MUST BE ADDED ACCORDING TO THE VS VERSION!!! + std::string regkey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\"); + regkey += "9.0"; + regkey += std::string("\\Setup\\VS;"); + + std::string base; + + if (!cmSystemTools::ReadRegistryValue((regkey+ + std::string("ProductDir")).c_str(), + base)) + { + return; + } + + cmSystemTools::ConvertToUnixSlashes(base); + + // NOW READ THE CONFIG FILE FOR THE SDKs + std::string configFilename = base + std::string("/VC/vcpackages/WCE.VCPlatform.config"); + cmSDKConfigParser *parser = new cmSDKConfigParser(); + if(parser->ParseFile(configFilename.c_str()) == 0) { + return; + } + platforms = parser->getPlatforms(); + delete parser; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 project files with SDK support."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_SDKGenerator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_SDKGenerator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} + +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS9SDKExtraLinkFlagTable[] = +{ + + // Optimization + {"OptimizeReferences", "OPT:NOREF", "ReferenceOptimization off", "1", 0}, + {"OptimizeReferences", "OPT:REF", "ReferenceOptimization on", "2", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "COMDATFolding off", "1", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "COMDATFolding on", "2", 0}, + + // Link Time Code Generation (this is also in LinkFlagTable!?) + {"LinkTimeCodeGeneration", "LTCG", "LinkTimeCodeGeneration", "1", 0}, + + // Link for special target machine + {"TargetMachine", "MACHINE:X86", "X86 compatible", "1", 0}, + {"TargetMachine", "MACHINE:AM33", "AM33 compatible", "2", 0}, + {"TargetMachine", "MACHINE:ARM", "ARM compatible", "3", 0}, + {"TargetMachine", "MACHINE:EBC", "EBC compatible", "4", 0}, + {"TargetMachine", "MACHINE:IA64", "IA64 compatible", "5", 0}, + {"TargetMachine", "MACHINE:M32R", "M32R compatible", "6", 0}, + {"TargetMachine", "MACHINE:MIPS", "MIPS compatible", "7", 0}, + {"TargetMachine", "MACHINE:MIPS16", "MIPS16 compatible", "8", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", "MIPSFPU compatible", "9", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", "MIPSFPU16 compatible", "10", 0}, + {"TargetMachine", "MACHINE:MIPSR41XX", "MIPSR41XX compatible", "11", 0}, + {"TargetMachine", "MACHINE:SH3", "SH3 compatible", "12", 0}, + {"TargetMachine", "MACHINE:SH3DSP", "SH3DSP compatible", "13", 0}, + {"TargetMachine", "MACHINE:SH4", "SH4 compatible", "14", 0}, + {"TargetMachine", "MACHINE:SH5", "SH5 compatible", "15", 0}, + {"TargetMachine", "MACHINE:THUMB", "THUMB compatible", "16", 0}, + {"TargetMachine", "MACHINE:X64", "X64 compatible", "17", 0}, + + // Subsystem to link for + {"SubSystem", "SUBSYSTEM:CONSOLE", "Console applicationoutput", "1", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", "Windows application output", "2", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", "Native application output", "3", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "EFI application output", "4", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "EFI boot service output", "5", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", "EFI ROM output", "6", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "EFI runtime driver output", "7", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", "WinCE application output", "8", 0}, + + // Stack size to reserve + {"StackReserveSize", "STACK:", "set the default stack size", "", cmVS7FlagTable::UserValue}, + + {0,0,0,0,0} +}; + +cmVS7FlagTable const* cmGlobalVisualStudio9_SDKGenerator::GetExtraLinkFlagTableVS8() +{ + return cmVS9SDKExtraLinkFlagTable; +} Index: Source/cmGlobalVisualStudio9_SDKGenerator.h =================================================================== --- Source/cmGlobalVisualStudio9_SDKGenerator.h (revision 0) +++ Source/cmGlobalVisualStudio9_SDKGenerator.h (revision 0) @@ -0,0 +1,75 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_SDKGenerator_h +#define cmGlobalVisualStudio9_SDKGenerator_h + +#include "cmGlobalVisualStudio8_SDKGenerator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_SDKGenerator : + public cmGlobalVisualStudio8_SDKGenerator +{ +public: + cmGlobalVisualStudio9_SDKGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_SDKGenerator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_SDKGenerator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 (with SDK support)";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); + +protected: + virtual cmVS7FlagTable const* GetExtraLinkFlagTableVS8(); + + virtual void GetSDKsInstalled(); +}; +#endif Index: Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx (revision 0) +++ Source/cmGlobalVisualStudio9_WindowsMobile_Generator.cxx (revision 0) @@ -0,0 +1,102 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.cxx,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.6 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9_WindowsMobile_Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + + +cmGlobalVisualStudio9_WindowsMobile_Generator::cmGlobalVisualStudio9_WindowsMobile_Generator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC90", "1"); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9_WindowsMobile_Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetPlatformName(this->PlatformName.c_str()); + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 9 2008 WM5 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9_WindowsMobile_Generator +::EnableLanguage(std::vector<std::string>const & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8_WindowsMobile_Generator::EnableLanguage(lang, mf, optional); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosDirectory() +{ + std::string base; + std::string path; + + // base begins with the VisualStudioProjectsLocation reg value... + if (cmSystemTools::ReadRegistryValue( + "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;" + "VisualStudioProjectsLocation", + base)) + { + cmSystemTools::ConvertToUnixSlashes(base); + + // 9.0 macros folder: + path = base + "/VSMacros80"; + // *NOT* a typo; right now in Visual Studio 2008 beta the macros + // folder is VSMacros80... They may change it to 90 before final + // release of 2008 or they may not... we'll have to keep our eyes + // on it + } + + // path is (correctly) still empty if we did not read the base value from + // the Registry value + return path; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio9_WindowsMobile_Generator::GetUserMacrosRegKeyBase() +{ + return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros"; +} Index: Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h =================================================================== --- Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h (revision 0) +++ Source/cmGlobalVisualStudio9_WindowsMobile_Generator.h (revision 0) @@ -0,0 +1,69 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmGlobalVisualStudio9_WindowsMobile_Generator.h,v $ + Language: C++ + Date: $Date: 2008-02-15 16:49:58 $ + Version: $Revision: 1.4 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalVisualStudio9_WindowsMobile_Generator_h +#define cmGlobalVisualStudio9_WindowsMobile_Generator_h + +#include "cmGlobalVisualStudio8_WindowsMobile_Generator.h" + + +/** \class cmGlobalVisualStudio9_WindowsMobile_Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9_WindowsMobile_Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9_WindowsMobile_Generator : + public cmGlobalVisualStudio8_WindowsMobile_Generator +{ +public: + cmGlobalVisualStudio9_WindowsMobile_Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9_WindowsMobile_Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9_WindowsMobile_Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008 - Windows Mobile";} + virtual void AddPlatformDefinitions(cmMakefile* mf); + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); + virtual void WriteSLNHeader(std::ostream& fout); + + /** + * Where does this version of Visual Studio look for macros for the + * current user? Returns the empty string if this version of Visual + * Studio does not implement support for VB macros. + */ + virtual std::string GetUserMacrosDirectory(); + + /** + * What is the reg key path to "vsmacros" for this version of Visual + * Studio? + */ + virtual std::string GetUserMacrosRegKeyBase(); +}; +#endif Index: Source/cmGlobalVisualStudio9Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio9Generator.cxx (working copy) @@ -46,6 +46,7 @@ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; lg->SetVersion9(); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmGlobalVisualStudio9Win64Generator.cxx =================================================================== --- Source/cmGlobalVisualStudio9Win64Generator.cxx (revision 1) +++ Source/cmGlobalVisualStudio9Win64Generator.cxx (working copy) @@ -31,6 +31,7 @@ lg->SetVersion9(); lg->SetPlatformName(this->PlatformName.c_str()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetExtraLinkFlagTable(0); lg->SetGlobalGenerator(this); return lg; } Index: Source/cmLocalVisualStudio7Generator.cxx =================================================================== --- Source/cmLocalVisualStudio7Generator.cxx (revision 1) +++ Source/cmLocalVisualStudio7Generator.cxx (working copy) @@ -536,9 +536,10 @@ bool& flag_handled); }; -void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, +void cmLocalVisualStudio7Generator::WritePlatformConfiguration(std::ostream& fout, const char* configName, const char *libName, + const char *platformName, cmTarget &target) { const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); @@ -546,9 +547,23 @@ { mfcFlag = "0"; } + + const char* wholeprogoptFlag; + if(strcmp(configName,"Release")==0) + wholeprogoptFlag = this->Makefile->GetDefinition("CMAKE_WHOLEPROGOPT_FLAG_RELEASE"); + else + wholeprogoptFlag = this->Makefile->GetDefinition("CMAKE_WHOLEPROGOPT_FLAG_DEBUG"); + if(!wholeprogoptFlag) + { + wholeprogoptFlag = "0"; + } + fout << "\t\t<Configuration\n" - << "\t\t\tName=\"" << configName << "|" << this->PlatformName << "\"\n" - << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + << "\t\t\tName=\"" << configName << "|" << platformName << "\"\n"; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + fout << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + else + fout << "\t\t\tOutputDirectory=\"" << platformName << "\\" << configName << "\"\n"; // This is an internal type to Visual Studio, it seems that: // 4 == static library // 2 == dll @@ -661,12 +676,15 @@ // target and a subdirectory for the configuration name. std::string intermediateDir = this->GetTargetDirectory(target); intermediateDir += "/"; + if(strcmp(platformName,"Win32") != 0 && strcmp(platformName,"x64") != 0) + intermediateDir += std::string(platformName) + "/"; intermediateDir += configName; fout << "\t\t\tIntermediateDirectory=\"" << this->ConvertToXMLOutputPath(intermediateDir.c_str()) << "\"\n" << "\t\t\tConfigurationType=\"" << configType << "\"\n" << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" + << "\t\t\tWholeProgramOptimization=\"" << wholeprogoptFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; // If unicode is enabled change the character set to unicode, if not @@ -737,9 +755,18 @@ { // We need to specify a program database file name even for // non-debug configurations because VS still creates .idb files. +if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) +{ fout << "\t\t\t\tProgramDataBaseFileName=\"" - << target.GetDirectory(configName) << "/" - << target.GetPDBName(configName) << "\"\n"; + << target.GetDirectory(configName) << "/"; +} +else +{ + fout << "\t\t\t\tProgramDataBaseFileName=\"" + << target.GetDirectory() << "/" << + std::string(platformName) << "/" << std::string(configName) << "/"; +} + fout << target.GetPDBName(configName) << "\"\n"; } fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool tool = "VCCustomBuildTool"; @@ -815,10 +842,28 @@ } this->OutputTargetRules(fout, configName, target, libName); - this->OutputBuildTool(fout, configName, target, targetOptions.IsDebug()); + this->OutputBuildTool(fout, configName, platformName, target, targetOptions.IsDebug()); fout << "\t\t</Configuration>\n"; } +void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, + const char* configName, + const char *libName, + cmTarget &target) +{ + if((this->PlatformName).compare("Mobile Platform") == 0) + { + cmGlobalVisualStudio7Generator *gg = static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator); + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + WritePlatformConfiguration(fout,configName,libName,(j->PlatformName).c_str(),target); + } + else + { + WritePlatformConfiguration(fout,configName,libName,(this->PlatformName).c_str(),target); + } +} + //---------------------------------------------------------------------------- std::string cmLocalVisualStudio7Generator @@ -837,6 +882,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, const char* configName, + const char* platformName, cmTarget &target, bool isDebug) { @@ -879,15 +925,25 @@ extraLinkOptions += " "; extraLinkOptions += targetLinkFlags; } - Options linkOptions(this, this->Version, Options::Linker); + Options linkOptions(this, this->Version, Options::Linker, this->ExtraLinkFlagTable); // MODIFIED BY CLEMENS linkOptions.Parse(extraLinkOptions.c_str()); switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: { std::string targetNameFull = target.GetFullName(configName); - std::string libpath = target.GetDirectory(configName); + std::string libpath; + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { + libpath = target.GetDirectory(configName); libpath += "/"; + } + else + { + libpath = target.GetDirectory(); + libpath += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } libpath += targetNameFull; const char* tool = "VCLibrarianTool"; if(this->FortranProject) @@ -937,15 +993,29 @@ fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " - << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) - << " "; + << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; temp = target.GetDirectory(configName); temp += "/"; + } + else + { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + + fout << "\t\t\t\tAdditionalDependencies=\" "; + this->Internal->OutputLibraries(fout, cli.GetItems()); + fout << "\"\n"; + fout << "\t\t\t\tDelayLoadDLLs=\"$(NOINHERIT)" << "\"\n"; + fout << "\t\t\t\tRandomizedBaseAddress=\"1" << "\"\n"; + fout << "\t\t\t\tDataExecutionPrevention=\"0" << "\"\n"; + } temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -955,8 +1025,17 @@ this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; this->OutputModuleDefinitionFile(fout, target); + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName); temp += "/"; + } + else + { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNamePDB; fout << "\t\t\t\tProgramDataBaseFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -972,8 +1051,17 @@ { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n"; } + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName, true); temp += "/"; + } + else + { + temp = target.GetDirectory("",true); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; @@ -1009,6 +1097,8 @@ } fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. @@ -1017,8 +1107,32 @@ << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; + } else + { + linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); + // Use the NOINHERIT macro to avoid getting VS project default + // libraries which may be set by the user to something bad. + fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " + << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()) + << " "; + this->Internal->OutputLibraries(fout, cli.GetItems()); + fout << "\"\n"; + + fout << "\t\t\t\tDelayLoadDLLs=\"$(NOINHERIT)" << "\"\n"; + //fout << "\t\t\t\tSubSystem=\"0" << "\"\n"; + fout << "\t\t\t\tRandomizedBaseAddress=\"1" << "\"\n"; + fout << "\t\t\t\tDataExecutionPrevention=\"0" << "\"\n"; + } + if( strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0 || + strcmp(target.GetName(),"cmTryCompileExec") == 0 ) + // this is stupid hack to keep the try_compile stuff working for other platforms + { temp = target.GetDirectory(configName); temp += "/"; + } else { + temp = target.GetDirectory(); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; @@ -1027,13 +1141,23 @@ fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; - fout << "\t\t\t\tProgramDataBaseFile=\"" - << target.GetDirectory(configName) << "/" << targetNamePDB + fout << "\t\t\t\tProgramDataBaseFile=\""; + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { + fout << target.GetDirectory(configName) << "/" << targetNamePDB << "\"\n"; + } + else + { + fout << target.GetDirectory() << "/" << + std::string(platformName) << "/" << std::string(configName) << "/" << targetNamePDB + << "\"\n"; + } if(isDebug) { fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"; } + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) { if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) { fout << "\t\t\t\tSubSystem=\"2\"\n"; @@ -1042,6 +1166,7 @@ { fout << "\t\t\t\tSubSystem=\"1\"\n"; } + } std::string stackVar = "CMAKE_"; stackVar += linkLanguage; stackVar += "_STACK_SIZE"; @@ -1050,8 +1175,18 @@ { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\""; } + + if(strcmp(platformName,"Win32") == 0 || strcmp(platformName,"x64") == 0) + { temp = target.GetDirectory(configName, true); temp += "/"; + } + else + { + temp = target.GetDirectory("",true); + temp += "/" + std::string(platformName) + "/" + std::string(configName) + "/"; + } + temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; @@ -1379,6 +1514,9 @@ dir_max += config_max; dir_max += "/"; + cmGlobalVisualStudio7Generator * gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + // Loop through each source in the source group. std::string objectName; for(std::vector<const cmSourceFile *>::const_iterator sf = @@ -1432,6 +1570,50 @@ fci = fcinfo.FileConfigMap.begin(); fci != fcinfo.FileConfigMap.end(); ++fci) { + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + { + cmLVS7GFileConfig const& fc = fci->second; + fout << "\t\t\t\t<FileConfiguration\n" + << "\t\t\t\t\tName=\"" << fci->first + << "|" << j->PlatformName << "\""; + if(fc.ExcludedFromBuild) + { + fout << " ExcludedFromBuild=\"true\""; + } + fout << ">\n"; + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n"; + if(!fc.CompileFlags.empty() || + !fc.CompileDefs.empty() || + !fc.CompileDefsConfig.empty()) + { + Options fileOptions(this, this->Version, Options::Compiler, + this->ExtraFlagTable); + fileOptions.Parse(fc.CompileFlags.c_str()); + fileOptions.AddDefines(fc.CompileDefs.c_str()); + fileOptions.AddDefines(fc.CompileDefsConfig.c_str()); + fileOptions.OutputAdditionalOptions(fout, "\t\t\t\t\t", "\n"); + fileOptions.OutputFlagMap(fout, "\t\t\t\t\t"); + fileOptions.OutputPreprocessorDefinitions(fout, + "\t\t\t\t\t", "\n"); + } + if(!fc.AdditionalDeps.empty()) + { + fout << "\t\t\t\t\tAdditionalDependencies=\"" + << fc.AdditionalDeps.c_str() << "\"\n"; + } + if(!fc.ObjectName.empty()) + { + fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" + << fc.ObjectName.c_str() << "\"\n"; + } + fout << "\t\t\t\t\t/>\n" + << "\t\t\t\t</FileConfiguration>\n"; + } + else + { cmLVS7GFileConfig const& fc = fci->second; fout << "\t\t\t\t<FileConfiguration\n" << "\t\t\t\t\tName=\"" << fci->first @@ -1471,6 +1653,7 @@ << "\t\t\t\t</FileConfiguration>\n"; } } + } fout << "\t\t\t</File>\n"; } } @@ -1499,9 +1682,9 @@ // Write the rule for each configuration. std::vector<std::string>::iterator i; - std::vector<std::string> *configs = - static_cast<cmGlobalVisualStudio7Generator *> - (this->GlobalGenerator)->GetConfigurations(); + cmGlobalVisualStudio7Generator * gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + std::vector<std::string> *configs = gg->GetConfigurations(); const char* compileTool = "VCCLCompilerTool"; if(this->FortranProject) { @@ -1514,6 +1697,83 @@ } for(i = configs->begin(); i != configs->end(); ++i) { + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + { + cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; + fout << "\t\t\t\t<FileConfiguration\n"; + fout << "\t\t\t\t\tName=\"" << *i << "|" << j->PlatformName << "\">\n"; + if(!fc.CompileFlags.empty()) + { + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << compileTool << "\"\n" + << "\t\t\t\t\tAdditionalOptions=\"" + << this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n"; + } + + std::string script = + this->ConstructScript(command.GetCommandLines(), + command.GetWorkingDirectory(), + i->c_str(), + command.GetEscapeOldStyle(), + command.GetEscapeAllowMakeVars()); + fout << "\t\t\t\t\t<Tool\n" + << "\t\t\t\t\tName=\"" << customTool << "\"\n" + << "\t\t\t\t\tDescription=\"" + << this->EscapeForXML(comment.c_str()) << "\"\n" + << "\t\t\t\t\tCommandLine=\"" + << this->EscapeForXML(script.c_str()) << "\"\n" + << "\t\t\t\t\tAdditionalDependencies=\""; + if(command.GetDepends().empty()) + { + // There are no real dependencies. Produce an artificial one to + // make sure the rule runs reliably. + if(!cmSystemTools::FileExists(source)) + { + std::ofstream depout(source); + depout << "Artificial dependency for a custom command.\n"; + } + fout << this->ConvertToXMLOutputPath(source); + } + else + { + // Write out the dependencies for the rule. + for(std::vector<std::string>::const_iterator d = + command.GetDepends().begin(); + d != command.GetDepends().end(); + ++d) + { + // Get the real name of the dependency in case it is a CMake target. + std::string dep = this->GetRealDependency(d->c_str(), i->c_str()); + fout << this->ConvertToXMLOutputPath(dep.c_str()) + << ";"; + } + } + fout << "\"\n"; + fout << "\t\t\t\t\tOutputs=\""; + if(command.GetOutputs().empty()) + { + fout << source << "_force"; + } + else + { + // Write a rule for the output generated by this command. + const char* sep = ""; + for(std::vector<std::string>::const_iterator o = + command.GetOutputs().begin(); + o != command.GetOutputs().end(); + ++o) + { + fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str()); + sep = ";"; + } + } + fout << "\"/>\n"; + fout << "\t\t\t\t</FileConfiguration>\n"; + } + else + { cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; fout << "\t\t\t\t<FileConfiguration\n"; fout << "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n"; @@ -1586,6 +1846,7 @@ fout << "\t\t\t\t</FileConfiguration>\n"; } } +} void cmLocalVisualStudio7Generator::WriteVCProjBeginGroup(std::ostream& fout, @@ -1789,13 +2050,19 @@ } if(projectType) { - fout << "\tProjectType=\"" << projectType << "\"\n"; + fout << "\tProjectType=\"" << projectType << "\">\n"; } fout<< "\tKeyword=\"" << keyword << "\">\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n" - << "\t<Platforms>\n" - << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" - << "\t</Platforms>\n"; + << "\t<Platforms>\n"; + + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + fout << "\t\t<Platform\n\t\t\tName=\"" << j->PlatformName << "\"/>\n"; + else + fout << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"; + fout << "\t</Platforms>\n"; } @@ -1850,9 +2117,15 @@ << "\tSccProvider=\"" << vsProvider << "\"\n"; } fout << "\tKeyword=\"" << keyword << "\">\n" - << "\t<Platforms>\n" - << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" - << "\t</Platforms>\n"; + << "\t<Platforms>\n"; + + if((this->PlatformName).compare("Mobile Platform") == 0) + for(std::vector<PlatformDefs>::iterator j = (gg->GetPlatforms())->begin(); + j != (gg->GetPlatforms())->end(); ++j) + fout << "\t\t<Platform\n\t\t\tName=\"" << j->PlatformName << "\"/>\n"; + else + fout << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"; + fout << "\t</Platforms>\n"; } Index: Source/cmLocalVisualStudio7Generator.h =================================================================== --- Source/cmLocalVisualStudio7Generator.h (revision 1) +++ Source/cmLocalVisualStudio7Generator.h (working copy) @@ -68,6 +68,8 @@ void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } + void SetExtraLinkFlagTable(cmVS7FlagTable const* table) + { this->ExtraLinkFlagTable = table; } private: typedef cmLocalVisualStudio7GeneratorOptions Options; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; @@ -85,6 +87,11 @@ void WriteVCProjFile(std::ostream& fout, const char *libName, cmTarget &tgt); cmSourceFile* CreateVCProjBuildRule(); + void WritePlatformConfiguration(std::ostream& fout, + const char* configName, + const char *libName, + const char *platformName, + cmTarget &target); void WriteConfigurations(std::ostream& fout, const char *libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, @@ -96,7 +103,7 @@ void OutputTargetRules(std::ostream& fout, const char* configName, cmTarget &target, const char *libName); void OutputBuildTool(std::ostream& fout, const char* configName, - cmTarget& t, bool debug); + const char* platformName, cmTarget& t, bool debug); void OutputLibraryDirectories(std::ostream& fout, std::vector<std::string> const& dirs); void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target); @@ -124,6 +131,7 @@ friend class cmLocalVisualStudio7GeneratorInternals; cmVS7FlagTable const* ExtraFlagTable; + cmVS7FlagTable const* ExtraLinkFlagTable; std::string ModuleDefinitionFile; int Version; bool FortranProject; Index: Source/cmMakefile.cxx =================================================================== --- Source/cmMakefile.cxx (revision 1) +++ Source/cmMakefile.cxx (working copy) @@ -21,6 +21,10 @@ #include "cmSourceFileLocation.h" #include "cmSystemTools.h" #include "cmGlobalGenerator.h" +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) +# include "cmGlobalVisualStudio9_SDKGenerator.h" +# include "cmGlobalVisualStudio8_SDKGenerator.h" +#endif #include "cmLocalGenerator.h" #include "cmCommands.h" #include "cmCacheManager.h" @@ -2755,8 +2759,9 @@ std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND"); cmake cm; cm.SetIsInTryCompile(true); - cmGlobalGenerator *gg = cm.CreateGlobalGenerator - (this->LocalGenerator->GetGlobalGenerator()->GetName()); + cmGlobalGenerator *parentgg = this->LocalGenerator->GetGlobalGenerator(); + std::string parentggname(parentgg->GetName()); + cmGlobalGenerator *gg = cm.CreateGlobalGenerator(parentggname.c_str()); if (!gg) { cmSystemTools::Error( @@ -2765,6 +2770,21 @@ cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; } + // check to update platforms list if it is an SDK based builder +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) + if(parentggname.compare(cmGlobalVisualStudio8_SDKGenerator::GetActualName()) == 0) + { // gg should inherit platform vector from parent + cmGlobalVisualStudio8_SDKGenerator* srcgg = static_cast<cmGlobalVisualStudio8_SDKGenerator*>(parentgg); + cmGlobalVisualStudio8_SDKGenerator* targg = static_cast<cmGlobalVisualStudio8_SDKGenerator*>(gg); + targg->filterSDKs(srcgg->GetPlatforms()); + } + else if(parentggname.compare(cmGlobalVisualStudio9_SDKGenerator::GetActualName()) == 0) + { // gg should inherit platform vector from parent + cmGlobalVisualStudio9_SDKGenerator* srcgg = static_cast<cmGlobalVisualStudio9_SDKGenerator*>(parentgg); + cmGlobalVisualStudio9_SDKGenerator* targg = static_cast<cmGlobalVisualStudio9_SDKGenerator*>(gg); + targg->filterSDKs(srcgg->GetPlatforms()); + } +#endif cm.SetGlobalGenerator(gg); // do a configure Index: Source/CTest/cmCTestScriptHandler.cxx =================================================================== --- Source/CTest/cmCTestScriptHandler.cxx (revision 1) +++ Source/CTest/cmCTestScriptHandler.cxx (working copy) @@ -335,6 +335,8 @@ // cmake instance and generators, and then reads in the script int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) { + cmSystemTools::ResetErrorOccuredFlag(); + // if the argument has a , in it then it needs to be broken into the fist // argument (which is the script) and the second argument which will be // passed into the scripts as S_ARG Index: Tests/CMakeLists.txt =================================================================== --- Tests/CMakeLists.txt (revision 1) +++ Tests/CMakeLists.txt (working copy) @@ -65,6 +65,19 @@ SET(CMAKE_LONG_TEST_TIMEOUT 1500) ENDIF(CMAKE_LONG_TEST_TIMEOUT LESS 1500) + CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/SimplePPC2003/CMakeCache.txt.in" + "${CMake_BINARY_DIR}/Tests/SimplePPC2003/CMakeCache.txt" COPYONLY + ) + ADD_TEST(SimplePPC2003 ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/SimplePPC2003" + "${CMake_BINARY_DIR}/Tests/SimplePPC2003" + --build-two-config + --build-generator "Visual Studio 9 2008 (with SDK support)" + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-project SimplePPC2003) + # add a bunch of standard build-and-test style tests ADD_TEST_MACRO(CommandLineTest CommandLineTest) ADD_TEST_MACRO(FindPackageTest FindPackageTest) @@ -429,6 +442,7 @@ --test-command Tutorial 25.0) ENDFOREACH(STP) + ADD_TEST(testing ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Testing" Index: Tests/SimplePPC2003/CMakeCache.txt.in =================================================================== --- Tests/SimplePPC2003/CMakeCache.txt.in (revision 0) +++ Tests/SimplePPC2003/CMakeCache.txt.in (revision 0) @@ -0,0 +1,5 @@ +//SDK to use +CMAKE_GENERATOR:INTERNAL=Visual Studio 9 2008 (with SDK support) +CMAKE_SYSTEM_NAME:STRING=WINCE +CMAKE_SYSTEM_VERSION:STRING=4.20 +PLATFORM_SDKS:STRING=Pocket PC 2003 (ARMV4) Index: Tests/SimplePPC2003/CMakeLists.txt =================================================================== --- Tests/SimplePPC2003/CMakeLists.txt (revision 0) +++ Tests/SimplePPC2003/CMakeLists.txt (revision 0) @@ -0,0 +1,14 @@ +# a simple test case for compiling a PPC 2003 project +PROJECT(SimplePPC2003) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(RESOURCEFILES resourceppc.h SimplePPC2003ppc.rc SimplePPC2003ppc.rc2) +SET(SOURCEFILES SimplePPC2003.cpp stdafx.cpp) +SET(HEADERFILES stdafx.h SimplePPC2003.h) + +ADD_DEFINITIONS(-DWINCE -D$(ARCHFAM) -D$(_ARCHFAM_) -D_UNICODE -DUNICODE -D_USRDLL ) + +ADD_EXECUTABLE(SimplePPC2003 ${RESOURCEFILES} ${SOURCEFILES} ${HEADERFILES}) + +SET_TARGET_PROPERTIES(SimplePPC2003 PROPERTIES LINK_FLAGS /machine:ARM) Index: Tests/SimplePPC2003/GetCompilerVersion.cmake =================================================================== --- Tests/SimplePPC2003/GetCompilerVersion.cmake (revision 0) +++ Tests/SimplePPC2003/GetCompilerVersion.cmake (revision 0) @@ -0,0 +1,95 @@ + +FIND_PROGRAM(CMAKE_VCVARS + NAMES vcvarsall.bat + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/VC" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC" + ) + +# Testing the machine type of the generated binaries: +FIND_PROGRAM(CMAKE_TEST_COMPILER + NAMES cl.exe + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/VC/bin" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio 8/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/VC/bin" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/VC/bin" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/VC/bin" + ) + +SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") +STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + +EXEC_PROGRAM("\"${CMAKE_VCVARS}\" && \"${CMAKE_TEST_COMPILER}\" /nologo -EP \"${testNmakeCLVersionFile}\"" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + +IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) + SET(MSVC_VERSION "${compilerVersion}") +ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") +ENDIF(NOT CMAKE_COMPILER_RETURN) Index: Tests/SimplePPC2003/resourceppc.h =================================================================== --- Tests/SimplePPC2003/resourceppc.h (revision 0) +++ Tests/SimplePPC2003/resourceppc.h (revision 0) @@ -0,0 +1,34 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by SimplePPC2003ppc.rc +// + +#define IDS_APP_TITLE 1 +#define IDC_SIMPLEPPC2003 2 +#define IDI_SIMPLEPPC2003 101 +#define IDR_MENU 102 +#define IDS_OK 103 +#define IDS_HELP 104 +#define IDD_ABOUTBOX 105 +#define IDD_ABOUTBOX_WIDE 106 +#define IDC_STATIC_1 201 +#define IDC_STATIC_2 202 +#define IDC_STATIC_3 203 +#define IDM_OK 40000 +#define IDM_HELP 40001 +#define IDM_HELP_ABOUT 40002 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif Index: Tests/SimplePPC2003/SimplePPC2003.cpp =================================================================== --- Tests/SimplePPC2003/SimplePPC2003.cpp (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003.cpp (revision 0) @@ -0,0 +1,259 @@ +// SimplePPC2003.cpp : Defines the entry point for the application. +// + +#include "stdafx.h" +#include "SimplePPC2003.h" + + +#define MAX_LOADSTRING 100 + +// Global Variables: +HINSTANCE g_hInst; // current instance +HWND g_hWndMenuBar; // menu bar handle + +// Forward declarations of functions included in this code module: +ATOM MyRegisterClass(HINSTANCE, LPTSTR); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); + +int WINAPI WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Perform application initialization: + if (!InitInstance(hInstance, nCmdShow)) + { + return FALSE; + } + + HACCEL hAccelTable; + hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SIMPLEPPC2003)); + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return (int) msg.wParam; +} + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +// COMMENTS: +// +ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SIMPLEPPC2003)); + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = 0; + wc.lpszClassName = szWindowClass; + + return RegisterClass(&wc); +} + +// +// FUNCTION: InitInstance(HINSTANCE, int) +// +// PURPOSE: Saves instance handle and creates main window +// +// COMMENTS: +// +// In this function, we save the instance handle in a global variable and +// create and display the main program window. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[MAX_LOADSTRING]; // title bar text + TCHAR szWindowClass[MAX_LOADSTRING]; // main window class name + + g_hInst = hInstance; // Store instance handle in our global variable + + // SHInitExtraControls should be called once during your application's initialization to initialize any + // of the device specific controls such as CAPEDIT and SIPPREF. + SHInitExtraControls(); + + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadString(hInstance, IDC_SIMPLEPPC2003, szWindowClass, MAX_LOADSTRING); + + //If it is already running, then focus on the window, and exit + hWnd = FindWindow(szWindowClass, szTitle); + if (hWnd) + { + // set focus to foremost child window + // The "| 0x00000001" is used to bring any owned windows to the foreground and + // activate them. + SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001)); + return 0; + } + + if (!MyRegisterClass(hInstance, szWindowClass)) + { + return FALSE; + } + + hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + // When the main window is created using CW_USEDEFAULT the height of the menubar (if one + // is created is not taken into account). So we resize the window after creating it + // if a menubar is present + if (g_hWndMenuBar) + { + RECT rc; + RECT rcMenuBar; + + GetWindowRect(hWnd, &rc); + GetWindowRect(g_hWndMenuBar, &rcMenuBar); + rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top); + + MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE); + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + + return TRUE; +} + +// +// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// PURPOSE: Processes messages for the main window. +// +// WM_COMMAND - process the application menu +// WM_PAINT - Paint the main window +// WM_DESTROY - post a quit message and return +// +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + + static SHACTIVATEINFO s_sai; + + switch (message) + { + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) + { + case IDM_HELP_ABOUT: + DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); + break; + case IDM_OK: + SendMessage (hWnd, WM_CLOSE, 0, 0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + case WM_CREATE: + SHMENUBARINFO mbi; + + memset(&mbi, 0, sizeof(SHMENUBARINFO)); + mbi.cbSize = sizeof(SHMENUBARINFO); + mbi.hwndParent = hWnd; + mbi.nToolBarId = IDR_MENU; + mbi.hInstRes = g_hInst; + + if (!SHCreateMenuBar(&mbi)) + { + g_hWndMenuBar = NULL; + } + else + { + g_hWndMenuBar = mbi.hwndMB; + } + + // Initialize the shell activate info structure + memset(&s_sai, 0, sizeof (s_sai)); + s_sai.cbSize = sizeof (s_sai); + break; + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + + // TODO: Add any drawing code here... + + EndPaint(hWnd, &ps); + break; + case WM_DESTROY: + CommandBar_Destroy(g_hWndMenuBar); + PostQuitMessage(0); + break; + + case WM_ACTIVATE: + // Notify shell of our activate message + SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); + break; + case WM_SETTINGCHANGE: + SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + +// Message handler for about box. +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + { + // Create a Done button and size it. + SHINITDLGINFO shidi; + shidi.dwMask = SHIDIM_FLAGS; + shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU; + shidi.hDlg = hDlg; + SHInitDialog(&shidi); + } + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) + { + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + } + break; + + case WM_CLOSE: + EndDialog(hDlg, message); + return TRUE; + + } + return (INT_PTR)FALSE; +} Index: Tests/SimplePPC2003/SimplePPC2003.h =================================================================== --- Tests/SimplePPC2003/SimplePPC2003.h (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003.h (revision 0) @@ -0,0 +1,2 @@ +#pragma once +#include "resourceppc.h" Index: Tests/SimplePPC2003/SimplePPC2003ppc.rc =================================================================== --- Tests/SimplePPC2003/SimplePPC2003ppc.rc (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003ppc.rc (revision 0) @@ -0,0 +1,170 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resourceppc.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#include "resdefce.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +//IDI_SIMPLEPPC2003 ICON "SimplePPC2003.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "Help" + BEGIN + MENUITEM "About", IDM_HELP_ABOUT + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_SIMPLEPPC2003 ACCELERATORS +BEGIN + "A", IDM_HELP_ABOUT, VIRTKEY, CONTROL, NOINVERT + "Q", IDM_OK, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG 0, 0, 156, 129 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_CAPTIONOKBTN +CAPTION "About SimplePPC2003" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SIMPLEPPC2003,IDC_STATIC_1,12,12,21,20,SS_REALSIZEIMAGE + LTEXT "SimplePPC2003 Version 1.0",IDC_STATIC_2,12,36,70,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC_3,12,48,66,8 +END + +IDD_ABOUTBOX_WIDE DIALOG 0, 0, 210, 129 +STYLE WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_CAPTIONOKBTN +CAPTION "About SimplePPC2003" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SIMPLEPPC2003,IDC_STATIC_1,12,12,21,20,SS_REALSIZEIMAGE + LTEXT "SimplePPC2003 Version 1.0",IDC_STATIC_2,48,12,66,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC_3,48,24,66,8 +END + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 149 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END + + IDD_ABOUTBOX_WIDE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END +END +#endif // APSTUDIO_INVOKED + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// +1 TEXTINCLUDE +BEGIN + "resourceppc.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#include ""resdefce.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""SimplePPC2003ppc.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// +STRINGTABLE +BEGIN + IDC_SIMPLEPPC2003 "SIMPLEPPC2003" + IDS_APP_TITLE "SimplePPC2003" + IDS_OK "OK" + IDS_HELP "HELP" +END + +#endif +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "SimplePPC2003ppc.rc2" // non-Microsoft Visual C++ edited resources +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED Index: Tests/SimplePPC2003/SimplePPC2003ppc.rc2 =================================================================== --- Tests/SimplePPC2003/SimplePPC2003ppc.rc2 (revision 0) +++ Tests/SimplePPC2003/SimplePPC2003ppc.rc2 (revision 0) @@ -0,0 +1,35 @@ +// +// SimplePPC2003PPC.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// +HI_RES_AWARE CEUX {1} // turn off the emulation layer + // Remove this resource to enable pixel- + // doubling on platforms that support it +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// +// SHMENUBAR +// + +IDR_MENU SHMENUBAR DISCARDABLE +BEGIN + IDR_MENU, + 2, + + I_IMAGENONE, IDM_OK, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, + IDS_OK, 0, NOMENU, + + I_IMAGENONE, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, + IDS_HELP, 0, 0, +END + Index: Tests/SimplePPC2003/stdafx.cpp =================================================================== --- Tests/SimplePPC2003/stdafx.cpp (revision 0) +++ Tests/SimplePPC2003/stdafx.cpp (revision 0) @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimplePPC2003.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file Index: Tests/SimplePPC2003/stdafx.h =================================================================== --- Tests/SimplePPC2003/stdafx.h (revision 0) +++ Tests/SimplePPC2003/stdafx.h (revision 0) @@ -0,0 +1,62 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#pragma comment(linker, "/nodefaultlib:libc.lib") +#pragma comment(linker, "/nodefaultlib:libcd.lib") + +// NOTE - this value is not strongly correlated to the Windows CE OS version being targeted +#define WINVER _WIN32_WCE + +#include <ceconfig.h> +#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) +#define SHELL_AYGSHELL +#endif + +#ifdef _CE_DCOM +#define _ATL_APARTMENT_THREADED +#endif + +#include <windows.h> +#include <commctrl.h> + +#include <aygshell.h> +#pragma comment(lib, "aygshell.lib") + + +// Windows Header Files: +#include <windows.h> + +// C RunTime Header Files +#include <stdlib.h> +#include <malloc.h> +#include <memory.h> +#include <tchar.h> + +#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) +#ifndef _DEVICE_RESOLUTION_AWARE +#define _DEVICE_RESOLUTION_AWARE +#endif +#endif + +#ifdef _DEVICE_RESOLUTION_AWARE +#include "DeviceResolutionAware.h" +#endif + +#if _WIN32_WCE < 0x500 && ( defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) ) + #pragma comment(lib, "ccrtrtti.lib") + #ifdef _X86_ + #if defined(_DEBUG) + #pragma comment(lib, "libcmtx86d.lib") + #else + #pragma comment(lib, "libcmtx86.lib") + #endif + #endif +#endif + +#include <altcecrt.h> + +// TODO: reference additional headers your program requires here | ||||||||
Relationships | |||||||||||
|
Relationships |
Notes | |
(0015323) Clemens (reporter) 2009-02-24 03:45 |
Hi again, I downloaded the 2.6.3 sources on Windows and patched them to include the Windows Mobile support. I have created a patch with TortoiseSVN, so it should be easy to test my changes applying my patch to virginal 2.6.3 sources. Regards Clemens |
(0015845) Clemens (reporter) 2009-03-30 07:01 |
As discussed in the forum I have tried to generate a test for the framework, which currently works only for Visual Studio 9 2008! |
(0016276) Clemens (reporter) 2009-05-02 07:02 |
Uploaded patch against 2.6.4, also including the test project |
(0031751) Brad King (manager) 2012-11-28 16:13 |
Resolving as duplicate of 0007919 which has now been addressed. |
(0032887) Robert Maynard (manager) 2013-04-17 08:54 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2008-11-14 14:27 | Clemens | New Issue | |
2008-11-14 14:27 | Clemens | File Added: cmake_2.6.2p_files.zip | |
2008-12-15 10:08 | Bill Hoffman | Status | new => assigned |
2008-12-15 10:08 | Bill Hoffman | Assigned To | => Bill Hoffman |
2009-02-24 03:45 | Clemens | Note Added: 0015323 | |
2009-02-24 03:45 | Clemens | File Added: cmake-2.6.3.patch | |
2009-03-30 07:00 | Clemens | File Added: cmake-2.6.3_1.patch | |
2009-03-30 07:01 | Clemens | Note Added: 0015845 | |
2009-05-02 07:02 | Clemens | Note Added: 0016276 | |
2009-05-02 07:02 | Clemens | File Added: cmake-2.6.4.diff | |
2009-06-04 08:10 | Clemens | File Added: cmake-2.6.4_new.diff | |
2009-06-04 08:58 | Clemens | File Added: cmake-2.6.4_new_040609.diff | |
2009-06-05 13:05 | David Cole | Relationship added | related to 0007919 |
2012-11-28 16:12 | Brad King | Relationship replaced | duplicate of 0007919 |
2012-11-28 16:13 | Brad King | Note Added: 0031751 | |
2012-11-28 16:13 | Brad King | Assigned To | Bill Hoffman => |
2012-11-28 16:13 | Brad King | Status | assigned => resolved |
2012-11-28 16:13 | Brad King | Resolution | open => duplicate |
2012-11-28 16:13 | Brad King | Fixed in Version | => CMake 2.8.11 |
2012-11-28 16:13 | Brad King | Target Version | => CMake 2.8.11 |
2012-11-28 16:13 | Brad King | Relationship added | related to 0008486 |
2013-04-17 08:54 | Robert Maynard | Note Added: 0032887 | |
2013-04-17 08:54 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |