CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #
  2. # Copyright (c) 2008-2016 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. # https://www.sqlite.org/compile.html
  25. add_definitions (-DSQLITE_USE_URI=1 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_SOUNDEX)
  26. # Do not use pthread and dl libraries for Web platform
  27. if (WEB)
  28. add_definitions (-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION)
  29. endif ()
  30. # Define source files
  31. set (SOURCE_FILES src/sqlite3.c)
  32. # Setup target
  33. setup_library ()
  34. # Install headers for building and using the Urho3D library
  35. install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/SQLite FILES_MATCHING PATTERN *.h) # Note: the trailing slash is significant
  36. # Setup additional SQLite CLI standalone target (this target can be transfered and executed on an embedded device, such as Raspberry Pi and Android)
  37. if (NOT IOS AND NOT WEB)
  38. # Define target name for SQLite shell
  39. set (TARGET_NAME isql)
  40. # Define source files
  41. set (SOURCE_FILES src/shell.c src/sqlite3.c src/sqlite3.h)
  42. # Define dependency libs
  43. if (NOT WIN32)
  44. set (LIBS dl)
  45. endif ()
  46. if (READLINE_FOUND)
  47. add_definitions (-DHAVE_READLINE)
  48. # FIXME: temporary quick fix
  49. if (SYSROOT)
  50. set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=\"${SYSROOT}\"")
  51. endif ()
  52. list (APPEND INCLUDE_DIRS ${READLINE_INCLUDE_DIRS})
  53. list (APPEND LIBS ${READLINE_LIBRARIES})
  54. endif ()
  55. # Setup target
  56. setup_executable (NODEPS)
  57. endif ()
  58. # SQLite will not work correctly with the -ffast-math option of GCC
  59. # ATOMIC: Add check for empty CMAKE_C_FLAGS
  60. if (CMAKE_C_FLAGS)
  61. string (REPLACE -ffast-math "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
  62. endif()