I'm trying to use OCE 0.17.1 in our multi-platform software package. Our software runs on both Linux and Windows (32- & 64-bit for both), but all four platforms are built on linux development stations using gcc. The Windows builds are compiled using MinGW compilers. Our company has been using mingw for years, but I haven't had to deal with it myself. Nobody here, including me, has any prior experience with cmake.
I've gotten OCE built for linux easily enough, and it seems to link with our software & run just fine. However, I'm having trouble building the Windows version of OCE with MinGW on our linux boxen. Due to licensing constraints, I need to build shared DLL's for OCE rather than linking it into our software statically. I've created what I think should be appropriate cmake files that describe our mingw build environment, but when OCE compiles, the resulting libraries are all ELF shared libs with a .so extension. I'm having a hard time figuring out how to force it to build Windows DLL's. Our company has been using mingw for years, but I haven't had to deal with it myself. Nobody here, including me, has any prior experience with cmake.
Has anybody build OCE for Windows DLL's using a linux platform with mingw? How did you do it?
Below is the cmake file that I'm using to configure the 64-bit Windows build:
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Show compiler commands" FORCE)
set(CMAKE_SYSTEM_NAME gcc)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_FORCE_CXX_COMPILER "x86_64-w64-mingw32-g++" CACHE FILEPATH "CXX compiler" FORCE)
set(CMAKE_FORCE_C_COMPILER "x86_64-w64-mingw32-gcc" CACHE FILEPATH "C compiler" FORCE)
set(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib" CACHE FILEPATH "Path to a program." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "-shared --enable-runtime-pseudo-reloc" CACHE STRING "Flags used by the linker during the creation of dll's." FORCE)
set(CMAKE_FORCE_CXX_FLAGS "-fmessage-length=0 -fno-strict-aliasing -fno-stack-protector -DMINGW -DUNICODE -D_WIN32_WINNT=0x0500 -D_DWFCORE_WIN32_SYSTEM -D__MINGW32__ -Wno-deprecated -DOD_STD_ALLOCATOR_AS_IS" CACHE STRING "Flags used by the compiler during all build types." FORCE)
set(CMAKE_FORCE_C_FLAGS "-fmessage-length=0 -fno-strict-aliasing -fno-stack-protector -DMINGW -DUNICODE -D_WIN32_WINNT=0x0500 -D_DWFCORE_WIN32_SYSTEM -D__MINGW32__ -DOD_STD_ALLOCATOR_AS_IS" CACHE STRING "Flags used by the compiler during all build types." FORCE)
set(FREETYPE_INCLUDE_DIR_freetype2 /usr/include/freetype2 CACHE PATH "the path of freetype2" FORCE)
set(FREETYPE_INCLUDE_DIR_ft2build /usr/lib/sds2/thirdparty-libs-for-sds2-2015/win64-gcc46/include CACHE PATH "the path of ft2build.h" FORCE)
set(FREETYPE_LIBRARY /usr/lib/sds2/thirdparty-libs-for-sds2-2015/lib/win64-gcc46/libfreetype.a CACHE FILEPATH "freetype library" FORCE)
set(OPENGL_INCLUDE_DIR /usr/x86_64-w64-mingw32/include/GL CACHE PATH "path to OpenGL includes" FORCE)
set(OPENGL_gl_LIBRARY /usr/x86_64-w64-mingw32/lib/libopengl32.a CACHE FILEPATH "path to OpenGL library" FORCE)
set(OPENGL_glu_LIBRARY /usr/x86_64-w64-mingw32/lib/libglu32.a CACHE FILEPATH "path to OpenGL library" FORCE)
set(OCE_INSTALL_PREFIX /tmp/oce/win64 CACHE PATH "Directory that will contain install files of OCCT" FORCE)
set(OCE_VISUALISATION OFF CACHE BOOL "include Visualization" FORCE)
set(OCE_TESTING OFF CACHE BOOL "Enable unittesting framework" FORCE)
set(OCE_DISABLE_TKSERVICE_FONT ON CACHE BOOL "Disable TKService Font (only without Visualization)" FORCE)
set(INSTALL_FREETYPE OFF CACHE BOOL "Is freetype required to be copied into install directory" FORCE)
set(INSTALL_TCL OFF CACHE BOOL "Is tcl lib required to be copied into install directory" FORCE)
set(INSTALL_TESTS OFF CACHE BOOL "Is tests copy to install directory" FORCE)
set(INSTALL_VTK OFF CACHE BOOL "Is vtk required to be copied into install directory" FORCE)
set(USE_FREEIMAGE OFF CACHE BOOL "Is freeimage used or not" FORCE)
set(USE_GL2PS OFF CACHE BOOL "Is gl2ps used or not" FORCE)
set(USE_OPENCL OFF CACHE BOOL "Is OpenCL used or not" FORCE)
set(USE_TBB OFF CACHE BOOL "Is tbb used or not" FORCE)
set(USE_VTK OFF CACHE BOOL "Is VTK used or not" FORCE)