diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7b16b8f4d..c7830c112 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,6 +33,30 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Third-party libraries +if(USE_SHARED_ALLEGRO4) + # Find the shared Allegro 4 library + find_library(LIBALLEGRO4_LIBRARY alleg) + find_path(LIBALLEGRO4_INCLUDE_DIR allegro.h) + + if(NOT LIBALLEGRO4_LIBRARY) + message(FATAL_ERROR "Allegro 4 not found") + endif() + + # Get flags to link programs using allegro-config program + execute_process(COMMAND allegro-config --libs --shared + OUTPUT_VARIABLE LIBALLEGRO4_LINK_FLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE) + + include_directories(${LIBALLEGRO4_INCLUDE_DIR}) +else() + add_definitions(-DALLEGRO4_WITH_RESIZE_PATCH) + add_definitions(-DALLEGRO4_WITH_EXTRA_CURSORS) + + # Use patched version of Allegro 4 (with window resize support). + add_subdirectory(allegro) + set(libs3rdparty ${libs3rdparty} allegro) +endif() + if(USE_SHARED_JPEGLIB) find_package(JPEG) if(JPEG_FOUND) @@ -99,6 +123,16 @@ else() include_directories(${LOADPNG_DIR}) endif() +###################################################################### +# Add C++11 support only for our code (avoid Allegro) + +if(UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -std=gnu++11") +endif() + +###################################################################### +# Updater + if (CMAKE_USE_PTHREADS_INIT) set(sys_libs ${sys_libs} ${CMAKE_THREAD_LIBS_INIT}) endif() @@ -146,37 +180,6 @@ else() add_definitions(-DENABLE_TRIAL_MODE) endif() -if(USE_SHARED_ALLEGRO4) - # Find the shared Allegro 4 library - find_library(LIBALLEGRO4_LIBRARY alleg) - find_path(LIBALLEGRO4_INCLUDE_DIR allegro.h) - - if(NOT LIBALLEGRO4_LIBRARY) - message(FATAL_ERROR "Allegro 4 not found") - endif() - - # Get flags to link programs using allegro-config program - execute_process(COMMAND allegro-config --libs --shared - OUTPUT_VARIABLE LIBALLEGRO4_LINK_FLAGS - OUTPUT_STRIP_TRAILING_WHITESPACE) - - include_directories(${LIBALLEGRO4_INCLUDE_DIR}) -else() - add_definitions(-DALLEGRO4_WITH_RESIZE_PATCH) - add_definitions(-DALLEGRO4_WITH_EXTRA_CURSORS) - - # Use patched version of Allegro 4 (with window resize support). - add_subdirectory(allegro) - set(libs3rdparty ${libs3rdparty} allegro) -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) diff --git a/src/updater/CMakeLists.txt b/src/updater/CMakeLists.txt index 699f8fed3..adf53ce1c 100644 --- a/src/updater/CMakeLists.txt +++ b/src/updater/CMakeLists.txt @@ -7,10 +7,8 @@ set(UPDATER_LIB_SOURCES if(WIN32) set(UPDATER_LIB_SOURCES ${UPDATER_LIB_SOURCES} user_agent_win.c) -else() - if(APPLE) - set(UPDATER_LIB_SOURCES ${UPDATER_LIB_SOURCES} user_agent_mac.m) - endif() +elseif(APPLE) + set(UPDATER_LIB_SOURCES ${UPDATER_LIB_SOURCES} user_agent_mac.mm) endif() add_library(updater-lib ${UPDATER_LIB_SOURCES}) diff --git a/src/updater/user_agent_mac.m b/src/updater/user_agent_mac.mm similarity index 100% rename from src/updater/user_agent_mac.m rename to src/updater/user_agent_mac.mm