CMakeLists.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #######################################
  2. # Required CMake version #
  3. #######################################
  4. cmake_minimum_required( VERSION 3.3 )
  5. #######################################
  6. # Project name #
  7. #######################################
  8. project( OpENer C )
  9. #######################################
  10. # Project version #
  11. #######################################
  12. set( OpENer_Device_Config_Vendor_Id 1 CACHE STRING "Device Vendor ID")
  13. set( OpENer_Device_Config_Device_Type 12 CACHE STRING "Device Type ID")
  14. set( OpENer_Device_Config_Product_Code 65001 CACHE STRING "Device Product Code")
  15. set( OpENer_Device_Config_Device_Name "OpENer PC" CACHE STRING "Device Name")
  16. set( OpENer_VERSION_MAJOR 2 )
  17. set( OpENer_VERSION_MINOR 1 )
  18. configure_file(
  19. "${PROJECT_SOURCE_DIR}/src/ports/devicedata.h.in"
  20. "${PROJECT_BINARY_DIR}/src/ports/devicedata.h"
  21. )
  22. find_path( OpENer_BUILDSUPPORT_DIR OpENer.cmake ${PROJECT_SOURCE_DIR}/buildsupport )
  23. INCLUDE( ${OpENer_BUILDSUPPORT_DIR}/OpENer.cmake )
  24. #######################################
  25. # Platform switches #
  26. #######################################
  27. set( OpENer_KNOWN_PLATFORMS "POSIX" "WIN32" )
  28. set( OpENer_PLATFORM CACHE STRINGS "Platform OpENer will be built for" )
  29. set_property(CACHE OpENer_PLATFORM PROPERTY STRINGS ${OpENer_KNOWN_PLATFORMS} )
  30. #######################################
  31. # Platform-dependent functions check #
  32. #######################################
  33. INCLUDE( ${OpENer_BUILDSUPPORT_DIR}/OpENer_function_checks.cmake )
  34. #######################################
  35. # OpENer 64-bit data types #
  36. #######################################
  37. set( OpENer_64_BIT_DATA_TYPES_ENABLED CACHE BOOL "Enable 64-bit data type support" )
  38. if( OpENer_64_BIT_DATA_TYPES_ENABLED )
  39. add_definitions( -DOPENER_SUPPORT_64BIT_DATATYPES )
  40. endif( OpENer_64_BIT_DATA_TYPES_ENABLED )
  41. #######################################
  42. # OpENer tracer switches #
  43. #######################################
  44. set( OpENer_TRACES OFF CACHE BOOL "Activate OpENer traces" )
  45. if(OpENer_TRACES)
  46. createTraceLevelOptions()
  47. endif(OpENer_TRACES)
  48. #######################################
  49. # Test switch #
  50. #######################################
  51. set( OpENer_TESTS OFF CACHE BOOL "Enable tests to be built" )
  52. if( OpENer_TESTS )
  53. enable_testing()
  54. enable_language( CXX )
  55. set( CPPUTEST_HOME "" CACHE PATH "Path to CppUTest directory" )
  56. INCLUDE( ${OpENer_BUILDSUPPORT_DIR}/OpENer_Tests.cmake )
  57. add_subdirectory( tests )
  58. endif( OpENer_TESTS )
  59. #######################################
  60. # OpENer C flags #
  61. #######################################
  62. set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" )
  63. ####################################################
  64. # Internal cache holding the available CIP objects #
  65. ####################################################
  66. set( OpENer_ADD_CIP_OBJECTS "" CACHE INTERNAL STRING )
  67. #######################################
  68. # Add custom CIP objects #
  69. #######################################
  70. set( OpENer_CIP_OBJECTS_DIR ${PROJECT_SOURCE_DIR}/src/cip_objects )
  71. include(${OpENer_BUILDSUPPORT_DIR}/OpENer_CIP_Object_generator.cmake)
  72. #######################################
  73. # Add subdirectories #
  74. #######################################
  75. add_subdirectory( src )