Add compiler flags for C++11 so we can start using it

This commit is contained in:
David Capello 2014-08-14 00:40:01 -03:00
parent 877fe94746
commit f62356d410
2 changed files with 16 additions and 8 deletions

View File

@ -3,16 +3,20 @@
add_definitions(-DHAVE_CONFIG_H) add_definitions(-DHAVE_CONFIG_H)
######################################################################
# Compiler-specific flags
if(MSVC) if(MSVC)
# Do not link with libcmt.lib (to avoid duplicated symbols with msvcrtd.lib) # Do not link with libcmt.lib (to avoid duplicated symbols with msvcrtd.lib)
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:LIBCMT") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:LIBCMT")
endif() endif()
# Add support for Windows XP
if (CMAKE_SIZEOF_VOID_P EQUAL 8) if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64 bits
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MACHINE:X64") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MACHINE:X64")
else() else()
# Add support for Windows XP with 5.01 subsystem
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MACHINE:X86 /SUBSYSTEM:WINDOWS,5.01") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MACHINE:X86 /SUBSYSTEM:WINDOWS,5.01")
endif() endif()
endif(MSVC) endif(MSVC)
@ -166,6 +170,13 @@ else()
set(libs3rdparty ${libs3rdparty} allegro) set(libs3rdparty ${libs3rdparty} allegro)
endif() endif()
######################################################################
# Add C++11 support only for our code (avoid Allegro)
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11")
endif()
###################################################################### ######################################################################
# Aseprite Libraries (in preferred order to be built) # Aseprite Libraries (in preferred order to be built)

View File

@ -215,22 +215,19 @@ int App::run()
{ {
UIContext* context = UIContext::instance(); UIContext* context = UIContext::instance();
Console console; Console console;
for (FileList::iterator for (const std::string& filename : m_files) {
it = m_files.begin(),
end = m_files.end();
it != end; ++it) {
// Load the sprite // Load the sprite
Document* document = load_document(context, it->c_str()); Document* document = load_document(context, filename.c_str());
if (!document) { if (!document) {
if (!isGui()) if (!isGui())
console.printf("Error loading file \"%s\"\n", it->c_str()); console.printf("Error loading file \"%s\"\n", filename.c_str());
} }
else { else {
// Add the given file in the argument as a "recent file" only // Add the given file in the argument as a "recent file" only
// if we are running in GUI mode. If the program is executed // if we are running in GUI mode. If the program is executed
// in batch mode this is not desirable. // in batch mode this is not desirable.
if (isGui()) if (isGui())
getRecentFiles()->addRecentFile(it->c_str()); getRecentFiles()->addRecentFile(filename.c_str());
// Add the document to the exporter. // Add the document to the exporter.
if (m_exporter != NULL) if (m_exporter != NULL)