Building AbcImport/AbcExport on Windows (with CMake)

584 views
Skip to first unread message

Shih-Chin

unread,
May 31, 2013, 11:26:51 PM5/31/13
to alembic-d...@googlegroups.com
Hi folks,

I've received few emails asking about compiling AbcImport/AbcExport on Windows.
After few experiments, I found the following workflow might be the easier way to build the plugins with CMake.

Prerequisites
  • Boost
    1. open vc10 command prompt
    2. cd c:\boost\boost_1_xx_00
    3. bootstrap.bat
    4. b2 toolset=msvc-10.0 address-model=64 link=static threading=multi --with-program_options --with-thread
Ps. Since I usually build maya plugin with /MD, thus all the static third-party libraries I used are built with /MD.


Pre-Configuration

Now, suppose we have following folder structure:
Create init_cache.cmake
In order to make configuration easier, we could create a simple text file name "init_cache.cmake" as initial cmake cache:
 
SET(BOOST_ROOT C:/boost/boost_1_53_0 CACHE PATH "Boost Root")
SET(ENV{HDF5_ROOT} D:/coding/packages/HDF5 CACHE PATH "HDF5 Root")
SET(ILMBASE_ROOT D:/coding/packages/ilmbase CACHE PATH "Ilmbase Root")
SET(ZLIB_ROOT D:/coding/packages/zlib CACHE PATH "Zlib Root")
SET(GLUT_ROOT_PATH D:/coding/packages/glut-3.7 CACHE PATH "Glut Root")
SET(MAYA_ROOT C:/adsk/Maya2013 CACHE PATH "Maya Root"); 
 
SET(USE_PYALEMBIC OFF CACHE BOOL "Compile Python Binding")
SET(USE_ARNOLD OFF CACHE BOOL "Use Arnold")

Ps. Please replace the path of each 3rd-party library in your local machine.

Modify CMakeLists.txt (optional)
If we want to link static libraries of Ilmbase, we have to do little modification of CMakeLists.txt in line 80:

#ADD_DEFINITIONS ( -DOPENEXR_DLL -DHALF_EXPORTS )
ADD_DEFINITIONS ( -DPLATFORM_BUILD_STATIC )

Create VC Project
  1. open vc10 command prompt
  2. cd /d alembic_source_root
  3. mkdir vc_proj
  4. cd vc_proj
  5. cmake -G "Visual Studio 10 Win64" -C ..\init_cache.cmake ..
  6. If all goes well, we could simply open the ALEMBIC.sln and compile the libraries as usual.
Hope this short post would make some windows users' lives a little easier. :)

Ps. I've not successfully built the PyAlembic yet, I still have the import error as described in 
If anyone has any idea on that, please let me know. Thanks.

Cheers,
Shih-Chin

Roeland Schoukens

unread,
Jun 6, 2013, 2:38:26 AM6/6/13
to alembic-d...@googlegroups.com
The easiest way to build the core Alembic lib is:
  • Get the prerequisites and build those with the included CMake or VS project files. (be careful to always link to the same runtime lib)
  • create an empty Visual C++ project
  • add the source files under lib/Alembic (exclude the Tests/ directories). You can drag and drop a folder to add all subfiles, although then they appear as a flat list in the solution explorer.
  • set up the include and library paths to the prerequisites.
  • Set the Configuration Type to a DLL or a static lib
  • build

Someone posted a project file a while ago → https://groups.google.com/d/msg/alembic-discussion/Mn-NFIPvefM/QkJX40xbm9sJ.

If I would have to build PyAlembic I would also just try to set up a visual studio project like this.


--
Roeland

Moritz Moeller

unread,
Jun 6, 2013, 5:50:18 AM6/6/13
to alembic-d...@googlegroups.com
On 1/6/13 5:26 AM, Shih-Chin wrote:
> Create VC Project
>
> 1. open vc10 command prompt
> 2. cd /d alembic_source_root
> 3. mkdir vc_proj
> 4. cd vc_proj
> 5. cmake -G "Visual Studio 10 Win64" -C ..\init_cache.cmake ..
> 6. If all goes well, we could simply open the ALEMBIC.sln and compile
> the libraries as usual.

Just out of curiosity: why not generate an nmake or JOM makefiles with
CMake and do the final build step on the command line, too? Why open an IDE?

.mm

Reply all
Reply to author
Forward
0 new messages