Update CMakeLists.txt

This commit is contained in:
MrLetsplay 2022-10-08 14:27:25 +02:00
parent e65297de1e
commit a168893acc

View File

@ -29,13 +29,10 @@ add_compile_definitions(FT_CONFIG_OPTION_ERROR_STRINGS) # Freetype error strings
if(${KEKENGINE_DEBUG})
add_compile_options(-Wall -g)
message("Compiler flags A")
else()
add_compile_options(-Wall -O3)
message("Compiler flags B")
endif()
add_subdirectory(dependencies/microtar)
# kekengine resources
@ -43,12 +40,14 @@ add_custom_target(kekengine_res ALL DEPENDS ${KEKENGINE_RESOURCE_FILES})
add_custom_command(TARGET kekengine_res PRE_BUILD
BYPRODUCTS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources.tar
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
COMMAND ${CMAKE_COMMAND} -E
chdir ${KEKENGINE_RESOURCE_DIR}
tar cf ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources.tar ${KEKENGINE_RELATIVE_RESOURCE_FILES})
# libkekengine
add_library(kekengine ${KEKENGINE_SOURCE_FILES})
add_dependencies(kekengine kekengine_res)
target_link_libraries(kekengine PUBLIC glfw GLEW GL microtar)
target_include_directories(kekengine PRIVATE "src/kekengine/include")
@ -59,18 +58,22 @@ pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
target_link_libraries(kekengine PUBLIC ${GTK3_LIBRARIES})
target_include_directories(kekengine PRIVATE ${GTK3_INCLUDE_DIRS})
if(${KEKENGINE_BUILD_KEKGAME})
# kekgame resources
add_custom_target(kekgame_res ALL
DEPENDS ${KEKGAME_RESOURCE_FILES} kekengine_res)
add_custom_command(TARGET kekgame_res PRE_BUILD
BYPRODUCTS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources.tar
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
COMMAND ${CMAKE_COMMAND} -E
chdir ${KEKGAME_RESOURCE_DIR}
tar rf ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources.tar ${KEKGAME_RELATIVE_RESOURCE_FILES})
# kekgame
add_executable(kekgame ${KEKGAME_SOURCE_FILES})
add_dependencies(kekgame kekgame_res)
target_link_libraries(kekgame PUBLIC kekengine)
target_include_directories(kekgame PRIVATE "src/kekengine/include")
endif()