+ Update instructions for Mefisto2f build on Win x64

This commit is contained in:
wmayer
2014-01-08 22:49:19 +01:00
parent 7cf3b61c54
commit 367d828030
2 changed files with 61 additions and 26 deletions

View File

@@ -59,31 +59,52 @@ To create an intstaller package you need WIX.
Additional information on building special 3rd party libraries
--------------------------------------------------------------
The addressed audience for this section is rather the developers
themselves than those people who build the FreeCAD sources.
* Mefisto2F
* Salome SMESH
The Salome SMESH library needs the Mefisto2F library which contains some Fortran code.
The easiest way is to convert the Fortran code into C code and use the f2c library to
build a static library.
The Salome SMESH library needs some special steps in order to be built
because it contains some Fortran code.
1. Get the f2c utility from http://netlib.sandia.gov/f2c/mswin/index.html
2. Get f2c.h from http://netlib.sandia.gov/f2c/f2c.h
3. Convert the Fortran file trte.f into a C file trte.c using the f2c utility
>>> f2c trte.f
4. Get the sources for the lib f2c from http://netlib.sandia.gov/f2c/libf2c.zip and
pack them. Before doing the build do these changes:
arithchk.c:
#include <stddef.h>
typedef int ssize_t;
1. First get the SMESH sources smesh-5.1.2.2.tar.gz from the Sourceforge download area
2. Make sure that the IDE can find the boost header files
3. Start compiling all the projects. The NETGENPlugin probably fails but this can simply
be unloaded or removed because we don't need it.
Except of MESFISTO2 all other projects should compile fine. For MEFISTO2 we get a couple
of linker errors.
4. Get the f2c utility from http://netlib.sandia.gov/f2c/mswin/index.html
5. Get f2c.h from http://netlib.sandia.gov/f2c/f2c.h.gz
6. Convert the Fortran file trte.f into a C file trte.c using the f2c utility
7. Get the sources for the lib f2c from http://netlib.sandia.gov/f2c/libf2c.zip.
Unpack the sources and add the compiler switch /MD to makefile.vc. This is needed to
link against the shared C runtime, not the static one.
8. Remove the __WATCOM__ define from the list of the preprocessor macros of the MESFISTO2
>>> cl -DUSE_CLOCK -DMSDOS -DNO_ONEXIT -Ot1 -DNO_My_ctype -DNO_ISATTY -DNO_FPINIT arithchk.c
makefile.vc:
CFLAGS = -DUSE_CLOCK -DMSDOS -DNO_ONEXIT -Ot1 -DNO_My_ctype -DNO_ISATTY -MD
w = \
+trte.obj \
-main.obj \
Adding "-MD" is needed to link against the shared C runtime, not the static one.
libf2c.lbc:
+trte.obj
-main.obj
open.c:
Replace "access" with "_access"
Run nmake -f makefile.vc
5. Remove the __WATCOM__ define from the list of the preprocessor macros of the MESFISTO2
project.
9. Build the file vcf2c.lib with "nmake -f makefile.vc" and add it to the MEFISTO2 project as
6. Build the file vcf2c.lib with "nmake -f makefile.vc" and add it to the MEFISTO2 project as
additional library. The linker errors should now go away.
Alternatively, you can use the Watcom Fortran compiler. The needed project file can be get from
here: http://sourceforge.net/p/salomesmesh/code/HEAD/tree/trunk/adm/win32-watcom/
However, this doesn't work for x64 targets at the moment.
* FreeType
http://stackoverflow.com/questions/6207176/compiling-freetype-to-dll-as-opposed-to-static-library

View File

@@ -364,12 +364,22 @@ endif(MSVC)
# MEFISTO2 #
##############
if (MSVC)
FILE(GLOB MEFISTO2_source_files
src/MEFISTO2/*.cpp
src/MEFISTO2/MEFISTO2F.def
inc/Rn.h
inc/aptrte.h
)
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
# Mefisto2f.lib was built using f2c which created
# all function names with an '_' at the end.
FILE(GLOB MEFISTO2_source_files
src/MEFISTO2/*.cpp
inc/Rn.h
inc/aptrte.h
)
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
FILE(GLOB MEFISTO2_source_files
src/MEFISTO2/*.cpp
src/MEFISTO2/MEFISTO2F.def
inc/Rn.h
inc/aptrte.h
)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
else(MSVC)
FILE(GLOB MEFISTO2_source_files
src/MEFISTO2/*.cpp
@@ -383,7 +393,11 @@ ADD_LIBRARY(MEFISTO2 SHARED ${MEFISTO2_source_files})
if(MSVC)
TARGET_LINK_LIBRARIES(MEFISTO2 ${SMESH_LIBS} MEFISTO2f.lib) # in case of Windows link the prebuild Fortran lib
set_target_properties(MEFISTO2 PROPERTIES COMPILE_FLAGS "-DMEFISTO2D_EXPORTS -D__WATCOM__")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set_target_properties(MEFISTO2 PROPERTIES COMPILE_FLAGS "-DMEFISTO2D_EXPORTS")
else(CMAKE_SIZEOF_VOID_P EQUAL 8)
set_target_properties(MEFISTO2 PROPERTIES COMPILE_FLAGS "-DMEFISTO2D_EXPORTS -D__WATCOM__")
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set_target_properties(MEFISTO2 PROPERTIES DEBUG_OUTPUT_NAME "MEFISTO2d")
set_target_properties(MEFISTO2 PROPERTIES OUTPUT_NAME "MEFISTO2")
set_target_properties(MEFISTO2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)