Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating import library on Windows builds #85

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -570,3 +570,4 @@ windows:
- 69-support-for-epiphan-on-windows-10
- 75-build-against-epiphan-sdk-on-windows-10-for-69
- 78-opencv-free-epiphan-on-windows-10-for-69
- 84-generate-import-library-on-windows-builds-for-69
16 changes: 16 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ endif(USE_NUMPY AND NOT BUILD_PYTHON)
# Library name
SET(NAME giftgrab)

# For generating import lib in Windows
if(WIN32)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}")
endif()

# Library include dirs
INCLUDE_DIRECTORIES(api)
INCLUDE_DIRECTORIES(utils)
Expand All @@ -187,6 +192,7 @@ SET(HEADERS
api/videosourcefactory.h
api/videotargetfactory.h
api/except.h
api/exports.h
)
SET(SOURCES
api/iobservable.cpp
Expand Down Expand Up @@ -347,6 +353,16 @@ if(BUILD_PYTHON)
LIST(APPEND INSTALLABLES ${NAME_PYTHON})
endif(BUILD_PYTHON)

# For generating import lib in Windows
if(WIN32)
INCLUDE(GenerateExportHeader)

GENERATE_EXPORT_HEADER(${NAME}
EXPORT_MACRO_NAME GG_EXPORTS
EXPORT_FILE_NAME gg_exports_win.h
STATIC_DEFINE SHARED_EXPORTS_BUILT_AS_STATIC
)
endif()

# Install
INSTALL(
Expand Down
17 changes: 9 additions & 8 deletions src/api/except.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "exports.h"
#include <stdexcept>
#include <string>

Expand All @@ -13,7 +14,7 @@ namespace gg {
//! \attention <b>In Python:</b> This exception
//! maps to \c RuntimeError
//!
class BasicException : public std::exception {
class GG_EXPORTS BasicException : public std::exception {
protected:
//!
//! \brief Exception details
Expand Down Expand Up @@ -47,7 +48,7 @@ class BasicException : public std::exception {
//! \attention <b>In Python:</b> This exception
//! maps to \c IOError
//!
class DeviceAlreadyConnected : public BasicException
class GG_EXPORTS DeviceAlreadyConnected : public BasicException
{
public:
//!
Expand All @@ -71,7 +72,7 @@ class DeviceAlreadyConnected : public BasicException
//! \attention <b>In Python:</b> This exception
//! maps to \c IOError
//!
class DeviceNotFound : public BasicException {
class GG_EXPORTS DeviceNotFound : public BasicException {
public:
//!
//! \brief
Expand All @@ -94,7 +95,7 @@ class DeviceNotFound : public BasicException {
//! \attention <b>In Python:</b> This exception
//! maps to \c IOError
//!
class DeviceOffline : public BasicException {
class GG_EXPORTS DeviceOffline : public BasicException {
public:
//!
//! \brief
Expand All @@ -117,7 +118,7 @@ class DeviceOffline : public BasicException {
//! \attention <b>In Python:</b> This exception
//! maps to \c RuntimeError
//!
class VideoTargetError : public BasicException
class GG_EXPORTS VideoTargetError : public BasicException
{
public:
//!
Expand All @@ -141,7 +142,7 @@ class VideoTargetError : public BasicException
//! \attention <b>In Python:</b> This exception
//! maps to \c RuntimeError
//!
class VideoSourceError : public BasicException
class GG_EXPORTS VideoSourceError : public BasicException
{
public:
//!
Expand All @@ -164,7 +165,7 @@ class VideoSourceError : public BasicException
//! \attention <b>In Python:</b> This exception
//! maps to \c RuntimeError
//!
class ObserverError : public BasicException
class GG_EXPORTS ObserverError : public BasicException
{
public:
//!
Expand All @@ -187,7 +188,7 @@ class ObserverError : public BasicException
//! \attention <b>In Python:</b> This exception
//! maps to \c IOError
//!
class NetworkSourceUnavailable : public BasicException
class GG_EXPORTS NetworkSourceUnavailable : public BasicException
{
public:
//!
Expand Down
7 changes: 7 additions & 0 deletions src/api/exports.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#ifdef WIN32
#include "gg_exports_win.h"
#else
#define GG_EXPORTS
#endif
3 changes: 2 additions & 1 deletion src/api/iobservable.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "exports.h"
#include "iobserver.h"
#include <vector>
#include <mutex>
Expand Down Expand Up @@ -39,7 +40,7 @@ namespace gg
//! ensuring data is promptly copied to their own
//! data buffer.
//!
class IObservable
class GG_EXPORTS IObservable
{
protected:
//!
Expand Down
3 changes: 2 additions & 1 deletion src/api/iobserver.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "exports.h"
#include "videoframe.h"

namespace gg
Expand Down Expand Up @@ -32,7 +33,7 @@ namespace gg
//! pass
//! \endcode
//!
class IObserver
class GG_EXPORTS IObserver
{
public:
//!
Expand Down
3 changes: 2 additions & 1 deletion src/api/ivideosource.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "exports.h"
#include "videoframe.h"
#include "except.h"
#include "iobservable.h"
Expand All @@ -12,7 +13,7 @@
//! This enables the underlying algorithms to be agnostic of
//! the data sources.
//!
class IVideoSource : public gg::IObservable
class GG_EXPORTS IVideoSource : public gg::IObservable
{
public:
//!
Expand Down
3 changes: 2 additions & 1 deletion src/api/ivideotarget.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "exports.h"
#include "videoframe.h"
#include "except.h"
#include "iobserver.h"
Expand All @@ -14,7 +15,7 @@ namespace gg
//! functionality to save streamed video e.g.
//! to files
//!
class IVideoTarget : public IObserver
class GG_EXPORTS IVideoTarget : public IObserver
{
protected:
//!
Expand Down
3 changes: 2 additions & 1 deletion src/api/videoframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace cv
#endif
#endif // USE_OPENCV

#include "exports.h"
#include <memory>
#include "maskframe.h"
#include "except.h"
Expand Down Expand Up @@ -44,7 +45,7 @@ enum ColourSpace
//! within a single frame object, so as to preserve temporal
//! relations and to facilitate potential stereo encoding.
//!
class VideoFrame
class GG_EXPORTS VideoFrame
{
protected:
//!
Expand Down
3 changes: 2 additions & 1 deletion src/api/videosourcefactory.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "exports.h"
#include "ivideosource.h"
#include "device.h"
#include "codec.h"
Expand All @@ -22,7 +23,7 @@ namespace gg
//! \sa IVideoSource
//! \sa Device
//!
class VideoSourceFactory
class GG_EXPORTS VideoSourceFactory
{
protected:
//!
Expand Down
3 changes: 2 additions & 1 deletion src/api/videotargetfactory.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "exports.h"
#include "macros.h"
#include "codec.h"
#include "ivideotarget.h"
Expand All @@ -19,7 +20,7 @@ namespace gg
//!
//! \sa IVideoTarget
//!
class VideoTargetFactory
class GG_EXPORTS VideoTargetFactory
{
protected:
//!
Expand Down