Skip to content

Commit 55adeec

Browse files
committed
windows packaging and CMake adjustments
1 parent 4f8df65 commit 55adeec

File tree

10 files changed

+63
-28
lines changed

10 files changed

+63
-28
lines changed

AthenaNSIS.bmp

30.1 KB
Binary file not shown.

CMakeLists.txt

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,10 @@ add_library(AthenaZelda
152152
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
153153
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
154154
if(WIN32 AND NOT CYGWIN)
155-
set(DEF_INSTALL_CMAKE_DIR cmake)
155+
set(INSTALL_CMAKE_DIR cmake)
156156
else()
157-
set(DEF_INSTALL_CMAKE_DIR lib/cmake/Athena)
157+
set(INSTALL_CMAKE_DIR lib/cmake/Athena)
158158
endif()
159-
set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
160159

161160
# Make relative paths absolute (needed later on)
162161
foreach(p LIB INCLUDE CMAKE)
@@ -169,14 +168,15 @@ foreach(p LIB INCLUDE CMAKE)
169168
endforeach()
170169

171170
# Define installs
172-
install(DIRECTORY include/ DESTINATION ${INSTALL_INCLUDE_DIR}/Athena)
171+
install(DIRECTORY include/ DESTINATION ${INSTALL_INCLUDE_DIR}/Athena COMPONENT Athena)
173172
install(TARGETS AthenaCore AthenaSakura AthenaWiiSave AthenaZelda
174-
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets)
173+
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT Athena)
175174
if(WIN32 AND NOT CYGWIN)
176-
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR})
175+
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT Athena)
177176
elseif(UNIX)
178-
install(FILES lib/pkgconfig/libAthena.pc
179-
DESTINATION ${INSTALL_LIB_DIR}/pkgconfig)
177+
configure_file(libAthena.pc.in libAthena.pc @ONLY)
178+
install(FILES ${PROJECT_BINARY_DIR}/libAthena.pc
179+
DESTINATION ${INSTALL_LIB_DIR}/pkgconfig COMPONENT Athena)
180180
endif()
181181

182182
##################
@@ -209,18 +209,26 @@ configure_file(AthenaConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/AthenaConfigV
209209
install(FILES
210210
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/AthenaConfig.cmake"
211211
"${PROJECT_BINARY_DIR}/AthenaConfigVersion.cmake"
212-
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT dev)
212+
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT Athena)
213213

214214
# Install the export set for use with the install-tree
215-
install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT dev)
215+
install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT Athena)
216+
217+
################
218+
# atdna import #
219+
################
220+
221+
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/atdna/")
222+
add_subdirectory(atdna)
223+
endif()
216224

217225
#########
218226
# CPack #
219227
#########
220228

221229
include(InstallRequiredSystemLibraries)
222230
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Athena")
223-
set(CPACK_PACKAGE_VENDOR "2015 Antidote / Jackoalan")
231+
set(CPACK_PACKAGE_VENDOR "Antidote / Jackoalan")
224232
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
225233
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
226234
set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION})
@@ -230,12 +238,15 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "Athena")
230238
if(WIN32 AND NOT UNIX)
231239
# There is a bug in NSI that does not handle full unix paths properly. Make
232240
# sure there is at least one set of four (4) backlasshes.
233-
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/Athena.ico")
234-
set(CPACK_NSIS_INSTALLED_ICON_NAME "Athena.ico")
241+
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Athena")
242+
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\AthenaNSIS.bmp")
243+
set(CPACK_NSIS_MODIFY_PATH ON)
244+
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
245+
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
246+
set(CPACK_NSIS_INSTALLED_ICON_NAME "Uninstall.exe")
235247
set(CPACK_NSIS_DISPLAY_NAME "Athena")
236248
set(CPACK_NSIS_URL_INFO_ABOUT "http://libathena.github.io")
237249
set(CPACK_NSIS_CONTACT "antidote.crk@gmail.com")
238-
set(CPACK_NSIS_MODIFY_PATH ON)
239250
endif()
240251
include(CPack)
241252

extern/lzo/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
if(NOT WIN32)
12
find_library(LZO_LIB lzo2)
2-
if(LZO_LIB STREQUAL LZO_LIB-NOTFOUND)
3+
endif()
4+
if(WIN32 OR LZO_LIB STREQUAL LZO_LIB-NOTFOUND)
5+
include_directories(include)
6+
message("-- Using Athena's built-in lzo")
37
add_library(lzo2
48
src/lzo1.c
59
src/lzo1_99.c
@@ -73,7 +77,9 @@ add_library(lzo2
7377
include/lzo/lzoconf.h
7478
include/lzo/lzodefs.h
7579
include/lzo/lzoutil.h)
76-
install(DIRECTORY include/lzo DESTINATION include/lzo)
77-
install(TARGETS lzo2 DESTINATION lib)
80+
if(WIN32 AND NOT UNIX)
81+
install(DIRECTORY include/lzo DESTINATION include COMPONENT lzo2)
82+
install(TARGETS lzo2 DESTINATION lib COMPONENT lzo2)
83+
endif()
7884
set(LZO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE PATH "LZO include path" FORCE)
7985
endif()

extern/zlib/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
if(NOT WIN32)
12
find_package(ZLIB)
2-
if(NOT ZLIB_FOUND)
3+
endif()
4+
if(WIN32 OR NOT ZLIB_FOUND)
5+
message("-- Using Athena's built-in zlib")
36
add_library(z
47
adler32.c
58
compress.c
@@ -23,7 +26,9 @@ add_library(z
2326
zconf.h
2427
zlib.h
2528
zutil.h)
26-
install(FILES zconf.h zlib.h DESTINATION include)
27-
install(TARGETS z DESTINATION lib)
29+
if(WIN32 AND NOT UNIX)
30+
install(FILES zconf.h zlib.h DESTINATION include COMPONENT zlib)
31+
install(TARGETS z DESTINATION lib COMPONENT zlib)
32+
endif()
2833
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Zlib include path" FORCE)
2934
endif()

include/Athena/FileReader.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#ifndef FILESTREAM_HPP
22
#define FILESTREAM_HPP
33

4-
#include "Athena/IStreamReader.hpp"
54
#include <string>
5+
#include <memory>
66
#include <stdio.h>
7+
#include "Athena/IStreamReader.hpp"
78

89
namespace Athena
910
{

include/Athena/IStreamReader.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class IStreamReader : public IStream
226226
* \return atVec2f The value at the current address
227227
* \throw IOException when address is out of range
228228
*/
229-
inline atVec2f readVec3f()
229+
inline atVec2f readVec2f()
230230
{
231231
atVec2f val;
232232
readUBytesToBuf(&val, 8);

include/Athena/MemoryReader.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#ifndef MEMORYREADER_HPP
22
#define MEMORYREADER_HPP
33

4-
#include "Athena/IStreamReader.hpp"
54
#include <string>
5+
#include <memory>
66
#include <functional>
7+
#include "Athena/IStreamReader.hpp"
78

89
namespace Athena
910
{

include/Athena/MemoryWriter.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#ifndef MEMORYWRITER_HPP
22
#define MEMORYWRITER_HPP
33

4-
#include "Athena/IStreamWriter.hpp"
54
#include <string>
5+
#include <memory>
66
#include <functional>
7+
#include "Athena/IStreamWriter.hpp"
78

89
namespace Athena
910
{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
prefix=/usr
1+
prefix=@CMAKE_INSTALL_PREFIX@
22
includedir=${prefix}/include
33
libdir=${prefix}/lib
44

55
Name: libAthena
66
Description: Basic cross platform IO library
7-
Version: 2.0.0
7+
Version: @ATHENA_VERSION@
88
Cflags: -I${includedir}/Athena -std=c++11
99
Libs: -L${libdir} -lAthenaCore -lAthenaSakura -lAthenaZelda -lAthenaWiiSave
1010
Requires: zlib

src/aes.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#include "aes.hpp"
22
#include <stdio.h>
33
#include <string.h>
4+
#if _WIN32
5+
#include <intrin.h>
6+
#else
47
#include <cpuid.h>
8+
#endif
59

610
namespace Athena
711
{
@@ -478,7 +482,7 @@ void SoftwareAES::encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outb
478482
}
479483
}
480484

481-
#if __AES__
485+
#if __AES__ || _MSC_VER >= 1800
482486

483487
#include <wmmintrin.h>
484488

@@ -598,12 +602,18 @@ class NiAES : public IAES
598602
static int HAS_AES_NI = -1;
599603
std::unique_ptr<IAES> NewAES()
600604
{
601-
#if __AES__
605+
#if __AES__ || _MSC_VER >= 1800
602606
if (HAS_AES_NI == -1)
603607
{
608+
#if _MSC_VER
609+
int info[4];
610+
__cpuid(info, 1);
611+
HAS_AES_NI = ((info[2] & 0x2000000) != 0);
612+
#else
604613
unsigned int a,b,c,d;
605614
__cpuid(1, a,b,c,d);
606615
HAS_AES_NI = ((c & 0x2000000) != 0);
616+
#endif
607617
}
608618
if (HAS_AES_NI)
609619
return std::unique_ptr<IAES>(new NiAES);

0 commit comments

Comments
 (0)