2015-09-02 18:49:23 +00:00
|
|
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
2017-06-18 02:50:29 +00:00
|
|
|
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # because of CMAKE_CXX_STANDARD
|
2016-03-04 23:00:12 +00:00
|
|
|
project(athena)
|
2017-06-18 02:50:29 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2015-09-02 18:49:23 +00:00
|
|
|
endif()
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2015-07-08 23:53:40 +00:00
|
|
|
##################
|
|
|
|
# Athena Version #
|
|
|
|
##################
|
|
|
|
|
|
|
|
set(ATHENA_MAJOR_VERSION 2)
|
2015-08-03 01:21:19 +00:00
|
|
|
set(ATHENA_MINOR_VERSION 3)
|
2015-07-08 23:53:40 +00:00
|
|
|
set(ATHENA_PATCH_VERSION 0)
|
|
|
|
set(ATHENA_VERSION
|
|
|
|
${ATHENA_MAJOR_VERSION}.${ATHENA_MINOR_VERSION}.${ATHENA_PATCH_VERSION})
|
|
|
|
|
|
|
|
################
|
|
|
|
# Athena Build #
|
|
|
|
################
|
|
|
|
|
2015-07-07 03:23:37 +00:00
|
|
|
add_subdirectory(extern)
|
|
|
|
|
2017-01-03 10:32:39 +00:00
|
|
|
include_directories(include ${LZO_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
2016-06-30 05:20:27 +00:00
|
|
|
|
2015-07-07 03:23:37 +00:00
|
|
|
if(WIN32)
|
2016-09-18 23:45:19 +00:00
|
|
|
list(APPEND CORE_EXTRA src/win32_largefilewrapper.c include/win32_largefilewrapper.h
|
|
|
|
src/athena/FileWriterWin32.cpp src/athena/FileReaderWin32.cpp)
|
|
|
|
else()
|
2017-01-27 03:25:48 +00:00
|
|
|
list(APPEND CORE_EXTRA src/athena/FileWriterNix.cpp src/athena/FileReader.cpp)
|
2016-10-27 23:44:50 +00:00
|
|
|
if(APPLE OR GEKKO OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
2015-10-16 08:07:54 +00:00
|
|
|
list(APPEND CORE_EXTRA src/osx_largefilewrapper.c include/osx_largefilewrapper.h)
|
|
|
|
if(GEKKO)
|
|
|
|
list(APPEND CORE_EXTRA src/gekko_support.c include/gekko_support.h)
|
|
|
|
endif()
|
2015-07-07 03:23:37 +00:00
|
|
|
endif()
|
2016-09-18 23:45:19 +00:00
|
|
|
endif()
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
add_library(athena-core
|
|
|
|
src/athena/Utility.cpp
|
|
|
|
src/athena/MemoryReader.cpp
|
|
|
|
src/athena/MemoryWriter.cpp
|
2017-01-27 03:25:48 +00:00
|
|
|
src/athena/FileWriterGeneric.cpp
|
2016-03-04 23:00:12 +00:00
|
|
|
src/athena/Global.cpp
|
|
|
|
src/athena/Checksums.cpp
|
|
|
|
src/athena/Compression.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
src/LZ77/LZLookupTable.cpp
|
|
|
|
src/LZ77/LZType10.cpp
|
|
|
|
src/LZ77/LZType11.cpp
|
|
|
|
src/LZ77/LZBase.cpp
|
2016-03-04 23:00:12 +00:00
|
|
|
src/athena/FileInfo.cpp
|
|
|
|
src/athena/Dir.cpp
|
|
|
|
src/athena/DNAYaml.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
${CORE_EXTRA}
|
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/IStream.hpp
|
|
|
|
include/athena/IStreamReader.hpp
|
|
|
|
include/athena/IStreamWriter.hpp
|
|
|
|
include/athena/Types.hpp
|
|
|
|
include/athena/Utility.hpp
|
|
|
|
include/athena/Global.hpp
|
|
|
|
include/athena/FileReader.hpp
|
|
|
|
include/athena/FileWriter.hpp
|
|
|
|
include/athena/MemoryReader.hpp
|
|
|
|
include/athena/MemoryWriter.hpp
|
|
|
|
include/athena/Checksums.hpp
|
|
|
|
include/athena/Compression.hpp
|
2017-01-07 05:03:13 +00:00
|
|
|
include/athena/Socket.hpp
|
2015-07-07 03:23:37 +00:00
|
|
|
include/LZ77/LZBase.hpp
|
|
|
|
include/LZ77/LZLookupTable.hpp
|
|
|
|
include/LZ77/LZType10.hpp
|
|
|
|
include/LZ77/LZType11.hpp
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/FileInfo.hpp
|
|
|
|
include/athena/Dir.hpp
|
|
|
|
include/athena/DNA.hpp
|
|
|
|
include/athena/DNAYaml.hpp
|
2015-08-31 21:11:42 +00:00
|
|
|
include/yaml.h
|
|
|
|
include/utf8proc.h
|
2016-03-26 02:22:04 +00:00
|
|
|
include/optional.hpp
|
2015-07-07 03:23:37 +00:00
|
|
|
)
|
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
add_library(athena-sakura EXCLUDE_FROM_ALL
|
|
|
|
src/athena/Sprite.cpp
|
|
|
|
src/athena/SpriteFile.cpp
|
|
|
|
src/athena/SpriteFileReader.cpp
|
|
|
|
src/athena/SpriteFileWriter.cpp
|
|
|
|
src/athena/SpriteFrame.cpp
|
|
|
|
src/athena/SpritePart.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/SakuraGlobal.hpp
|
|
|
|
include/athena/Sprite.hpp
|
|
|
|
include/athena/SpriteFile.hpp
|
|
|
|
include/athena/SpriteFileReader.hpp
|
|
|
|
include/athena/SpriteFileWriter.hpp
|
|
|
|
include/athena/SpriteFrame.hpp
|
|
|
|
include/athena/SpritePart.hpp
|
2015-07-07 03:23:37 +00:00
|
|
|
)
|
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
add_library(athena-wiisave EXCLUDE_FROM_ALL
|
|
|
|
src/athena/WiiBanner.cpp
|
|
|
|
src/athena/WiiFile.cpp
|
|
|
|
src/athena/WiiImage.cpp
|
|
|
|
src/athena/WiiSave.cpp
|
|
|
|
src/athena/WiiSaveReader.cpp
|
|
|
|
src/athena/WiiSaveWriter.cpp
|
2017-01-03 10:32:39 +00:00
|
|
|
src/bn.cpp
|
|
|
|
src/ec.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
src/md5.cpp
|
|
|
|
src/sha1.cpp
|
2015-07-08 02:53:39 +00:00
|
|
|
src/aes.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/WiiBanner.hpp
|
|
|
|
include/athena/WiiFile.hpp
|
|
|
|
include/athena/WiiImage.hpp
|
|
|
|
include/athena/WiiSave.hpp
|
|
|
|
include/athena/WiiSaveReader.hpp
|
|
|
|
include/athena/WiiSaveWriter.hpp
|
2015-07-08 02:53:39 +00:00
|
|
|
include/aes.hpp
|
2017-01-03 10:32:39 +00:00
|
|
|
include/bn.hpp
|
|
|
|
include/ec.hpp
|
2015-07-07 03:23:37 +00:00
|
|
|
include/md5.h
|
|
|
|
include/sha1.h
|
|
|
|
)
|
2015-10-16 08:07:54 +00:00
|
|
|
if(NOT MSVC AND NOT GEKKO)
|
2015-07-08 02:53:39 +00:00
|
|
|
set_source_files_properties(src/aes.cpp PROPERTIES COMPILE_FLAGS -maes)
|
2015-07-22 18:59:40 +00:00
|
|
|
endif()
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-06-30 05:20:27 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
add_library(athena-zelda EXCLUDE_FROM_ALL
|
|
|
|
src/athena/ALTTPFile.cpp
|
|
|
|
src/athena/ALTTPFileReader.cpp
|
|
|
|
src/athena/ALTTPFileWriter.cpp
|
|
|
|
src/athena/ALTTPQuest.cpp
|
|
|
|
src/athena/MCFile.cpp
|
|
|
|
src/athena/MCFileReader.cpp
|
|
|
|
src/athena/MCFileWriter.cpp
|
|
|
|
src/athena/MCSlot.cpp
|
|
|
|
src/athena/SkywardSwordFile.cpp
|
|
|
|
src/athena/SkywardSwordFileReader.cpp
|
|
|
|
src/athena/SkywardSwordFileWriter.cpp
|
|
|
|
src/athena/SkywardSwordQuest.cpp
|
|
|
|
src/athena/ZQuestFile.cpp
|
|
|
|
src/athena/ZQuestFileReader.cpp
|
|
|
|
src/athena/ZQuestFileWriter.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/ALTTPEnums.hpp
|
|
|
|
include/athena/ALTTPFile.hpp
|
|
|
|
include/athena/ALTTPFileReader.hpp
|
|
|
|
include/athena/ALTTPFileWriter.hpp
|
|
|
|
include/athena/ALTTPQuest.hpp
|
|
|
|
include/athena/ALTTPStructs.hpp
|
|
|
|
include/athena/MCFile.hpp
|
|
|
|
include/athena/MCFileReader.hpp
|
|
|
|
include/athena/MCFileWriter.hpp
|
|
|
|
include/athena/SkywardSwordFile.hpp
|
|
|
|
include/athena/SkywardSwordFileReader.hpp
|
|
|
|
include/athena/SkywardSwordFileWriter.hpp
|
|
|
|
include/athena/SkywardSwordQuest.hpp
|
2017-01-03 11:15:07 +00:00
|
|
|
include/athena/ZQuestFile.hpp
|
|
|
|
include/athena/ZQuestFileReader.hpp
|
|
|
|
include/athena/ZQuestFileWriter.hpp
|
2015-07-07 03:23:37 +00:00
|
|
|
)
|
|
|
|
|
2015-08-04 03:42:44 +00:00
|
|
|
# Icon
|
|
|
|
set(ATHENA_ICO ${CMAKE_CURRENT_SOURCE_DIR}/Athena.ico)
|
|
|
|
|
2015-07-08 23:53:40 +00:00
|
|
|
# Offer the user the choice of overriding the installation directories
|
|
|
|
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
|
|
|
|
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
|
|
|
if(WIN32 AND NOT CYGWIN)
|
2015-07-10 23:44:31 +00:00
|
|
|
set(INSTALL_CMAKE_DIR cmake)
|
2015-07-08 23:53:40 +00:00
|
|
|
else()
|
2016-03-04 23:00:12 +00:00
|
|
|
set(INSTALL_CMAKE_DIR lib/cmake/athena)
|
2015-07-08 23:53:40 +00:00
|
|
|
endif()
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2015-07-08 23:53:40 +00:00
|
|
|
# Make relative paths absolute (needed later on)
|
|
|
|
foreach(p LIB INCLUDE CMAKE)
|
|
|
|
set(var INSTALL_${p}_DIR)
|
|
|
|
if(NOT IS_ABSOLUTE "${${var}}")
|
2015-07-09 00:57:51 +00:00
|
|
|
set(ABS_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
|
|
|
else()
|
|
|
|
set(ABS_${var} "${${var}}")
|
2015-07-08 23:53:40 +00:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# Define installs
|
2016-03-04 23:00:12 +00:00
|
|
|
install(DIRECTORY include/ DESTINATION ${INSTALL_INCLUDE_DIR}/athena COMPONENT athena)
|
|
|
|
install(TARGETS athena-core
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT athena)
|
2015-07-08 23:53:40 +00:00
|
|
|
if(WIN32 AND NOT CYGWIN)
|
2016-03-04 23:00:12 +00:00
|
|
|
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT athena)
|
2015-07-09 00:01:05 +00:00
|
|
|
elseif(UNIX)
|
2015-07-10 23:44:31 +00:00
|
|
|
configure_file(libAthena.pc.in libAthena.pc @ONLY)
|
2015-08-14 03:21:49 +00:00
|
|
|
configure_file(PKGBUILD.in ${CMAKE_CURRENT_SOURCE_DIR}/PKGBUILD @ONLY)
|
2015-07-10 23:44:31 +00:00
|
|
|
install(FILES ${PROJECT_BINARY_DIR}/libAthena.pc
|
2016-03-04 23:00:12 +00:00
|
|
|
DESTINATION ${INSTALL_LIB_DIR}/pkgconfig COMPONENT athena)
|
2015-07-08 20:21:50 +00:00
|
|
|
endif()
|
|
|
|
|
2015-07-08 23:53:40 +00:00
|
|
|
##################
|
|
|
|
# Package Export #
|
|
|
|
##################
|
|
|
|
|
|
|
|
# Add all targets to the build-tree export set
|
2016-03-04 23:00:12 +00:00
|
|
|
export(TARGETS athena-core FILE "${PROJECT_BINARY_DIR}/AthenaTargets.cmake")
|
2015-07-08 23:53:40 +00:00
|
|
|
|
|
|
|
# Export the package for use from the build-tree
|
|
|
|
# (this registers the build-tree with a global CMake-registry)
|
2016-03-04 23:00:12 +00:00
|
|
|
export(PACKAGE athena)
|
2015-07-08 23:53:40 +00:00
|
|
|
|
|
|
|
# Create the AthenaConfig.cmake
|
|
|
|
# ... for the build tree
|
2016-03-04 23:00:12 +00:00
|
|
|
set(CONF_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include/athena")
|
2015-07-08 23:53:40 +00:00
|
|
|
set(CONF_ICON_DIR "${PROJECT_SOURCE_DIR}/Athena.ico")
|
|
|
|
configure_file(AthenaConfig.cmake.in "${PROJECT_BINARY_DIR}/AthenaConfig.cmake" @ONLY)
|
|
|
|
# ... for the install tree
|
2015-07-09 00:57:51 +00:00
|
|
|
file(RELATIVE_PATH REL_INCLUDE_DIR "${ABS_INSTALL_CMAKE_DIR}" "${ABS_INSTALL_INCLUDE_DIR}")
|
|
|
|
file(RELATIVE_PATH REL_ICON_DIR "${ABS_INSTALL_CMAKE_DIR}" "${ABS_INSTALL_LIB_DIR}/Athena.ico")
|
2016-03-04 23:00:12 +00:00
|
|
|
set(CONF_INCLUDE_DIR "\${ATHENA_CMAKE_DIR}/${REL_INCLUDE_DIR}/athena")
|
2015-07-08 23:53:40 +00:00
|
|
|
set(CONF_ICON_DIR "\${ATHENA_CMAKE_DIR}/${REL_ICON_DIR}")
|
|
|
|
configure_file(AthenaConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/AthenaConfig.cmake" @ONLY)
|
|
|
|
# ... for both
|
|
|
|
configure_file(AthenaConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/AthenaConfigVersion.cmake" @ONLY)
|
|
|
|
|
|
|
|
# Install AthenaConfig.cmake
|
|
|
|
install(FILES
|
|
|
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/AthenaConfig.cmake"
|
|
|
|
"${PROJECT_BINARY_DIR}/AthenaConfigVersion.cmake"
|
2016-03-04 23:00:12 +00:00
|
|
|
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT athena)
|
2015-07-08 23:53:40 +00:00
|
|
|
|
|
|
|
# Install the export set for use with the install-tree
|
2016-03-04 23:00:12 +00:00
|
|
|
install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT athena)
|
2015-07-10 23:44:31 +00:00
|
|
|
|
|
|
|
################
|
|
|
|
# atdna import #
|
|
|
|
################
|
|
|
|
|
2015-10-16 08:07:54 +00:00
|
|
|
if(NOT GEKKO)
|
2015-08-03 01:42:47 +00:00
|
|
|
add_subdirectory(atdna)
|
2015-10-16 08:07:54 +00:00
|
|
|
endif()
|
2015-07-08 23:53:40 +00:00
|
|
|
|
|
|
|
#########
|
|
|
|
# CPack #
|
|
|
|
#########
|
|
|
|
|
2015-07-08 20:21:50 +00:00
|
|
|
include(InstallRequiredSystemLibraries)
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Athena")
|
2015-07-10 23:44:31 +00:00
|
|
|
set(CPACK_PACKAGE_VENDOR "Antidote / Jackoalan")
|
2015-07-08 20:21:50 +00:00
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
2015-07-08 23:53:40 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION})
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR ${ATHENA_MINOR_VERSION})
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${ATHENA_PATCH_VERSION})
|
2016-03-04 23:00:12 +00:00
|
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "athena")
|
2015-07-08 20:21:50 +00:00
|
|
|
if(WIN32 AND NOT UNIX)
|
|
|
|
# There is a bug in NSI that does not handle full unix paths properly. Make
|
|
|
|
# sure there is at least one set of four (4) backlasshes.
|
2016-03-04 23:00:12 +00:00
|
|
|
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "athena")
|
2015-07-10 23:44:31 +00:00
|
|
|
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\AthenaNSIS.bmp")
|
|
|
|
set(CPACK_NSIS_MODIFY_PATH ON)
|
|
|
|
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
|
|
|
|
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
|
|
|
|
set(CPACK_NSIS_INSTALLED_ICON_NAME "Uninstall.exe")
|
2015-07-08 20:21:50 +00:00
|
|
|
set(CPACK_NSIS_DISPLAY_NAME "Athena")
|
|
|
|
set(CPACK_NSIS_URL_INFO_ABOUT "http://libathena.github.io")
|
|
|
|
set(CPACK_NSIS_CONTACT "antidote.crk@gmail.com")
|
|
|
|
endif()
|
|
|
|
include(CPack)
|
2015-07-07 03:23:37 +00:00
|
|
|
|