Skip to content

Commit ced29ab

Browse files
authored
do not use cmake export all flag for windows
* do not use cmake export all flag for windows and try to export used symbols by hand * run examples in ci for windows
1 parent 0a5d300 commit ced29ab

22 files changed

+69
-43
lines changed

.github/workflows/ci.yaml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,13 @@ jobs:
5353
shell: bash -l {0}
5454
run: |
5555
cd bld
56-
ctest -V
56+
ctest -V -R test
5757
58-
- name: Run examples
58+
- name: Run C++ examples
5959
shell: bash -l {0}
6060
run: |
61-
cd bld/examples/
62-
63-
pushd accumulator
64-
./main_accumulator .
65-
popd
66-
67-
pushd serialize
68-
./main_serialize .
69-
popd
70-
71-
pushd custom_factory_with_metadata
72-
./main_custom_factory_with_metadata .
73-
popd
74-
75-
61+
cd bld
62+
ctest -V -R example
7663
7764
- name: Install
7865
shell: bash -l {0}
@@ -123,7 +110,7 @@ jobs:
123110
-G Ninja ^
124111
-DCMAKE_BUILD_TYPE=Release ^
125112
-DXPLUGIN_BUILD_TESTS=ON ^
126-
-DXPLUGIN_BUILD_EXAMPLES=OFF ^
113+
-DXPLUGIN_BUILD_EXAMPLES=ON ^
127114
-DCMAKE_PREFIX_PATH="%CONDA_PREFIX%\Library" ^
128115
-DCMAKE_INSTALL_PREFIX="%CONDA_PREFIX%
129116
cmake --build . --config Release
@@ -132,7 +119,13 @@ jobs:
132119
shell: cmd /C CALL {0}
133120
run: |
134121
cd bld
135-
ctest -V --config Release
122+
ctest -V --config Release -R test
123+
124+
- name: Run C++ examples
125+
shell: cmd /C CALL {0}
126+
run: |
127+
cd bld
128+
ctest -V --config Release -R example
136129
137130
- name: Install
138131
shell: cmd /C CALL {0}

cmake/xplugin_add_xplugin.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ function(add_xplugin target_name)
55

66
if (WIN32)
77
# add compile definitions
8-
target_compile_definitions(${target_name} PUBLIC XPLUGIN_EXPORTS)
8+
target_compile_definitions(${target_name} PRIVATE XPLUGIN_EXPORTS)
99

10-
set_property(TARGET ${target_name} PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS true)
1110
endif()
1211

1312
set_target_properties(${target_name} PROPERTIES

examples/accumulator/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ target_compile_features(main_accumulator PRIVATE cxx_std_17)
1515
set_target_properties(main_accumulator PROPERTIES POSITION_INDEPENDENT_CODE ON)
1616

1717
xplugin_add_emscripten_main_module_flags(main_accumulator)
18+
19+
20+
# if tests are enabled, add a the example to the tests
21+
if (XPLUGIN_BUILD_TESTS)
22+
add_test(NAME example_accumulator COMMAND main_accumulator ${CMAKE_CURRENT_BINARY_DIR})
23+
endif()

examples/accumulator/accumulator_base.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
#include <string>
55
#include <vector>
66

7+
#include <xplugin/xplugin_config.hpp> // XPLUGIN_API
8+
79
namespace acc
810
{
9-
class AccumulatorBase
11+
class XPLUGIN_API AccumulatorBase
1012
{
1113
public:
1214
virtual ~AccumulatorBase()

examples/accumulator/plugin_accumulator_min.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <algorithm>
55

6-
class AccumulatorMin : public acc::AccumulatorBase
6+
class XPLUGIN_API AccumulatorMin : public acc::AccumulatorBase
77
{
88
public:
99
AccumulatorMin() = default;

examples/custom_factory_with_metadata/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ target_link_libraries(main_custom_factory_with_metadata PUBLIC xplugin_host)
1111
set_target_properties(main_custom_factory_with_metadata PROPERTIES POSITION_INDEPENDENT_CODE ON)
1212

1313
xplugin_add_emscripten_main_module_flags(main_custom_factory_with_metadata)
14+
15+
# if tests are enabled, add a the example to the tests
16+
if (XPLUGIN_BUILD_TESTS)
17+
add_test(NAME example_custom_factory_with_metadata COMMAND main_custom_factory_with_metadata ${CMAKE_CURRENT_BINARY_DIR})
18+
endif()

examples/custom_factory_with_metadata/custom_factory_with_metadata_plugin_a.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// for XPLUGIN_CREATE_XPLUGIN_FACTORY macro
44
#include <xplugin/xfactory.hpp>
55

6-
class PluginA : public PluginBase
6+
class XPLUGIN_API PluginA : public PluginBase
77
{
88
public:
99
PluginA() = default;
@@ -19,7 +19,7 @@ class PluginA : public PluginBase
1919
std::string m_b;
2020
};
2121

22-
class PluginAFactory : public PluginFactoryBase
22+
class XPLUGIN_API PluginAFactory : public PluginFactoryBase
2323
{
2424
public:
2525
using factory_base_type = PluginFactoryBase;

examples/custom_factory_with_metadata/custom_factory_with_metadata_plugin_b.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// for XPLUGIN_CREATE_XPLUGIN_FACTORY macro
44
#include <xplugin/xfactory.hpp>
55

6-
class PluginB : public PluginBase
6+
class XPLUGIN_API PluginB : public PluginBase
77
{
88
public:
99
PluginB() = default;
@@ -19,7 +19,7 @@ class PluginB : public PluginBase
1919
std::string m_b;
2020
};
2121

22-
class PluginBFactory : public PluginFactoryBase
22+
class XPLUGIN_API PluginBFactory : public PluginFactoryBase
2323
{
2424
public:
2525
using factory_base_type = PluginFactoryBase;

examples/custom_factory_with_metadata/custom_factory_with_metadata_plugin_base.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#include <memory>
55
#include <string>
66

7-
class PluginBase
7+
#include <xplugin/xplugin_config.hpp>
8+
9+
class XPLUGIN_API PluginBase
810
{
911
public:
1012
virtual ~PluginBase()
@@ -14,7 +16,7 @@ class PluginBase
1416
virtual std::string some_function() const = 0;
1517
};
1618

17-
class PluginFactoryBase
19+
class XPLUGIN_API PluginFactoryBase
1820
{
1921
public:
2022
virtual ~PluginFactoryBase() = default;

examples/fubar/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ target_link_libraries(main_fubar PUBLIC xplugin_host)
1111
set_target_properties(main_fubar PROPERTIES POSITION_INDEPENDENT_CODE ON)
1212

1313
xplugin_add_emscripten_main_module_flags(main_fubar)
14+
15+
# if tests are enabled, add a the example to the tests
16+
if (XPLUGIN_BUILD_TESTS)
17+
add_test(NAME example_fubar COMMAND main_fubar ${CMAKE_CURRENT_BINARY_DIR})
18+
endif()

0 commit comments

Comments
 (0)