Small changes to facilitate building on Windows platform using VS2015

This commit is contained in:
D. Polders 2016-11-17 21:37:44 +01:00
parent cdc1890212
commit 6cb81ab1af
4 changed files with 23 additions and 0 deletions

3
.gitignore vendored
View file

@ -34,3 +34,6 @@ Makefile
.cproject .cproject
.project .project
.settings/ .settings/
# WinMerge
.bak

View file

@ -47,7 +47,11 @@ endif()
find_package(Freetype REQUIRED) find_package(Freetype REQUIRED)
find_package(FreeImage REQUIRED) find_package(FreeImage REQUIRED)
find_package(SDL2 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) find_package(Boost REQUIRED COMPONENTS system filesystem date_time locale)
endif()
find_package(Eigen3 REQUIRED) find_package(Eigen3 REQUIRED)
find_package(CURL REQUIRED) find_package(CURL REQUIRED)
find_package(VLC REQUIRED) find_package(VLC REQUIRED)
@ -81,9 +85,14 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif() endif()
#set up compiler flags for GCC #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_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 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O3") #-s = strip binary
endif() endif()
endif()
if(${GLSystem} MATCHES "Desktop OpenGL") if(${GLSystem} MATCHES "Desktop OpenGL")
add_definitions(-DUSE_OPENGL_DESKTOP) add_definitions(-DUSE_OPENGL_DESKTOP)

View file

@ -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) 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 pathStr = path.c_str();
std::string relativeToStr = relativeTo.c_str(); std::string relativeToStr = relativeTo.c_str();
#endif
if (pathStr.find_first_of(relativeToStr) == 0) { if (pathStr.find_first_of(relativeToStr) == 0) {
contains = true; contains = true;
return pathStr.substr(relativeToStr.size() + 1); return pathStr.substr(relativeToStr.size() + 1);

View file

@ -84,7 +84,13 @@ int quitES(const std::string& filename)
void touch(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); int fd = open(filename.c_str(), O_CREAT|O_WRONLY, 0644);
if (fd >= 0) if (fd >= 0)
close(fd); close(fd);
#endif
} }