Discussion:
[CMake] Generating makefile from Visual Studio Project (Migrating to Eclipse)
Olumide
2007-12-04 03:31:46 UTC
Permalink
Hello -

I'm a CMake newbie and I'd appreciate help creating a makefile *from* a
Visual Studio .NET 2003 project/solution. I'm trying like to migrate my
projects to eclipse and I hope CMake will help make that transition.

Many thanks,

- Olumide


PS: I've already tried creating the config file CMakeLists.txt using
vcproj2cmake.rb ( http://www.eskilson.se/vcproj2cmake.rb ). Below is the
config file generated from a small project -- commenting out the
offending add_locate directives(?). I'm not sure how of what I ought to
do next in order to generate a standard (UNIX) makefile.

#################################################################

project( TestTexturePlugin )

set(SOURCES
pluginMain.cpp
)

include_directories(
C:/Program Files/Alias/Maya6.5/include
)

add_definitions(
-DWIN32,_DEBUG,_WINDOWS,_AFXDLL,_MBCS,NT_PLUGIN,REQUIRE_IOSTREAM
)

add_library( TestTexturePlugin SHARED ${SOURCES} )

#add_locale( TestTexturePlugin ENU <RESFILE> )
#add_locale( TestTexturePlugin JPN <RESFILE> )

target_link_libraries( TestTexturePlugin Foundation OpenMaya )

#################################################################
Jesper Eskilson
2007-12-04 09:05:23 UTC
Permalink
Post by Olumide
Hello -
I'm a CMake newbie and I'd appreciate help creating a makefile *from* a
Visual Studio .NET 2003 project/solution. I'm trying like to migrate my
projects to eclipse and I hope CMake will help make that transition.
Many thanks,
- Olumide
PS: I've already tried creating the config file CMakeLists.txt using
vcproj2cmake.rb ( http://www.eskilson.se/vcproj2cmake.rb ). Below is the
config file generated from a small project -- commenting out the
offending add_locate directives(?). I'm not sure how of what I ought to
do next in order to generate a standard (UNIX) makefile.
I've uploaded a new version of the vcproj2cmake.rb script which does not
emit any add_locale() macros.
Post by Olumide
#################################################################
project( TestTexturePlugin )
set(SOURCES
pluginMain.cpp
)
include_directories(
C:/Program Files/Alias/Maya6.5/include
)
You need double quotes around the path, since it contains spaces.
Post by Olumide
add_definitions(
-DWIN32,_DEBUG,_WINDOWS,_AFXDLL,_MBCS,NT_PLUGIN,REQUIRE_IOSTREAM
)
No commas between the symbols.
Post by Olumide
add_library( TestTexturePlugin SHARED ${SOURCES} )
#add_locale( TestTexturePlugin ENU <RESFILE> )
#add_locale( TestTexturePlugin JPN <RESFILE> )
target_link_libraries( TestTexturePlugin Foundation OpenMaya )
#################################################################
You should be able to run CMake directly on this file. If you're on
Unix, try

$ cd [your project dir]
$ cmake .

--
/Jesper
Olumide
2007-12-04 21:58:00 UTC
Permalink
Post by Jesper Eskilson
I've uploaded a new version of the vcproj2cmake.rb script which does not
emit any add_locale() macros.
...
Post by Olumide
include_directories(
C:/Program Files/Alias/Maya6.5/include
)
You need double quotes around the path, since it contains spaces.
Post by Olumide
add_definitions(
-DWIN32,_DEBUG,_WINDOWS,_AFXDLL,_MBCS,NT_PLUGIN,REQUIRE_IOSTREAM
)
No commas between the symbols.
Thanks.

Here's a copy of my new CMakeLists.txt, after double quoting paths with
spaces and removing commas between symbols

#######################################################################

project( TestTexturePlugin )

set(SOURCES
C:/Work/Demo/TestTexturePlugin/pluginMain.cpp
)

include_directories(
C:/Program
C:/Work/Demo/TestTexturePlugin/Files/Alias/Maya6.5/include
)

add_definitions(
-DWIN32 _WINDOWS _DEBUG "WIN32 _DEBUG _WINDOWS _AFXDLL _MBCS
NT_PLUGIN REQUIRE_IOSTREAM" "CMAKE_INTDIR=\"Debug\""
TestTexturePlugin_EXPORTS
)

add_library( TestTexturePlugin SHARED ${SOURCES} )

target_link_libraries( TestTexturePlugin $(NOINHERIT) kernel32 user32
gdi32 winspool comdlg32 advapi32 shell32 ole32 oleaut32 uuid odbc32
odbccp32 Foundation OpenMaya )

#######################################################################

'Just a few observations/questions:

(1.) The definitions section previously read:

add_definitions(
-DWIN32,_WINDOWS,_DEBUG,"WIN32,_DEBUG,_WINDOWS,_AFXDLL,_MBCS,NT_PLUGIN,REQUIRE_IOSTREAM","CMAKE_INTDIR=\"Debug\"",TestTexturePlugin_EXPORTS
)

Why does WIN32 begin with a quote mark, and REQUIRE_IOSTREAM end with a
quote mark? Is this some sort of grouping of
WIN32,_DEBUG,_WINDOWS,_AFXDLL,_MBCS,NT_PLUGIN,REQUIRE_IOSTREAM? Also, is
CMAKE_INTDIR=\"Debug\" intentionally double quoted?


(2.) The contents of the include_directories section are somewhat
mangled i.e. they read:

include_directories(
C:/Program
C:/Work/Demo/TestTexturePlugin/Files/Alias/Maya6.5/include
)

instead of:

include_directories(
"C:/Program Files/Alias/Maya6.5/include"
C:/Work/Demo/TestTexturePlugin/
)

Regards,

- Olumide
Olumide
2007-12-05 20:56:23 UTC
Permalink
Post by Olumide
I'm a CMake newbie and I'd appreciate help creating a makefile *from* a
Visual Studio .NET 2003 project/solution. I'm trying like to migrate my
projects to eclipse and I hope CMake will help make that transition.
I'm trying to generate a Unix style (or NMake) Makefile that I can use
to port my visual studio project to eclipse. I've tried running cmake on
the project directory with the -G"Unix Makefiles" and -G"NMake
Makefiles" option, but its not working -- I'm getting lots of errors.
Apparently, I'm missing a number of variables. How can I set these
variables? I'd still like to use the Microsoft compiler *but* within the
eclipse environment.


C:\Work\Demo\TestTexturePlugin>cmake ..\TestTexturePlugin -G"Unix Makefiles"
CMake Error: CMake was unable to find a build program corresponding to
"Unix Makefiles". CMAKE_MAKE
_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module
file:C:/Work/Demo/TestTexturePlugin/CMakeFiles/CMakeCCompil
er.cmake
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module
file:C:/Work/Demo/TestTexturePlugin/CMakeFiles/CMakeCXXComp
iler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring done


Also, I've previously run CMake on the project directory, and I got
TestTexturePlugin.vcproj.cmake, ALL_BUILD.vcproj.cmake. What is a cmake
file? And what can I do with it?

('sorry to be asking these noobish questions)
Bill Hoffman
2007-12-05 21:45:21 UTC
Permalink
Post by Olumide
Post by Olumide
I'm a CMake newbie and I'd appreciate help creating a makefile *from*
a Visual Studio .NET 2003 project/solution. I'm trying like to migrate
my projects to eclipse and I hope CMake will help make that transition.
I'm trying to generate a Unix style (or NMake) Makefile that I can use
to port my visual studio project to eclipse. I've tried running cmake on
the project directory with the -G"Unix Makefiles" and -G"NMake
Makefiles" option, but its not working -- I'm getting lots of errors.
Apparently, I'm missing a number of variables. How can I set these
variables? I'd still like to use the Microsoft compiler *but* within the
eclipse environment.
You need to setup the MS compile to work from the command line. The easy
way is to run the visual studio command prompt from the start menu under
visual studio tools. Then run cmake from that shell, and it should work.
Post by Olumide
Also, I've previously run CMake on the project directory, and I got
TestTexturePlugin.vcproj.cmake, ALL_BUILD.vcproj.cmake. What is a cmake
file? And what can I do with it?
There should also be a .vcproj file and a .sln file. The .cmake files
are sort of time stamp files so we can do copy if different operations
and not have visual studio remove its own files.

-Bill
Olumide
2007-12-06 05:38:51 UTC
Permalink
Post by Bill Hoffman
Post by Olumide
I'm trying to generate a Unix style (or NMake) Makefile that I can use
to port my visual studio project to eclipse. I've tried running cmake
on the project directory with the -G"Unix Makefiles" and -G"NMake
Makefiles" option, but its not working -- I'm getting lots of errors.
Apparently, I'm missing a number of variables. How can I set these
variables? I'd still like to use the Microsoft compiler *but* within
the eclipse environment.
You need to setup the MS compile to work from the command line. The easy
way is to run the visual studio command prompt from the start menu under
visual studio tools. Then run cmake from that shell, and it should work.
Thanks Bill.

Do you mean I should start the command prompt and run devenv or
something like that? I dont understand what you mean by "run the visual
studio command prompt from the start menu under visual studio tools". Am
I to launch the command shell from/within visual studio?
Jesper Eskilson
2007-12-06 07:10:53 UTC
Permalink
Post by Olumide
Post by Bill Hoffman
Post by Olumide
I'm trying to generate a Unix style (or NMake) Makefile that I can
use to port my visual studio project to eclipse. I've tried running
cmake on the project directory with the -G"Unix Makefiles" and
-G"NMake Makefiles" option, but its not working -- I'm getting lots
of errors. Apparently, I'm missing a number of variables. How can I
set these variables? I'd still like to use the Microsoft compiler
*but* within the eclipse environment.
You need to setup the MS compile to work from the command line. The
easy way is to run the visual studio command prompt from the start
menu under visual studio tools. Then run cmake from that shell, and
it should work.
Thanks Bill.
Do you mean I should start the command prompt and run devenv or
something like that? I dont understand what you mean by "run the visual
studio command prompt from the start menu under visual studio tools". Am
I to launch the command shell from/within visual studio?
The command prompt can be found from your start menu: Start Menu -> All
Programs -> Microsoft Visual Studio 2005 -> Visual Studio Tools ->
Visual Studio 2005 Command Prompt.

This will give you a regular windows command prompt with all environment
variables set up in order for you to be able to run the command-line
studio tools (cl, nmake, vcbuild, etc.)
--
/Jesper
Olumide
2007-12-06 21:34:04 UTC
Permalink
Post by Jesper Eskilson
The command prompt can be found from your start menu: Start Menu -> All
Programs -> Microsoft Visual Studio 2005 -> Visual Studio Tools ->
Visual Studio 2005 Command Prompt.
This will give you a regular windows command prompt with all environment
variables set up in order for you to be able to run the command-line
studio tools (cl, nmake, vcbuild, etc.)
Thanks.


I've started the visual studio (.NET 2003) command prompt as you
described and typed the commands

cmake -G"Unix Makefiles" C:\Work\Demo\TestTexturePlugin
cmake -G"NMake Makefiles" C:\Work\Demo\TestTexturePlugin

in it, but I still got the errors:

CMake Error: CMake was unable to find a build program corresponding to
"Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to
select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly. Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly. Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:C:/Program Files/Common
Files/System/Mapi/1033/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:C:/Program Files/Common
Files/System/Mapi/1033/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring done


and


CMake Error: CMake was unable to find a build program corresponding to
"NMake Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to s
elect a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly. Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly. Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:C:/Program Files/Common
Files/System/Mapi/1033/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly. Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly. Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:C:/Program Files/Common
Files/System/Mapi/1033/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring done
Bill Hoffman
2007-12-06 22:27:17 UTC
Permalink
Post by Olumide
Post by Jesper Eskilson
The command prompt can be found from your start menu: Start Menu ->
All Programs -> Microsoft Visual Studio 2005 -> Visual Studio Tools ->
Visual Studio 2005 Command Prompt.
This will give you a regular windows command prompt with all
environment variables set up in order for you to be able to run the
command-line studio tools (cl, nmake, vcbuild, etc.)
Thanks.
I've started the visual studio (.NET 2003) command prompt as you
described and typed the commands
cmake -G"Unix Makefiles" C:\Work\Demo\TestTexturePlugin
cmake -G"NMake Makefiles" C:\Work\Demo\TestTexturePlugin
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:C:/Program Files/Common
Files/System/Mapi/1033/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring done
Bad compiler installation? Can you run nmake and cl from that prompt?

-Bill
Olumide
2007-12-06 22:49:07 UTC
Permalink
Post by Bill Hoffman
Post by Olumide
I've started the visual studio (.NET 2003) command prompt as you
described and typed the commands
cmake -G"Unix Makefiles" C:\Work\Demo\TestTexturePlugin
cmake -G"NMake Makefiles" C:\Work\Demo\TestTexturePlugin
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:C:/Program Files/Common
Files/System/Mapi/1033/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring done
Bad compiler installation? Can you run nmake and cl from that prompt?
nmake and cl work from that prompt.

C:\Program Files\Common Files\System\MAPI\1033>nmake

Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.

NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop.

-----------------------------------------------------

C:\Program Files\Common Files\System\MAPI\1033>cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]


PS: the di C:\Program Files\Common Files\System\Mapi\1033\CMakeFiles
exists but it contains only the file cmake.check_cache
Bill Hoffman
2007-12-06 23:41:50 UTC
Permalink
Post by Olumide
CMake Error: Could not find cmake module file:C:/Program Files/Common
Files/System/Mapi/1033/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring done
Are you running in this directory:
C:/Program Files/Common Files/System/Mapi/1033?

Can you give the version of cmake and exact commands you are running?
Can you create a very simple project?

Try this:

1. mkdir test
2. cd test
3. create a CMakeLists.txt in test with the following in it:
add_executable(foo foo.cxx)

4. mkdir b
5 cd b
6. cmake -G"NMake Makefiles" ..

Do this all from the visual studio command shell.

-Bill
Olumide
2007-12-07 01:20:44 UTC
Permalink
Post by Bill Hoffman
C:/Program Files/Common Files/System/Mapi/1033?
I'm running the tests you've asked me to in this directory. My projects
are in another directory.
Post by Bill Hoffman
Can you give the version of cmake and exact commands you are running?
I have cmake version 2.4-patch 7. So far, I've only tried running cmake
-G"NMake Makefiles" and cmake -G"Unix Makefiles" in my visual studio
project directory.
Post by Bill Hoffman
Can you create a very simple project?
[...]
6. cmake -G"NMake Makefiles" ..
Success finally -- or is it?

C:\Program Files\Common Files\System\Mapi\1033\test\b>cmake -G"NMake
Makefiles" ..
-- Check for CL compiler version
-- Check for CL compiler version - 1310
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - no
-- Check CL platform
-- Check CL platform - 32 bit
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio .NET 2003/Vc7/bin/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio .NET 2003/Vc7/bin/cl.exe -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual
Studio .NET 2003/Vc7/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual
Studio .NET 2003/Vc7/bin/cl.exe -- works
CMake Error: Cannot find source file "C:/Program Files/Common
Files/System/Mapi/1033/test/foo.cxx" for target "foo"

Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
-- Configuring done


PS: thanks for taking the time to help. I'm very grateful.
Bill Hoffman
2007-12-07 01:33:38 UTC
Permalink
Post by Olumide
Post by Bill Hoffman
C:/Program Files/Common Files/System/Mapi/1033?
I'm running the tests you've asked me to in this directory. My projects
are in another directory.
Post by Bill Hoffman
Can you give the version of cmake and exact commands you are running?
I have cmake version 2.4-patch 7. So far, I've only tried running cmake
-G"NMake Makefiles" and cmake -G"Unix Makefiles" in my visual studio
project directory.
Post by Bill Hoffman
Can you create a very simple project?
[...]
6. cmake -G"NMake Makefiles" ..
Success finally -- or is it?
\
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
-- Configuring done
That is success. You would of course need to create a foo.cxx file to be
compiled. But the compiler detection worked fine. I would recommend
starting from an empty build tree.

-Bill
Olumide
2007-12-07 01:57:40 UTC
Permalink
Post by Bill Hoffman
Post by Olumide
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
-- Configuring done
That is success. You would of course need to create a foo.cxx file to be
compiled. But the compiler detection worked fine. I would recommend
starting from an empty build tree.
I've run cmake on my project's CMakeLists.txt file (generated from my
visual studio project by Jesper's script) as follows:

C:\Work\Demo\TestTexturePlugin\CMakeLists.txt
C:\Program Files\Common Files\System\MAPI\1033>cmake -G"NMake Makefiles"
C:\Work\Demo\TestTexturePlugin\CMakeLists.txt

Result:
-- Check for CL compiler version
-- Check for CL compiler version - 1310
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - no
-- Check CL platform
-- Check CL platform - 32 bit
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio .NET 2003/Vc7/bin/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio .NET 2003/Vc7/bin/cl.exe -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual
Studio .NET 2003/Vc7/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual
Studio .NET 2003/Vc7/bin/cl.exe -- works
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Work/Demo/TestTexturePlugin

The directory C:\Work\Demo\TestTexturePlugin\CMakeFiles now contains,
among other files, Makefile2, which I assume is the NMake Makefile, and
Makefile.cmake. Where can I find more information about these files. I'm
not sure which files I need to perform the migration to eclipse.

Oddly, running cmake on my project directory fails i.e.:
C:\Program Files\Common Files\System\MAPI\1033>cmake -G"NMake Makefiles"
C:\Work\Demo\TestTexturePlugin

produces the familiar list of errors.

- Olumide

PS: my understanding of what a build tree is; from:
http://ecos.sourceware.org/docs-2.0/user-guide/build-tree.html
Build tree: the directory hierarchy in which all generated files are
placed ...
Olumide
2007-12-07 02:06:53 UTC
Permalink
Post by Olumide
The directory C:\Work\Demo\TestTexturePlugin\CMakeFiles now contains,
among other files, Makefile2, which I assume is the NMake Makefile, and
Makefile.cmake. Where can I find more information about these files. I'm
not sure which files I need to perform the migration to eclipse.
I see there is a Makefile in C:\Work\Demo\TestTexturePlugin.

Anyway here is the result of running nmake
C:\Work\Demo\TestTexturePlugin>nmake

Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.

[100%] Building CXX object CMakeFiles/TestTexturePlugin.dir/pluginMain.obj
_WINDOWS
c1xx : fatal error C1083: Cannot open source file: '_WINDOWS': No such
file or directory
_DEBUG
c1xx : fatal error C1083: Cannot open source file: '_DEBUG': No such
file or directory
WIN32
c1xx : fatal error C1083: Cannot open source file: 'WIN32': No such file
or directory
_DEBUG
c1xx : fatal error C1083: Cannot open source file: '_DEBUG': No such
file or directory
_WINDOWS
c1xx : fatal error C1083: Cannot open source file: '_WINDOWS': No such
file or directory
_AFXDLL
c1xx : fatal error C1083: Cannot open source file: '_AFXDLL': No such
file or directory
_MBCS
c1xx : fatal error C1083: Cannot open source file: '_MBCS': No such file
or directory
NT_PLUGIN
c1xx : fatal error C1083: Cannot open source file: 'NT_PLUGIN': No such
file or directory
REQUIRE_IOSTREAM
c1xx : fatal error C1083: Cannot open source file: 'REQUIRE_IOSTREAM':
No such file or directory
CMAKE_INTDIR=Debug
c1xx : fatal error C1083: Cannot open source file: 'CMAKE_INTDIR=Debug':
No such file or directory
TestTexturePlugin_EXPORTS
c1xx : fatal error C1083: Cannot open source file:
'TestTexturePlugin_EXPORTS': No such file or directory
pluginMain.cpp
C:\Program Files\Alias\Maya6.5\include\maya\MTypes.h(222) : error C2632:
'char' followed by 'bool' is illegal
C:\Program Files\Alias\Maya6.5\include\maya\MTypes.h(222) : warning
C4091: 'typedef ' : ignored on left of 'unsigned char' when no
variable is declared
C:\Program Files\Alias\Maya6.5\include\maya\MTypes.h(226) : error C2143:
syntax error : missing '}' before 'constant'
C:\Program Files\Alias\Maya6.5\include\maya\MTypes.h(226) : error C2143:
syntax error : missing ';' before '}'
C:\Program Files\Alias\Maya6.5\include\maya\MTypes.h(226) : error C2059:
syntax error : '}'
C:\Program Files\Alias\Maya6.5\include\maya\MObject.h(88) : fatal error
C1083: Cannot open include file: 'stdio.h': No such file or
directory
Generating Code...
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3.NET\Vc7\bin\cl.exe' :
return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
.NET 2003\Vc7\bin\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
.NET 2003\Vc7\bin\nmake.exe"' : return code '0x2'
Stop.



Here is my CMakeLists.txt file, generated by Jesper's script (from my
original visual studio project/solution). The _WINDOWS, _DEBUG, etc that
nmake complains about are in the add definitions section.

#######################################################################

project( TestTexturePlugin )

set(SOURCES
C:/Work/Demo/TestTexturePlugin/pluginMain.cpp
)

include_directories(
"C:/Program Files/Alias/Maya6.5/include"
C:/Work/Demo/TestTexturePlugin/
)

add_definitions(
-DWIN32 _WINDOWS _DEBUG WIN32 _DEBUG _WINDOWS _AFXDLL _MBCS NT_PLUGIN
REQUIRE_IOSTREAM CMAKE_INTDIR=Debug TestTexturePlugin_EXPORTS
)

add_library( TestTexturePlugin SHARED ${SOURCES} )

target_link_libraries( TestTexturePlugin $(NOINHERIT) kernel32 user32
gdi32 winspool comdlg32 advapi32 shell32 ole32 oleaut32 uuid odbc32
odbccp32 Foundation OpenMaya )
Olumide
2007-12-07 17:27:38 UTC
Permalink
Post by Olumide
Post by Olumide
The directory C:\Work\Demo\TestTexturePlugin\CMakeFiles now contains,
among other files, Makefile2, which I assume is the NMake Makefile,
and Makefile.cmake. Where can I find more information about these
files. I'm not sure which files I need to perform the migration to
eclipse.
I see there is a Makefile in C:\Work\Demo\TestTexturePlugin.
Anyway here is the result of running nmake
C:\Work\Demo\TestTexturePlugin>nmake
Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
[100%] Building CXX object CMakeFiles/TestTexturePlugin.dir/pluginMain.obj
_WINDOWS
c1xx : fatal error C1083: Cannot open source file: '_WINDOWS': No such
file or directory
_DEBUG
Compiled and linked! :)

Had to overhaul my CMakeLists.txt tho'. Here are the changes I had to make:

include_directories(
"$(VSINSTALLDIR)include"
"$(VCInstallDir)atlmfc/include"
"$(VCInstallDir)PlatformSDK/include/prerelease"
"$(VCInstallDir)PlatformSDK/include"
"$(FrameworkSDKDir)include"

"C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/include"
"C:/Program Files/Microsoft Visual Studio .NET
2003/Vc7/PlatformSDK/Include"
"C:/Program Files/Alias/Maya6.5/include"
C:/Work/Demo/TestTexturePlugin/
)

add_definitions(
"/D \"WIN32\""
"/D \"_DEBUG\""
"/D \"_AFXDLL\""
"/D \"_MBCS\""
"/D \"_WINDOWS\""
"/D \"NT_PLUGIN\""
"/D \"REQUIRE_IOSTREAM\""
"/D \"CMAKE_INTDIR=Debug\""
#TestTexturePlugin_EXPORTS
)

link_directories(
"$(VCInstallDir)lib"
"$(VCInstallDir)atlmfc/lib"
"$(VCInstallDir)PlatformSDK/lib/prerelease"
"$(VCInstallDir)PlatformSDK/lib"
"$(FrameworkSDKDir)lib"
"C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/lib"
"C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Lib"
"C:/Program Files/Alias/Maya6.5/lib"
)

I've still got a few odd's and ends to take care of. To begin with, the
target application (Autodesk Maya) refuses to lead the plugin because
its unable to find an initialize function which is included in the
source file pluginMain.cpp. Specifically, the output should have a .mll
file extension instead of .dll.

One other minor question: it appears the visual studio path(?) macros
e.g. $(VCInstallDir) aren't recognized/expanded. Why is this so?

- Olumide
Olumide
2007-12-08 17:30:09 UTC
Permalink
Post by Olumide
I've still got a few odd's and ends to take care of. To begin with, the
target application (Autodesk Maya) refuses to lead the plugin because
its unable to find an initialize function which is included in the
source file pluginMain.cpp. Specifically, the output should have a .mll
file extension instead of .dll.
Complete success!!! Plugin compiled, linked and loaded :-) . What was
missing were the linker flags:

set_target_properties(
TestTexturePlugin PROPERTIES SUFFIX ".mll" LINK_FLAGS
"/subsystem:windows /dll /incremental:yes /debug /machine:I386
/export:initializePlugin /export:uninitializePlugin"
)

I'm posting my entire CMakeLists.txt file for posterity.

#############################################################

project( TestTexturePlugin )

set(SOURCES
C:/Work/Demo/TestTexturePlugin/pluginMain.cpp
)

include_directories(
"$(VSINSTALLDIR)include"
"$(VCInstallDir)atlmfc/include"
"$(VCInstallDir)PlatformSDK/include/prerelease"
"$(VCInstallDir)PlatformSDK/include"
"$(FrameworkSDKDir)include"

"C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/include"
"C:/Program Files/Microsoft Visual Studio .NET
2003/Vc7/PlatformSDK/Include"
"C:/Program Files/Alias/Maya6.5/include"
C:/Work/Demo/TestTexturePlugin/
)

add_definitions(
"/D \"WIN32\""
"/D \"_DEBUG\""
"/D \"_AFXDLL\""
"/D \"_MBCS\""
"/D \"_WINDOWS\""
"/D \"NT_PLUGIN\""
"/D \"REQUIRE_IOSTREAM\""
"/D \"CMAKE_INTDIR=Debug\""
"/D \"TestTexturePlugin_EXPORTS\""
)

link_directories(
"$(VCInstallDir)lib"
"$(VCInstallDir)atlmfc/lib"
"$(VCInstallDir)PlatformSDK/lib/prerelease"
"$(VCInstallDir)PlatformSDK/lib"
"$(FrameworkSDKDir)lib"
"C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/lib"
"C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Lib"
"C:/Program Files/Alias/Maya6.5/lib"
)


add_library( TestTexturePlugin SHARED ${SOURCES} )

set_target_properties(
TestTexturePlugin PROPERTIES SUFFIX ".mll" LINK_FLAGS
"/subsystem:windows /dll /incremental:yes /debug /machine:I386
/export:initializePlugin /export:uninitializePlugin"
)

target_link_libraries( TestTexturePlugin $(NOINHERIT) kernel32 user32
gdi32 winspool comdlg32 advapi32 shell32 ole32 oleaut32 uuid odbc32
odbccp32 Foundation OpenMaya )

####################################################################

Thanks again to everyone. I'll be focusing on the actual migration to
eclipse bit next, and probably write a small "how to" when its all done.

- Olumide

Loading...