Skip to content

Commit

Permalink
smartcardpp: Use relative includes for its own headers
Browse files Browse the repository at this point in the history
This avoid intermediate header staging step and makes building a lot simpler.


git-svn-id: https://esteid.googlecode.com/svn/smartcardpp/trunk@3687 0d7e1ef0-d974-fc83-f0b3-ccc071561e0e
  • Loading branch information
kalevlember committed Nov 17, 2010
1 parent 2d67b54 commit a60d196
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 60 deletions.
26 changes: 3 additions & 23 deletions CMakeLists.txt
Expand Up @@ -22,7 +22,6 @@ if(MSVC)
endif(MSVC) endif(MSVC)


include_directories( include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${LIBDL_INCLUDE_DIR} ${LIBDL_INCLUDE_DIR}
${PCSCLITE_INCLUDE_DIR} ${PCSCLITE_INCLUDE_DIR}
Expand Down Expand Up @@ -81,27 +80,9 @@ set(esteid_HDRS
# Public headers which get installed into smartcardpp/sim/ directory # Public headers which get installed into smartcardpp/sim/ directory
set(sim_HDRS sim/SIMCard.h) set(sim_HDRS sim/SIMCard.h)


set(GENERATED_HEADERS "") install(FILES ${smartcard_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/smartcardpp)
macro(stage_smartcard_headers HEADERS) install(FILES ${esteid_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/smartcardpp/esteid)
foreach(H ${HEADERS}) install(FILES ${sim_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/smartcardpp/sim)
set(SRC "${CMAKE_CURRENT_SOURCE_DIR}/${H}")
set(DST "${CMAKE_CURRENT_BINARY_DIR}/smartcardpp/${H}")

add_custom_command(
OUTPUT ${DST}
COMMAND ${CMAKE_COMMAND} -E copy ${SRC} ${DST}
DEPENDS ${SRC}
)

set(GENERATED_HEADERS ${GENERATED_HEADERS} ${DST})
endforeach(H)
endmacro(stage_smartcard_headers)

stage_smartcard_headers("${smartcard_HDRS}")
stage_smartcard_headers("${esteid_HDRS}")
stage_smartcard_headers("${sim_HDRS}")

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/smartcardpp DESTINATION ${INCLUDE_INSTALL_DIR})


if(WIN32 OR APPLE) if(WIN32 OR APPLE)
set(LIB_TYPE STATIC) set(LIB_TYPE STATIC)
Expand All @@ -110,7 +91,6 @@ else(WIN32 OR APPLE)
endif(WIN32 OR APPLE) endif(WIN32 OR APPLE)


add_library(smartcardpp ${LIB_TYPE} add_library(smartcardpp ${LIB_TYPE}
${GENERATED_HEADERS}
${smartcard_SRCS} ${smartcard_SRCS}
${sim_SRCS} ${sim_SRCS}
${esteid_SRCS} ${esteid_SRCS}
Expand Down
6 changes: 3 additions & 3 deletions CTAPIManager.cpp
Expand Up @@ -6,9 +6,9 @@
\date $Date: 2009-11-17 01:16:15 +0200 (T, 17 nov 2009) $ \date $Date: 2009-11-17 01:16:15 +0200 (T, 17 nov 2009) $
*/ */
// Revision $Revision: 493 $ // Revision $Revision: 493 $
#include <smartcardpp/CTAPIManager.h> #include "CTAPIManager.h"
#include <smartcardpp/SCError.h> //for exceptions #include "SCError.h" //for exceptions
#include <smartcardpp/CardBase.h> //for exceptions #include "CardBase.h" //for exceptions
#include "helperMacro.h" #include "helperMacro.h"
#include "common.h" #include "common.h"


Expand Down
4 changes: 2 additions & 2 deletions CTAPIManager.h
Expand Up @@ -7,8 +7,8 @@
*/ */
// Revision $Revision: 345 $ // Revision $Revision: 345 $
#pragma once #pragma once
#include <smartcardpp/ManagerInterface.h> #include "ManagerInterface.h"
#include <smartcardpp/DynamicLibrary.h> #include "DynamicLibrary.h"


#ifdef _WIN32 #ifdef _WIN32
#define CTAPI __stdcall #define CTAPI __stdcall
Expand Down
2 changes: 1 addition & 1 deletion CardBase.cpp
Expand Up @@ -6,7 +6,7 @@
\date $Date: 2009-07-15 21:16:04 +0300 (Wed, 15 Jul 2009) $ \date $Date: 2009-07-15 21:16:04 +0300 (Wed, 15 Jul 2009) $
*/ */
// Revision $Revision: 361 $ // Revision $Revision: 361 $
#include <smartcardpp/CardBase.h> #include "CardBase.h"
#include <algorithm> #include <algorithm>
#include "helperMacro.h" #include "helperMacro.h"
#include "common.h" #include "common.h"
Expand Down
2 changes: 1 addition & 1 deletion CardBase.h
Expand Up @@ -7,7 +7,7 @@
*/ */
// Revision $Revision: 422 $ // Revision $Revision: 422 $
#pragma once #pragma once
#include <smartcardpp/ManagerInterface.h> #include "ManagerInterface.h"


using std::vector; using std::vector;


Expand Down
2 changes: 1 addition & 1 deletion DynamicLibrary.cpp
Expand Up @@ -6,7 +6,7 @@
\date $Date: 2009-10-05 22:16:29 +0300 (E, 05 okt 2009) $ \date $Date: 2009-10-05 22:16:29 +0300 (E, 05 okt 2009) $
*/ */
// Revision $Revision: 473 $ // Revision $Revision: 473 $
#include <smartcardpp/DynamicLibrary.h> #include "DynamicLibrary.h"
#include <string.h> #include <string.h>
#include "common.h" #include "common.h"


Expand Down
2 changes: 1 addition & 1 deletion ManagerInterface.h
Expand Up @@ -8,7 +8,7 @@
// Revision $Revision: 345 $ // Revision $Revision: 345 $
#pragma once #pragma once


#include <smartcardpp/types.h> #include "types.h"
#include <stdexcept> #include <stdexcept>


struct ConnectionBase; struct ConnectionBase;
Expand Down
6 changes: 3 additions & 3 deletions PCSCManager.cpp
Expand Up @@ -14,9 +14,9 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif


#include <smartcardpp/PCSCManager.h> #include "PCSCManager.h"
#include <smartcardpp/SCError.h> #include "SCError.h"
#include <smartcardpp/CardBase.h> //for exceptions #include "CardBase.h" //for exceptions
#include "common.h" #include "common.h"


#ifndef CM_IOCTL_GET_FEATURE_REQUEST #ifndef CM_IOCTL_GET_FEATURE_REQUEST
Expand Down
4 changes: 2 additions & 2 deletions PCSCManager.h
Expand Up @@ -7,8 +7,8 @@
*/ */
// Revision $Revision: 470 $ // Revision $Revision: 470 $
#pragma once #pragma once
#include <smartcardpp/ManagerInterface.h> #include "ManagerInterface.h"
#include <smartcardpp/DynamicLibrary.h> #include "DynamicLibrary.h"
#ifndef _WIN32 #ifndef _WIN32
#ifdef __APPLE__ #ifdef __APPLE__
typedef void *LPVOID; typedef void *LPVOID;
Expand Down
2 changes: 1 addition & 1 deletion PinString.h
@@ -1,4 +1,4 @@
#include <smartcardpp/locked_allocator.h> #include "locked_allocator.h"


typedef std::basic_string<char, std::char_traits<char>, locked_allocator<char> > base_str; typedef std::basic_string<char, std::char_traits<char>, locked_allocator<char> > base_str;


Expand Down
2 changes: 1 addition & 1 deletion SCError.cpp
Expand Up @@ -6,7 +6,7 @@
\date $Date: 2009-07-06 13:21:43 +0300 (Mon, 06 Jul 2009) $ \date $Date: 2009-07-06 13:21:43 +0300 (Mon, 06 Jul 2009) $
*/ */
// Revision $Revision: 345 $ // Revision $Revision: 345 $
#include <smartcardpp/SCError.h> #include "SCError.h"
#include "common.h" #include "common.h"


SCError::SCError(long err) : runtime_error("smart card API error"),error(err) SCError::SCError(long err) : runtime_error("smart card API error"),error(err)
Expand Down
6 changes: 3 additions & 3 deletions SmartCardManager.cpp
Expand Up @@ -6,9 +6,9 @@
\date $Date: 2009-07-15 21:16:04 +0300 (Wed, 15 Jul 2009) $ \date $Date: 2009-07-15 21:16:04 +0300 (Wed, 15 Jul 2009) $
*/ */
// Revision $Revision: 361 $ // Revision $Revision: 361 $
#include <smartcardpp/SmartCardManager.h> #include "SmartCardManager.h"
#include <smartcardpp/PCSCManager.h> #include "PCSCManager.h"
#include <smartcardpp/CTAPIManager.h> #include "CTAPIManager.h"
#include "common.h" #include "common.h"


enum mgrType { enum mgrType {
Expand Down
2 changes: 1 addition & 1 deletion SmartCardManager.h
Expand Up @@ -7,7 +7,7 @@
*/ */
// Revision $Revision: 361 $ // Revision $Revision: 361 $
#pragma once #pragma once
#include <smartcardpp/ManagerInterface.h> #include "ManagerInterface.h"


struct SmartCardManagerPriv; struct SmartCardManagerPriv;
struct SmartCardConnectionPriv; struct SmartCardConnectionPriv;
Expand Down
2 changes: 1 addition & 1 deletion common.h
Expand Up @@ -5,7 +5,7 @@
#include <stdexcept> #include <stdexcept>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <smartcardpp/types.h> #include "types.h"


#ifdef _WIN32 #ifdef _WIN32
#include <tchar.h> #include <tchar.h>
Expand Down
4 changes: 2 additions & 2 deletions esteid/EstEidCard.cpp
Expand Up @@ -6,8 +6,8 @@
\date $Date: 2010-02-04 08:10:53 +0200 (N, 04 veebr 2010) $ \date $Date: 2010-02-04 08:10:53 +0200 (N, 04 veebr 2010) $
*/ */
// Revision $Revision: 512 $ // Revision $Revision: 512 $
#include <smartcardpp/esteid/EstEidCard.h> #include "EstEidCard.h"
#include <smartcardpp/SCError.h> #include "SCError.h"
#include <algorithm> #include <algorithm>
#include "helperMacro.h" #include "helperMacro.h"
#include "common.h" #include "common.h"
Expand Down
4 changes: 2 additions & 2 deletions esteid/EstEidCard.h
Expand Up @@ -7,8 +7,8 @@
*/ */
// Revision $Revision: 512 $ // Revision $Revision: 512 $
#pragma once #pragma once
#include <smartcardpp/CardBase.h> #include "../CardBase.h"
#include <smartcardpp/PinString.h> #include "../PinString.h"


/// Estonian ID card class. Supplies most of the card functions /// Estonian ID card class. Supplies most of the card functions
class EstEidCard: class EstEidCard:
Expand Down
2 changes: 1 addition & 1 deletion esteid/EstEidCardMaintainer.cpp
Expand Up @@ -6,7 +6,7 @@
\date $Date: 2009-07-09 19:31:59 +0300 (Thu, 09 Jul 2009) $ \date $Date: 2009-07-09 19:31:59 +0300 (Thu, 09 Jul 2009) $
*/ */
// Revision $Revision: 351 $ // Revision $Revision: 351 $
#include <smartcardpp/esteid/EstEidCardMaintainer.h> #include "EstEidCardMaintainer.h"
#include "common.h" #include "common.h"


void EstEidCardMaintainer::performGenerateNewKeys() { void EstEidCardMaintainer::performGenerateNewKeys() {
Expand Down
2 changes: 1 addition & 1 deletion esteid/EstEidCardMaintainer.h
Expand Up @@ -7,7 +7,7 @@
*/ */
// Revision $Revision: 346 $ // Revision $Revision: 346 $
#pragma once #pragma once
#include <smartcardpp/esteid/EstEidCard.h> #include "EstEidCard.h"


/// Estonian ID card maintaier class, for generating keys and replacing certificates /// Estonian ID card maintaier class, for generating keys and replacing certificates
class EstEidCardMaintainer { class EstEidCardMaintainer {
Expand Down
2 changes: 1 addition & 1 deletion sim/SIMCard.cpp
@@ -1,4 +1,4 @@
#include <smartcardpp/sim/SIMCard.h> #include "SIMCard.h"
#include "common.h" #include "common.h"


SIMCard::SIMCard(ManagerInterface &ref) : CardBase(ref) {} SIMCard::SIMCard(ManagerInterface &ref) : CardBase(ref) {}
Expand Down
2 changes: 1 addition & 1 deletion sim/SIMCard.h
@@ -1,5 +1,5 @@
#pragma once #pragma once
#include <smartcardpp/CardBase.h> #include "../CardBase.h"


class SIMCard : class SIMCard :
public CardBase public CardBase
Expand Down
14 changes: 7 additions & 7 deletions smartcardpp.h
Expand Up @@ -3,12 +3,12 @@


//This is a main header - it inludes everything else. //This is a main header - it inludes everything else.


#include <smartcardpp/CardBase.h> #include "CardBase.h"
#include <smartcardpp/DynamicLibrary.h> #include "DynamicLibrary.h"
#include <smartcardpp/esteid/EstEidCard.h> #include "esteid/EstEidCard.h"
#include <smartcardpp/SCError.h> #include "SCError.h"
#include <smartcardpp/sim/SIMCard.h> #include "sim/SIMCard.h"
#include <smartcardpp/SmartCardManager.h> #include "SmartCardManager.h"
#include <smartcardpp/types.h> #include "types.h"


#endif // SMARTCARDPP_H #endif // SMARTCARDPP_H
2 changes: 1 addition & 1 deletion test.cpp
@@ -1,6 +1,6 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <smartcardpp/smartcardpp.h> #include "smartcardpp.h"


void validateOnPinpad() { void validateOnPinpad() {
SmartCardManager mgr; SmartCardManager mgr;
Expand Down

0 comments on commit a60d196

Please sign in to comment.