mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-01 10:13:22 +00:00
Reorganize compilation flags in CMakeLists.txt files
* Moved flags that only app-lib uses from add_definitions() to target_compile_definitions() * Curl flags for TLS moved from third_party to root CMakeLists.txt (as they were defined in both places)
This commit is contained in:
parent
8f7bf09263
commit
533fb778f3
@ -82,13 +82,18 @@ else()
|
|||||||
set(REQUIRE_CURL OFF)
|
set(REQUIRE_CURL OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Select libcurl's TLS backend according to target platform
|
# SSL/TLS support
|
||||||
if(REQUIRE_CURL AND ENABLE_DRM)
|
if(REQUIRE_CURL AND NOT USE_SHARED_CURL)
|
||||||
if(APPLE)
|
# Disable OpenSSL (use native libraries only)
|
||||||
option(CMAKE_USE_SECTRANSP "enable Apple OS native SSL/TLS" ON)
|
set(CMAKE_USE_OPENSSL OFF CACHE BOOL "Use OpenSSL code. Experimental")
|
||||||
endif()
|
set(CMAKE_USE_LIBSSH2 OFF CACHE BOOL "Use libSSH2")
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(CMAKE_USE_SCHANNEL "enable Windows native SSL/TLS" ON)
|
set(CMAKE_USE_SCHANNEL ON CACHE BOOL "enable Windows native SSL/TLS")
|
||||||
|
elseif(APPLE)
|
||||||
|
set(CMAKE_USE_SECTRANSP ON CACHE BOOL "enable Apple OS native SSL/TLS")
|
||||||
|
else()
|
||||||
|
# TODO Linux?
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -28,14 +28,6 @@ else()
|
|||||||
add_definitions(-Wno-sign-compare)
|
add_definitions(-Wno-sign-compare)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_NEWS)
|
|
||||||
add_definitions(-DENABLE_NEWS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_UPDATER)
|
|
||||||
add_definitions(-DENABLE_UPDATER)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# Needed to include icons in win32 .rc file
|
# Needed to include icons in win32 .rc file
|
||||||
include_directories(..)
|
include_directories(..)
|
||||||
@ -48,45 +40,6 @@ if(REQUIRE_CURL AND NOT USE_SHARED_CURL AND CURL_STATICLIB)
|
|||||||
add_definitions(-DCURL_STATICLIB)
|
add_definitions(-DCURL_STATICLIB)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# Special versions (full/trial, devmode, UI/CLI, etc.)
|
|
||||||
|
|
||||||
if(NOT ENABLE_TRIAL_MODE)
|
|
||||||
add_definitions(-DENABLE_SAVE)
|
|
||||||
else()
|
|
||||||
add_definitions(-DENABLE_TRIAL_MODE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_DRM)
|
|
||||||
add_definitions(-DENABLE_DRM)
|
|
||||||
add_definitions(-DENABLE_SAVE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_DEVMODE)
|
|
||||||
add_definitions(-DENABLE_DEVMODE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_UI)
|
|
||||||
add_definitions(-DENABLE_UI)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_UI AND (NOT ENABLE_TRIAL_MODE OR ENABLE_DRM))
|
|
||||||
set(ENABLE_DATA_RECOVERY on)
|
|
||||||
add_definitions(-DENABLE_DATA_RECOVERY)
|
|
||||||
else()
|
|
||||||
set(ENABLE_DATA_RECOVERY off)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_SCRIPTING)
|
|
||||||
# Needed for "app" and "main"
|
|
||||||
add_definitions(-DENABLE_SCRIPTING)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_WEBSOCKET)
|
|
||||||
# Needed for "app" and "main"
|
|
||||||
add_definitions(-DENABLE_WEBSOCKET)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Aseprite Libraries (in preferred order to be built)
|
# Aseprite Libraries (in preferred order to be built)
|
||||||
|
|
||||||
|
@ -87,14 +87,6 @@ add_custom_command(
|
|||||||
DEPENDS ${GEN_DEP} ${widget_files} ${string_files} "${SOURCE_DATA_DIR}/gui.xml")
|
DEPENDS ${GEN_DEP} ${widget_files} ${string_files} "${SOURCE_DATA_DIR}/gui.xml")
|
||||||
list(APPEND generated_files ${output_fn})
|
list(APPEND generated_files ${output_fn})
|
||||||
|
|
||||||
if(ENABLE_WEBP)
|
|
||||||
add_definitions(-DENABLE_WEBP)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_PSD)
|
|
||||||
add_definitions(-DENABLE_PSD)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# libarchive definitions
|
# libarchive definitions
|
||||||
add_definitions(-DLIBARCHIVE_STATIC)
|
add_definitions(-DLIBARCHIVE_STATIC)
|
||||||
|
|
||||||
@ -113,7 +105,21 @@ else()
|
|||||||
target_sources(app-lib PRIVATE font_path_unix.cpp)
|
target_sources(app-lib PRIVATE font_path_unix.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Trial-version vs Full version (enable save command)
|
||||||
|
if(ENABLE_TRIAL_MODE)
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_TRIAL_MODE)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_SAVE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Data recovery
|
||||||
|
if(ENABLE_UI AND (NOT ENABLE_TRIAL_MODE OR ENABLE_DRM))
|
||||||
|
set(ENABLE_DATA_RECOVERY on)
|
||||||
|
else()
|
||||||
|
set(ENABLE_DATA_RECOVERY off)
|
||||||
|
endif()
|
||||||
if(ENABLE_DATA_RECOVERY)
|
if(ENABLE_DATA_RECOVERY)
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_DATA_RECOVERY)
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
crash/backup_observer.cpp
|
crash/backup_observer.cpp
|
||||||
crash/data_recovery.cpp
|
crash/data_recovery.cpp
|
||||||
@ -123,6 +129,7 @@ if(ENABLE_DATA_RECOVERY)
|
|||||||
ui/data_recovery_view.cpp)
|
ui/data_recovery_view.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# File formats
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
file/ase_format.cpp
|
file/ase_format.cpp
|
||||||
file/bmp_format.cpp
|
file/bmp_format.cpp
|
||||||
@ -137,15 +144,32 @@ target_sources(app-lib PRIVATE
|
|||||||
file/svg_format.cpp
|
file/svg_format.cpp
|
||||||
file/tga_format.cpp)
|
file/tga_format.cpp)
|
||||||
if(ENABLE_WEBP)
|
if(ENABLE_WEBP)
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_WEBP)
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
file/webp_format.cpp)
|
file/webp_format.cpp)
|
||||||
endif()
|
endif()
|
||||||
if(ENABLE_PSD)
|
if(ENABLE_PSD)
|
||||||
|
target_link_libraries(app-lib psd)
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_PSD)
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
file/psd_format.cpp)
|
file/psd_format.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Extras
|
||||||
|
if(ENABLE_DEVMODE)
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_DEVMODE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Enable "Check for updates" info
|
||||||
|
if(ENABLE_UPDATER)
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_UPDATER)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Scripting
|
||||||
if(ENABLE_SCRIPTING)
|
if(ENABLE_SCRIPTING)
|
||||||
|
target_link_libraries(app-lib lua lauxlib lualib)
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_SCRIPTING)
|
||||||
|
|
||||||
if(ENABLE_UI)
|
if(ENABLE_UI)
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
commands/cmd_developer_console.cpp
|
commands/cmd_developer_console.cpp
|
||||||
@ -153,10 +177,14 @@ if(ENABLE_SCRIPTING)
|
|||||||
commands/debugger.cpp
|
commands/debugger.cpp
|
||||||
ui/devconsole_view.cpp)
|
ui/devconsole_view.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_WEBSOCKET)
|
if(ENABLE_WEBSOCKET)
|
||||||
|
target_link_libraries(app-lib ixwebsocket)
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_WEBSOCKET)
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
script/websocket_class.cpp)
|
script/websocket_class.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
commands/cmd_run_script.cpp
|
commands/cmd_run_script.cpp
|
||||||
script/app_command_object.cpp
|
script/app_command_object.cpp
|
||||||
@ -220,7 +248,9 @@ if(ENABLE_SCRIPTING)
|
|||||||
shell.cpp)
|
shell.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# UI-only files
|
||||||
if(ENABLE_UI)
|
if(ENABLE_UI)
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_UI)
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
app_brushes.cpp
|
app_brushes.cpp
|
||||||
app_menus.cpp
|
app_menus.cpp
|
||||||
@ -431,23 +461,23 @@ if(ENABLE_UI)
|
|||||||
ui_context.cpp
|
ui_context.cpp
|
||||||
widget_loader.cpp)
|
widget_loader.cpp)
|
||||||
if(ENABLE_NEWS)
|
if(ENABLE_NEWS)
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_NEWS)
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
res/http_loader.cpp
|
res/http_loader.cpp
|
||||||
ui/news_listbox.cpp)
|
ui/news_listbox.cpp)
|
||||||
endif()
|
endif()
|
||||||
if(ENABLE_DRM)
|
if(ENABLE_DRM)
|
||||||
|
target_link_libraries(app-lib drm-lib)
|
||||||
|
target_compile_definitions(app-lib PUBLIC
|
||||||
|
-DENABLE_DRM
|
||||||
|
-DENABLE_SAVE)
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
ui/enter_license.cpp
|
ui/enter_license.cpp
|
||||||
ui/aseprite_update.cpp)
|
ui/aseprite_update.cpp)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_SENTRY)
|
# Main app sources
|
||||||
target_sources(app-lib PRIVATE sentry_wrapper.cpp)
|
|
||||||
else()
|
|
||||||
target_sources(app-lib PRIVATE send_crash.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_sources(app-lib PRIVATE
|
target_sources(app-lib PRIVATE
|
||||||
active_site_handler.cpp
|
active_site_handler.cpp
|
||||||
app.cpp
|
app.cpp
|
||||||
@ -734,14 +764,6 @@ target_link_libraries(app-lib
|
|||||||
tinyexpr
|
tinyexpr
|
||||||
qoi)
|
qoi)
|
||||||
|
|
||||||
if(ENABLE_PSD)
|
|
||||||
target_link_libraries(app-lib psd)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_DRM)
|
|
||||||
target_link_libraries(app-lib drm-lib)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Directory where generated files by "gen" utility will stay.
|
# Directory where generated files by "gen" utility will stay.
|
||||||
target_include_directories(app-lib PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(app-lib PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
@ -749,14 +771,7 @@ if(REQUIRE_CURL)
|
|||||||
target_link_libraries(app-lib net-lib)
|
target_link_libraries(app-lib net-lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_SCRIPTING)
|
# Enable loading Steam API
|
||||||
target_link_libraries(app-lib lua lauxlib lualib)
|
|
||||||
|
|
||||||
if(ENABLE_WEBSOCKET)
|
|
||||||
target_link_libraries(app-lib ixwebsocket)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_STEAM)
|
if(ENABLE_STEAM)
|
||||||
# We need the ENABLE_STEAM flag in main module too so AppOptions are
|
# We need the ENABLE_STEAM flag in main module too so AppOptions are
|
||||||
# equal in both modules, app-lib and main (that's why this flag is
|
# equal in both modules, app-lib and main (that's why this flag is
|
||||||
@ -765,6 +780,7 @@ if(ENABLE_STEAM)
|
|||||||
target_link_libraries(app-lib steam-lib)
|
target_link_libraries(app-lib steam-lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Report crashes using Sentry
|
||||||
if(ENABLE_SENTRY)
|
if(ENABLE_SENTRY)
|
||||||
target_compile_definitions(app-lib PUBLIC
|
target_compile_definitions(app-lib PUBLIC
|
||||||
-DENABLE_SENTRY
|
-DENABLE_SENTRY
|
||||||
@ -773,4 +789,7 @@ if(ENABLE_SENTRY)
|
|||||||
-DSENTRY_ENV="${SENTRY_ENV}")
|
-DSENTRY_ENV="${SENTRY_ENV}")
|
||||||
add_subdirectory(${SENTRY_DIR} sentry)
|
add_subdirectory(${SENTRY_DIR} sentry)
|
||||||
target_link_libraries(app-lib sentry)
|
target_link_libraries(app-lib sentry)
|
||||||
|
target_sources(app-lib PRIVATE sentry_wrapper.cpp)
|
||||||
|
else()
|
||||||
|
target_sources(app-lib PRIVATE send_crash.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Aseprite Document IO Library
|
# Aseprite Document IO Library
|
||||||
# Copyright (c) 2022-2023 Igara Studio S.A.
|
# Copyright (c) 2022-2024 Igara Studio S.A.
|
||||||
# Copyright (c) 2016-2018 David Capello
|
# Copyright (c) 2016-2018 David Capello
|
||||||
|
|
||||||
add_library(dio-lib
|
add_library(dio-lib
|
||||||
@ -10,6 +10,10 @@ add_library(dio-lib
|
|||||||
detect_format.cpp
|
detect_format.cpp
|
||||||
stdio.cpp)
|
stdio.cpp)
|
||||||
|
|
||||||
|
if(ENABLE_DEVMODE)
|
||||||
|
target_compile_definitions(dio-lib PUBLIC -DENABLE_DEVMODE)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(dio-lib
|
target_link_libraries(dio-lib
|
||||||
${ZLIB_LIBRARIES}
|
${ZLIB_LIBRARIES}
|
||||||
fmt
|
fmt
|
||||||
|
11
third_party/CMakeLists.txt
vendored
11
third_party/CMakeLists.txt
vendored
@ -62,17 +62,6 @@ if(REQUIRE_CURL AND NOT USE_SHARED_CURL)
|
|||||||
set(BUILD_RELEASE_DEBUG_DIRS ON BOOL)
|
set(BUILD_RELEASE_DEBUG_DIRS ON BOOL)
|
||||||
set(BUILD_CURL_EXE OFF CACHE BOOL "Set to ON to build curl executable.")
|
set(BUILD_CURL_EXE OFF CACHE BOOL "Set to ON to build curl executable.")
|
||||||
|
|
||||||
# SSL/TLS support (use native libraries only)
|
|
||||||
set(CMAKE_USE_OPENSSL OFF CACHE BOOL "Use OpenSSL code. Experimental")
|
|
||||||
set(CMAKE_USE_LIBSSH2 OFF CACHE BOOL "Use libSSH2")
|
|
||||||
if(WIN32)
|
|
||||||
set(CMAKE_USE_SCHANNEL ON CACHE BOOL "enable Windows native SSL/TLS")
|
|
||||||
elseif(APPLE)
|
|
||||||
set(CMAKE_USE_SECTRANSP ON CACHE BOOL "enable Apple OS native SSL/TLS")
|
|
||||||
else()
|
|
||||||
# TODO Linux?
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(curl)
|
add_subdirectory(curl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user