-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
90 lines (60 loc) · 2.95 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
project (edj_reload_album_art LANGUAGES CXX C)
cmake_minimum_required (VERSION 3.3)
# --- some general config
set (CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
# --- find the OpenImageIO library on the development system
# get the path for all homebrew files
execute_process (
COMMAND bash -c "brew --prefix"
OUTPUT_VARIABLE brewPrefix
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# --- our source files
set (HEADERS
sqlite3.h
sqlite3ext.h
)
set (SOURCES
main.cpp
sqlite3.c
)
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES} )
#find_library( OIIO_LIB NAMES OpenImageIO )
#find_library( OIIO_UTIL_LIB NAMES OpenImageIO_Util )
find_package(ImageMagick 7 COMPONENTS Magick++ MagickCore)
if(ImageMagick_FOUND)
# Find Imagemagick Library directory
get_filename_component(MAGICK_LIB_DIR ${ImageMagick_MagickCore_LIBRARY} DIRECTORY)
# we get "../lib/.." but this is too deep. one level iup
set(MAGICK_LIB_DIR ${MAGICK_LIB_DIR}/.. )
# Find where Magick++-config lives
file(GLOB_RECURSE MAGICK_CONFIG FOLLOW_SYMLINKS ${MAGICK_LIB_DIR}/Magick++-config)
# Ask about CXX and lib flags/locations
set(MAGICK_CONFIG ${MAGICK_CONFIG} CACHE STRING "Path to Magick++-config utility")
execute_process(COMMAND "${MAGICK_CONFIG}" "--cxxflags" OUTPUT_VARIABLE MAGICK_CXX_FLAGS)
execute_process(COMMAND "${MAGICK_CONFIG}" "--libs" OUTPUT_VARIABLE MAGICK_LD_FLAGS)
# Add these to cache
set(MAGICK_CXX_FLAGS "${MAGICK_CXX_FLAGS}" CACHE STRING "ImageMagick configuration specific compilation flags." )
set(MAGICK_LD_FLAGS "${MAGICK_LD_FLAGS}" CACHE STRING "ImageMagick configuration specific linking flags.")
# Split into list:
string(REGEX MATCHALL "([^\ ]+)" MAGICK_CXX_FLAGS "${MAGICK_CXX_FLAGS}")
string(REGEX MATCHALL "([^\ ]+)" MAGICK_LD_FLAGS "${MAGICK_LD_FLAGS}")
# Remove trailing whitespace (CMAKE warns about this)
string(STRIP "${MAGICK_CXX_FLAGS}" MAGICK_CXX_FLAGS)
string(STRIP "${MAGICK_LD_FLAGS}" MAGICK_LD_FLAGS)
target_compile_options(${PROJECT_NAME} PUBLIC ${MAGICK_CXX_FLAGS})
##target_include_directories(${PROJECT_NAME} PUBLIC "/opt/homebrew/Cellar/imagemagick/7.1.0-45/include/ImageMagick-7")
target_link_options(${PROJECT_NAME} PUBLIC ${MAGICK_LD_FLAGS})
message(STATUS ${MAGICK_LD_FLAGS})
message(STATUS ${MAGICK_CXX_FLAGS})
endif(ImageMagick_FOUND)
# --- add taglib to our build env
add_subdirectory(taglib-1.12)
### there has to be a more easy way to propagete the include dirs from target lib. But this works.
get_property(taglib_includes DIRECTORY taglib-1.12/taglib PROPERTY INCLUDE_DIRECTORIES)
# --- our target definitions
target_link_libraries(${PROJECT_NAME} tag )
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/taglib-1.12 )
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/taglib-1.12/taglib )
target_include_directories(${PROJECT_NAME} PUBLIC ${taglib_includes} )