Skip to content

Commit

Permalink
Wrong include folders structure, missing DLL exports
Browse files Browse the repository at this point in the history
  • Loading branch information
retifrav committed Jul 19, 2023
1 parent a4f4c3e commit b7efcfc
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 37 deletions.
2 changes: 1 addition & 1 deletion dpndnc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ target_include_directories(${PROJECT_NAME}

# without it public headers won't get installed
set(public_headers
include/thingy.h
include/Thingy/thingy.h
)

include(Installing)
29 changes: 29 additions & 0 deletions dpndnc/include/Thingy/thingy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef THINGY_H
#define THINGY_H

#ifdef Thingy_EXPORTS // CMake sets that when BUILD_SHARED_LIBS=1
#ifdef _MSC_VER // for MSVC
// export on compiling the DLL (when building)
#define DLLEXPORT __declspec(dllexport)
//#elif __GNUC__ >= 4 // for GCC
// #define DLLEXPORT __attribute__ ((visibility("default")))
#endif // any other compilers require anything like that?
#else
#ifdef _MSC_VER // for MSVC
// import on using the created DLL (when using in projects)
#define DLLEXPORT __declspec(dllimport)
//#elif __GNUC__ >= 4 // for GCC
// // something here for GCC?
#endif // any other compilers require anything like that?
#endif

#ifndef DLLEXPORT
#define DLLEXPORT // so it doesn't fail being undefined
#endif

namespace dpndnc
{
DLLEXPORT void doThingy();
}

#endif // THINGY_H
9 changes: 0 additions & 9 deletions dpndnc/include/thingy.h

This file was deleted.

1 change: 1 addition & 0 deletions dpndnc/src/thingy.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <iostream>

#include <Thingy/thingy.h>
#include "stuff.h"

namespace dpndnc
Expand Down
2 changes: 1 addition & 1 deletion prjct/libraries/AnotherLibrary/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ endif()

# without it public headers won't get installed
set(public_headers
include/another.h
include/Another/another.h
)

# to guard against against undefined BUILD_SHARED_LIBS inside Config.cmake.in,
Expand Down
35 changes: 35 additions & 0 deletions prjct/libraries/AnotherLibrary/include/Another/another.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef ANOTHER_H
#define ANOTHER_H

#ifdef AnotherLibrary_EXPORTS // CMake sets that when BUILD_SHARED_LIBS=1
#ifdef _MSC_VER // for MSVC
// export on compiling the DLL (when building)
#define DLLEXPORT __declspec(dllexport)
//#elif __GNUC__ >= 4 // for GCC
// #define DLLEXPORT __attribute__ ((visibility("default")))
#endif // any other compilers require anything like that?
#else
#ifdef _MSC_VER // for MSVC
// import on using the created DLL (when using in projects)
#define DLLEXPORT __declspec(dllimport)
//#elif __GNUC__ >= 4 // for GCC
// // something here for GCC?
#endif // any other compilers require anything like that?
#endif

#ifndef DLLEXPORT
#define DLLEXPORT // so it doesn't fail being undefined
#endif

namespace prjct
{
namespace lbrAnother
{
DLLEXPORT void doAnother();
#ifndef THINGY_INTERFACE
DLLEXPORT void doTheThing();
#endif
}
}

#endif // ANOTHER_H
13 changes: 0 additions & 13 deletions prjct/libraries/AnotherLibrary/include/another.h

This file was deleted.

1 change: 1 addition & 0 deletions prjct/libraries/AnotherLibrary/src/another.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Thingy/thingy.h>
#endif

#include <Another/another.h>
#include "stuff.h"

namespace prjct
Expand Down
2 changes: 1 addition & 1 deletion prjct/libraries/SomeLibrary/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ target_include_directories(${PROJECT_NAME}

# without it public headers won't get installed
set(public_headers
include/some.h
include/Some/some.h
)

include(Installing)
32 changes: 32 additions & 0 deletions prjct/libraries/SomeLibrary/include/Some/some.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef SOME_H
#define SOME_H

#ifdef SomeLibrary_EXPORTS // CMake sets that when BUILD_SHARED_LIBS=1
#ifdef _MSC_VER // for MSVC
// export on compiling the DLL (when building)
#define DLLEXPORT __declspec(dllexport)
//#elif __GNUC__ >= 4 // for GCC
// #define DLLEXPORT __attribute__ ((visibility("default")))
#endif // any other compilers require anything like that?
#else
#ifdef _MSC_VER // for MSVC
// import on using the created DLL (when using in projects)
#define DLLEXPORT __declspec(dllimport)
//#elif __GNUC__ >= 4 // for GCC
// // something here for GCC?
#endif // any other compilers require anything like that?
#endif

#ifndef DLLEXPORT
#define DLLEXPORT // so it doesn't fail being undefined
#endif

namespace prjct
{
namespace lbrSome
{
DLLEXPORT void doSome();
}
}

#endif // SOME_H
12 changes: 0 additions & 12 deletions prjct/libraries/SomeLibrary/include/some.h

This file was deleted.

1 change: 1 addition & 0 deletions prjct/libraries/SomeLibrary/src/some.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <iostream>

#include <Some/some.h>
#include "stuff.h"

namespace prjct
Expand Down

0 comments on commit b7efcfc

Please sign in to comment.