43 lines
1.4 KiB
CMake
43 lines
1.4 KiB
CMake
|
cmake_minimum_required(VERSION 3.16.0)
|
||
|
|
||
|
set(CMAKE_C_STANDARD 90)
|
||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||
|
|
||
|
project(IC_Explorer)
|
||
|
|
||
|
find_package(PkgConfig REQUIRED)
|
||
|
|
||
|
pkg_check_modules(SDL2 REQUIRED sdl2 SDL2_mixer SDL2_image SDL2_ttf)
|
||
|
|
||
|
function(add_resources out_var)
|
||
|
set(result)
|
||
|
foreach(in_f ${ARGN})
|
||
|
file(RELATIVE_PATH src_f ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${in_f})
|
||
|
set(out_f ${PROJECT_BINARY_DIR}/${in_f}.o)
|
||
|
get_filename_component(f_name ${src_f} NAME)
|
||
|
get_filename_component(f_dir ${src_f} DIRECTORY)
|
||
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${f_dir})
|
||
|
add_custom_command(OUTPUT ${out_f}
|
||
|
COMMAND ld -r -b binary -o ${out_f} ${f_name}
|
||
|
DEPENDS ${in_f}
|
||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/${f_dir}
|
||
|
COMMENT "Building resource ${out_f}"
|
||
|
VERBATIM)
|
||
|
list(APPEND result ${out_f})
|
||
|
endforeach()
|
||
|
set(${out_var} "${result}" PARENT_SCOPE)
|
||
|
endfunction()
|
||
|
|
||
|
add_resources(RESOURCES assets/font.ttf assets/background.png
|
||
|
assets/button.png assets/button-pressed.png assets/mute.png
|
||
|
assets/volume.png assets/bgm.wav assets/hover.wav assets/click.wav
|
||
|
assets/release.wav)
|
||
|
|
||
|
include_directories(${SDL2_INCLUDE_DIRS})
|
||
|
link_directories(${SDL2_LIBRARY_DIRS})
|
||
|
add_definitions(${SDL2_CFLAGS_OTHER} "-Wall")
|
||
|
|
||
|
add_executable(IC_Explorer main.c window.c button.c textbox.c ${RESOURCES})
|
||
|
|
||
|
target_link_libraries(IC_Explorer ${SDL2_LIBRARIES})
|