*/}}

CMakeLists.txt 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. cmake_minimum_required(VERSION 3.1)
  2. project(OurPaint)
  3. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
  4. find_package(lagui REQUIRED)
  5. find_package(PNG REQUIRED)
  6. find_package(LCMS2 REQUIRED)
  7. add_definitions(-w)
  8. # embed_resource("data.dat" "data.h" "DATA")
  9. function(embed_resource resource_file_name source_file_name variable_name)
  10. if(EXISTS "${source_file_name}")
  11. if("${source_file_name}" IS_NEWER_THAN "${resource_file_name}")
  12. return()
  13. endif()
  14. endif()
  15. file(READ "${resource_file_name}" hex_content HEX)
  16. string(REPEAT "[0-9a-f]" 32 pattern)
  17. string(REGEX REPLACE "(${pattern})" "\\1\n" content "${hex_content}")
  18. string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1, " content "${content}")
  19. string(REGEX REPLACE ", $" "" content "${content}")
  20. set(array_definition "unsigned char ${variable_name}[] =\n{\n${content}\n};")
  21. set(source "// Auto generated file.\n${array_definition}\n")
  22. file(WRITE "${source_file_name}" "${source}")
  23. endfunction()
  24. file(MAKE_DIRECTORY "BuildResources")
  25. embed_resource("Resources/splash.png" "BuildResources/data_splash.c" "DATA_SPLASH")
  26. embed_resource("Resources/splash_highdpi.png" "BuildResources/data_splash_highdpi.c" "DATA_SPLASH_HIGHDPI")
  27. include_directories(
  28. ${LAGUI_INCLUDE_DIRS_ALL}
  29. )
  30. file(GLOB_RECURSE OurPaintFiles
  31. ourpaint.c ouroperations.c ournodes.c ourtranslations.c
  32. BuildResources/data_splash.c
  33. BuildResources/data_splash_highdpi.c
  34. )
  35. add_executable(OurPaint ${OurPaintFiles})
  36. target_link_libraries(OurPaint
  37. ${LAGUI_SHARED_LIBS}
  38. ${PNG_LIBRARY}
  39. ${LCMS2_LIBRARIES}
  40. )