2017-11-30 21:00:47 +01:00
|
|
|
cmake_minimum_required (VERSION 3.2.0)
|
|
|
|
|
|
|
|
SET(CMAKE_COLOR_MAKEFILE ON)
|
|
|
|
|
|
|
|
project(breakhack C)
|
|
|
|
|
2018-03-07 19:15:08 +01:00
|
|
|
set(breakhack_GAME_TITLE "BreakHack")
|
2019-03-20 20:28:29 +01:00
|
|
|
set(breakhack_MAJOR_VERSION 3)
|
2019-05-14 20:36:00 +02:00
|
|
|
set(breakhack_MINOR_VERSION 1)
|
|
|
|
set(breakhack_PATCH_VERSION 1)
|
2018-10-27 13:56:17 +02:00
|
|
|
set(breakhack_RELEASE_TYPE "")
|
2018-03-07 19:15:08 +01:00
|
|
|
|
2019-03-21 08:52:39 +01:00
|
|
|
# Checksums
|
|
|
|
set(breakhack_STEAMAPI_DLL_CHECKSUM 0x18dba28)
|
|
|
|
set(breakhack_STEAMAPI_SO_CHECKSUM 0x1f5786b)
|
|
|
|
|
2018-09-08 23:47:24 +02:00
|
|
|
include(FindLua)
|
|
|
|
include(FindPhysFS)
|
2018-05-13 16:46:14 +02:00
|
|
|
include(build/cmake/FindSDL2.cmake)
|
|
|
|
include(build/cmake/FindSDL2_image.cmake)
|
|
|
|
include(build/cmake/FindSDL2_ttf.cmake)
|
|
|
|
include(build/cmake/FindSDL2_mixer.cmake)
|
|
|
|
include(build/cmake/FindCCache.cmake)
|
|
|
|
include(build/cmake/FindCMocka.cmake)
|
|
|
|
include(build/cmake/Findcppcheck.cmake)
|
2017-12-19 19:42:05 +01:00
|
|
|
|
2017-12-21 11:57:12 +01:00
|
|
|
configure_file(
|
|
|
|
"${PROJECT_SOURCE_DIR}/src/config.h.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/config.h"
|
|
|
|
)
|
|
|
|
|
2018-12-04 14:07:05 +01:00
|
|
|
macro(set_option option value)
|
|
|
|
set(${option} ${value} CACHE INTERNAL "" FORCE)
|
|
|
|
endmacro()
|
|
|
|
|
2018-08-27 17:16:01 +02:00
|
|
|
if (EXISTS "${PROJECT_SOURCE_DIR}/steamworks_c_wrapper/sdk")
|
2018-08-29 14:03:18 +02:00
|
|
|
MESSAGE ( STATUS "Steam SDK located, Steam build enabled")
|
2018-08-27 17:16:01 +02:00
|
|
|
set(STEAM 1)
|
2018-08-29 14:03:18 +02:00
|
|
|
else ()
|
|
|
|
MESSAGE ( STATUS "Steam SDK not found, Steam build disabled")
|
2018-08-27 17:16:01 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (STEAM)
|
|
|
|
add_subdirectory(steamworks_c_wrapper)
|
|
|
|
endif()
|
2019-02-21 20:57:38 +01:00
|
|
|
add_subdirectory(bh_random)
|
2019-03-11 00:00:27 +01:00
|
|
|
add_subdirectory(checksum)
|
2018-08-27 17:16:01 +02:00
|
|
|
|
2018-05-09 00:21:38 +02:00
|
|
|
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
2018-04-23 09:15:43 +02:00
|
|
|
set(CLANG 1)
|
2018-05-09 00:21:38 +02:00
|
|
|
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
set(GCC 1)
|
2018-04-23 09:15:43 +02:00
|
|
|
endif()
|
|
|
|
|
2019-04-06 12:27:42 +02:00
|
|
|
if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
|
|
|
|
set(NINJA 1)
|
|
|
|
endif()
|
|
|
|
|
2018-05-18 23:11:09 +02:00
|
|
|
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
|
|
|
set(OSX 1)
|
|
|
|
endif()
|
|
|
|
|
2018-05-12 10:36:04 +02:00
|
|
|
set (default_build_type "Release")
|
|
|
|
if (NOT CMAKE_BUILD_TYPE AND default_build_type)
|
|
|
|
message( STATUS "Setting default buildtype to '${default_build_type}' as none was specified")
|
|
|
|
set(CMAKE_BUILD_TYPE "${default_build_type}")
|
|
|
|
endif ()
|
|
|
|
|
2018-04-23 09:24:09 +02:00
|
|
|
# Deal with travis compile issue
|
2018-04-23 09:15:43 +02:00
|
|
|
if (CCACHE_FOUND AND CLANG)
|
|
|
|
add_definitions(-Qunused-arguments -fcolor-diagnostics)
|
|
|
|
endif()
|
|
|
|
|
2018-05-12 10:36:04 +02:00
|
|
|
if (CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
|
|
set(DEBUG_BUILD TRUE)
|
|
|
|
endif()
|
2018-04-23 09:15:43 +02:00
|
|
|
|
2018-05-09 00:21:38 +02:00
|
|
|
IF ( MSVC )
|
2018-02-28 07:10:35 +01:00
|
|
|
MESSAGE ( STATUS "Setting MSVC MT switches")
|
2019-03-08 14:39:23 +01:00
|
|
|
string (REPLACE
|
|
|
|
"/MDd"
|
|
|
|
"/MTd"
|
|
|
|
CMAKE_C_FLAGS_DEBUG
|
|
|
|
${CMAKE_C_FLAGS_DEBUG}
|
2018-02-28 07:10:35 +01:00
|
|
|
)
|
2019-03-08 14:39:23 +01:00
|
|
|
string (REPLACE
|
|
|
|
"/MDd"
|
|
|
|
"/MTd"
|
|
|
|
CMAKE_C_FLAGS_RELEASE
|
|
|
|
${CMAKE_C_FLAGS_RELEASE}
|
2018-02-28 07:10:35 +01:00
|
|
|
)
|
2018-05-12 10:36:04 +02:00
|
|
|
ELSEIF ( WIN32 )
|
|
|
|
SET (
|
|
|
|
CMAKE_C_FLAGS_DEBUG
|
2018-08-29 14:03:18 +02:00
|
|
|
"${CMAKE_C_FLAGS_DEBUG} -mconsole"
|
2018-05-12 10:36:04 +02:00
|
|
|
)
|
|
|
|
SET (
|
|
|
|
CMAKE_C_FLAGS_RELEASE
|
2018-08-29 14:03:18 +02:00
|
|
|
"${CMAKE_C_FLAGS_RELEASE} -mwindows"
|
2018-05-12 10:36:04 +02:00
|
|
|
)
|
|
|
|
ENDIF ()
|
2018-05-09 00:21:38 +02:00
|
|
|
IF ( GCC OR CLANG )
|
|
|
|
SET (
|
|
|
|
CMAKE_C_FLAGS_DEBUG
|
|
|
|
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer"
|
|
|
|
)
|
|
|
|
ENDIF ( GCC OR CLANG )
|
2018-02-28 07:10:35 +01:00
|
|
|
|
2018-08-29 14:03:18 +02:00
|
|
|
if (STEAM)
|
|
|
|
include_directories(
|
|
|
|
${STEAMWORKS_INCLUDE_DIR}
|
|
|
|
steamworks_c_wrapper/src
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2018-09-08 23:54:22 +02:00
|
|
|
if (NOT LUA_FOUND OR STEAM)
|
2018-09-08 23:47:24 +02:00
|
|
|
add_subdirectory(lua-5.3.5)
|
|
|
|
include_directories(lua-5.3.5/src)
|
2018-09-08 23:54:22 +02:00
|
|
|
set(LUA_LIBRARIES lua)
|
|
|
|
set(LUA_INCLUDE_DIR lua-5.3.5/src)
|
2018-09-08 23:47:24 +02:00
|
|
|
endif ()
|
|
|
|
|
2018-09-08 23:54:22 +02:00
|
|
|
if (NOT PHYSFS_FOUND OR STEAM)
|
2018-12-04 14:07:05 +01:00
|
|
|
set_option(PHYSFS_BUILD_SHARED off)
|
|
|
|
set_option(PHYSFS_BUILD_TEST off)
|
2018-12-04 13:59:34 +01:00
|
|
|
add_subdirectory(physfs-3.0)
|
|
|
|
include_directories(physfs-3.0/src)
|
2018-09-08 23:47:24 +02:00
|
|
|
set(PHYSFS_LIBRARY physfs-static)
|
2018-12-04 13:59:34 +01:00
|
|
|
set(PHYSFS_INCLUDE_DIR physfs-3.0/src)
|
2018-09-08 23:47:24 +02:00
|
|
|
endif ()
|
2018-09-08 23:01:12 +02:00
|
|
|
|
2017-12-13 12:09:04 +01:00
|
|
|
include_directories(
|
2017-12-19 21:00:02 +01:00
|
|
|
${PROJECT_BINARY_DIR}
|
2017-12-13 12:09:04 +01:00
|
|
|
${SDL2_INCLUDE_DIR}
|
|
|
|
${SDL2_IMAGE_INCLUDE_DIR}
|
|
|
|
${SDL2_TTF_INCLUDE_DIR}
|
2018-02-14 16:04:40 +01:00
|
|
|
${SDL2_MIXER_INCLUDE_DIR}
|
2018-09-08 23:54:22 +02:00
|
|
|
${PHYSFS_INCLUDE_DIR}
|
|
|
|
${LUA_INCLUDE_DIR}
|
2018-08-21 16:32:26 +02:00
|
|
|
sqlite3
|
2019-02-21 20:57:38 +01:00
|
|
|
bh_random/src
|
2019-03-11 00:00:27 +01:00
|
|
|
checksum/src
|
2017-12-05 12:40:37 +01:00
|
|
|
)
|
|
|
|
|
2018-05-11 19:09:34 +02:00
|
|
|
if (CMOCKA_FOUND)
|
2018-04-20 14:46:00 +02:00
|
|
|
include_directories(
|
2018-05-11 19:09:34 +02:00
|
|
|
${CMOCKA_INCLUDE_DIR}
|
2018-04-20 14:46:00 +02:00
|
|
|
)
|
2018-05-11 19:09:34 +02:00
|
|
|
endif(CMOCKA_FOUND)
|
2017-12-19 21:00:02 +01:00
|
|
|
|
2018-05-11 19:09:34 +02:00
|
|
|
if (NOT MSVC)
|
2018-02-02 16:16:55 +01:00
|
|
|
add_definitions(-std=gnu11
|
|
|
|
-pedantic -Wall -Wextra -Wshadow
|
|
|
|
-Wpointer-arith -Wcast-qual
|
|
|
|
-Wstrict-prototypes
|
|
|
|
-Wmissing-prototypes
|
2018-02-22 09:44:27 +01:00
|
|
|
-Wconversion -Wno-sign-conversion
|
2018-02-02 16:16:55 +01:00
|
|
|
)
|
2018-05-13 23:46:27 +02:00
|
|
|
if (NOT APPLE)
|
2018-05-13 16:46:14 +02:00
|
|
|
add_definitions(-static -static-libgcc -static-libstdc++)
|
|
|
|
endif ()
|
2018-05-11 19:09:34 +02:00
|
|
|
endif (NOT MSVC)
|
2017-11-30 21:00:47 +01:00
|
|
|
|
2018-02-03 23:39:49 +01:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
|
2018-08-27 17:16:01 +02:00
|
|
|
if (STEAM)
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSTEAM_BUILD")
|
2018-08-29 22:13:22 +02:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DSTEAM_BUILD")
|
2019-04-06 12:27:42 +02:00
|
|
|
set(STEAM_SOURCES
|
|
|
|
src/steam/steamworks_api_wrapper
|
|
|
|
)
|
|
|
|
else ()
|
|
|
|
set(STEAM_SOURCES "")
|
2018-08-27 17:16:01 +02:00
|
|
|
endif ()
|
2019-04-06 12:27:42 +02:00
|
|
|
|
2019-02-24 22:42:51 +01:00
|
|
|
if (MINGW)
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DMINGW")
|
|
|
|
endif (MINGW)
|
2018-02-03 13:02:39 +01:00
|
|
|
|
2019-05-09 21:06:06 +02:00
|
|
|
if (NOT MSVC)
|
2019-04-06 12:27:42 +02:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__FNAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
|
2018-08-29 14:11:36 +02:00
|
|
|
else ()
|
2019-04-06 12:27:42 +02:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__FNAME__=__FILE__")
|
2018-08-29 14:11:36 +02:00
|
|
|
endif ()
|
|
|
|
|
2017-11-30 21:00:47 +01:00
|
|
|
# PROGRAMS:
|
2017-12-01 16:03:19 +01:00
|
|
|
add_executable(breakhack
|
2017-11-30 21:00:47 +01:00
|
|
|
src/main
|
|
|
|
src/texture
|
|
|
|
src/screenresolution
|
|
|
|
src/sprite
|
2019-03-04 20:32:09 +01:00
|
|
|
src/sprite_util
|
2017-11-30 21:00:47 +01:00
|
|
|
src/util
|
2019-03-10 00:15:47 +01:00
|
|
|
src/event
|
2017-11-30 21:00:47 +01:00
|
|
|
src/player
|
2017-12-01 16:03:19 +01:00
|
|
|
src/map
|
2017-12-02 23:32:40 +01:00
|
|
|
src/map_lua
|
2017-12-01 16:03:19 +01:00
|
|
|
src/camera
|
2017-12-05 08:30:08 +01:00
|
|
|
src/timer
|
2017-12-05 15:03:20 +01:00
|
|
|
src/roommatrix
|
|
|
|
src/position
|
2017-12-13 14:26:30 +01:00
|
|
|
src/monster
|
2017-12-15 08:08:45 +01:00
|
|
|
src/stats
|
2017-12-15 15:03:29 +01:00
|
|
|
src/actiontext
|
2017-12-17 13:43:41 +01:00
|
|
|
src/random
|
2019-02-20 18:08:13 +01:00
|
|
|
src/time
|
2017-12-19 09:06:21 +01:00
|
|
|
src/linkedlist
|
|
|
|
src/hashtable
|
2017-12-22 15:15:40 +01:00
|
|
|
src/gui
|
2018-01-24 21:14:34 +01:00
|
|
|
src/item
|
|
|
|
src/item_builder
|
2018-01-31 09:15:33 +01:00
|
|
|
src/pointer
|
2018-02-02 16:16:55 +01:00
|
|
|
src/gui_button
|
2018-02-03 23:39:49 +01:00
|
|
|
src/particle_engine
|
2019-05-07 11:52:30 +02:00
|
|
|
src/particle_emitter
|
2018-02-08 17:01:38 +01:00
|
|
|
src/menu
|
2018-02-09 06:53:06 +01:00
|
|
|
src/collisions
|
2018-02-12 10:55:36 +01:00
|
|
|
src/keyboard
|
2018-05-20 00:02:39 +02:00
|
|
|
src/input
|
2018-02-14 16:04:40 +01:00
|
|
|
src/mixer
|
2018-02-22 12:36:24 +01:00
|
|
|
src/io_util
|
|
|
|
src/physfsrwops
|
2018-02-23 11:01:25 +01:00
|
|
|
src/skillbar
|
2018-02-23 23:53:52 +01:00
|
|
|
src/texturecache
|
2018-02-24 07:13:28 +01:00
|
|
|
src/skill
|
2018-03-08 00:58:26 +01:00
|
|
|
src/projectile
|
|
|
|
src/vector2d
|
2018-03-15 16:30:41 +01:00
|
|
|
src/map_room_modifiers
|
2018-08-21 16:32:26 +02:00
|
|
|
sqlite3/sqlite3
|
2018-04-16 21:19:26 +02:00
|
|
|
src/db
|
2018-03-17 00:04:26 +01:00
|
|
|
src/settings
|
2018-05-15 11:16:56 +02:00
|
|
|
src/actiontextbuilder
|
2018-07-09 19:26:06 +02:00
|
|
|
src/animation
|
2018-08-06 00:28:23 +02:00
|
|
|
src/trap
|
2018-08-08 00:14:24 +02:00
|
|
|
src/artifact
|
2018-08-12 09:13:18 +02:00
|
|
|
src/screen
|
2018-08-12 16:14:07 +02:00
|
|
|
src/hiscore
|
2018-08-13 13:11:32 +02:00
|
|
|
src/object
|
2018-08-19 20:25:31 +02:00
|
|
|
src/gui_util
|
2018-08-20 14:30:31 +02:00
|
|
|
src/tooltip
|
2018-10-12 22:56:48 +02:00
|
|
|
src/gamecontroller
|
2018-08-29 14:11:36 +02:00
|
|
|
${STEAM_SOURCES}
|
2017-11-30 21:00:47 +01:00
|
|
|
)
|
|
|
|
|
2018-10-03 16:49:06 +02:00
|
|
|
if (MSVC)
|
|
|
|
source_group("Header files" REGULAR_EXPRESSION ".*\\.h")
|
|
|
|
source_group("Source files" REGULAR_EXPRESSION ".*\\.c")
|
|
|
|
endif ()
|
|
|
|
|
2018-03-16 19:46:28 +01:00
|
|
|
# Sqlite has some warnings that I we don't need to see
|
2018-08-21 16:32:26 +02:00
|
|
|
set_source_files_properties(sqlite3/sqlite3.c COMPILE_FLAGS -w)
|
2018-03-16 19:46:28 +01:00
|
|
|
|
2017-12-01 16:03:19 +01:00
|
|
|
target_link_libraries(breakhack
|
2018-03-16 19:46:28 +01:00
|
|
|
${CMAKE_DL_LIBS} # Sqlite needs DL libs
|
2017-12-13 12:09:04 +01:00
|
|
|
${SDL2_LIBRARY}
|
2018-02-22 13:12:59 +01:00
|
|
|
${SDL2MAIN_LIBRARY}
|
2017-12-13 12:09:04 +01:00
|
|
|
${SDL2_IMAGE_LIBRARY}
|
|
|
|
${SDL2_TTF_LIBRARY}
|
2018-02-14 16:04:40 +01:00
|
|
|
${SDL2_MIXER_LIBRARY}
|
2018-09-08 23:54:22 +02:00
|
|
|
${LUA_LIBRARIES}
|
2018-09-08 23:47:24 +02:00
|
|
|
${PHYSFS_LIBRARY}
|
2019-02-21 20:57:38 +01:00
|
|
|
bh_random
|
2019-03-11 00:00:27 +01:00
|
|
|
checksum
|
2017-11-30 21:00:47 +01:00
|
|
|
)
|
|
|
|
|
2018-08-27 17:16:01 +02:00
|
|
|
if (STEAM)
|
|
|
|
target_link_libraries(breakhack
|
|
|
|
steamworks_c_wrapper
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2018-02-28 22:31:38 +01:00
|
|
|
if (MSVC)
|
2019-04-21 08:24:47 +02:00
|
|
|
set_target_properties(breakhack PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE /NODEFAULTLIB:MSVCRTD")
|
2018-02-27 19:59:51 +01:00
|
|
|
set_target_properties(breakhack PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
|
|
|
|
set_target_properties(breakhack PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
|
|
|
|
set_target_properties(breakhack PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE")
|
2019-04-21 08:24:47 +02:00
|
|
|
set_target_properties(breakhack PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS /NODEFAULTLIB:MSVCRTD")
|
2018-02-27 19:59:51 +01:00
|
|
|
set_target_properties(breakhack PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
|
2018-02-28 22:31:38 +01:00
|
|
|
endif (MSVC)
|
2018-02-27 19:59:51 +01:00
|
|
|
|
2017-11-30 21:00:47 +01:00
|
|
|
# TESTS:
|
2018-05-18 23:11:09 +02:00
|
|
|
IF (CMOCKA_FOUND AND NOT OSX AND NOT CLANG)
|
2017-12-13 12:18:20 +01:00
|
|
|
find_package(Threads REQUIRED)
|
2017-12-13 12:09:04 +01:00
|
|
|
enable_testing()
|
2018-05-11 19:09:34 +02:00
|
|
|
add_executable(test_util test/test_util src/util)
|
2018-05-18 23:20:28 +02:00
|
|
|
target_link_libraries(test_util ${CMOCKA_LIBRARY})
|
2017-12-13 12:09:04 +01:00
|
|
|
add_test(test_util test_util)
|
2017-12-19 09:06:21 +01:00
|
|
|
|
2018-05-11 19:09:34 +02:00
|
|
|
add_executable(test_linkedlist test/test_linkedlist src/linkedlist src/util)
|
2018-05-18 23:20:28 +02:00
|
|
|
target_link_libraries(test_linkedlist ${CMOCKA_LIBRARY})
|
2017-12-19 09:06:21 +01:00
|
|
|
add_test(test_linkedlist test_linkedlist)
|
|
|
|
|
2018-05-11 19:09:34 +02:00
|
|
|
add_executable(test_hashtable test/test_hashtable src/hashtable src/util)
|
2018-05-18 23:20:28 +02:00
|
|
|
target_link_libraries(test_hashtable ${CMOCKA_LIBRARY})
|
2017-12-19 09:06:21 +01:00
|
|
|
add_test(test_hashtable test_hashtable)
|
2018-05-17 23:14:42 +02:00
|
|
|
|
2018-05-20 00:02:39 +02:00
|
|
|
add_executable(test_input test/test_input src/input src/keyboard)
|
|
|
|
target_link_libraries(test_input
|
2018-05-18 23:20:28 +02:00
|
|
|
${CMOCKA_LIBRARY}
|
|
|
|
${SDL2_LIBRARY}
|
|
|
|
${SDL2MAIN_LIBRARY}
|
|
|
|
)
|
2018-05-20 00:02:39 +02:00
|
|
|
#set_target_properties(test_input PROPERTIES
|
|
|
|
#LINK_FLAGS "-Wl,--wrap,keyboard_direction_press -Wl,--wrap,keyboard_press")
|
|
|
|
add_test(test_input test_input)
|
2018-05-18 23:13:56 +02:00
|
|
|
ENDIF ()
|
2018-02-22 19:17:57 +01:00
|
|
|
|
2018-03-13 09:35:44 +01:00
|
|
|
# LINT:
|
|
|
|
if (CPPCHECK_FOUND)
|
|
|
|
add_custom_target(lint
|
2019-02-28 13:31:56 +01:00
|
|
|
COMMAND ${CPPCHECK_EXECUTABLE} --force --language=c --template=gcc --error-exitcode=1 --quiet --suppress=unreadVariable --suppress=missingInclude --enable=warning,style,performance,portability,information,missingInclude src/
|
2018-03-13 09:35:44 +01:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
COMMENT "Run cppcheck"
|
|
|
|
)
|
|
|
|
endif (CPPCHECK_FOUND)
|
|
|
|
|
2018-05-12 10:36:04 +02:00
|
|
|
if (NOT DEBUG_BUILD)
|
2018-02-22 19:17:57 +01:00
|
|
|
add_custom_target(assets_pack ALL
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E tar "-cf" "../assets.pack" "--format=zip" --
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/assets/Characters"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/assets/Commissions"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/assets/GUI"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/assets/Items"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/assets/Objects"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/assets/Sounds"
|
2018-04-28 19:10:49 +02:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/assets/Extras"
|
2018-02-22 19:17:57 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/assets
|
|
|
|
)
|
2018-02-22 23:19:33 +01:00
|
|
|
|
2018-02-27 19:59:51 +01:00
|
|
|
add_custom_target(data_pack ALL
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E tar "-cf" "../data.pack" "--format=zip" --
|
|
|
|
"mapgen.lua"
|
|
|
|
"maproombuilder.lua"
|
|
|
|
"menumapgen.lua"
|
|
|
|
"monstergen.lua"
|
2018-08-06 00:28:23 +02:00
|
|
|
"trapgen.lua"
|
2018-08-10 20:09:56 +02:00
|
|
|
"chestgen.lua"
|
2019-03-08 14:39:23 +01:00
|
|
|
"layoutparser.lua"
|
2018-05-15 11:16:56 +02:00
|
|
|
"pitlayouts.dat"
|
2019-03-08 14:39:23 +01:00
|
|
|
"walllayouts.dat"
|
|
|
|
"shoplayouts.dat"
|
2019-03-16 10:32:58 +01:00
|
|
|
"lockedroomlayouts.dat"
|
2018-02-27 19:59:51 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data
|
|
|
|
)
|
2018-05-12 10:36:04 +02:00
|
|
|
endif ()
|
2018-02-27 19:59:51 +01:00
|
|
|
|
2018-02-28 07:10:35 +01:00
|
|
|
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT "Release")
|
|
|
|
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ".")
|
2018-03-13 16:13:54 +01:00
|
|
|
if (WIN32)
|
|
|
|
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
|
2018-08-29 14:03:18 +02:00
|
|
|
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
|
2018-02-22 23:19:33 +01:00
|
|
|
${CMAKE_SOURCE_DIR}/bin/libFLAC-8.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/libfreetype-6.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/libmodplug-1.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/libmpg123-0.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/libogg-0.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/libpng16-16.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/libvorbis-0.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/libvorbisfile-3.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/SDL2.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/SDL2_image.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/SDL2_mixer.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/SDL2_ttf.dll
|
|
|
|
${CMAKE_SOURCE_DIR}/bin/zlib1.dll
|
2018-02-28 06:32:16 +01:00
|
|
|
)
|
2018-08-27 17:16:01 +02:00
|
|
|
if (STEAM)
|
|
|
|
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
|
|
|
|
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
|
2018-08-29 14:03:18 +02:00
|
|
|
steamworks_c_wrapper/sdk/redistributable_bin/steam_api.dll
|
2018-08-27 17:16:01 +02:00
|
|
|
)
|
|
|
|
endif ()
|
2018-09-08 23:01:12 +02:00
|
|
|
else (WIN32)
|
|
|
|
if (STEAM)
|
|
|
|
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
|
|
|
|
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
|
|
|
|
steamworks_c_wrapper/sdk/redistributable_bin/linux64/libsteam_api.so
|
2018-09-08 23:47:24 +02:00
|
|
|
build/linux/breakhack.run
|
2018-09-08 23:01:12 +02:00
|
|
|
)
|
|
|
|
endif ()
|
2018-03-13 16:13:54 +01:00
|
|
|
endif (WIN32)
|
2018-02-23 07:17:55 +01:00
|
|
|
include(InstallRequiredSystemLibraries)
|
2018-02-28 06:32:16 +01:00
|
|
|
|
2018-02-27 19:59:51 +01:00
|
|
|
INSTALL(TARGETS breakhack
|
|
|
|
COMPONENT Release
|
|
|
|
RUNTIME DESTINATION .
|
|
|
|
)
|
|
|
|
INSTALL(FILES assets.pack data.pack
|
|
|
|
COMPONENT Release
|
|
|
|
DESTINATION .
|
|
|
|
)
|
|
|
|
|
|
|
|
set(CPACK_INSTALL_CMAKE_PROJECTS "${PROJECT_BINARY_DIR};breakhack;Release;.")
|
2018-02-23 07:17:55 +01:00
|
|
|
set(CPACK_PACKAGE_NAME "BreakHack")
|
|
|
|
set(CPACK_PACKAGE_VENDOR "OliveShark")
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
|
|
|
|
set(CPACK_PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package)
|
2018-05-17 09:49:03 +02:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR ${breakhack_MAJOR_VERSION})
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR ${breakhack_MINOR_VERSION})
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${breakhack_PATCH_VERSION})
|
2018-02-23 07:17:55 +01:00
|
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "BreakHack")
|
2018-09-04 11:24:16 +02:00
|
|
|
set(CPACK_PACKAGE_CHECKSUM "MD5")
|
2018-08-29 14:03:18 +02:00
|
|
|
if (WIN32)
|
|
|
|
set(CPACK_PACKAGE_FILE_NAME "breakhack-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-win32")
|
|
|
|
else ()
|
|
|
|
set(CPACK_PACKAGE_FILE_NAME "breakhack-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
|
|
|
endif ()
|
2018-09-04 11:24:16 +02:00
|
|
|
if (STEAM)
|
|
|
|
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
|
2018-09-05 11:22:33 +02:00
|
|
|
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-steambuild")
|
2018-09-04 11:24:16 +02:00
|
|
|
endif ()
|
2018-02-27 19:59:51 +01:00
|
|
|
|
2018-02-23 07:17:55 +01:00
|
|
|
if(UNIX)
|
2018-09-08 23:01:12 +02:00
|
|
|
set(CPACK_GENERATOR TGZ ZIP)
|
2018-02-23 07:17:55 +01:00
|
|
|
set(CPACK_STRIP_FILES breakhack)
|
|
|
|
set(CPACK_SOURCE_STRIP_FILES "")
|
2018-05-09 22:30:22 +02:00
|
|
|
elseif(WIN32)
|
2018-05-15 23:34:38 +02:00
|
|
|
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
|
2018-05-09 22:30:22 +02:00
|
|
|
set(CPACK_GENERATOR NSIS ZIP)
|
|
|
|
endif()
|
2018-02-23 07:17:55 +01:00
|
|
|
|
2018-02-27 19:59:51 +01:00
|
|
|
include(CPack)
|