2014-07-13 16:24:57 +00:00
|
|
|
# Aseprite
|
2018-03-13 12:56:23 +00:00
|
|
|
# Copyright (C) 2001-2018 David Capello
|
2012-01-05 22:45:03 +00:00
|
|
|
#
|
2010-10-16 20:02:12 +00:00
|
|
|
# Parts of this file come from the Allegro 4.4 CMakeLists.txt
|
|
|
|
|
2018-08-03 16:03:05 +00:00
|
|
|
cmake_minimum_required(VERSION 3.4)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2018-08-03 17:26:53 +00:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2018-08-06 19:42:55 +00:00
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF) # We use -std=c++11 instead of -std=gnu++11 in macOS
|
2016-04-18 16:27:36 +00:00
|
|
|
|
2014-07-13 16:24:57 +00:00
|
|
|
if(COMMAND cmake_policy)
|
|
|
|
# CMP0003: Libraries linked via full path no longer produce linker search paths.
|
|
|
|
#cmake_policy(SET CMP0003 NEW)
|
2014-09-14 09:00:05 +00:00
|
|
|
if(CMAKE_MAJOR_VERSION GREATER 2)
|
|
|
|
# CMP0046: Old behavior to silently ignore non-existent dependencies.
|
|
|
|
cmake_policy(SET CMP0046 OLD)
|
2016-03-31 20:48:54 +00:00
|
|
|
endif()
|
2014-07-13 16:24:57 +00:00
|
|
|
endif(COMMAND cmake_policy)
|
2010-10-16 20:02:12 +00:00
|
|
|
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
|
|
|
|
"Choose the type of build, options are:
|
|
|
|
None Debug Release RelWithDebInfo Profile."
|
|
|
|
FORCE)
|
|
|
|
endif()
|
2010-08-11 00:49:32 +00:00
|
|
|
|
2010-10-16 20:02:12 +00:00
|
|
|
# Restrict configuration types to the selected build type.
|
|
|
|
# Note: This needs to be done before the project command
|
|
|
|
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}" CACHE INTERNAL "internal")
|
2010-08-25 19:20:30 +00:00
|
|
|
|
2017-09-19 16:41:28 +00:00
|
|
|
set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
|
|
|
|
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)
|
|
|
|
|
2014-12-02 04:38:38 +00:00
|
|
|
# Aseprite project
|
2010-10-16 20:02:12 +00:00
|
|
|
project(aseprite C CXX)
|
2010-08-11 00:49:32 +00:00
|
|
|
|
2018-08-06 19:42:55 +00:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
|
|
|
# As we compile with CMAKE_OSX_DEPLOYMENT_TARGET=10.7, we have to
|
|
|
|
# explicitly say that we want to use libc++ instead of the GNU libstdc++
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
|
|
|
endif()
|
|
|
|
|
2016-11-01 15:47:48 +00:00
|
|
|
# Check repository status
|
2016-11-01 15:53:58 +00:00
|
|
|
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/laf/CMakeLists.txt)
|
2016-11-01 15:47:48 +00:00
|
|
|
message(FATAL_ERROR "Your Aseprite repository is incomplete, initialize submodules using:\n git submodule update --init --recursive")
|
|
|
|
endif()
|
|
|
|
|
2016-06-13 19:56:53 +00:00
|
|
|
# This required for KDE/Qt destop integration, which sets BUILD_SHARED_LIBS to
|
2016-06-14 12:02:19 +00:00
|
|
|
# TRUE by default
|
2016-06-13 19:56:53 +00:00
|
|
|
set(BUILD_SHARED_LIBS off)
|
|
|
|
|
2016-11-01 15:47:48 +00:00
|
|
|
enable_testing()
|
2016-06-13 19:56:53 +00:00
|
|
|
|
2010-08-25 19:20:30 +00:00
|
|
|
######################################################################
|
2011-07-28 00:26:22 +00:00
|
|
|
# Options (these can be specified in cmake command line or modifying
|
|
|
|
# CMakeCache.txt)
|
2010-08-25 19:20:30 +00:00
|
|
|
|
2018-04-03 15:50:25 +00:00
|
|
|
option(WITH_WEBP_SUPPORT "Enable support to load/save .webp files" on)
|
2016-03-04 20:22:44 +00:00
|
|
|
option(WITH_GTK_FILE_DIALOG_SUPPORT "Enable support for the experimental native GTK File Dialog" off)
|
2016-04-28 17:36:23 +00:00
|
|
|
option(WITH_DESKTOP_INTEGRATION "Enable desktop integration modules" off)
|
|
|
|
option(WITH_QT_THUMBNAILER "Enable kde5/qt5 thumnailer" off)
|
2016-04-01 14:05:15 +00:00
|
|
|
|
2017-01-28 11:18:41 +00:00
|
|
|
option(USE_SHARED_CMARK "Use your installed copy of cmark" off)
|
2012-03-15 03:17:49 +00:00
|
|
|
option(USE_SHARED_CURL "Use your installed copy of curl" off)
|
|
|
|
option(USE_SHARED_GIFLIB "Use your installed copy of giflib" off)
|
2010-09-30 20:04:32 +00:00
|
|
|
option(USE_SHARED_JPEGLIB "Use your installed copy of jpeglib" off)
|
|
|
|
option(USE_SHARED_ZLIB "Use your installed copy of zlib" off)
|
|
|
|
option(USE_SHARED_LIBPNG "Use your installed copy of libpng" off)
|
2012-07-09 00:21:01 +00:00
|
|
|
option(USE_SHARED_LIBLOADPNG "Use your installed copy of libloadpng" off)
|
2012-03-19 17:04:24 +00:00
|
|
|
option(USE_SHARED_TINYXML "Use your installed copy of tinyxml" off)
|
2014-10-26 01:22:58 +00:00
|
|
|
option(USE_SHARED_PIXMAN "Use your installed copy of pixman" off)
|
2015-09-22 22:27:44 +00:00
|
|
|
option(USE_SHARED_FREETYPE "Use shared FreeType library" off)
|
2017-12-20 19:54:41 +00:00
|
|
|
option(USE_SHARED_HARFBUZZ "Use shared HarfBuzz library" off)
|
2012-03-19 16:24:15 +00:00
|
|
|
option(USE_SHARED_ALLEGRO4 "Use shared Allegro 4 library (without resize support)" off)
|
2010-10-10 19:47:01 +00:00
|
|
|
option(ENABLE_MEMLEAK "Enable memory-leaks detector (only for developers)" off)
|
2011-08-09 23:13:22 +00:00
|
|
|
option(ENABLE_UPDATER "Enable automatic check for updates" on)
|
2016-11-21 13:25:27 +00:00
|
|
|
option(ENABLE_SCRIPTING "Compile with scripting support" on)
|
2013-03-31 03:36:00 +00:00
|
|
|
option(ENABLE_WEBSERVER "Enable support to run a webserver (for HTML5 gamedev)" off)
|
2017-07-18 20:03:12 +00:00
|
|
|
option(ENABLE_TESTS "Compile unit tests" off)
|
|
|
|
option(ENABLE_BENCHMARKS "Compile benchmarks" off)
|
2014-04-10 03:33:28 +00:00
|
|
|
option(ENABLE_TRIAL_MODE "Compile the trial version" off)
|
2016-02-24 16:21:37 +00:00
|
|
|
option(ENABLE_STEAM "Compile with Steam library" off)
|
2017-08-15 18:47:06 +00:00
|
|
|
option(ENABLE_DEVMODE "Compile vesion for developers" off)
|
2018-05-07 03:11:50 +00:00
|
|
|
option(ENABLE_UI "Compile UI (turn off to compile CLI-only version)" on)
|
2011-08-09 23:27:12 +00:00
|
|
|
option(FULLSCREEN_PLATFORM "Enable fullscreen by default" off)
|
2014-06-03 00:31:44 +00:00
|
|
|
set(CUSTOM_WEBSITE_URL "" CACHE STRING "Enable custom local webserver to check updates")
|
2010-08-25 19:20:30 +00:00
|
|
|
|
2018-05-07 03:11:50 +00:00
|
|
|
if(NOT ENABLE_UI)
|
|
|
|
# Without UI, don't use back-ends
|
2016-04-19 17:09:01 +00:00
|
|
|
set(USE_ALLEG4_BACKEND off)
|
2018-05-07 03:11:50 +00:00
|
|
|
set(USE_SKIA_BACKEND off)
|
|
|
|
set(USE_NONE_BACKEND on)
|
2016-04-19 17:09:01 +00:00
|
|
|
else()
|
2018-05-07 03:11:50 +00:00
|
|
|
if(APPLE)
|
|
|
|
# On OS X Allegro isn't supported anymore
|
|
|
|
set(USE_ALLEG4_BACKEND off)
|
|
|
|
set(USE_SKIA_BACKEND on)
|
|
|
|
set(USE_NONE_BACKEND off)
|
|
|
|
else()
|
|
|
|
option(USE_ALLEG4_BACKEND "Use Allegro 4 backend" on)
|
|
|
|
option(USE_SKIA_BACKEND "Use Skia backend" off)
|
|
|
|
set(USE_NONE_BACKEND off)
|
|
|
|
endif()
|
2016-04-19 17:09:01 +00:00
|
|
|
endif()
|
|
|
|
|
2017-12-21 19:34:17 +00:00
|
|
|
# Check valid gtk + libpng combination
|
|
|
|
if(WITH_GTK_FILE_DIALOG_SUPPORT)
|
|
|
|
if(NOT USE_SHARED_LIBPNG)
|
|
|
|
message(FATAL_ERROR "Cannot compile with gtk and static libpng, set USE_SHARED_LIBPNG=ON")
|
|
|
|
endif()
|
|
|
|
if(NOT USE_SHARED_HARFBUZZ)
|
|
|
|
message(FATAL_ERROR "Cannot compile with gtk and static HarfBuzz, set USE_SHARED_HARFBUZZ=ON")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2010-08-25 19:20:30 +00:00
|
|
|
######################################################################
|
2010-10-16 20:02:12 +00:00
|
|
|
# Profile build type
|
|
|
|
|
|
|
|
list(APPEND CMAKE_BUILD_TYPES Profile)
|
|
|
|
mark_as_advanced(
|
|
|
|
CMAKE_C_FLAGS_PROFILE
|
|
|
|
CMAKE_CXX_FLAGS_PROFILE
|
2015-03-16 18:05:13 +00:00
|
|
|
CMAKE_EXE_LINKER_FLAGS_PROFILE)
|
2010-10-16 20:02:12 +00:00
|
|
|
|
2014-11-29 02:04:14 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
2010-10-16 20:02:12 +00:00
|
|
|
set(CMAKE_C_FLAGS_PROFILE "-pg"
|
2014-11-29 02:04:14 +00:00
|
|
|
CACHE STRING "Profiling C flags")
|
2010-10-16 20:02:12 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE}"
|
2014-11-29 02:04:14 +00:00
|
|
|
CACHE STRING "Profiling C++ flags")
|
2010-10-16 20:02:12 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "-pg"
|
2014-11-29 02:04:14 +00:00
|
|
|
CACHE STRING "Profiling linker flags")
|
|
|
|
endif()
|
2010-10-16 20:02:12 +00:00
|
|
|
|
2014-11-29 02:04:14 +00:00
|
|
|
if(MSVC)
|
2017-09-19 16:41:28 +00:00
|
|
|
set(CMAKE_C_FLAGS_PROFILE "/MT /Zi /Ox /Gd"
|
2014-11-29 02:04:14 +00:00
|
|
|
CACHE STRING "Profiling C flags")
|
2010-10-16 20:02:12 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE}"
|
2014-11-29 02:04:14 +00:00
|
|
|
CACHE STRING "Profiling C++ flags")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "/PROFILE /DEBUG"
|
|
|
|
CACHE STRING "Profiling linker flags")
|
|
|
|
endif()
|
2010-10-16 20:02:12 +00:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Directories
|
2010-08-25 19:20:30 +00:00
|
|
|
|
2014-12-02 04:30:01 +00:00
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
# We need to specify the output for each configuration to make it work
|
|
|
|
# on Visual Studio solutions.
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_PROFILE "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_PROFILE "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_PROFILE "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
|
2017-01-28 11:18:41 +00:00
|
|
|
set(CMARK_DIR ${CMAKE_SOURCE_DIR}/third_party/cmark)
|
2012-01-05 22:45:03 +00:00
|
|
|
set(CURL_DIR ${CMAKE_SOURCE_DIR}/third_party/curl)
|
|
|
|
set(GIFLIB_DIR ${CMAKE_SOURCE_DIR}/third_party/giflib)
|
|
|
|
set(LIBJPEG_DIR ${CMAKE_SOURCE_DIR}/third_party/jpeg)
|
|
|
|
set(LIBPNG_DIR ${CMAKE_SOURCE_DIR}/third_party/libpng)
|
|
|
|
set(LOADPNG_DIR ${CMAKE_SOURCE_DIR}/third_party/loadpng)
|
2015-09-01 11:04:11 +00:00
|
|
|
set(LIBWEBP_DIR ${CMAKE_SOURCE_DIR}/third_party/libwebp)
|
2014-10-26 01:22:58 +00:00
|
|
|
set(PIXMAN_DIR ${CMAKE_SOURCE_DIR}/third_party/pixman)
|
2015-09-22 22:27:44 +00:00
|
|
|
set(FREETYPE_DIR ${CMAKE_SOURCE_DIR}/third_party/freetype2)
|
2017-02-20 20:14:41 +00:00
|
|
|
set(HARFBUZZ_DIR ${CMAKE_SOURCE_DIR}/third_party/harfbuzz)
|
2014-10-17 00:27:25 +00:00
|
|
|
set(SIMPLEINI_DIR ${CMAKE_SOURCE_DIR}/third_party/simpleini)
|
2012-01-05 22:45:03 +00:00
|
|
|
set(TINYXML_DIR ${CMAKE_SOURCE_DIR}/third_party/tinyxml)
|
|
|
|
set(ZLIB_DIR ${CMAKE_SOURCE_DIR}/third_party/zlib)
|
2010-08-11 00:49:32 +00:00
|
|
|
|
2010-10-16 20:02:12 +00:00
|
|
|
# Search in the "cmake" directory for additional CMake modules.
|
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|
|
|
|
|
|
|
# Put libraries into "lib".
|
|
|
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
|
2010-08-25 19:20:30 +00:00
|
|
|
######################################################################
|
2015-06-09 13:20:56 +00:00
|
|
|
# Common definitions to compile all sources (app code and third party)
|
2010-08-25 19:20:30 +00:00
|
|
|
|
|
|
|
# Debug C/C++ flags
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
add_definitions(-DDEBUGMODE -D_DEBUG)
|
|
|
|
else()
|
|
|
|
add_definitions(-DNDEBUG)
|
|
|
|
endif()
|
|
|
|
|
2015-04-27 15:23:54 +00:00
|
|
|
if(NOT USE_SHARED_CURL)
|
|
|
|
set(CURL_STATICLIB ON BOOL)
|
|
|
|
endif()
|
|
|
|
|
2015-07-13 15:16:55 +00:00
|
|
|
# zlib
|
|
|
|
if(USE_SHARED_ZLIB)
|
2016-03-26 09:26:22 +00:00
|
|
|
find_package(ZLIB REQUIRED)
|
2015-07-13 15:16:55 +00:00
|
|
|
else()
|
2018-04-03 15:43:26 +00:00
|
|
|
set(ZLIB_FOUND)
|
|
|
|
set(ZLIB_LIBRARY zlibstatic)
|
|
|
|
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
|
2016-03-31 20:48:54 +00:00
|
|
|
set(ZLIB_INCLUDE_DIRS
|
|
|
|
${ZLIB_DIR}
|
|
|
|
${CMAKE_BINARY_DIR}/third_party/zlib) # Zlib generated zconf.h file
|
2018-04-03 15:43:26 +00:00
|
|
|
set(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS} CACHE PATH "")
|
2015-06-09 13:20:56 +00:00
|
|
|
endif()
|
2016-03-26 09:40:16 +00:00
|
|
|
include_directories(${ZLIB_INCLUDE_DIRS})
|
2015-06-09 13:20:56 +00:00
|
|
|
|
2015-07-13 15:16:55 +00:00
|
|
|
# libpng
|
2015-06-09 13:20:56 +00:00
|
|
|
if(USE_SHARED_LIBPNG)
|
2016-03-26 09:26:22 +00:00
|
|
|
find_package(PNG REQUIRED)
|
2015-06-09 13:20:56 +00:00
|
|
|
add_definitions(${PNG_DEFINITIONS})
|
|
|
|
else()
|
2018-04-03 15:43:26 +00:00
|
|
|
set(PNG_FOUND ON)
|
|
|
|
set(PNG_LIBRARY png_static)
|
|
|
|
set(PNG_LIBRARIES ${PNG_LIBRARY})
|
2016-03-31 20:48:54 +00:00
|
|
|
set(PNG_INCLUDE_DIRS
|
|
|
|
${LIBPNG_DIR}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/third_party/libpng) # Libpng generated pnglibconf.h file
|
2018-04-03 16:02:20 +00:00
|
|
|
set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS} CACHE PATH "")
|
|
|
|
set(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS} CACHE PATH "")
|
2015-06-09 13:20:56 +00:00
|
|
|
endif()
|
2016-03-26 09:40:16 +00:00
|
|
|
include_directories(${PNG_INCLUDE_DIRS})
|
2015-07-13 15:16:55 +00:00
|
|
|
add_definitions(-DPNG_NO_MMX_CODE) # Do not use MMX optimizations in PNG code
|
2015-06-09 13:20:56 +00:00
|
|
|
|
2015-09-01 11:04:11 +00:00
|
|
|
# libwebp
|
2015-09-07 17:43:31 +00:00
|
|
|
if(WITH_WEBP_SUPPORT)
|
2018-06-09 17:58:00 +00:00
|
|
|
set(WEBP_LIBRARIES webp webpdemux webpmux)
|
2018-03-26 17:08:08 +00:00
|
|
|
set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
|
2015-09-07 17:43:31 +00:00
|
|
|
include_directories(${WEBP_INCLUDE_DIR})
|
2015-09-01 11:04:11 +00:00
|
|
|
endif()
|
|
|
|
|
2015-07-13 15:16:55 +00:00
|
|
|
# tinyxml
|
|
|
|
if(USE_SHARED_TINYXML)
|
|
|
|
find_library(TINYXML_LIBRARY NAMES tinyxml)
|
|
|
|
find_path(TINYXML_INCLUDE_DIR NAMES tinyxml.h)
|
|
|
|
else()
|
|
|
|
set(TINYXML_LIBRARY tinyxml)
|
|
|
|
set(TINYXML_INCLUDE_DIR ${TINYXML_DIR})
|
|
|
|
endif()
|
|
|
|
include_directories(${TINYXML_INCLUDE_DIR})
|
|
|
|
|
|
|
|
# pixman
|
|
|
|
if(USE_SHARED_PIXMAN)
|
|
|
|
find_library(PIXMAN_LIBRARY NAMES pixman pixman-1)
|
|
|
|
find_path(PIXMAN_INCLUDE_DIR NAMES pixman.h PATH_SUFFIXES pixman-1)
|
|
|
|
else()
|
|
|
|
set(PIXMAN_LIBRARY pixman)
|
2016-03-31 20:48:54 +00:00
|
|
|
set(PIXMAN_INCLUDE_DIR
|
|
|
|
${PIXMAN_DIR}/pixman
|
|
|
|
${CMAKE_BINARY_DIR}) # For pixman-version.h
|
2015-07-13 15:16:55 +00:00
|
|
|
endif()
|
|
|
|
include_directories(${PIXMAN_INCLUDE_DIR})
|
|
|
|
|
2015-09-22 22:27:44 +00:00
|
|
|
# freetype
|
|
|
|
if(USE_SHARED_FREETYPE)
|
2016-03-26 09:26:22 +00:00
|
|
|
find_package(Freetype REQUIRED)
|
2015-09-22 22:27:44 +00:00
|
|
|
else()
|
2018-04-03 15:43:26 +00:00
|
|
|
set(FREETYPE_FOUND ON)
|
|
|
|
set(FREETYPE_LIBRARY freetype)
|
|
|
|
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
|
2016-03-26 09:40:16 +00:00
|
|
|
set(FREETYPE_INCLUDE_DIRS ${FREETYPE_DIR}/include)
|
2015-09-22 22:27:44 +00:00
|
|
|
endif()
|
2016-03-26 09:40:16 +00:00
|
|
|
include_directories(${FREETYPE_INCLUDE_DIRS})
|
2015-09-22 22:27:44 +00:00
|
|
|
|
2017-02-20 20:14:41 +00:00
|
|
|
# harfbuzz
|
2017-06-07 20:49:51 +00:00
|
|
|
if(USE_SHARED_HARFBUZZ)
|
|
|
|
find_package(HarfBuzz)
|
|
|
|
else()
|
|
|
|
set(HARFBUZZ_LIBRARIES harfbuzz)
|
|
|
|
set(HARFBUZZ_INCLUDE_DIRS ${HARFBUZZ_DIR}/src)
|
|
|
|
endif()
|
|
|
|
include_directories(${HARFBUZZ_INCLUDE_DIRS})
|
2017-02-20 20:14:41 +00:00
|
|
|
|
2015-07-13 15:16:55 +00:00
|
|
|
if(USE_SHARED_GIFLIB)
|
|
|
|
find_package(GIF REQUIRED)
|
|
|
|
else()
|
2018-04-03 14:11:10 +00:00
|
|
|
set(GIF_LIBRARY giflib)
|
2018-04-03 15:43:26 +00:00
|
|
|
set(GIF_LIBRARIES ${GIF_LIBRARY})
|
2018-04-03 14:11:10 +00:00
|
|
|
set(GIF_INCLUDE_DIR ${GIFLIB_DIR}/lib)
|
2018-04-03 15:43:26 +00:00
|
|
|
set(GIF_INCLUDE_DIRS ${GIF_INCLUDE_DIR})
|
2015-07-13 15:16:55 +00:00
|
|
|
endif()
|
2016-03-26 09:40:16 +00:00
|
|
|
include_directories(${GIF_INCLUDE_DIRS})
|
2015-07-13 15:16:55 +00:00
|
|
|
|
|
|
|
if(USE_SHARED_JPEGLIB)
|
2016-03-26 09:26:22 +00:00
|
|
|
find_package(JPEG REQUIRED)
|
2015-07-13 15:16:55 +00:00
|
|
|
else()
|
2018-04-03 15:43:26 +00:00
|
|
|
set(JPEG_FOUND ON)
|
|
|
|
set(JPEG_INCLUDE_DIR ${LIBJPEG_DIR})
|
|
|
|
set(JPEG_LIBRARY jpeg CACHE FILEPATH "")
|
|
|
|
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
|
|
|
|
set(JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR})
|
2015-07-13 15:16:55 +00:00
|
|
|
endif()
|
2016-03-26 09:40:16 +00:00
|
|
|
include_directories(${JPEG_INCLUDE_DIRS})
|
2015-07-13 15:16:55 +00:00
|
|
|
|
|
|
|
if(USE_ALLEG4_BACKEND)
|
|
|
|
if(USE_SHARED_LIBLOADPNG)
|
|
|
|
find_library(LOADPNG_LIBRARY NAMES loadpng)
|
|
|
|
find_path(LOADPNG_INCLUDE_DIR NAMES loadpng.h)
|
|
|
|
else()
|
|
|
|
set(LOADPNG_LIBRARY loadpng)
|
|
|
|
set(LOADPNG_INCLUDE_DIR ${LOADPNG_DIR})
|
|
|
|
endif()
|
|
|
|
include_directories(${LOADPNG_INCLUDE_DIR})
|
|
|
|
endif()
|
|
|
|
|
2017-01-28 11:18:41 +00:00
|
|
|
if(USE_SHARED_CMARK)
|
|
|
|
find_library(CMARK_LIBRARIES NAMES cmark)
|
|
|
|
find_path(CMARK_INCLUDE_DIRS NAMES cmark.h)
|
|
|
|
else()
|
|
|
|
add_definitions(-DCMARK_STATIC_DEFINE)
|
|
|
|
set(CMARK_LIBRARIES libcmark_static)
|
2017-01-28 21:02:24 +00:00
|
|
|
include_directories(${CMAKE_BINARY_DIR}/third_party/cmark)
|
2017-01-28 11:18:41 +00:00
|
|
|
endif()
|
|
|
|
|
2015-07-13 15:16:55 +00:00
|
|
|
if(USE_SHARED_CURL)
|
2016-03-26 09:26:22 +00:00
|
|
|
find_package(CURL REQUIRED)
|
2015-07-13 15:16:55 +00:00
|
|
|
else()
|
2016-03-26 11:01:45 +00:00
|
|
|
set(CURL_LIBRARIES libcurl)
|
|
|
|
set(CURL_INCLUDE_DIRS ${CURL_DIR}/include)
|
2015-07-13 15:16:55 +00:00
|
|
|
endif()
|
2016-03-26 11:01:45 +00:00
|
|
|
include_directories(${CURL_INCLUDE_DIRS})
|
2015-07-13 15:16:55 +00:00
|
|
|
|
|
|
|
# simpleini
|
|
|
|
include_directories(${SIMPLEINI_DIR})
|
2015-06-09 13:20:56 +00:00
|
|
|
|
2015-03-16 18:05:13 +00:00
|
|
|
######################################################################
|
2015-07-13 16:02:34 +00:00
|
|
|
# Platform specific stuff
|
2015-03-16 18:05:13 +00:00
|
|
|
|
2015-07-13 16:02:34 +00:00
|
|
|
set(PLATFORM_LIBS)
|
|
|
|
|
|
|
|
# Allegro 4 backend
|
2015-03-16 18:05:13 +00:00
|
|
|
if(USE_ALLEG4_BACKEND)
|
2015-10-14 16:30:45 +00:00
|
|
|
add_definitions(-DUSE_ALLEG4_BACKEND)
|
|
|
|
|
2015-03-16 18:05:13 +00:00
|
|
|
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)
|
|
|
|
|
|
|
|
set(LIBALLEGRO4_LINK_FLAGS ${LIBALLEGRO4_LINK_FLAGS} ${PLATFORM_LIBS})
|
|
|
|
include_directories(${LIBALLEGRO4_INCLUDE_DIR})
|
|
|
|
else()
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src/allegro/include)
|
|
|
|
include_directories(${CMAKE_BINARY_DIR}/include)
|
|
|
|
|
|
|
|
add_definitions(-DALLEGRO4_WITH_RESIZE_PATCH)
|
|
|
|
add_definitions(-DALLEGRO4_WITH_EXTRA_CURSORS)
|
|
|
|
|
|
|
|
# Static Allegro (the code of Allegro library is embedded).
|
|
|
|
add_definitions(-DALLEGRO_STATICLINK)
|
2015-07-13 15:16:55 +00:00
|
|
|
|
|
|
|
set(LIBALLEGRO4_LINK_FLAGS allegro)
|
2015-03-16 18:05:13 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-10-14 16:30:45 +00:00
|
|
|
# Skia backend
|
|
|
|
if(USE_SKIA_BACKEND)
|
|
|
|
add_definitions(-DUSE_SKIA_BACKEND)
|
|
|
|
endif()
|
|
|
|
|
2010-10-16 20:02:12 +00:00
|
|
|
# -- Unix --
|
|
|
|
|
|
|
|
if(UNIX AND NOT APPLE AND NOT BEOS)
|
|
|
|
# Pthreads
|
2016-03-26 09:26:22 +00:00
|
|
|
find_package(Threads REQUIRED)
|
2010-10-16 20:02:12 +00:00
|
|
|
list(APPEND PLATFORM_LIBS m ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
|
|
|
# X11
|
2016-03-26 09:26:22 +00:00
|
|
|
find_package(X11 REQUIRED)
|
2010-10-16 20:02:12 +00:00
|
|
|
include_directories(SYSTEM ${X11_INCLUDE_DIR})
|
|
|
|
list(APPEND PLATFORM_LIBS ${X11_LIBRARIES})
|
|
|
|
|
|
|
|
if(X11_XShm_FOUND)
|
|
|
|
list(APPEND PLATFORM_LIBS ${X11_Xext_LIB})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(X11_Xcursor_FOUND)
|
|
|
|
list(APPEND PLATFORM_LIBS ${X11_Xcursor_LIB})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(X11_Xpm_FOUND)
|
|
|
|
list(APPEND PLATFORM_LIBS ${X11_Xpm_LIB})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
find_library(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH})
|
|
|
|
mark_as_advanced(X11_Xxf86vm_LIB)
|
|
|
|
if(X11_xf86vmode_FOUND)
|
|
|
|
list(APPEND PLATFORM_LIBS ${X11_Xxf86vm_LIB})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_library_exists(X11 XOpenIM "${X11_LIB_SEARCH_PATH}" XIM_FOUND)
|
|
|
|
check_library_exists(Xxf86dga XDGAQueryExtension
|
|
|
|
"${X11_LIB_SEARCH_PATH}" XDGA_FOUND)
|
|
|
|
|
|
|
|
if(XDGA_FOUND)
|
2011-03-06 19:20:11 +00:00
|
|
|
list(APPEND PLATFORM_LIBS Xxf86dga ${X11_LIBRARIES})
|
2010-10-16 20:02:12 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# -- Windows --
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
list(APPEND PLATFORM_LIBS
|
2015-03-16 18:05:13 +00:00
|
|
|
kernel32 user32 gdi32 comdlg32 ole32 winmm
|
2015-07-13 15:16:55 +00:00
|
|
|
shlwapi psapi wininet comctl32 dbghelp)
|
2010-10-16 20:02:12 +00:00
|
|
|
|
2017-11-02 01:42:30 +00:00
|
|
|
# Windows Vista is the minimum supported platform but we're defining
|
|
|
|
# Windows 10 to get the all constant/structure definitions.
|
|
|
|
add_definitions(-D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00)
|
2011-01-20 20:28:21 +00:00
|
|
|
|
2013-10-14 22:58:11 +00:00
|
|
|
# We need Unicode support
|
|
|
|
add_definitions(-DUNICODE -D_UNICODE)
|
2010-10-16 20:02:12 +00:00
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
# -- Mac OS X --
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
find_library(COCOA_LIBRARY Cocoa)
|
|
|
|
find_library(CARBON_LIBRARY Carbon)
|
|
|
|
find_library(IOKIT_LIBRARY IOKit)
|
|
|
|
mark_as_advanced(COCOA_LIBRARY CARBON_LIBRARY IOKIT_LIBRARY)
|
|
|
|
|
|
|
|
list(APPEND PLATFORM_LIBS
|
|
|
|
${COCOA_LIBRARY}
|
|
|
|
${CARBON_LIBRARY}
|
2015-06-01 17:39:30 +00:00
|
|
|
${IOKIT_LIBRARY})
|
2010-10-31 14:54:23 +00:00
|
|
|
|
|
|
|
# Hack to deal with Mac OS X 10.6. NSQuickDrawView is not defined by
|
|
|
|
# NSQuickDrawView.h when compiling in 64-bit mode, and 64-bit mode is the
|
|
|
|
# default when compiling on Snow Leopard.
|
|
|
|
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL i386)
|
2012-01-05 22:45:03 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386")
|
2010-10-31 14:54:23 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# The Mac port simply uses too many deprecated things.
|
|
|
|
if(COMPILER_GCC)
|
|
|
|
set(WFLAGS "${WFLAGS} -Wno-deprecated-declarations")
|
|
|
|
endif(COMPILER_GCC)
|
2010-10-16 20:02:12 +00:00
|
|
|
endif(APPLE)
|
|
|
|
|
2016-11-01 15:47:48 +00:00
|
|
|
# Third parties
|
|
|
|
add_subdirectory(third_party)
|
2010-08-25 19:20:30 +00:00
|
|
|
|
2016-11-01 15:47:48 +00:00
|
|
|
# LAF libraries + Aseprite are compiled with config.h
|
|
|
|
include_directories(src)
|
|
|
|
add_definitions(-DHAVE_CONFIG_H)
|
|
|
|
if(ENABLE_MEMLEAK)
|
2016-11-02 19:14:01 +00:00
|
|
|
add_definitions(-DLAF_MEMLEAK)
|
2016-11-01 15:47:48 +00:00
|
|
|
endif()
|
2010-08-11 00:49:32 +00:00
|
|
|
|
2016-11-01 15:47:48 +00:00
|
|
|
set(LAF_WITH_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable LAF tests")
|
2016-12-19 17:19:30 +00:00
|
|
|
set(UNDO_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable undo tests")
|
|
|
|
|
2016-11-01 15:47:48 +00:00
|
|
|
add_subdirectory(laf)
|
2010-08-25 19:20:30 +00:00
|
|
|
|
2016-11-01 15:47:48 +00:00
|
|
|
add_subdirectory(src)
|