Skip to content

Commit

Permalink
Generate at build time alias headers
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Aug 29, 2022
1 parent 445be69 commit 0e91936
Show file tree
Hide file tree
Showing 110 changed files with 195 additions and 178 deletions.
6 changes: 3 additions & 3 deletions demos/ff7tkQmlGallery/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <QQmlApplicationEngine>
#include <QQmlContext>

#include <FF7Text.h>
#include <FF7Item.h>
#include <ff7tkAbout.h>
#include <FF7Text>
#include <FF7Item>
#include <ff7tkAbout>

int main(int argc, char *argv[])
{
Expand Down
6 changes: 3 additions & 3 deletions demos/ff7tkWidgetGallery/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include <QMessageBox>
#include <QProgressDialog>

#include <FF7Save.h>
#include <ff7tkAbout.h>
#include <FF7ItemModel.h>
#include <FF7Save>
#include <ff7tkAbout>
#include <FF7ItemModel>

MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{
Expand Down
2 changes: 1 addition & 1 deletion demos/ff7tkWidgetGallery/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <AchievementEditor.h>
#include <ItemListView.h>
#include <HexLineEdit.h>
#include <Lgp.h>
#include <Lgp>

namespace Ui
{
Expand Down
24 changes: 22 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,30 @@ endif()
# LIB_TARGET_PrivateLIBLINKS
macro(MAKE_LIBRARY LIB_TARGET HEADER_INSTALL_DIR)

add_library (${LIB_TARGET}
SHARED
add_library (${LIB_TARGET} SHARED
${${LIB_TARGET}_SRC}
${${LIB_TARGET}_HEADERS}
${${LIB_TARGET}_RESOURCES}
)
add_library (ff7tk::${LIB_TARGET} ALIAS ${LIB_TARGET})

#Generate the non .h ending header let the user include "HEADER" or "HEADER.h"
foreach ( HEADER ${${LIB_TARGET}_HEADERS})
if(${HEADER} MATCHES "^/")
string(FIND ${HEADER} "/" lastSlash REVERSE)
string(SUBSTRING ${HEADER} 0 ${lastSlash} RMSTRING)
string(REPLACE "${RMSTRING}/" "" HEADER ${HEADER})
elseif(${HEADER} MATCHES "^([A-Z]):")
string(FIND ${HEADER} "/" lastSlash REVERSE)
string(SUBSTRING ${HEADER} 0 ${lastSlash} RMSTRING)
string(REPLACE "${RMSTRING}/" "" HEADER ${HEADER})
endif()
set(fileContent "#pragma once\n#include<${HEADER}>\n")
string(REPLACE ".h" "" HEADER ${HEADER})
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${HEADER} ${fileContent})
list(APPEND ALIASHEADERS ${CMAKE_CURRENT_BINARY_DIR}/${HEADER})
endforeach()

if(APPLE)
set_target_properties(${LIB_TARGET} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
if(${BUILD_FRAMEWORKS})
Expand Down Expand Up @@ -86,6 +102,10 @@ macro(MAKE_LIBRARY LIB_TARGET HEADER_INSTALL_DIR)
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${HEADER_INSTALL_DIR}
COMPONENT ff7tk_headers
)
install (FILES ${ALIASHEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${HEADER_INSTALL_DIR}
COMPONENT ff7tk_headers
)

if(UNIX)
if(NOT APPLE)
Expand Down
2 changes: 1 addition & 1 deletion src/data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ set (ff7tk_HEADERS
FF7Achievements.h FF7Item.h FF7Save.h FF7Text.h Type_FF7CHOCOBO.h
FF7Char.h FF7Location.h FF7SaveInfo.h SaveIcon.h Type_materia.h
FF7ItemModel.h
${CMAKE_CURRENT_BINARY_DIR}/ff7tk_export.h
${CMAKE_CURRENT_BINARY_DIR}/ff7tkAbout.h
${CMAKE_CURRENT_BINARY_DIR}/ff7tk_export.h
)

set ( ff7tk_RESOURCES
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7Achievements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#include <FF7Achievements.h>
#include <FF7Achievements>

#include <QFile>

Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7Achievements.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#pragma once

#include <QObject>
#include <ff7tk_export.h>
#include <ff7tk_export>

/*!
* \class FF7Achievements
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7Char.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// GNU General Public License for more details. //
/****************************************************************************/

#include <FF7Char.h>
#include <FF7Char>

#include <QIcon>
#include <QRandomGenerator>
Expand Down
4 changes: 2 additions & 2 deletions src/data/FF7Char.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

#include <QObject>
#include <QtGlobal>
#include <ff7tk_export.h>
#include <Type_FF7CHAR.h>
#include <ff7tk_export>
#include <Type_FF7CHAR>

class QIcon;
class QQmlEngine;
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7FieldItemList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#include <FF7FieldItemList.h>
#include <FF7FieldItemList>

#include<QStringList>
#include <QQmlEngine>
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7FieldItemList.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <QObject>
#include <QtGlobal>
#include <ff7tk_export.h>
#include <ff7tk_export>

class QQmlEngine;
class QJSEngine;
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7Item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#include <FF7Item.h>
#include <FF7Item>

#include <QIcon>
#include <QtEndian>
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7Item.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#pragma once

#include <QObject>
#include <ff7tk_export.h>
#include <ff7tk_export>

class QIcon;
class QQmlEngine;
Expand Down
4 changes: 2 additions & 2 deletions src/data/FF7ItemModel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "FF7ItemModel.h"
#include <FF7Item.h>
#include <FF7ItemModel>
#include <FF7Item>
#include <QIcon>
#include <QModelIndex>

Expand Down
4 changes: 2 additions & 2 deletions src/data/FF7ItemModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#pragma once

#include <QAbstractTableModel>
#include <ff7tk_export.h>
#include <FF7Item.h>
#include <ff7tk_export>
#include <FF7Item>

class FF7TK_EXPORT FF7ItemModel : public QAbstractTableModel
{
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7Location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#include <FF7Location.h>
#include <FF7Location>

#include <QQmlEngine>

Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7Location.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#pragma once

#include <QObject>
#include <ff7tk_export.h>
#include <ff7tk_export>

class QQmlEngine;
class QJSEngine;
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7Materia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#include <FF7Materia.h>
#include <FF7Materia>

#include <QQmlEngine>

Expand Down
4 changes: 2 additions & 2 deletions src/data/FF7Materia.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include <QIcon>
#include <QtEndian>

#include <ff7tk_export.h>
#include <Type_materia.h>
#include <ff7tk_export>
#include <Type_materia>

class QQmlEngine;
class QJSEngine;
Expand Down
10 changes: 5 additions & 5 deletions src/data/FF7Save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#include <FF7Save.h>
#include <FF7Save>
// This Class should contain NO Gui Parts
#include <QColor>
#include <QDateTime>
Expand All @@ -26,10 +26,10 @@
#include <QtXml/QDomDocument>
#include <QVector>
#include <QtEndian>
#include <FF7Text.h>
#include <FF7Item.h>
#include <FF7Materia.h>
#include <FF7Char.h>
#include <FF7Text>
#include <FF7Item>
#include <FF7Materia>
#include <FF7Char>

// I'm not installing this header.
#include "crypto/aes.h"
Expand Down
6 changes: 3 additions & 3 deletions src/data/FF7Save.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

#include <QObject>
#include <cstdlib>
#include <ff7tk_export.h>
#include <FF7SaveInfo.h>
#include <FF7Save_Types.h>
#include <ff7tk_export>
#include <FF7SaveInfo>
#include <FF7Save_Types>

class QColor;
class QDateTime;
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7SaveInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#include <FF7SaveInfo.h>
#include <FF7SaveInfo>

#include <QByteArrayList>
#include <QQmlEngine>
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7SaveInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#pragma once

#include <QObject>
#include <ff7tk_export.h>
#include <QRegularExpression>
#include <ff7tk_export>

class QJSEngine;
class QQmlEngine;
Expand Down
6 changes: 3 additions & 3 deletions src/data/FF7Save_Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#endif

#include <QVector>
#include <ff7tk_export.h>
#include <Type_FF7CHAR.h>
#include <Type_FF7CHOCOBO.h>
#include <ff7tk_export>
#include <Type_FF7CHAR>
#include <Type_FF7CHOCOBO>
//Materia Type is included as part of FF7Char
/*~~~~~~~~~~~~~~~~~~~~~~~~STRUCT TYPES AND SAVE STRUCT~~~~~~~~~~~~~~~~*/
PACK(
Expand Down
2 changes: 1 addition & 1 deletion src/data/FF7Text.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#pragma once

#include <QObject>
#include <ff7tk_export.h>
#include <ff7tk_export>

class QQmlEngine;
class QJSEngine;
Expand Down
2 changes: 1 addition & 1 deletion src/data/SaveIcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <QObject>
#include <QPixmap>
#include <ff7tk_export.h>
#include <ff7tk_export>

/** \class SaveIcon
* \brief PSX icon data as a QPixmap
Expand Down
4 changes: 2 additions & 2 deletions src/data/Type_FF7CHAR.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#pragma once

#include <QtCore/qglobal.h>
#include <Type_materia.h>
#include <ff7tk_export.h>
#include <Type_materia>
#include <ff7tk_export>

/*! \struct FF7CHAR
* \brief Character Info in the save game.
Expand Down
2 changes: 1 addition & 1 deletion src/data/Type_FF7CHOCOBO.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/****************************************************************************/
#pragma once
#include <QtCore/qglobal.h>
#include <ff7tk_export.h>
#include <ff7tk_export>

#ifdef _MSC_VER
# define PACK(structure) \
Expand Down
2 changes: 1 addition & 1 deletion src/formats/Akao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#include <Akao.h>
#include <Akao>

Akao::Akao() { }
2 changes: 1 addition & 1 deletion src/formats/Akao.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#pragma once

#include <QtCore>
#include <ff7tkformats_export.h>
#include <ff7tkformats_export>

class FF7TKFORMATS_EXPORT Akao
{
Expand Down
4 changes: 2 additions & 2 deletions src/formats/AkaoIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
/****************************************************************************/
#pragma once

#include <IO.h>
#include <Akao.h>
#include <IO>
#include <Akao>

class AkaoIO : public IO
{
Expand Down
2 changes: 1 addition & 1 deletion src/formats/Archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#include <Archive.h>
#include <Archive>

ArchiveObserver::~ArchiveObserver()
{
Expand Down
2 changes: 1 addition & 1 deletion src/formats/Archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <QByteArray>
#include <QFile>
#include <QDebug>
#include <ff7tkformats_export.h>
#include <ff7tkformats_export>

struct FF7TKFORMATS_EXPORT ArchiveObserver {
ArchiveObserver() {}
Expand Down
2 changes: 1 addition & 1 deletion src/formats/IsoArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#include <IsoArchive.h>
#include <IsoArchive>
#include <QCoreApplication>
#include <QDir>
#include <QtEndian>
Expand Down
4 changes: 2 additions & 2 deletions src/formats/IsoArchive.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#include <QIODevice>
#include <QString>
#include <Archive.h>
#include <ff7tkformats_export.h>
#include <Archive>
#include <ff7tkformats_export>

#define MAX_ISO_READ 10000
#define MAX_FILENAME_LENGTH 207
Expand Down
Loading

0 comments on commit 0e91936

Please sign in to comment.