CMakeLists.txt 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #
  2. # Copyright (c) 2008-2020 the Urho3D project.
  3. #
  4. # Permission is hereby granted, free of charge, to any person obtaining a copy
  5. # of this software and associated documentation files (the "Software"), to deal
  6. # in the Software without restriction, including without limitation the rights
  7. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. # copies of the Software, and to permit persons to whom the Software is
  9. # furnished to do so, subject to the following conditions:
  10. #
  11. # The above copyright notice and this permission notice shall be included in
  12. # all copies or substantial portions of the Software.
  13. #
  14. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. # THE SOFTWARE.
  21. #
  22. # Define target name
  23. set (TARGET_NAME sqlite)
  24. # Define preprocessor macros
  25. add_definitions (-DSQLITE_USE_URI=1 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_SOUNDEX) # https://www.sqlite.org/compile.html
  26. if (WEB)
  27. # Do not use pthread and dl libraries for Web platform
  28. add_definitions (-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION)
  29. elseif (MINGW)
  30. # We only support MinGW with "_mingw.h" header file, note the leading underscore
  31. add_definitions (-D_HAVE__MINGW_H)
  32. endif ()
  33. foreach (VAR HAVE_STDINT_H HAVE_INTTYPES_H HAVE_MALLOC_H HAVE_MALLOC_USABLE_SIZE)
  34. if (${VAR})
  35. add_definitions (-D${VAR})
  36. endif ()
  37. endforeach ()
  38. # Define source files
  39. set (SOURCE_FILES src/sqlite3.c)
  40. # Setup target
  41. setup_library ()
  42. # Install headers for building and using the Urho3D library
  43. install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/SQLite FILES_MATCHING PATTERN *.h) # Note: the trailing slash is significant
  44. # Setup additional SQLite CLI standalone target (this target can be transfered and executed on an embedded device, such as Raspberry Pi and Android)
  45. if (NOT IOS AND NOT TVOS AND NOT WEB)
  46. # Define target name for SQLite shell
  47. set (TARGET_NAME sqlite3)
  48. # Define source files
  49. set (SOURCE_FILES src/shell.c src/sqlite3.c src/sqlite3.h)
  50. # Define dependency libs
  51. if (NOT WIN32)
  52. set (LIBS dl)
  53. if (READLINE_FOUND)
  54. add_definitions (-DHAVE_READLINE)
  55. list (APPEND INCLUDE_DIRS ${READLINE_INCLUDE_DIRS})
  56. list (APPEND LIBS ${READLINE_LIBRARIES})
  57. endif ()
  58. endif ()
  59. # Setup target
  60. setup_executable (NODEPS)
  61. endif ()
  62. # SQLite will not work correctly with the -ffast-math option, so unset it in this scope only
  63. string (REPLACE -ffast-math "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") # Stringify for string replacement