CMakeLists.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #
  2. # Copyright 2016 WebAssembly Community Group participants
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. cmake_minimum_required(VERSION 3.10)
  17. project(WABT)
  18. set(COMPILER_IS_CLANG 1)
  19. set(COMPILER_IS_GNU 0)
  20. set(COMPILER_IS_MSVC 0)
  21. include(CheckIncludeFile)
  22. include(CheckSymbolExists)
  23. check_include_file("alloca.h" HAVE_ALLOCA_H)
  24. check_include_file("unistd.h" HAVE_UNISTD_H)
  25. check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
  26. check_symbol_exists(sysconf "unistd.h" HAVE_SYSCONF)
  27. check_symbol_exists(strcasecmp "strings.h" HAVE_STRCASECMP)
  28. if (WIN32)
  29. check_symbol_exists(ENABLE_VIRTUAL_TERMINAL_PROCESSING "windows.h" HAVE_WIN32_VT100)
  30. endif ()
  31. include(CheckTypeSize)
  32. check_type_size(ssize_t SSIZE_T)
  33. check_type_size(size_t SIZEOF_SIZE_T)
  34. configure_file(
  35. ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in
  36. ${CMAKE_CURRENT_BINARY_DIR}/config.h
  37. )
  38. include_directories(chakra ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
  39. # disable -Wunused-parameter: this is really common when implementing
  40. # interfaces, etc.
  41. # disable -Wpointer-arith: this is a GCC extension, and doesn't work in MSVC.
  42. if (MINGW)
  43. # Mingw won't define format (e.g. PRIu64) or limit (e.g. UINT32_MAX) macros
  44. # in C++ without these.
  45. add_definitions(-D__STDC_LIMIT_MACROS=1 -D__STDC_FORMAT_MACROS=1)
  46. endif ()
  47. if (COMPILER_IS_GNU)
  48. # disable -Wclobbered: it seems to be guessing incorrectly about a local
  49. # variable being clobbered by longjmp.
  50. add_definitions(-Wno-clobbered)
  51. endif ()
  52. if (COMPILER_IS_CLANG)
  53. add_definitions(-fcolor-diagnostics)
  54. endif ()
  55. include_directories(src/prebuilt)
  56. if (COMPILER_IS_CLANG OR COMPILER_IS_GNU)
  57. # yyerror passes a non-string-literal to a printf-like function, which is a
  58. # warning.
  59. set_source_files_properties(
  60. ${AST_PARSER_GEN_C}
  61. PROPERTIES
  62. COMPILE_FLAGS "-Wno-format-security -Wno-old-style-cast"
  63. )
  64. endif ()
  65. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${WABT_SOURCE_DIR}/cmake)
  66. set(WAST_LEXER_GEN_CC src/prebuilt/wast-lexer-gen.cc)
  67. add_custom_target(everything)
  68. add_library(libwabt OBJECT
  69. chakra/wabtapi.cc
  70. src/apply-names.cc
  71. src/binary.cc
  72. src/binary-reader.cc
  73. src/binary-reader-ir.cc
  74. src/binary-reader-logging.cc
  75. src/binary-writer.cc
  76. src/binary-writer-spec.cc
  77. src/binding-hash.cc
  78. src/color.cc
  79. src/common.cc
  80. src/config.cc
  81. src/error-formatter.cc
  82. src/expr-visitor.cc
  83. src/feature.cc
  84. src/filenames.cc
  85. src/generate-names.cc
  86. src/hash-util.cc
  87. src/ir.cc
  88. src/leb128.cc
  89. src/lexer-source.cc
  90. src/lexer-source-line-finder.cc
  91. src/literal.cc
  92. src/opcode.cc
  93. src/opcode-code-table.c
  94. src/option-parser.cc
  95. src/resolve-names.cc
  96. src/stream.cc
  97. src/string-view.cc
  98. src/token.cc
  99. src/tracing.cc
  100. src/type-checker.cc
  101. src/utf8.cc
  102. src/validator.cc
  103. src/wast-parser.cc
  104. src/wat-writer.cc
  105. ${WAST_LEXER_GEN_CC}
  106. )