aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: a3fdafb6740722ef1c8a739ad421e210652c738c (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
find_package(SameBoy REQUIRED)
find_package(SameBoyBootRom REQUIRED)
find_package(SameBoyTemplate REQUIRED)

if (USE_LIBPNG)
    find_package(libpng REQUIRED)
    add_compile_definitions(USE_LIBPNG)
    set(PNG_INCLUDE_DIRS ${LIBPNG_INCLUDE_DIRS})
    set(PNG_LIBRARIES ${LIBPNG_LIBRARIES})
else()
    find_package(lodepng REQUIRED)
    add_compile_definitions(USE_LODEPNG)
    set(PNG_INCLUDE_DIRS ${LODEPNG_INCLUDE_DIRS})
    set(PNG_LIBRARIES ${LODEPNG_LIBRARIES})
endif()

include_directories(${SAMEBOY_INCLUDE_DIRS})

list(APPEND
    THUMBNAILER_SOURCES
    ${CMAKE_CURRENT_SOURCE_DIR}/common.c
    ${CMAKE_CURRENT_SOURCE_DIR}/common.h
    ${CMAKE_CURRENT_SOURCE_DIR}/embed.h
    ${CMAKE_CURRENT_SOURCE_DIR}/get_image_for_rom.c
    ${CMAKE_CURRENT_SOURCE_DIR}/get_image_for_rom.h
    ${CMAKE_CURRENT_SOURCE_DIR}/image.c
    ${CMAKE_CURRENT_SOURCE_DIR}/image.h
    ${CMAKE_CURRENT_SOURCE_DIR}/main.c
    ${SAMEBOY_BOOTROM_SOURCES}
    ${SAMEBOY_TEMPLATE_SOURCES}
)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

add_executable(sameboy-thumbnailer ${THUMBNAILER_SOURCES})

add_dependencies(sameboy-thumbnailer sameboy_bootrom sameboy_template)

target_include_directories(sameboy-thumbnailer PUBLIC ${PNG_INCLUDE_DIRS})

target_link_libraries(sameboy-thumbnailer LINK_PUBLIC ${PNG_LIBRARIES})
target_link_libraries(sameboy-thumbnailer LINK_PUBLIC ${SAMEBOY_LIBRARIES})
target_link_libraries(sameboy-thumbnailer LINK_PUBLIC ${CMAKE_DL_LIBS})
target_link_libraries(sameboy-thumbnailer LINK_PUBLIC m)