mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-15 19:52:05 +00:00
Shared cmark library
Making optional linking with shared system cmark library with -DUSE_SHARED_CMARK option.
This commit is contained in:
parent
7c6d927eb1
commit
90624bbc22
@ -57,6 +57,7 @@ option(WITH_DESKTOP_INTEGRATION "Enable desktop integration modules" off)
|
||||
option(WITH_QT_THUMBNAILER "Enable kde5/qt5 thumnailer" off)
|
||||
|
||||
option(USE_STATIC_LIBC "Use static version of C and C++ runtimes" off)
|
||||
option(USE_SHARED_CMARK "Use your installed copy of cmark" off)
|
||||
option(USE_SHARED_CURL "Use your installed copy of curl" off)
|
||||
option(USE_SHARED_GIFLIB "Use your installed copy of giflib" off)
|
||||
option(USE_SHARED_JPEGLIB "Use your installed copy of jpeglib" off)
|
||||
@ -135,6 +136,7 @@ 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")
|
||||
|
||||
set(CMARK_DIR ${CMAKE_SOURCE_DIR}/third_party/cmark)
|
||||
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)
|
||||
@ -290,6 +292,14 @@ if(USE_ALLEG4_BACKEND)
|
||||
include_directories(${LOADPNG_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
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)
|
||||
endif()
|
||||
|
||||
if(USE_SHARED_CURL)
|
||||
find_package(CURL REQUIRED)
|
||||
else()
|
||||
|
@ -60,10 +60,6 @@ if(WITH_WEBP_SUPPORT)
|
||||
add_definitions(-DASEPRITE_WITH_WEBP_SUPPORT)
|
||||
endif()
|
||||
|
||||
# cmark include files
|
||||
add_definitions(-DCMARK_STATIC_DEFINE)
|
||||
include_directories(${CMAKE_BINARY_DIR}/third_party/cmark)
|
||||
|
||||
######################################################################
|
||||
# app-lib target
|
||||
|
||||
@ -476,7 +472,7 @@ target_link_libraries(app-lib
|
||||
she
|
||||
ui-lib
|
||||
undo
|
||||
libcmark_static
|
||||
${CMARK_LIBRARIES}
|
||||
${TINYXML_LIBRARY}
|
||||
${JPEG_LIBRARIES}
|
||||
${GIF_LIBRARIES}
|
||||
|
34
third_party/CMakeLists.txt
vendored
34
third_party/CMakeLists.txt
vendored
@ -88,19 +88,21 @@ endif()
|
||||
add_subdirectory(simpleini)
|
||||
|
||||
# Add cmark without tests
|
||||
set(CMARK_TESTS OFF CACHE BOOL "Build cmark tests and enable testing")
|
||||
add_subdirectory(cmark)
|
||||
set(cmark_headers
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmark/src/cmark.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmark/src/cmark_export.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmark/src/cmark_version.h)
|
||||
foreach(fn ${cmark_headers})
|
||||
get_filename_component(fn_name "${fn}" NAME)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cmark/${fn_name}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${fn} ${CMAKE_CURRENT_BINARY_DIR}/cmark/${fn_name}
|
||||
MAIN_DEPENDENCY ${fn})
|
||||
list(APPEND copy_cmark_headers ${CMAKE_CURRENT_BINARY_DIR}/cmark/${fn_name})
|
||||
endforeach()
|
||||
add_custom_target(copy_cmark_headers DEPENDS ${copy_cmark_headers})
|
||||
add_dependencies(libcmark_static copy_cmark_headers)
|
||||
if(NOT USE_SHARED_CMARK)
|
||||
set(CMARK_TESTS OFF CACHE BOOL "Build cmark tests and enable testing")
|
||||
add_subdirectory(cmark)
|
||||
set(cmark_headers
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmark/src/cmark.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmark/src/cmark_export.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmark/src/cmark_version.h)
|
||||
foreach(fn ${cmark_headers})
|
||||
get_filename_component(fn_name "${fn}" NAME)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cmark/${fn_name}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${fn} ${CMAKE_CURRENT_BINARY_DIR}/cmark/${fn_name}
|
||||
MAIN_DEPENDENCY ${fn})
|
||||
list(APPEND copy_cmark_headers ${CMAKE_CURRENT_BINARY_DIR}/cmark/${fn_name})
|
||||
endforeach()
|
||||
add_custom_target(copy_cmark_headers DEPENDS ${copy_cmark_headers})
|
||||
add_dependencies(libcmark_static copy_cmark_headers)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user