Changeset 120 for trunk


Ignore:
Timestamp:
06/15/13 02:05:49 (12 years ago)
Author:
epyon
Message:
  • Nova now properly compiles and works under: mingw GCC 4.6 32-bit target mingw GCC 4.6 64-bit targte clang 3.2 32-bit target (64-bit clang doesn't work under windows)
  • warning removal will follow soon
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv.lua

    r2 r120  
    1 -- project definition for nv
    21project "nv"
    32        location (_ACTION)
    4     language "C++"
     3        language "C++"
    54        kind "StaticLib"
    65        includedirs { "." }
    76        files { "nv/**.hh", "nv/**.inl", "src/**.cc" }
    87        targetname "nv"
     8
     9-- injection!
     10solution( solution().name )
     11        configuration "*"
     12                includedirs { os.getenv("GLM_PATH") }
     13        configuration "gmake"
     14                buildoptions "-std=c++0x"
     15        configuration "vs*"
     16                defines { "_SECURE_SCL=0", "_CRT_SECURE_NO_WARNINGS=1" }
     17
     18if _ACTION == "gmake-clang" then
     19        premake.gcc.cc  = "clang"
     20        premake.gcc.cxx = "clang++"
     21        _ACTION = "gmake"
     22end
     23
     24premake.action.add {
     25        trigger = "gmake-clang",
     26        description = "gmake file with clang overrides, needs 'make -R' to work",
     27}
     28
     29if _ACTION == "clean" then
     30        for action in premake.action.each() do
     31                os.rmdir(action.trigger)
     32        end
     33end
  • trunk/nv/common.hh

    r117 r120  
    4848#define NV_COMPILER NV_MSVC
    4949#define NV_COMP_VER _MSC_VER
     50#elif defined( __clang__ )
     51#define NV_COMPILER NV_CLANG
     52#define NV_COMP_VER (((__clang_major__)*100) + (__clang_minor__*10) + __clang_patchlevel__)
    5053#elif defined( __GNUC__ )
    5154#define NV_COMPILER NV_GNUC
    5255#define NV_COMP_VER (((__GNUC__)*100) + (__GNUC_MINOR__*10) + __GNUC_PATCHLEVEL__)
    53 #elif defined( __clang__ )
    54 #define NV_COMPILER NV_CLANG
    55 #define NV_COMP_VER (((__clang_major__)*100) + (__clang_minor__*10) + __clang_patchlevel__)
    5656#else
    5757#error "Unknown compiler!"
  • trunk/nv/gfx/cached_buffer.hh

    r119 r120  
    4747                        if ( locked || result )
    4848                        {
    49                                 m_cache->add_offset<T>( m_data.size(), m_offset, static_cast<T>(value) );
     49                                // funny, but this is what GCC expects
     50                                m_cache->template add_offset<T>( m_data.size(), m_offset, static_cast<T>(value) );
    5051                        }
    5152                        return result;
  • trunk/nv/interface/clear_state.hh

    r111 r120  
    6464                };
    6565
    66                 scissor_test scissor_test;
    67                 color_mask color_mask;
     66                nv::scissor_test scissor_test;
     67                nv::color_mask color_mask;
    6868                bool depth_mask;
    6969                uint32 front_stencil_mask;
  • trunk/nv/position.hh

    r115 r120  
    2929                typedef rectangle type;
    3030               
    31                 union
    32                 {
    33                         struct { position upper_left; position lower_right; };
    34                         struct { position ul;         position lr; };
    35                         struct { value_type x1,y1,x2,y2; };
    36                 };
     31                position ul;
     32                position lr;
    3733                /**
    3834                 *Creates a new rectangle assigned to {0, 0, 0, 0}.
     
    139135                 *@returns The width of the rectangle.
    140136                 */
    141                 value_type get_width() const { return x2 - x1; }
     137                value_type get_width() const { return lr.x - ul.x; }
    142138
    143139                /**
     
    146142                 *@returns The height of the rectangle.
    147143                 */
    148                 value_type get_height() const { return y2 - y1; }
     144                value_type get_height() const { return lr.y - ul.y; }
    149145
    150146                /**
     
    153149                 *@returns The area of the rectangle.
    154150                 */
    155                 value_type get_area() const { return (y2 - y1) * (x2 - x1); }
     151                value_type get_area() const { return (lr.y - ul.y) * (lr.x - ul.x); }
    156152
    157153                /**
     
    160156                 *@returns True if the rectangle's upper-left is above and left (or equal to) the rectangle's lower-right, false if it is not.
    161157                 */
    162                 bool is_valid() const { return x2 >= x1 && y2 >= y1; }
     158                bool is_valid() const { return lr.x >= ul.x && lr.y >= ul.y; }
    163159
    164160                /**
     
    246242                 *@returns True if the position is inside or on the edge of the rectangle, false otherwise.
    247243                 */
    248                 bool contains( const position& r ) const{ return y2 >= r.y && y1 <= r.y && x2 >= r.x && x1 <= r.x; }
     244                bool contains( const position& r ) const{ return lr.y >= r.y && ul.y <= r.y && lr.x >= r.x && ul.x <= r.x; }
    249245
    250246                /**
     
    262258                 *@returns True if any part of the rectangle to check overlaps this rectangle, false otherwise.
    263259                 */
    264                 bool collides( const rectangle& r ) const { return y2 > r.y1 && y1 < r.y2 && x2 > r.x1 && x1 < r.x2; }
     260                bool collides( const rectangle& r ) const { return lr.y > r.ul.y && ul.y < r.lr.y && lr.x > r.ul.x && ul.x < r.lr.x; }
    265261
    266262                /**
     
    298294                void repair()
    299295                {
    300                         if (x1 > x2) std::swap( x1, x2 );
    301                         if (y1 > y2) std::swap( y1, y2 );
     296                        if (ul.x > lr.x) std::swap( ul.x, lr.x );
     297                        if (ul.y > lr.y) std::swap( ul.y, lr.y );
    302298                }
    303299
  • trunk/premake4.lua

    r17 r120  
    1 -- Error handling if user didn't provide any action/target
    2 -- for the build
    3 if _ACTION == nil then
    4         print "Error! You must specify target build"
    5         print "Example: ./premake4 gmake"
    6         print "    This will create makefiles for Linux"
    7         print ""
    8         print "Aborting!"
    9         print ""
    10         return
    11 end
    12 
    131solution "nv"
    142        configurations { "debug", "release" }
    15 
    16         -- For starters, check the target build.
    17         -- If this is a gmake build we must add these
    18         -- flags to enable C++11 support.
    19         if _ACTION == "gmake" then
    20                 buildoptions "-std=c++11"
    21         end
    22 
    233        targetdir "bin"
    244        flags { "ExtraWarnings", "NoPCH" }
     
    299                flags { "Symbols" }
    3010                targetdir "bin"
    31                 objdir (_ACTION.."/debug")
     11                objdir (_ACTION or "".."/debug")
    3212
    3313        configuration "release"
     
    3515                flags { "Optimize" }
    3616                targetdir "bin"
    37                 objdir (_ACTION.."/release")
     17                objdir (_ACTION or "".."/release")
    3818
    3919        dofile("nv.lua")
     
    4626        end
    4727}
    48 
    49 if _ACTION == "clean" then
    50         for action in premake.action.each() do
    51                 os.rmdir(action.trigger)
    52         end
    53 end
    54 
  • trunk/src/gl/gl_device.cc

    r98 r120  
    7474        load_sdl_image_library();
    7575        SDL_Surface* image = IMG_Load( filename.c_str() );
     76        if (!image)
     77        {
     78                NV_LOG( LOG_ERROR, "Image file " << filename.c_str() << " not found!" );
     79                return nullptr;
     80        }
    7681        image_data* data = new image_data( glm::ivec2( image->w, image->h ), image->format->BytesPerPixel, (nv::uint8*)image->pixels );
    7782        return data;
  • trunk/src/gui/gui_element.cc

    r99 r120  
    2727                }
    2828        }
     29        //((environment*)m_root)->update( this, elapsed );
    2930}
    3031
     
    9091        }
    9192
    92         m_absolute = m_relative + pabsolute.upper_left;
     93        m_absolute = m_relative + pabsolute.ul;
    9394
    9495        for ( object* o : *this )
  • trunk/src/library.cc

    r113 r120  
    115115#if NV_PLATFORM == NV_WINDOWS
    116116    // We do hate WinAPI for code like this, don't we?
    117     LPVOID buffer;
     117    LPTSTR buffer = NULL;
    118118    FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
    119119        NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buffer, 0, NULL );
  • trunk/src/object.cc

    r107 r120  
    77#include "nv/object.hh"
    88
     9#include <algorithm>
    910#include "nv/root.hh"
    1011#include "nv/types.hh"
  • trunk/tests/render_test/premake4.lua

    r61 r120  
    1 if _ACTION == nil then
    2         print "Error! You must specify target build"
    3         print "Example: ./premake4 gmake"
    4         print "    This will create makefiles for Linux"
    5         print ""
    6         print "Aborting!"
    7         print ""
    8         return
    9 end
    10 
    111solution "nv_render_test"
    122        configurations { "debug", "release" }
     
    155        flags { "ExtraWarnings", "NoPCH" }
    166
    17         -- For starters, check the target build.
    18         -- If this is a gmake build we must add these
    19         -- flags to enable C++11 support.
    20         if _ACTION == "gmake" then
    21                 buildoptions "-std=c++11"
    22         end
    23 
    247        configuration "debug"
    258                defines { "DEBUG" }
    269                flags { "Symbols", "StaticRuntime" }
    27                 objdir (_ACTION.."/debug")
     10                objdir (_ACTION or "".."/debug")
    2811
    2912        configuration "release"
    3013                defines { "NDEBUG" }
    3114                flags { "Optimize", "StaticRuntime" }
    32                 objdir (_ACTION.."/release")
     15                objdir (_ACTION or "".."/release")
    3316
    3417        dofile("render_test.lua")
  • trunk/tests/render_test/render_test.lua

    r46 r120  
    55        includedirs { "../../" }
    66        targetname "rl"
    7         defines { "_SCL_SECURE_NO_WARNINGS" }
    87        links { "nv" }
    98 
Note: See TracChangeset for help on using the changeset viewer.