🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

383 lines
13 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. # Prevent in-source builds
  2. if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
  3. message(FATAL_ERROR "In-source builds prohibited. Call CMake from a build/<platform> directory.")
  4. endif()
  5. cmake_minimum_required(VERSION 3.25)
  6. # Create superbuild project
  7. project(antkeeper-superbuild VERSION "0.0.1")
  8. # Setup package variables
  9. set(PACKAGE_NAME ${PROJECT_NAME})
  10. set(PACKAGE_VERSION ${PROJECT_VERSION})
  11. set(PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
  12. set(PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
  13. set(PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
  14. get_filename_component(PACKAGE_PLATFORM ${CMAKE_BINARY_DIR} NAME CACHE)
  15. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  16. set(PACKAGE_BUILD_TYPE debug)
  17. else()
  18. set(PACKAGE_BUILD_TYPE release)
  19. endif()
  20. set(PACKAGE_FILENAME ${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM})
  21. set(PACKAGE_INSTALL_DIR ${CMAKE_SOURCE_DIR}/bin/${PACKAGE_BUILD_TYPE}/${PACKAGE_FILENAME})
  22. set(PACKAGE_DIST_DIR ${CMAKE_SOURCE_DIR}/dist/${PACKAGE_BUILD_TYPE})
  23. # Create output directories
  24. file(MAKE_DIRECTORY ${PACKAGE_INSTALL_DIR})
  25. file(MAKE_DIRECTORY ${PACKAGE_DIST_DIR})
  26. # Check for architecture mismatches
  27. if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
  28. if (PACKAGE_PLATFORM MATCHES "64$")
  29. message(FATAL_ERROR "Compiler architecture is 32-bit but target architecture is 64-bit.")
  30. endif()
  31. else()
  32. if (PACKAGE_PLATFORM MATCHES "32$")
  33. message(FATAL_ERROR "Compiler architecture is 64-bit but target architecture is 32-bit.")
  34. endif()
  35. endif()
  36. # Options
  37. set(BLENDER "blender" CACHE FILEPATH "Path to Blender executable")
  38. set(INKSCAPE "inkscape" CACHE FILEPATH "Path to Inkscape executable")
  39. # Set C++ compiler flags
  40. if(CMAKE_COMPILER_IS_GNUCC)
  41. set(CMAKE_CXX_FLAGS "-Wall -Wextra")
  42. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
  43. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
  44. elseif(MSVC)
  45. set(CMAKE_CXX_FLAGS "/MP /W3 /GR- /GS- /EHsc /D_WIN32_WINNT=0x0501 /DWINVER=0x0501")
  46. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /MTd")
  47. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MT /O2")
  48. endif()
  49. # Set C compiler flags
  50. set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
  51. set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
  52. set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
  53. # Set executable linker flags
  54. if(MSVC)
  55. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nologo")
  56. set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /INCREMENTAL:NO")
  57. endif()
  58. # Setup module directories
  59. set(MODULE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/modules")
  60. set(MODULE_BUILD_DIR "${PROJECT_BINARY_DIR}/modules/build")
  61. set(MODULE_INSTALL_DIR "${CMAKE_BINARY_DIR}/modules/install")
  62. # Include ExternalProject_Add macro
  63. include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
  64. # Build SDL2 module
  65. ExternalProject_Add(SDL2
  66. SOURCE_DIR ${MODULE_SOURCE_DIR}/SDL2
  67. BINARY_DIR ${MODULE_BUILD_DIR}/SDL2
  68. INSTALL_DIR ${MODULE_INSTALL_DIR}
  69. CMAKE_ARGS
  70. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  71. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  72. "-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
  73. "-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
  74. "-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
  75. "-DSDL_ASSERTIONS=disabled"
  76. "-DSDL_ATOMIC=OFF"
  77. "-DSDL_AUDIO=OFF"
  78. "-DSDL_CPUINFO=OFF"
  79. "-DSDL_DIRECTX=OFF"
  80. "-DSDL_EVENTS=ON"
  81. "-DSDL_FILE=OFF"
  82. "-DSDL_FILESYSTEM=OFF"
  83. "-DSDL_FORCE_STATIC_VCRT=ON"
  84. "-DSDL_HAPTIC=OFF"
  85. "-DSDL_HIDAPI=ON"
  86. "-DSDL_JOYSTICK=ON"
  87. "-DSDL_LIBC=ON"
  88. "-DSDL_LOADSO=ON"
  89. "-DSDL_LOCALE=OFF"
  90. "-DSDL_MISC=OFF"
  91. "-DSDL_OPENGL=ON"
  92. "-DSDL_OPENGLES=OFF"
  93. "-DSDL_POWER=OFF"
  94. "-DSDL_RENDER=OFF"
  95. "-DSDL_SENSOR=OFF"
  96. "-DSDL_SHARED=OFF"
  97. "-DSDL_STATIC=ON"
  98. "-DSDL_TEST=OFF"
  99. "-DSDL_THREADS=ON"
  100. "-DSDL_TIMERS=OFF"
  101. "-DSDL_VIDEO=ON"
  102. "-DSDL_VULKAN=OFF"
  103. "-DSDL_WASAPI=OFF"
  104. BUILD_ALWAYS 0)
  105. # Build OpenAL Soft module
  106. ExternalProject_Add(openal-soft
  107. SOURCE_DIR ${MODULE_SOURCE_DIR}/openal-soft
  108. BINARY_DIR ${MODULE_BUILD_DIR}/openal-soft
  109. INSTALL_DIR ${MODULE_INSTALL_DIR}
  110. CMAKE_ARGS
  111. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  112. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  113. "-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
  114. "-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
  115. "-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
  116. "-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'"
  117. "-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'"
  118. "-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'"
  119. "-DLIBTYPE=STATIC"
  120. "-DFORCE_STATIC_VCRT=ON"
  121. "-DALSOFT_UTILS=OFF"
  122. "-DALSOFT_EXAMPLES=OFF"
  123. BUILD_ALWAYS 0)
  124. # Build EnTT module
  125. ExternalProject_Add(entt
  126. SOURCE_DIR ${MODULE_SOURCE_DIR}/entt
  127. BINARY_DIR ${MODULE_BUILD_DIR}/entt
  128. INSTALL_DIR ${MODULE_INSTALL_DIR}
  129. CMAKE_ARGS
  130. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  131. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  132. "-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'"
  133. "-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'"
  134. "-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'"
  135. BUILD_ALWAYS 0)
  136. # Build nlohmann-json module
  137. ExternalProject_Add(nlohmann-json
  138. SOURCE_DIR ${MODULE_SOURCE_DIR}/nlohmann
  139. BINARY_DIR ${MODULE_BUILD_DIR}/nlohmann
  140. INSTALL_DIR ${MODULE_INSTALL_DIR}
  141. CMAKE_ARGS
  142. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  143. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  144. "-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'"
  145. "-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'"
  146. "-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'"
  147. BUILD_ALWAYS 0)
  148. # Build dr_wav module
  149. ExternalProject_Add(dr_wav
  150. SOURCE_DIR ${MODULE_SOURCE_DIR}/dr_wav
  151. BINARY_DIR ${MODULE_BUILD_DIR}/dr_wav
  152. INSTALL_DIR ${MODULE_INSTALL_DIR}
  153. CMAKE_ARGS
  154. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  155. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  156. "-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
  157. "-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
  158. "-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
  159. BUILD_ALWAYS 0)
  160. # Build stb module
  161. ExternalProject_Add(stb
  162. SOURCE_DIR ${MODULE_SOURCE_DIR}/stb
  163. BINARY_DIR ${MODULE_BUILD_DIR}/stb
  164. INSTALL_DIR ${MODULE_INSTALL_DIR}
  165. CMAKE_ARGS
  166. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  167. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  168. "-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
  169. "-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
  170. "-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
  171. BUILD_ALWAYS 0)
  172. # Build TinyEXR module
  173. ExternalProject_Add(tinyexr
  174. SOURCE_DIR ${MODULE_SOURCE_DIR}/tinyexr
  175. BINARY_DIR ${MODULE_BUILD_DIR}/tinyexr
  176. INSTALL_DIR ${MODULE_INSTALL_DIR}
  177. CMAKE_ARGS
  178. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  179. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  180. "-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'"
  181. "-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'"
  182. "-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'"
  183. "-DTINYEXR_BUILD_SAMPLE=OFF"
  184. "-DTINYEXR_USE_MINIZ=OFF"
  185. "-DTINYEXR_USE_STB_ZLIB=ON"
  186. BUILD_ALWAYS 0)
  187. # Build glad module
  188. ExternalProject_Add(glad
  189. SOURCE_DIR ${MODULE_SOURCE_DIR}/glad
  190. BINARY_DIR ${MODULE_BUILD_DIR}/glad
  191. INSTALL_DIR ${MODULE_INSTALL_DIR}
  192. CMAKE_ARGS
  193. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  194. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  195. "-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
  196. "-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
  197. "-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
  198. BUILD_ALWAYS 0)
  199. # Build cxxopts module
  200. ExternalProject_Add(cxxopts
  201. SOURCE_DIR ${MODULE_SOURCE_DIR}/cxxopts
  202. BINARY_DIR ${MODULE_BUILD_DIR}/cxxopts
  203. INSTALL_DIR ${MODULE_INSTALL_DIR}
  204. CMAKE_ARGS
  205. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  206. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  207. "-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'"
  208. "-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'"
  209. "-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'"
  210. "-DCXXOPTS_BUILD_EXAMPLES=OFF"
  211. "-DCXXOPTS_BUILD_TESTS=OFF"
  212. BUILD_ALWAYS 0)
  213. # Build PhysicsFS module
  214. ExternalProject_Add(physfs
  215. SOURCE_DIR ${MODULE_SOURCE_DIR}/physfs
  216. BINARY_DIR ${MODULE_BUILD_DIR}/physfs
  217. INSTALL_DIR ${MODULE_INSTALL_DIR}
  218. CMAKE_ARGS
  219. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  220. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  221. "-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
  222. "-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
  223. "-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
  224. "-DPHYSFS_ARCHIVE_ZIP=ON"
  225. "-DPHYSFS_ARCHIVE_7Z=OFF"
  226. "-DPHYSFS_ARCHIVE_GRP=OFF"
  227. "-DPHYSFS_ARCHIVE_WAD=OFF"
  228. "-DPHYSFS_ARCHIVE_HOG=OFF"
  229. "-DPHYSFS_ARCHIVE_MVL=OFF"
  230. "-DPHYSFS_ARCHIVE_QPAK=OFF"
  231. "-DPHYSFS_ARCHIVE_SLB=OFF"
  232. "-DPHYSFS_ARCHIVE_ISO9660=OFF"
  233. "-DPHYSFS_ARCHIVE_VDF=OFF"
  234. "-DPHYSFS_BUILD_STATIC=ON"
  235. "-DPHYSFS_BUILD_SHARED=OFF"
  236. "-DPHYSFS_BUILD_TEST=OFF"
  237. "-DPHYSFS_BUILD_DOCS=OFF"
  238. BUILD_ALWAYS 0)
  239. # Build FreeType module
  240. ExternalProject_Add(freetype
  241. SOURCE_DIR ${MODULE_SOURCE_DIR}/freetype
  242. BINARY_DIR ${MODULE_BUILD_DIR}/freetype
  243. INSTALL_DIR ${MODULE_INSTALL_DIR}
  244. CMAKE_ARGS
  245. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  246. "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}"
  247. "-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS}'"
  248. "-DCMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'"
  249. "-DCMAKE_C_FLAGS_RELEASE='${CMAKE_C_FLAGS_RELEASE}'"
  250. "-DBUILD_SHARED_LIBS=false"
  251. "-DFT_DISABLE_ZLIB=ON"
  252. "-DFT_DISABLE_BZIP2=ON"
  253. "-DFT_DISABLE_PNG=ON"
  254. "-DFT_DISABLE_HARFBUZZ=ON"
  255. "-DFT_DISABLE_BROTLI=ON"
  256. BUILD_ALWAYS 0)
  257. # Build antkeeper-source module
  258. ExternalProject_Add(antkeeper-source
  259. DEPENDS SDL2 openal-soft entt nlohmann-json dr_wav stb tinyexr glad physfs freetype
  260. SOURCE_DIR ${MODULE_SOURCE_DIR}/antkeeper-source
  261. BINARY_DIR ${MODULE_BUILD_DIR}/antkeeper-source
  262. INSTALL_DIR ${PACKAGE_INSTALL_DIR}
  263. CMAKE_ARGS
  264. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  265. "-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}"
  266. "-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}"
  267. "-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}"
  268. "-DVERSION_STRING=${PROJECT_VERSION}"
  269. "-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'"
  270. "-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'"
  271. "-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'"
  272. "-DCMAKE_EXE_LINKER_FLAGS='${CMAKE_EXE_LINKER_FLAGS}'"
  273. "-DCMAKE_EXE_LINKER_FLAGS_DEBUG='${CMAKE_EXE_LINKER_FLAGS_DEBUG}'"
  274. "-DCMAKE_EXE_LINKER_FLAGS_RELEASE='${CMAKE_EXE_LINKER_FLAGS_RELEASE}'"
  275. BUILD_ALWAYS 1)
  276. # Build antkeeper-data module (if exists)
  277. if(EXISTS ${MODULE_SOURCE_DIR}/antkeeper-data/CMakeLists.txt)
  278. ExternalProject_Add(antkeeper-data
  279. DEPENDS antkeeper-source
  280. SOURCE_DIR ${MODULE_SOURCE_DIR}/antkeeper-data
  281. BINARY_DIR ${MODULE_BUILD_DIR}/antkeeper-data
  282. INSTALL_DIR ${PACKAGE_INSTALL_DIR}
  283. CMAKE_ARGS
  284. "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
  285. "-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}"
  286. "-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}"
  287. "-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}"
  288. "-DBLENDER=${BLENDER}"
  289. "-DINKSCAPE=${INKSCAPE}"
  290. BUILD_ALWAYS 1)
  291. endif()
  292. # Create install target
  293. install(DIRECTORY "${PACKAGE_INSTALL_DIR}/" DESTINATION . COMPONENT "package" USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN "*")
  294. # Create clean-build target
  295. add_custom_target(clean-build
  296. COMMAND git clean -fdX
  297. WORKING_DIRECTORY "${PROJECT_BINARY_DIR}")
  298. # Create cpack target
  299. add_custom_target(cpack
  300. COMMAND "${CMAKE_COMMAND}" --build . --target package
  301. WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
  302. DEPENDS antkeeper-source
  303. VERBATIM)
  304. # Create dist target
  305. add_custom_target(dist DEPENDS cpack)
  306. # Configure CPack variables
  307. set(CPACK_PACKAGE_NAME "${PACKAGE_NAME}")
  308. set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
  309. set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
  310. set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
  311. set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM}")
  312. set(CPACK_PACKAGE_DESCRIPTION "")
  313. set(CPACK_PACKAGE_CONTACT "Christopher J. Howard <cjhoward@cjhoward.org>")
  314. set(CPACK_COMPONENTS_ALL "package")
  315. # Configure .tgz and .zip distribution packages
  316. set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
  317. #set(CPACK_ARCHIVE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.zip")
  318. #set(CPACK_ARCHIVE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.zip")
  319. # Configure .deb distribution package
  320. set(CPACK_DEB_COMPONENT_INSTALL ON)
  321. set(CPACK_DEBIAN_PACKAGE_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
  322. set(CPACK_DEBIAN_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.deb")
  323. set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
  324. # Configure NSIS installer package
  325. #set(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/data/icons/app-icon.ico")
  326. #set(CPACK_PACKAGE_INSTALL_DIRECTORY "App")
  327. # Build distribution packages according to target platform
  328. set(CPACK_GENERATOR "")
  329. if(PACKAGE_PLATFORM MATCHES "linux")
  330. set(CPACK_GENERATOR "TGZ;DEB")
  331. add_custom_command(TARGET dist
  332. COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIST_DIR}
  333. COMMAND ${CMAKE_COMMAND} -E copy "${CPACK_PACKAGE_FILE_NAME}-package.tar.gz" "${PACKAGE_DIST_DIR}/${PACKAGE_FILENAME}.tar.gz"
  334. COMMAND ${CMAKE_COMMAND} -E copy "${CPACK_DEBIAN_PACKAGE_FILE_NAME}" "${PACKAGE_DIST_DIR}")
  335. elseif(PACKAGE_PLATFORM MATCHES "win")
  336. set(CPACK_GENERATOR "ZIP;NSIS")
  337. add_custom_command(TARGET dist
  338. COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIST_DIR}
  339. COMMAND ${CMAKE_COMMAND} -E copy "${CPACK_PACKAGE_FILE_NAME}-package.zip" "${PACKAGE_DIST_DIR}/${PACKAGE_FILENAME}.zip"
  340. COMMAND ${CMAKE_COMMAND} -E copy "${CPACK_PACKAGE_FILE_NAME}.exe" "${PACKAGE_DIST_DIR}/${PACKAGE_FILENAME}.exe")
  341. elseif(PACKAGE_PLATFORM MATCHES "osx")
  342. set(CPACK_GENERATOR "ZIP;NSIS")
  343. add_custom_command(TARGET dist
  344. COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIST_DIR}
  345. COMMAND ${CMAKE_COMMAND} -E copy "${CPACK_PACKAGE_FILE_NAME}-package.zip" "${PACKAGE_DIST_DIR}/${PACKAGE_FILENAME}.zip")
  346. endif()
  347. # Include CPack macro
  348. include(CPack)