*/}}

CMakeLists.txt 3.8 KB

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