123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- cmake_minimum_required(VERSION 3.1)
- project(demo)
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
- find_package(lagui REQUIRED)
- find_package(PNG REQUIRED)
- find_package(LuaJIT)
- add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
- add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
- include_directories(
- ${LAGUI_INCLUDE_DIRS_ALL}
- )
- if(LUAJIT_FOUND)
- include_directories(${LUA_INCLUDE_DIR})
- endif()
- add_definitions(-w)
- set(SimplestFiles ${CMAKE_SOURCE_DIR}/simplest.c)
- set(OperatorFiles ${CMAKE_SOURCE_DIR}/operator.c)
- set(SimplePropertiesFiles ${CMAKE_SOURCE_DIR}/simple_properties.c)
- set(WidgetsFiles ${CMAKE_SOURCE_DIR}/widgets.c)
- set(WidgetFlagsFiles ${CMAKE_SOURCE_DIR}/widget_flags.c)
- set(FruitsFiles ${CMAKE_SOURCE_DIR}/fruits.c)
- set(ModellingFiles ${CMAKE_SOURCE_DIR}/modelling_main.c)
- set(CalculatorFiles ${CMAKE_SOURCE_DIR}/calculator.c)
- set(NVGTestFiles ${CMAKE_SOURCE_DIR}/nvgtest.c)
- if(LUAJIT_FOUND)
- set(LuajitFiles ${CMAKE_SOURCE_DIR}/luajit.c)
- endif()
- set(ExampleViewerFiles ${CMAKE_SOURCE_DIR}/example_viewer.c)
- add_executable(simplest ${SimplestFiles})
- add_executable(operator ${OperatorFiles})
- add_executable(simple_properties ${SimplePropertiesFiles})
- add_executable(widgets ${WidgetsFiles})
- add_executable(widget_flags ${WidgetFlagsFiles})
- add_executable(fruits ${FruitsFiles})
- add_executable(modelling_main ${ModellingFiles})
- add_executable(calculator ${CalculatorFiles})
- add_executable(nvgtest ${NVGTestFiles})
- if(LUAJIT_FOUND)
- add_executable(luajit ${LuajitFiles})
- endif()
- add_executable(example_viewer ${ExampleViewerFiles})
- target_link_libraries(simplest ${LAGUI_SHARED_LIBS} )
- target_link_libraries(operator ${LAGUI_SHARED_LIBS} )
- target_link_libraries(simple_properties ${LAGUI_SHARED_LIBS} )
- target_link_libraries(widgets ${LAGUI_SHARED_LIBS} )
- target_link_libraries(widget_flags ${LAGUI_SHARED_LIBS} )
- target_link_libraries(fruits ${LAGUI_SHARED_LIBS} )
- target_link_libraries(modelling_main ${LAGUI_SHARED_LIBS} )
- target_link_libraries(calculator ${LAGUI_SHARED_LIBS} )
- target_link_libraries(nvgtest ${LAGUI_SHARED_LIBS} )
- if(LUAJIT_FOUND)
- target_link_libraries(luajit ${LAGUI_SHARED_LIBS} ${LUA_LIBRARY})
- endif()
- target_link_libraries(example_viewer ${LAGUI_SHARED_LIBS} )
- message("${LAGUI_SHARED_LIBS}")
- target_link_options(simplest PUBLIC "-Wl,--start-group")
- target_link_options(operator PUBLIC "-Wl,--start-group")
- target_link_options(simple_properties PUBLIC "-Wl,--start-group")
- target_link_options(widgets PUBLIC "-Wl,--start-group")
- target_link_options(widget_flags PUBLIC "-Wl,--start-group")
- target_link_options(fruits PUBLIC "-Wl,--start-group")
- target_link_options(modelling_main PUBLIC "-Wl,--start-group")
- target_link_options(calculator PUBLIC "-Wl,--start-group")
- target_link_options(nvgtest PUBLIC "-Wl,--start-group")
- target_link_options(luajit PUBLIC "-Wl,--start-group")
- target_link_options(example_viewer PUBLIC "-Wl,--start-group")
- get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
- if(GENERATOR_IS_MULTI_CONFIG)
- set(INSTALL_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
- else()
- set(INSTALL_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR})
- endif()
- add_custom_command(
- TARGET example_viewer POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${INSTALL_CONFIG_PATH}/example_source_files
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/luajit.c ${INSTALL_CONFIG_PATH}/example_source_files/luajit.c
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/nvgtest.c ${INSTALL_CONFIG_PATH}/example_source_files/nvgtest.c
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/calculator.c ${INSTALL_CONFIG_PATH}/example_source_files/calculator.c
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/widgets.c ${INSTALL_CONFIG_PATH}/example_source_files/widgets.c
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/widget_flags.c ${INSTALL_CONFIG_PATH}/example_source_files/widget_flags.c
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/fruits.c ${INSTALL_CONFIG_PATH}/example_source_files/fruits.c
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/modelling_main.c ${INSTALL_CONFIG_PATH}/example_source_files/modelling_main.c
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/simple_properties.c ${INSTALL_CONFIG_PATH}/example_source_files/simple_properties.c
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/operator.c ${INSTALL_CONFIG_PATH}/example_source_files/operator.c
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/simplest.c ${INSTALL_CONFIG_PATH}/example_source_files/simplest.c
- )
|