diff --git a/.gitignore b/.gitignore index 0686c4180..685ee8c42 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ Makefile .cproject .project .settings/ + +# WinMerge +.bak \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 261215014..d15b4303e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,11 @@ endif() find_package(Freetype REQUIRED) find_package(FreeImage REQUIRED) find_package(SDL2 REQUIRED) +if(MSVC) +find_package(Boost REQUIRED COMPONENTS system date_time locale) +else() find_package(Boost REQUIRED COMPONENTS system filesystem date_time locale) +endif() find_package(Eigen3 REQUIRED) find_package(CURL REQUIRED) find_package(VLC REQUIRED) @@ -81,9 +85,14 @@ if(CMAKE_COMPILER_IS_GNUCXX) endif() #set up compiler flags for GCC +if (CMAKE_BUILD_TYPE MATCHES Debug) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -O0") #support C++11 for std::, optimize + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O0") +else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -O3") #support C++11 for std::, optimize set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O3") #-s = strip binary endif() +endif() if(${GLSystem} MATCHES "Desktop OpenGL") add_definitions(-DUSE_OPENGL_DESKTOP) diff --git a/es-core/src/Util.cpp b/es-core/src/Util.cpp index 34be52494..8d8810425 100644 --- a/es-core/src/Util.cpp +++ b/es-core/src/Util.cpp @@ -102,8 +102,13 @@ fs::path resolvePath(const fs::path& path, const fs::path& relativeTo, bool allo fs::path removeCommonPathUsingStrings(const fs::path& path, const fs::path& relativeTo, bool& contains) { +#ifdef WIN32 + std::wstring pathStr = path.c_str(); + std::wstring relativeToStr = relativeTo.c_str(); +#else std::string pathStr = path.c_str(); std::string relativeToStr = relativeTo.c_str(); +#endif if (pathStr.find_first_of(relativeToStr) == 0) { contains = true; return pathStr.substr(relativeToStr.size() + 1); diff --git a/es-core/src/platform.cpp b/es-core/src/platform.cpp index 31127a9ca..04d02b98f 100644 --- a/es-core/src/platform.cpp +++ b/es-core/src/platform.cpp @@ -84,7 +84,13 @@ int quitES(const std::string& filename) void touch(const std::string& filename) { +#ifdef WIN32 + FILE* fp = fopen(filename.c_str(), "ab+"); + if (fp != NULL) + fclose(fp); +#else int fd = open(filename.c_str(), O_CREAT|O_WRONLY, 0644); if (fd >= 0) close(fd); +#endif } \ No newline at end of file