66 lines
1.6 KiB
CMake
66 lines
1.6 KiB
CMake
set()
|
|
cmake_minimum_required(VERSION 3.12)
|
|
project(libbpic VERSION 1.0.0 LANGUAGES C DESCRIPTION "encode and decode any file to an image")
|
|
|
|
# dependencies
|
|
|
|
find_package(PNG REQUIRED)
|
|
message(STATUS ${PNG_INCLUDE_DIR})
|
|
include_directories(${PNG_INCLUDE_DIRS})
|
|
|
|
# sources
|
|
|
|
set(BPIC_SOURCES
|
|
src/bpic/common_utils.c
|
|
src/bpic/encode.c
|
|
src/bpic/decode.c)
|
|
set(BPIC_HEADERS
|
|
src/bpic/include/bpic.h
|
|
src/bpic/include/common_utils.h
|
|
src/bpic/include/decode.h
|
|
src/bpic/include/encode.h)
|
|
|
|
set(BPICENCODE_SOURCES
|
|
src/bpicencode/main.c)
|
|
|
|
set(BPICDECODE_SOURCES
|
|
src/bpicdecode/main.c)
|
|
|
|
set(BPICENCODE_TEST_SOURCES
|
|
src/bpicencode_test/main.c)
|
|
|
|
set(BPICDECODE_TEST_SOURCES
|
|
src/bpicdecode_test/main.c)
|
|
|
|
# building
|
|
|
|
add_library(bpic ${BPIC_HEADERS} ${BPIC_SOURCES})
|
|
set_target_property(TARGET bpic PROPERTY C_STANDARD 90)
|
|
|
|
target_include_directories(bpic PUBLIC src/bpic/include)
|
|
set_target_properties(bpic PROPERTIES PUBLIC_HEADER bpic.h)
|
|
|
|
add_executable(bpicencode ${BPICENCODE_SOURCES})
|
|
add_executable(bpicdecode ${BPICDECODE_SOURCES})
|
|
add_executable(bpicencode_test ${BPICENCODE_TEST_SOURCES})
|
|
add_executable(bpicdecode_test ${BPICDECODE_TEST_SOURCES})
|
|
|
|
|
|
# linking
|
|
message(STATUS ${PNG_LIBRARIES})
|
|
target_link_libraries(bpic ${PNG_LIBRARIES})
|
|
target_link_libraries(bpicencode bpic)
|
|
target_link_libraries(bpicdecode bpic)
|
|
target_link_libraries(bpicdecode_test bpic)
|
|
target_link_libraries(bpicencode_test bpic)
|
|
|
|
|
|
# installing
|
|
|
|
install(
|
|
TARGETS bpic
|
|
EXPORT bpic
|
|
LIBRARY DESTINATION lib
|
|
ARCHIVE DESTINATION lib
|
|
PUBLIC_HEADER DESTINATION include/${PROJECT_NAME}
|
|
)
|