[osg-users] [build] OSG 3.4.0 Build with Visual C++ 2015

Stuart Mentzer Stuart_Mentzer at objexx.com
Wed Apr 20 14:36:13 PDT 2016


An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160420/0ae9ec61/attachment-0003.htm>
-------------- next part --------------
OSG VC++ 2015 Build on Windows

Notes:
 mcd is a script for md then cd
 A subset of optional dependencies was used for this first try

cmake.VC.r.bat: (installs OSG to C:\OSG) (without /arch arg for build that works on generic CPU)
@echo off
setlocal
set PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\bin;C:\MinGW\bin;C:\Git\cmd;C:\CMake\bin
set INCLUDE=
set LIB=
set LIBPATH=
call setVC14.64.bat
set CC=cl
set CXX=cl
del CMakeCache.txt >nul 2>nul
C:\CMake\bin\cmake.exe -G "MinGW Makefiles" -DCMAKE_COLOR_MAKEFILE:BOOL=0 -DCMAKE_INSTALL_PREFIX="C:/OSG" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_FLAGS_RELEASE="/nologo /EHsc /DNOMINMAX /DWIN32_LEAN_AND_MEAN /DNDEBUG /O2 /GS- /MD" -DCMAKE_C_FLAGS_RELEASE="/nologo /EHsc /DNOMINMAX /DWIN32_LEAN_AND_MEAN /DNDEBUG /O2 /GS- /MD" %*
make -j%NUMBER_OF_PROCESSORS% VERBOSE=true
make install
endlocal


zlib:
mcd zlib_build
..\cmake.VC.r.bat ../zlib
copy zconf.h ..\zlib

minizip: (after zlib)
option(USE_AES "enables building of aes library" OFF)
mcd minizip_build
..\cmake.VC.r.bat -DZLIB_LIBRARY:FILEPATH="../zlib_build/zlib.lib" -DZLIB_INCLUDE_DIR:PATH="../zlib" ../minizip

curl:
option(CURL_STATICLIB "Set to ON to build libcurl with static linking." ON)
mcd curl_build
..\cmake.VC.r.bat ../curl

freetype:
mcd freetype_build
..\cmake.VC.r.bat /I ../freetype

giflib:
copy osg-3rdparty-cmake\giflib\* giflib
mcd giflib_build
..\cmake.VC.r.bat -DGIFLIB_SOURCE_DIR:PATH="../giflib" -DSKIP_INSTALL_ALL=1 ../giflib

glut:
copy osg-3rdparty-cmake\glut\* glut
mcd glut_build
..\cmake.VC.r.bat -DGLUT_SOURCE_DIR:PATH="../glut" -DSKIP_INSTALL_ALL=1 ../glut

jpeg:
copy osg-3rdparty-cmake\libjpeg\* jpeg
mcd jpeg_build
..\cmake.VC.r.bat -DLIBJPEG_SOURCE_DIR:PATH="../jpeg" -DSKIP_INSTALL_ALL=1 ../jpeg

lpng: (after zlib)
mcd lpng_build
..\cmake.VC.r.bat -DZLIB_INCLUDE_DIR:PATH="../zlib" -DZLIB_LIBRARY:FILEPATH="../zlib_build/zlib" -DPNG_STATIC=1 ../lpng

tiff:
mcd tiff_build
..\cmake.VC.r.bat -DCMAKE_PREFIX_PATH:PATH=".." ../tiff
(not finding zlib, jpeg, ... packages)

Collect all 3rd party libraries in 3rdparty\lib directory and rename them:
freetype.lib
giflib.lib
glut32.lib
jpeg.lib
libcurl.lib
libcurl.dll
libcurl.dll.manifest
libpng16.lib	(rename from libpng16_static.lib)
libpng16.dll
libpng16.dll.manifest
minizip.lib
tiff.lib
tiff.dll
tiff.dll.manifest
zlib.lib

Collect all 3rd party library headers in 3rdparty\include

OSG:

Put OSG 3.4.0 source in OSG directory

Top-level CMakeLists.txt:
 IF(MSVC) block (Use newest Windows Kits directory):
        # Objexx
        set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LIBPATH:\"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.10586.0/um/x64\"" CACHE INTERNAL "" FORCE)
        set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LIBPATH:\"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.10586.0/um/x64\"" CACHE INTERNAL "" FORCE)
        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LIBPATH:\"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.10586.0/um/x64\"" CACHE INTERNAL "" FORCE)
        include_directories(AFTER "C:/Projects/OSG/freetype/include")
 Enable packages on this line and add C:\CMake\bin to PATH so cpack is found:
    OPTION(BUILD_OSG_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" ON)

mcd OSG_build
..\cmake.VC.r.bat ../OSG


More information about the osg-users mailing list