Angel Ortiz 7 жил өмнө
parent
commit
90e8a18f56

+ 2 - 12
CMakeLists.txt

@@ -1,18 +1,8 @@
 cmake_minimum_required(VERSION 3.7)
 cmake_minimum_required(VERSION 3.7)
 project(softwareRenderer)
 project(softwareRenderer)
 
 
-#Location of cmake scripts
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
-
-#Switching SDL2 files based on compiler 
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
-  set(SDL2_PATH "C:\\vs_dev_lib\\SDL2-2.0.8-MinGW\\x86_64-w64-mingw32")
-elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
-  # using Intel C++
-elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
-  set(SDL2_PATH "C:\\vs_dev_lib\\SDL2-2.0.8-MSVC")
-endif()
-
+set(SDL2_PATH "C:\\vs_dev_lib\\SDL2-2.0.8")
 find_package(SDL2 REQUIRED)
 find_package(SDL2 REQUIRED)
 find_package(OpenMP REQUIRED)
 find_package(OpenMP REQUIRED)
 include_directories(${SDL2_INCLUDE_DIR} include libs)
 include_directories(${SDL2_INCLUDE_DIR} include libs)
@@ -20,7 +10,7 @@ include_directories(${SDL2_INCLUDE_DIR} include libs)
 file(GLOB source_files "*.h" "*.cpp" "src/*.cpp" "include/*.h" "libs/*.h")
 file(GLOB source_files "*.h" "*.cpp" "src/*.cpp" "include/*.h" "libs/*.h")
 add_executable(softwareRenderer ${source_files})
 add_executable(softwareRenderer ${source_files})
 #-fopt-info-vec-all -xCORE-AVX2 -no-prec-sqrt  
 #-fopt-info-vec-all -xCORE-AVX2 -no-prec-sqrt  
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -g -ffast-math  ")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -g  -ffast-math -static -static-libgcc -static-libstdc++ ")
 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g ")
 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g ")
 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -g ")
 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -g ")
 target_link_libraries(softwareRenderer ${SDL2_LIBRARY})
 target_link_libraries(softwareRenderer ${SDL2_LIBRARY})

+ 2 - 1
include/buffer.h

@@ -7,6 +7,7 @@
 // ===============================
 // ===============================
 
 
 #include "SDL.h"
 #include "SDL.h"
+#include <cstring>
 #include <type_traits>
 #include <type_traits>
 #include <string.h>
 #include <string.h>
 
 
@@ -42,7 +43,7 @@ struct Buffer{
             }
             }
 			else{
 			else{
 				//Set to a 15% white color to make it nicer looking.
 				//Set to a 15% white color to make it nicer looking.
-				memset(buffer,0xD, mPitch*mHeight);       
+				std::memset(buffer,0xD, mPitch*mHeight);       
 			}
 			}
         }
         }
 };
 };

+ 3 - 2
src/displayManager.cpp

@@ -5,7 +5,8 @@
 
 
 //Includes
 //Includes
 #include "displayManager.h"
 #include "displayManager.h"
-#include <stdio.h>
+#include <cstdio>
+#include <cstring>
 
 
 //Dummy constructors/destructors
 //Dummy constructors/destructors
 DisplayManager::DisplayManager(){}
 DisplayManager::DisplayManager(){}
@@ -46,7 +47,7 @@ void DisplayManager::swapBuffers(Buffer<Uint32> *pixels){
     SDL_LockSurface(mSurface);
     SDL_LockSurface(mSurface);
 
 
     //Copy pixels buffer resuls to screen surface
     //Copy pixels buffer resuls to screen surface
-    memcpy(mSurface->pixels, pixels->buffer, pixels->mHeight*pixels->mPitch);
+    std::memcpy(mSurface->pixels, pixels->buffer, pixels->mHeight*pixels->mPitch);
     SDL_UnlockSurface(mSurface);
     SDL_UnlockSurface(mSurface);
 
 
     //Apply surface changes to window
     //Apply surface changes to window