Browse Source

Compile with VS 2015 Express, build assimp on Windows

rdb 8 years ago
parent
commit
f7af155e93

+ 10 - 3
makepanda/makepanda.py

@@ -571,6 +571,10 @@ if (COMPILER == "MSVC"):
             #LibName(pkg, 'ddraw.lib')
             LibName(pkg, 'dxguid.lib')
 
+            if SDK.get("VISUALSTUDIO_VERSION") == '14.0':
+                # dxerr needs this for __vsnwprintf definition.
+                LibName(pkg, 'legacy_stdio_definitions.lib')
+
     if not PkgSkip("FREETYPE") and os.path.isdir(GetThirdpartyDir() + "freetype/include/freetype2"):
         IncDirectory("FREETYPE", GetThirdpartyDir() + "freetype/include/freetype2")
 
@@ -637,7 +641,6 @@ if (COMPILER == "MSVC"):
     if (PkgSkip("FFTW")==0):     LibName("FFTW",     GetThirdpartyDir() + "fftw/lib/rfftw.lib")
     if (PkgSkip("FFTW")==0):     LibName("FFTW",     GetThirdpartyDir() + "fftw/lib/fftw.lib")
     if (PkgSkip("ARTOOLKIT")==0):LibName("ARTOOLKIT",GetThirdpartyDir() + "artoolkit/lib/libAR.lib")
-    if (PkgSkip("ASSIMP")==0):   PkgDisable("ASSIMP")  # Not yet supported
     if (PkgSkip("OPENCV")==0):   LibName("OPENCV",   GetThirdpartyDir() + "opencv/lib/cv.lib")
     if (PkgSkip("OPENCV")==0):   LibName("OPENCV",   GetThirdpartyDir() + "opencv/lib/highgui.lib")
     if (PkgSkip("OPENCV")==0):   LibName("OPENCV",   GetThirdpartyDir() + "opencv/lib/cvaux.lib")
@@ -652,6 +655,9 @@ if (COMPILER == "MSVC"):
     if (PkgSkip("FCOLLADA")==0):
         LibName("FCOLLADA", GetThirdpartyDir() + "fcollada/lib/FCollada.lib")
         IncDirectory("FCOLLADA", GetThirdpartyDir() + "fcollada/include/FCollada")
+    if (PkgSkip("ASSIMP")==0):
+        LibName("ASSIMP", GetThirdpartyDir() + "assimp/lib/assimp.lib")
+        IncDirectory("ASSIMP", GetThirdpartyDir() + "assimp/include/assimp")
     if (PkgSkip("SQUISH")==0):
         if GetOptimize() <= 2:
             LibName("SQUISH",   GetThirdpartyDir() + "squish/lib/squishd.lib")
@@ -2875,7 +2881,8 @@ if tp_dir is not None:
                         CopyFile(GetOutputDir() + "/" + base, tp_lib)
 
     if GetTarget() == 'windows':
-        CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/")
+        if os.path.isdir(os.path.join(tp_dir, "extras", "bin")):
+            CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/")
 
         if not PkgSkip("PYTHON") and not RTDIST:
             # We need to copy the Python DLL to the bin directory for now.
@@ -5575,7 +5582,7 @@ if not PkgSkip("PANDATOOL") and not PkgSkip("ASSIMP"):
   TargetAdd('p3assimp_composite1.obj', opts=OPTS, input='p3assimp_composite1.cxx')
   TargetAdd('libp3assimp.dll', input='p3assimp_composite1.obj')
   TargetAdd('libp3assimp.dll', input=COMMON_PANDA_LIBS)
-  TargetAdd('libp3assimp.dll', opts=OPTS)
+  TargetAdd('libp3assimp.dll', opts=OPTS+['ZLIB'])
 
 #
 # DIRECTORY: pandatool/src/daeprogs/

+ 12 - 3
makepanda/makepandacore.py

@@ -2384,6 +2384,8 @@ def SetupVisualStudioEnviron():
     os.environ["VCINSTALLDIR"] = SDK["VISUALSTUDIO"] + "VC"
     os.environ["WindowsSdkDir"] = SDK["MSPLATFORM"]
 
+    winsdk_ver = SDK["MSPLATFORM_VERSION"]
+
     # Determine the directories to look in based on the architecture.
     arch = GetTargetArch()
     bindir = ""
@@ -2399,9 +2401,16 @@ def SetupVisualStudioEnviron():
         # Special version of the tools that run on x86.
         bindir = 'x86_' + bindir
 
-    binpath = SDK["VISUALSTUDIO"] + "VC\\bin\\" + bindir
-    if not os.path.isdir(binpath):
-        exit("Couldn't find compilers in %s.  You may need to install the Windows SDK 7.1 and the Visual C++ 2010 SP1 Compiler Update for Windows SDK 7.1." % binpath)
+    vc_binpath = SDK["VISUALSTUDIO"] + "VC\\bin"
+    binpath = os.path.join(vc_binpath, bindir)
+    if not os.path.isfile(binpath + "\\cl.exe"):
+        # Try the x86 tools, those should work just as well.
+        if arch == 'x64' and os.path.isfile(vc_binpath + "\\x86_amd64\\cl.exe"):
+            binpath = "{0}\\x86_amd64;{0}".format(vc_binpath)
+        elif winsdk_ver.startswith('10.'):
+            exit("Couldn't find compilers in %s.  You may need to install the Windows SDK 7.1 and the Visual C++ 2010 SP1 Compiler Update for Windows SDK 7.1." % binpath)
+        else:
+            exit("Couldn't find compilers in %s." % binpath)
 
     AddToPathEnv("PATH",    binpath)
     AddToPathEnv("PATH",    SDK["VISUALSTUDIO"] + "Common7\\IDE")

+ 0 - 5
panda/src/dxgsg9/config_dxgsg9.cxx

@@ -265,8 +265,3 @@ init_libdxgsg9() {
   PandaSystem *ps = PandaSystem::get_global_ptr();
   ps->add_system("DirectX9");
 }
-
-// Necessary to allow use of dxerr from MSVC 2015
-#if _MSC_VER >= 1900
-int (WINAPIV * __vsnprintf)(char *, size_t, const char*, va_list) = _vsnprintf;
-#endif

+ 2 - 2
panda/src/dxgsg9/dxGeomMunger9.cxx

@@ -164,7 +164,7 @@ munge_format_impl(const GeomVertexFormat *orig,
 
   // Now go through the remaining arrays and make sure they are tightly
   // packed.  If not, repack them.
-  for (int i = 0; i < new_format->get_num_arrays(); ++i) {
+  for (size_t i = 0; i < new_format->get_num_arrays(); ++i) {
     CPT(GeomVertexArrayFormat) orig_a = new_format->get_array(i);
     if (orig_a->count_unused_space() != 0) {
       PT(GeomVertexArrayFormat) new_a = new GeomVertexArrayFormat;
@@ -267,7 +267,7 @@ premunge_format_impl(const GeomVertexFormat *orig) {
 
   // Now go through the remaining arrays and make sure they are tightly
   // packed.  If not, repack them.
-  for (int i = 0; i < new_format->get_num_arrays(); ++i) {
+  for (size_t i = 0; i < new_format->get_num_arrays(); ++i) {
     CPT(GeomVertexArrayFormat) orig_a = new_format->get_array(i);
     if (orig_a->count_unused_space() != 0) {
       PT(GeomVertexArrayFormat) new_a = new GeomVertexArrayFormat;

+ 2 - 2
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -863,7 +863,7 @@ prepare_display_region(DisplayRegionPipelineReader *dr) {
   dr->get_region_pixels_i(l, u, w, h);
 
   // Create the viewport
-  D3DVIEWPORT9 vp = { l, u, w, h, 0.0f, 1.0f };
+  D3DVIEWPORT9 vp = { (DWORD)l, (DWORD)u, (DWORD)w, (DWORD)h, 0.0f, 1.0f };
   _current_viewport = vp;
   HRESULT hr = _d3d_device->SetViewport(&_current_viewport);
   if (FAILED(hr)) {
@@ -1185,7 +1185,7 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
 
     const TransformTable *table = data_reader->get_transform_table();
     if (table != (TransformTable *)NULL) {
-      for (int i = 0; i < table->get_num_transforms(); i++) {
+      for (size_t i = 0; i < table->get_num_transforms(); ++i) {
         LMatrix4 mat;
         table->get_transform(i)->mult_matrix(mat, _internal_transform->get_mat());
         const D3DMATRIX *d3d_mat = (const D3DMATRIX *)mat.get_data();

+ 1 - 1
panda/src/dxgsg9/dxIndexBufferContext9.cxx

@@ -168,7 +168,7 @@ upload_data(const GeomPrimitivePipelineReader *reader, bool force) {
   if (data_pointer == NULL) {
     return false;
   }
-  int data_size = reader->get_data_size_bytes();
+  size_t data_size = (size_t)reader->get_data_size_bytes();
 
   if (reader->get_index_type() == GeomEnums::NT_uint8) {
     // We widen 8-bits indices to 16-bits.

+ 2 - 1
pandatool/src/maxegg/maxEgg.rc

@@ -7,7 +7,8 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+#include "WinResrc.h"
+#define IDC_STATIC -1
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
 

+ 2 - 2
pandatool/src/maxprogs/maxImportRes.rc

@@ -7,8 +7,8 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
-
+#include "WinResrc.h"
+#define IDC_STATIC -1
 ////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS