*/}}

CMakeLists.txt 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. include_directories(
  7. ${LAGUI_INCLUDE_DIRS_ALL}
  8. )
  9. if(LUAJIT_FOUND)
  10. include_directories(${LUA_INCLUDE_DIR})
  11. endif()
  12. add_definitions(-w)
  13. set(SimplestFiles ${CMAKE_SOURCE_DIR}/simplest.c)
  14. set(OperatorFiles ${CMAKE_SOURCE_DIR}/operator.c)
  15. set(SimplePropertiesFiles ${CMAKE_SOURCE_DIR}/simple_properties.c)
  16. set(WidgetsFiles ${CMAKE_SOURCE_DIR}/widgets.c)
  17. set(WidgetFlagsFiles ${CMAKE_SOURCE_DIR}/widget_flags.c)
  18. set(FruitsFiles ${CMAKE_SOURCE_DIR}/fruits.c)
  19. set(ModellingFiles ${CMAKE_SOURCE_DIR}/modelling_main.c)
  20. set(CalculatorFiles ${CMAKE_SOURCE_DIR}/calculator.c)
  21. set(NVGTestFiles ${CMAKE_SOURCE_DIR}/nvgtest.c)
  22. if(LUAJIT_FOUND)
  23. set(LuajitFiles ${CMAKE_SOURCE_DIR}/luajit.c)
  24. endif()
  25. set(ExampleViewerFiles ${CMAKE_SOURCE_DIR}/example_viewer.c)
  26. add_executable(simplest ${SimplestFiles})
  27. add_executable(operator ${OperatorFiles})
  28. add_executable(simple_properties ${SimplePropertiesFiles})
  29. add_executable(widgets ${WidgetsFiles})
  30. add_executable(widget_flags ${WidgetFlagsFiles})
  31. add_executable(fruits ${FruitsFiles})
  32. add_executable(modelling_main ${ModellingFiles})
  33. add_executable(calculator ${CalculatorFiles})
  34. add_executable(nvgtest ${NVGTestFiles})
  35. if(LUAJIT_FOUND)
  36. add_executable(luajit ${LuajitFiles})
  37. endif()
  38. add_executable(example_viewer ${ExampleViewerFiles})
  39. target_link_libraries(simplest ${LAGUI_SHARED_LIBS} )
  40. target_link_libraries(operator ${LAGUI_SHARED_LIBS} )
  41. target_link_libraries(simple_properties ${LAGUI_SHARED_LIBS} )
  42. target_link_libraries(widgets ${LAGUI_SHARED_LIBS} )
  43. target_link_libraries(widget_flags ${LAGUI_SHARED_LIBS} )
  44. target_link_libraries(fruits ${LAGUI_SHARED_LIBS} )
  45. target_link_libraries(modelling_main ${LAGUI_SHARED_LIBS} )
  46. target_link_libraries(calculator ${LAGUI_SHARED_LIBS} )
  47. target_link_libraries(nvgtest ${LAGUI_SHARED_LIBS} )
  48. if(LUAJIT_FOUND)
  49. target_link_libraries(luajit ${LAGUI_SHARED_LIBS} ${LUA_LIBRARY})
  50. endif()
  51. target_link_libraries(example_viewer ${LAGUI_SHARED_LIBS} )
  52. add_custom_command(
  53. TARGET example_viewer POST_BUILD
  54. COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/example_source_files
  55. COMMAND cp ${CMAKE_SOURCE_DIR}/luajit.c ${CMAKE_CURRENT_BINARY_DIR}/example_source_files/luajit.c
  56. COMMAND cp ${CMAKE_SOURCE_DIR}/nvgtest.c ${CMAKE_CURRENT_BINARY_DIR}/example_source_files/nvgtest.c
  57. COMMAND cp ${CMAKE_SOURCE_DIR}/calculator.c ${CMAKE_CURRENT_BINARY_DIR}/example_source_files/calculator.c
  58. COMMAND cp ${CMAKE_SOURCE_DIR}/widgets.c ${CMAKE_CURRENT_BINARY_DIR}/example_source_files/widgets.c
  59. COMMAND cp ${CMAKE_SOURCE_DIR}/widget_flags.c ${CMAKE_CURRENT_BINARY_DIR}/example_source_files/widget_flags.c
  60. COMMAND cp ${CMAKE_SOURCE_DIR}/fruits.c ${CMAKE_CURRENT_BINARY_DIR}/example_source_files/fruits.c
  61. COMMAND cp ${CMAKE_SOURCE_DIR}/modelling_main.c ${CMAKE_CURRENT_BINARY_DIR}/example_source_files/modelling_main.c
  62. COMMAND cp ${CMAKE_SOURCE_DIR}/simple_properties.c ${CMAKE_CURRENT_BINARY_DIR}/example_source_files/simple_properties.c
  63. COMMAND cp ${CMAKE_SOURCE_DIR}/operator.c ${CMAKE_CURRENT_BINARY_DIR}/example_source_files/operator.c
  64. COMMAND cp ${CMAKE_SOURCE_DIR}/simplest.c ${CMAKE_CURRENT_BINARY_DIR}/example_source_files/simplest.c)