*/}}

CMakeLists.txt 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. cmake_minimum_required(VERSION 3.1)
  2. project(demo)
  3. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
  4. find_package(lagui REQUIRED)
  5. find_package(LuaJIT OPTIONAL_COMPONENTS)
  6. add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
  7. add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
  8. include_directories(
  9. ${LAGUI_INCLUDE_DIRS_ALL}
  10. )
  11. if(LUAJIT_FOUND)
  12. include_directories(${LUA_INCLUDE_DIR})
  13. endif()
  14. add_definitions(-w)
  15. set(SimplestFiles ${CMAKE_SOURCE_DIR}/simplest.c)
  16. set(OperatorFiles ${CMAKE_SOURCE_DIR}/operator.c)
  17. set(SimplePropertiesFiles ${CMAKE_SOURCE_DIR}/simple_properties.c)
  18. set(WidgetsFiles ${CMAKE_SOURCE_DIR}/widgets.c)
  19. set(WidgetFlagsFiles ${CMAKE_SOURCE_DIR}/widget_flags.c)
  20. set(FruitsFiles ${CMAKE_SOURCE_DIR}/fruits.c)
  21. set(ModellingFiles ${CMAKE_SOURCE_DIR}/modelling_main.c)
  22. set(CalculatorFiles ${CMAKE_SOURCE_DIR}/calculator.c)
  23. set(NVGTestFiles ${CMAKE_SOURCE_DIR}/nvgtest.c)
  24. if(LUAJIT_FOUND)
  25. set(LuajitFiles ${CMAKE_SOURCE_DIR}/luajit.c)
  26. endif()
  27. set(ExampleViewerFiles ${CMAKE_SOURCE_DIR}/example_viewer.c)
  28. add_executable(simplest ${SimplestFiles})
  29. add_executable(operator ${OperatorFiles})
  30. add_executable(simple_properties ${SimplePropertiesFiles})
  31. add_executable(widgets ${WidgetsFiles})
  32. add_executable(widget_flags ${WidgetFlagsFiles})
  33. add_executable(fruits ${FruitsFiles})
  34. add_executable(modelling_main ${ModellingFiles})
  35. add_executable(calculator ${CalculatorFiles})
  36. add_executable(nvgtest ${NVGTestFiles})
  37. if(LUAJIT_FOUND)
  38. add_executable(luajit ${LuajitFiles})
  39. endif()
  40. add_executable(example_viewer ${ExampleViewerFiles})
  41. target_link_libraries(simplest ${LAGUI_SHARED_LIBS} )
  42. target_link_libraries(operator ${LAGUI_SHARED_LIBS} )
  43. target_link_libraries(simple_properties ${LAGUI_SHARED_LIBS} )
  44. target_link_libraries(widgets ${LAGUI_SHARED_LIBS} )
  45. target_link_libraries(widget_flags ${LAGUI_SHARED_LIBS} )
  46. target_link_libraries(fruits ${LAGUI_SHARED_LIBS} )
  47. target_link_libraries(modelling_main ${LAGUI_SHARED_LIBS} )
  48. target_link_libraries(calculator ${LAGUI_SHARED_LIBS} )
  49. target_link_libraries(nvgtest ${LAGUI_SHARED_LIBS} )
  50. if(LUAJIT_FOUND)
  51. target_link_libraries(luajit ${LAGUI_SHARED_LIBS} ${LUA_LIBRARY})
  52. endif()
  53. target_link_libraries(example_viewer ${LAGUI_SHARED_LIBS} )
  54. get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
  55. if(GENERATOR_IS_MULTI_CONFIG)
  56. set(INSTALL_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
  57. else()
  58. set(INSTALL_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR})
  59. endif()
  60. add_custom_command(
  61. TARGET example_viewer POST_BUILD
  62. COMMAND ${CMAKE_COMMAND} -E make_directory ${INSTALL_CONFIG_PATH}/example_source_files
  63. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/luajit.c ${INSTALL_CONFIG_PATH}/example_source_files/luajit.c
  64. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/nvgtest.c ${INSTALL_CONFIG_PATH}/example_source_files/nvgtest.c
  65. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/calculator.c ${INSTALL_CONFIG_PATH}/example_source_files/calculator.c
  66. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/widgets.c ${INSTALL_CONFIG_PATH}/example_source_files/widgets.c
  67. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/widget_flags.c ${INSTALL_CONFIG_PATH}/example_source_files/widget_flags.c
  68. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/fruits.c ${INSTALL_CONFIG_PATH}/example_source_files/fruits.c
  69. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/modelling_main.c ${INSTALL_CONFIG_PATH}/example_source_files/modelling_main.c
  70. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/simple_properties.c ${INSTALL_CONFIG_PATH}/example_source_files/simple_properties.c
  71. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/operator.c ${INSTALL_CONFIG_PATH}/example_source_files/operator.c
  72. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/simplest.c ${INSTALL_CONFIG_PATH}/example_source_files/simplest.c
  73. )