Advertisement
Guest User

Untitled

a guest
Mar 9th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 4.59 KB | None | 0 0
  1. # Copyright (c) 2008-2017 the Urho3D project.
  2. #
  3. # Permission is hereby granted, free of charge, to any person obtaining a copy
  4. # of this software and associated documentation files (the "Software"), to deal
  5. # in the Software without restriction, including without limitation the rights
  6. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. # copies of the Software, and to permit persons to whom the Software is
  8. # furnished to do so, subject to the following conditions:
  9. #
  10. # The above copyright notice and this permission notice shall be included in
  11. # all copies or substantial portions of the Software.
  12. #
  13. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. # THE SOFTWARE.
  20. #
  21.  
  22. # For our own config.h.in
  23. set (PROJECT_NAME "IK")
  24.  
  25. # memory debugging
  26. if (CMAKE_BUILD_TYPE MATCHES Debug)
  27.     option (IK_MEMORY_DEBUGGING "Global switch for memory options. Keeps track of the number of allocations and de-allocations and prints a report when the program shuts down" ON)
  28. else ()
  29.     option (IK_MEMORY_DEBUGGING "Global switch for memory options. Keeps track of the number of allocations and de-allocations and prints a report when the program shuts down" OFF)
  30. endif ()
  31. if (IK_MEMORY_DEBUGGING)
  32.     if(${CMAKE_BUILD_TYPE} MATCHES Debug)
  33.         option (IK_MEMORY_BACKTRACE "Generates backtraces for every malloc(), making it easy to track down memory leaks" ON)
  34.     else ()
  35.         option (IK_MEMORY_BACKTRACE "Generates backtraces for every malloc(), making it easy to track down memory leaks" OFF)
  36.     endif ()
  37. else ()
  38.     option (IK_MEMORY_BACKTRACE "Generates backtraces for every malloc(), making it easy to track down memory leaks" OFF)
  39. endif ()
  40.  
  41. set (IK_REAL "float" CACHE STRING "Type to use for real numbers")
  42. option (IK_DOT_OUTPUT "When enabled, the generated chains are dumped to DOT for debug purposes" OFF)
  43.  
  44. set (EXPORT_H_TEMPLATE "ik/include/ik/export.h.in")
  45.  
  46. configure_file (${EXPORT_H_TEMPLATE}
  47.                 "include/ik/export.h")
  48. configure_file ("ik/include/ik/config.h.in"
  49.                 "include/ik/config.h")
  50.  
  51. ###############################################################################
  52. # compiler flags
  53. ###############################################################################
  54.  
  55. if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
  56.     add_definitions (-W -Wall -Wextra -Werror -pedantic -Wno-unused-parameter)
  57. elseif (${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
  58.     add_definitions (-W -Wall -Wextra -Werror -pedantic -Wno-unused-parameter)
  59. elseif (${CMAKE_C_COMPILER_ID} STREQUAL "Intel")
  60. elseif (${CMAKE_C_COMPILER_ID} STREQUAL "MSVC")
  61.     add_definitions (-D_CRT_SECURE_NO_WARNINGS)
  62.     if (CMAKE_BUILD_TYPE MATCHES Debug)
  63.         STRING(REGEX REPLACE "/MDd" "" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
  64.         add_definitions (-MTd)
  65.     elseif (CMAKE_BUILD_TYPE MATCHES Release)
  66.         STRING(REGEX REPLACE "/MD" "" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
  67.         add_definitions (-MT)
  68.     endif ()
  69. endif ()
  70.  
  71. ###############################################################################
  72. # source files and library definition
  73. ###############################################################################
  74.  
  75. file (GLOB IK_HEADERS "include/ik/*.h")
  76. file (GLOB IK_SOURCES "src/*.c")
  77.  
  78. list (APPEND IK_HEADERS
  79.     "ik/include/ik/config.h.in"
  80.     "${EXPORT_H_TEMPLATE}")
  81.  
  82. if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  83.     file (GLOB IK_PLATFORM_SOURCES "src/platform/linux/*.c")
  84. endif ()
  85. list (APPEND IK_SOURCES ${IK_PLATFORM_SOURCES})
  86.  
  87. set (TARGET_NAME ik)
  88. set (SOURCE_FILES ${IK_SOURCES} ${IK_HEADERS})
  89. set (INCLUDE_DIRS include)
  90.  
  91. setup_library ()
  92.  
  93. # The library is being built
  94. add_definitions (-DIK_BUILDING)
  95.  
  96. ###############################################################################
  97. # install targets
  98. ###############################################################################
  99.  
  100. # Install headers for building and using the Urho3D library
  101. install_header_files (DIRECTORY include/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/ik FILES_MATCHING PATTERN *.h)  # Note: the trailing slash is significant
  102. install_header_files (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/ik FILES_MATCHING PATTERN *.h)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement