athena/CMakeLists.txt

251 lines
7.8 KiB
CMake
Raw Normal View History

2015-07-07 03:23:37 +00:00
cmake_minimum_required(VERSION 3.0)
project(Athena)
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)
2015-07-30 06:09:37 +00:00
include_directories(include ${LZO_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${YAML_INCLUDE_DIR})
2015-07-24 05:24:52 +00:00
if (NOT MSVC)
2015-07-12 18:06:07 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
2015-07-07 03:23:37 +00:00
if(WIN32)
list(APPEND CORE_EXTRA src/win32_largefilewrapper.c)
elseif(APPLE)
list(APPEND CORE_EXTRA src/osx_largefilewrapper.c)
2015-07-11 01:45:26 +00:00
elseif(GEKKO)
list(APPEND CORE_EXTRA src/gekko_support.c)
2015-07-07 03:23:37 +00:00
endif()
add_library(AthenaCore
src/Athena/Utility.cpp
src/Athena/Global.cpp
src/Athena/Checksums.cpp
src/Athena/Compression.cpp
src/LZ77/LZLookupTable.cpp
src/LZ77/LZType10.cpp
src/LZ77/LZType11.cpp
src/LZ77/LZBase.cpp
src/Athena/FileInfo.cpp
src/Athena/Dir.cpp
2015-07-30 06:09:37 +00:00
src/Athena/DNAYaml.cpp
2015-07-07 03:23:37 +00:00
${CORE_EXTRA}
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
include/LZ77/LZBase.hpp
include/LZ77/LZLookupTable.hpp
include/LZ77/LZType10.hpp
include/LZ77/LZType11.hpp
include/Athena/FileInfo.hpp
include/Athena/Dir.hpp
include/gekko_support.h
include/Athena/DNA.hpp
2015-07-30 06:09:37 +00:00
include/Athena/DNAYaml.hpp
2015-07-07 03:23:37 +00:00
)
add_library(AthenaSakura
src/Athena/Sprite.cpp
src/Athena/SpriteFile.cpp
src/Athena/SpriteFileReader.cpp
src/Athena/SpriteFileWriter.cpp
src/Athena/SpriteFrame.cpp
src/Athena/SpritePart.cpp
include/Athena/Sprite.hpp
include/Athena/SpriteFile.hpp
include/Athena/SpriteFileReader.hpp
include/Athena/SpriteFileWriter.hpp
include/Athena/SpriteFrame.hpp
include/Athena/SpritePart.hpp
)
add_library(AthenaWiiSave
src/Athena/WiiBanner.cpp
src/Athena/WiiFile.cpp
src/Athena/WiiImage.cpp
src/Athena/WiiSave.cpp
src/Athena/WiiSaveReader.cpp
src/Athena/WiiSaveWriter.cpp
src/bn.cpp
src/ec.cpp
src/md5.cpp
src/sha1.cpp
src/aes.cpp
2015-07-07 03:23:37 +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
include/aes.hpp
2015-07-07 03:23:37 +00:00
include/bn.h
include/ec.h
include/md5.h
include/sha1.h
)
2015-07-24 05:24:52 +00:00
if(NOT MSVC)
set_source_files_properties(src/aes.cpp PROPERTIES COMPILE_FLAGS -maes)
endif()
2015-07-07 03:23:37 +00:00
add_library(AthenaZelda
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
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
)
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)
set(INSTALL_CMAKE_DIR cmake)
2015-07-08 23:53:40 +00:00
else()
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
install(DIRECTORY include/ DESTINATION ${INSTALL_INCLUDE_DIR}/Athena COMPONENT Athena)
2015-07-07 03:23:37 +00:00
install(TARGETS AthenaCore AthenaSakura AthenaWiiSave AthenaZelda
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT Athena)
2015-07-08 23:53:40 +00:00
if(WIN32 AND NOT CYGWIN)
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT Athena)
2015-07-09 00:01:05 +00:00
elseif(UNIX)
configure_file(libAthena.pc.in libAthena.pc @ONLY)
configure_file(PKGBUILD.in ${CMAKE_CURRENT_SOURCE_DIR}/PKGBUILD @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/libAthena.pc
DESTINATION ${INSTALL_LIB_DIR}/pkgconfig COMPONENT Athena)
endif()
2015-07-08 23:53:40 +00:00
##################
# Package Export #
##################
# Add all targets to the build-tree export set
export(TARGETS AthenaCore AthenaSakura AthenaWiiSave AthenaZelda
FILE "${PROJECT_BINARY_DIR}/AthenaTargets.cmake")
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE Athena)
# Create the AthenaConfig.cmake
# ... for the build tree
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")
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"
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT Athena)
2015-07-08 23:53:40 +00:00
# Install the export set for use with the install-tree
install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT Athena)
################
# atdna import #
################
2015-08-03 01:42:47 +00:00
add_subdirectory(atdna)
2015-07-08 23:53:40 +00:00
#########
# CPack #
#########
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Athena")
set(CPACK_PACKAGE_VENDOR "Antidote / Jackoalan")
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})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Athena")
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.
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Athena")
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")
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