summaryrefslogtreecommitdiff
path: root/indra/integration_tests/llimage_libtest/CMakeLists.txt
blob: bd59f57e492948c12ef39b88737a405f0514bdec (plain)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# -*- cmake -*-

# Integration tests of the llimage library (JPEG2000, PNG, jpeg, etc... images reading and writing)

project (llimage_libtest)

include(00-Common)
include(LLCommon)
include(LLImage)
include(LLMath)
include(LLImageJ2COJ) 
include(LLKDU)
include(LLFileSystem)

include_directories(
    ${LLCOMMON_INCLUDE_DIRS}
    ${LLFILESYSTEM_INCLUDE_DIRS}
    ${LLIMAGE_INCLUDE_DIRS}
    ${LLMATH_INCLUDE_DIRS}
    )
include_directories(SYSTEM
    ${LLCOMMON_SYSTEM_INCLUDE_DIRS}
    )

set(llimage_libtest_SOURCE_FILES
    llimage_libtest.cpp
    )

set(llimage_libtest_HEADER_FILES
    CMakeLists.txt
    llimage_libtest.h
    )

set_source_files_properties(${llimage_libtest_HEADER_FILES}
                            PROPERTIES HEADER_FILE_ONLY TRUE)

list(APPEND llimage_libtest_SOURCE_FILES ${llimage_libtest_HEADER_FILES})

add_executable(llimage_libtest
    WIN32
    MACOSX_BUNDLE
    ${llimage_libtest_SOURCE_FILES}
    )

set_target_properties(llimage_libtest
    PROPERTIES
    WIN32_EXECUTABLE
    FALSE
)

# OS-specific libraries
if (DARWIN)
  include(CMakeFindFrameworks)
  find_library(COREFOUNDATION_LIBRARY CoreFoundation)
  set(OS_LIBRARIES ${COREFOUNDATION_LIBRARY})
elseif (WINDOWS)
  set(OS_LIBRARIES)
elseif (LINUX)
  set(OS_LIBRARIES)
else (DARWIN)
  message(FATAL_ERROR "Unknown platform")
endif (DARWIN)

# Libraries on which this application depends on
# Sort by high-level to low-level
target_link_libraries(llimage_libtest
    ${LEGACY_STDIO_LIBS}
    ${LLCOMMON_LIBRARIES}
    ${LLFILESYSTEM_LIBRARIES}
    ${LLMATH_LIBRARIES}
    ${LLIMAGE_LIBRARIES}
    ${LLKDU_LIBRARIES}
    ${KDU_LIBRARY}
    ${LLIMAGEJ2COJ_LIBRARIES}
    ${OS_LIBRARIES}
    )
    
if (DARWIN)
  # Path inside the app bundle where we'll need to copy libraries
  set(LLIMAGE_LIBTEST_DESTINATION_DIR
    ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llimage_libtest.app/Contents/Resources
  )
  # Create the Contents/Resources directory
  add_custom_command(
    TARGET llimage_libtest POST_BUILD
    COMMAND ${CMAKE_COMMAND}
    ARGS
      -E
      make_directory
      ${LLIMAGE_LIBTEST_DESTINATION_DIR}
    COMMENT "Creating Resources directory in app bundle."
  ) 
else (DARWIN)
  set(LLIMAGE_LIBTEST_DESTINATION_DIR
    ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
  )
endif (DARWIN)

get_target_property(BUILT_LLCOMMON llcommon LOCATION)
add_custom_command(TARGET llimage_libtest POST_BUILD
  COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_LLCOMMON}  ${LLIMAGE_LIBTEST_DESTINATION_DIR}
  DEPENDS ${BUILT_LLCOMMON}
)

if (DARWIN)
  # Copy the required libraries to the package app
  add_custom_command(TARGET llimage_libtest POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy ${AUTOBUILD_INSTALL_DIR}/lib/release/libapr-1.0.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR}
    DEPENDS ${AUTOBUILD_INSTALL_DIR}/lib/release/libapr-1.0.dylib
  )
  add_custom_command(TARGET llimage_libtest POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy ${AUTOBUILD_INSTALL_DIR}/lib/release/libaprutil-1.0.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR}
    DEPENDS ${AUTOBUILD_INSTALL_DIR}/lib/release/libaprutil-1.0.dylib
  )
  add_custom_command(TARGET llimage_libtest POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy ${AUTOBUILD_INSTALL_DIR}/lib/release/libexception_handler.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR}
    DEPENDS ${AUTOBUILD_INSTALL_DIR}/lib/release/libexception_handler.dylib
  )
  foreach(expat ${EXPAT_COPY})
    add_custom_command(TARGET llimage_libtest POST_BUILD
      COMMAND ${CMAKE_COMMAND} -E copy ${AUTOBUILD_INSTALL_DIR}/lib/release/${expat} ${LLIMAGE_LIBTEST_DESTINATION_DIR}
      DEPENDS ${AUTOBUILD_INSTALL_DIR}/lib/release/${expat}
    )
  endforeach(expat)
endif (DARWIN)

if (WINDOWS)
  # Check indra/test_apps/llplugintest/CMakeLists.txt for an example of what to copy over for Windows and how
endif (WINDOWS)

# Ensure people working on the viewer don't break this library
# *NOTE: This could be removed, or only built by TeamCity, if the build
# and link times become too long.
add_dependencies(viewer llimage_libtest)