Merge branch 'main' into beta

This commit is contained in:
David Capello 2021-06-16 17:26:19 -03:00
commit 31420d0ef5
5 changed files with 50 additions and 32 deletions

2
laf

@ -1 +1 @@
Subproject commit c4ffd09f718eb4c5f161e98344aab51cd5c1f379
Subproject commit 5350fd8c5ad7a6c46ced74a187f358d96de18a6e

View File

@ -134,33 +134,35 @@ add_subdirectory(app)
######################################################################
# Copy data/ directory target
set(DATA_OUTPUT_DIR ${CMAKE_BINARY_DIR}/bin/data)
file(GLOB_RECURSE src_data_files
RELATIVE ${SOURCE_DATA_DIR}/ "${SOURCE_DATA_DIR}/*.*")
foreach(fn ${src_data_files})
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/bin/data/${fn}
COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_DATA_DIR}/${fn} ${CMAKE_BINARY_DIR}/bin/data/${fn}
OUTPUT ${DATA_OUTPUT_DIR}/${fn}
COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_DATA_DIR}/${fn} ${DATA_OUTPUT_DIR}/${fn}
MAIN_DEPENDENCY ${SOURCE_DATA_DIR}/${fn})
list(APPEND out_data_files ${CMAKE_BINARY_DIR}/bin/data/${fn})
list(APPEND out_data_files ${DATA_OUTPUT_DIR}/${fn})
endforeach()
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/bin/data/README.md
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../README.md ${CMAKE_BINARY_DIR}/bin/data/README.md
OUTPUT ${DATA_OUTPUT_DIR}/README.md
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../README.md ${DATA_OUTPUT_DIR}/README.md
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/../README.md)
list(APPEND out_data_files ${CMAKE_BINARY_DIR}/bin/data/README.md)
list(APPEND out_data_files ${DATA_OUTPUT_DIR}/README.md)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/bin/data/EULA.txt
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../EULA.txt ${CMAKE_BINARY_DIR}/bin/data/EULA.txt
OUTPUT ${DATA_OUTPUT_DIR}/EULA.txt
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../EULA.txt ${DATA_OUTPUT_DIR}/EULA.txt
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/../EULA.txt)
list(APPEND out_data_files ${CMAKE_BINARY_DIR}/bin/data/EULA.txt)
list(APPEND out_data_files ${DATA_OUTPUT_DIR}/EULA.txt)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/bin/data/docs/LICENSES.md
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../docs/LICENSES.md ${CMAKE_BINARY_DIR}/bin/data/docs/LICENSES.md
OUTPUT ${DATA_OUTPUT_DIR}/docs/LICENSES.md
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../docs/LICENSES.md ${DATA_OUTPUT_DIR}/docs/LICENSES.md
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/../docs/LICENSES.md)
list(APPEND out_data_files ${CMAKE_BINARY_DIR}/bin/data/docs/LICENSES.md)
list(APPEND out_data_files ${DATA_OUTPUT_DIR}/docs/LICENSES.md)
add_custom_target(copy_data DEPENDS ${out_data_files})
@ -168,26 +170,32 @@ add_custom_target(copy_data DEPENDS ${out_data_files})
# Aseprite application
if(ENABLE_ASEPRITE_EXE)
set(main_target aseprite)
if(WIN32)
set(win32_resources
set(main_resources
main/resources_win32.rc
main/settings.manifest)
endif()
add_executable(aseprite main/main.cpp ${win32_resources})
if(WIN32 AND ENABLE_UI)
set_target_properties(aseprite PROPERTIES WIN32_EXECUTABLE true)
add_executable(${main_target}
main/main.cpp
${main_resources})
if(ENABLE_UI)
if(WIN32)
set_target_properties(${main_target} PROPERTIES WIN32_EXECUTABLE true)
endif()
endif()
set_target_properties(aseprite PROPERTIES LINK_FLAGS "${LAF_BACKEND_LINK_FLAGS}")
target_link_libraries(aseprite app-lib)
add_dependencies(aseprite copy_data)
set_target_properties(${main_target} PROPERTIES LINK_FLAGS "${LAF_BACKEND_LINK_FLAGS}")
target_link_libraries(${main_target} app-lib)
add_dependencies(${main_target} copy_data)
if(LAF_OS_BACKEND_LINK_FLAGS)
set_target_properties(aseprite PROPERTIES LINK_FLAGS
set_target_properties(${main_target} PROPERTIES LINK_FLAGS
${LAF_OS_BACKEND_LINK_FLAGS})
endif()
install(TARGETS aseprite
install(TARGETS ${main_target}
RUNTIME DESTINATION bin)
install(DIRECTORY ../data

View File

@ -73,7 +73,17 @@ In Debug mode (`_DEBUG`):
# Detect Platform
You can check the platform using the following checks:
You can check the platform using some `laf` macros:
#if LAF_WINDOWS
// ...
#elif LAF_MACOS
// ...
#elif LAF_LINUX
// ...
#endif
Or using platform-specific macros:
#ifdef _WIN32
#ifdef _WIN64

View File

@ -69,8 +69,8 @@
#include "ui/ui.h"
#include "ver/info.h"
#ifdef __APPLE__
#include "os/osx/system.h"
#if LAF_MACOS
#include "os/osx/system.h"
#endif
#include <iostream>
@ -231,7 +231,7 @@ int App::initialize(const AppOptions& options)
m_isShell = options.startShell();
m_coreModules = new CoreModules;
#ifdef _WIN32
#if LAF_WINDOWS
if (options.disableWintab() ||
!preferences().experimental.loadWintabDriver() ||
preferences().tablet.api() == "pointer") {
@ -243,7 +243,7 @@ int App::initialize(const AppOptions& options)
system->setTabletAPI(os::TabletAPI::Wintab);
#endif
#ifdef __APPLE__
#if LAF_MACOS
if (!preferences().general.osxAsyncView())
os::osx_set_async_view(false);
#endif
@ -356,14 +356,14 @@ void App::run()
#ifdef ENABLE_UI
// Run the GUI
if (isGui()) {
#ifdef _WIN32
#if LAF_WINDOWS
// How to interpret one finger on Windows tablets.
ui::Manager::getDefault()->display()->nativeWindow()
->setInterpretOneFingerGestureAsMouseMovement(
preferences().experimental.oneFingerAsMouseMovement());
#endif
#if !defined(_WIN32) && !defined(__APPLE__)
#if LAF_LINUX
// Setup app icon for Linux window managers
try {
os::Window* window = os::instance()->defaultWindow();

View File

@ -26,7 +26,7 @@
#include <ctime>
#include <iostream>
#ifdef _WIN32
#if LAF_WINDOWS
#include <windows.h>
#endif
@ -43,7 +43,7 @@ namespace {
#endif
};
#ifdef _WIN32
#if LAF_WINDOWS
// Successful calls to CoInitialize() (S_OK or S_FALSE) must match
// the calls to CoUninitialize().
// From: https://docs.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-couninitialize#remarks
@ -73,7 +73,7 @@ int app_main(int argc, char* argv[])
// Initialize the random seed.
std::srand(static_cast<unsigned int>(std::time(nullptr)));
#ifdef _WIN32
#if LAF_WINDOWS
CoInit com; // To create COM objects
#endif