sandboxed-api/oss-internship-2020/openjpeg/examples/CMakeLists.txt

49 lines
1.9 KiB
CMake
Raw Normal View History

2020-08-12 19:24:30 +08:00
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2020-09-01 19:06:12 +08:00
# we need to use modified versions of some of the library tools
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/gen_files")
file(COPY "${PROJECT_SOURCE_DIR}/openjpeg/src/bin/jp2/convert.c" DESTINATION "${PROJECT_BINARY_DIR}/gen_files/")
file(COPY "${PROJECT_SOURCE_DIR}/openjpeg/src/bin/jp2/convert.h" DESTINATION "${PROJECT_BINARY_DIR}/gen_files/")
file(COPY "${PROJECT_SOURCE_DIR}/examples/convert.patch" DESTINATION "${PROJECT_BINARY_DIR}/gen_files/")
file(COPY "${PROJECT_SOURCE_DIR}/examples/convert_h.patch" DESTINATION "${PROJECT_BINARY_DIR}/gen_files/")
add_custom_command(
2020-09-01 19:06:12 +08:00
OUTPUT ${PROJECT_BINARY_DIR}/gen_files/convert.cc ${PROJECT_BINARY_DIR}/gen_files/convert.h
COMMAND cd ${PROJECT_BINARY_DIR}/gen_files && patch < ${PROJECT_SOURCE_DIR}/examples/convert.patch > /dev/null
COMMAND cd ${PROJECT_BINARY_DIR}/gen_files && patch < ${PROJECT_SOURCE_DIR}/examples/convert_h.patch > /dev/null
COMMAND mv ${PROJECT_BINARY_DIR}/gen_files/convert.c ${PROJECT_BINARY_DIR}/gen_files/convert.cc
)
2020-08-12 19:24:30 +08:00
add_library(convert_helper STATIC
2020-09-01 19:06:12 +08:00
${PROJECT_BINARY_DIR}/gen_files/convert.cc
${PROJECT_BINARY_DIR}/gen_files/convert.h
2020-08-12 19:24:30 +08:00
)
add_executable(decompress_sandboxed
decompress_example.cc
2020-08-12 19:24:30 +08:00
)
target_link_libraries(decompress_sandboxed PRIVATE
convert_helper
openjp2_sapi
sapi::sapi
2020-08-12 19:24:30 +08:00
)
target_link_libraries(convert_helper PRIVATE
openjp2_sapi
sapi::sapi
2020-08-12 19:24:30 +08:00
)