diff --git a/CMakeLists.txt b/CMakeLists.txt index 808cdca3e..7672655fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,27 @@ if(${CMAKE_SYSTEM} MATCHES "Darwin") endif() endif() -# TODO support MacOSX builds +# Set EXE names so the assets CMakeLists can refer to its target +set(SRB2_SDL2_EXE_NAME srb2) +set(SRB2_WIN_EXE_NAME srb2dd) -add_subdirectory(src/) +add_subdirectory(src) +add_subdirectory(assets) + + + +##### PACKAGE CONFIGURATION ##### + +if(${CMAKE_SYSTEM} MATCHES "Windows") + set(CPACK_GENERATOR "ZIP") +endif() + +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2") +set(CPACK_PACKAGE_VENDOR "Sonic Team Jr.") +#set(CPACK_PACKAGE_DESCRIPTION_FILE ) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH}) +set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}") +include(CPack) diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt new file mode 100644 index 000000000..cbcb6ba1c --- /dev/null +++ b/assets/CMakeLists.txt @@ -0,0 +1,29 @@ +## Assets Target Configuration ## + +# MD5 generation +set(SRB2_ASSET_ALL + ${CMAKE_CURRENT_SOURCE_DIR}/srb2.srb + ${CMAKE_CURRENT_SOURCE_DIR}/player.dta + ${CMAKE_CURRENT_SOURCE_DIR}/rings.dta + ${CMAKE_CURRENT_SOURCE_DIR}/zones.dta + ${CMAKE_CURRENT_SOURCE_DIR}/patch.dta + ${CMAKE_CURRENT_SOURCE_DIR}/music.dta +) + +set(SRB2_ASSET_HASHED + ${CMAKE_CURRENT_SOURCE_DIR}/srb2.srb + ${CMAKE_CURRENT_SOURCE_DIR}/player.dta + ${CMAKE_CURRENT_SOURCE_DIR}/rings.dta + ${CMAKE_CURRENT_SOURCE_DIR}/zones.dta + ${CMAKE_CURRENT_SOURCE_DIR}/patch.dta +) + +foreach(SRB2_ASSET ${SRB2_ASSET_HASHED}) + file(MD5 ${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH") +endforeach() + +# Installation + +install(FILES ${SRB2_ASSET_ALL} + DESTINATION . +) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index b6b120568..7d540b6c3 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -42,15 +42,6 @@ set(SRB2_SDL2_HEADERS prepend_sources(SRB2_SDL2_SOURCES) prepend_sources(SRB2_SDL2_HEADERS) -# Binary name -set(SRB2_SDL2_EXE_NAME srb2sdl2) -if(${CMAKE_SYSTEM} MATCHES "Windows") - set(SRB2_SDL2_EXE_NAME srb2win) -endif() -if(CLANG) - set(SRB2_SDL2_EXE_NAME SRB2) -endif() - # Dependency find_package(SDL2) @@ -160,6 +151,40 @@ if(${SDL2_FOUND}) -DHAVE_SDL -DNDEBUG ) + + #### Installation #### + install(TARGETS ${SRB2_SDL2_EXE_NAME} ${SRB2_SDL2_EXE_NAME} + RUNTIME DESTINATION . + ) + + if(${CMAKE_SYSTEM} MATCHES Windows) + find_library(SRB2_SDL2_DLL_SDL2 "SDL2.dll") + if(${SRB2_CONFIG_SDL2_USEMIXER}) + find_library(SRB2_SDL2_DLL_SDL2_mixer "SDL2_mixer.dll") + find_library(SRB2_SDL2_DLL_libmikmod-2 "libmikmod-2.dll") + find_library(SRB2_SDL2_DLL_libogg_0 "libogg-0.dll") + find_library(SRB2_SDL2_DLL_libvorbis_0 "libvorbis-0.dll") + find_library(SRB2_SDL2_DLL_libvorbisfile_3 "libvorbisfile-3.dll") + find_library(SRB2_SDL2_DLL_smpeg2 "smpeg2.dll") + endif() + if(${SRB2_CONFIG_HAVE_GME}) + find_library(SRB2_SDL2_DLL_libgme "libgme.dll") + endif() + + install(PROGRAMS + ${SRB2_SDL2_DLL_SDL2} + + ${SRB2_SDL2_DLL_SDL2_mixer} + ${SRB2_SDL2_DLL_libmikmod} + ${SRB2_SDL2_DLL_libogg_0} + ${SRB2_SDL2_DLL_libvorbis_0} + ${SRB2_SDL2_DLL_libvorbisfile_3} + ${SRB2_SDL2_DLL_smpeg2} + + ${SRB2_SDL2_DLL_libgme} + DESTINATION . + ) + endif() else() message(WARNING "SDL2 wasn't found, so ${SRB2_SDL2_EXE_NAME} won't be available") endif() diff --git a/src/win32/CMakeLists.txt b/src/win32/CMakeLists.txt index 4800852c9..94c198299 100644 --- a/src/win32/CMakeLists.txt +++ b/src/win32/CMakeLists.txt @@ -1,5 +1,3 @@ -set(SRB2_WIN_EXE_NAME srb2dd) - add_executable(${SRB2_WIN_EXE_NAME} EXCLUDE_FROM_ALL ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}