├── .github └── workflows │ ├── wxGTK_x86_64.yml │ ├── wxMSW_x86_32_MSBuild.yml │ ├── wxMSW_x86_64_MSBuild.yml │ └── wxOSX_arm64.yml ├── README.md ├── SampleGuiPlugin1 ├── CMakeLists.txt ├── SampleGuiPlugin1.cpp ├── SampleGuiPlugin1.def ├── SampleGuiPlugin1.h ├── SampleGuiPlugin1.pjd ├── SampleGuiPlugin1.rc ├── SampleGuiPlugin1Exports.cpp ├── SampleGuiPluginWindow1.cpp └── SampleGuiPluginWindow1.h ├── SampleGuiPlugin2 ├── CMakeLists.txt ├── SampleGuiPlugin2.cpp ├── SampleGuiPlugin2.def ├── SampleGuiPlugin2.h ├── SampleGuiPlugin2.pjd ├── SampleGuiPlugin2.rc ├── SampleGuiPlugin2Exports.cpp ├── SampleGuiPluginWindow2.cpp └── SampleGuiPluginWindow2.h ├── SampleNonGuiPlugin ├── CMakeLists.txt ├── SampleNonGuiPlugin.cpp ├── SampleNonGuiPlugin.def ├── SampleNonGuiPlugin.h └── SampleNonGuiPluginExports.cpp ├── build ├── CMakeLists.txt ├── FindPackageHandleStandardArgs.cmake ├── FindPackageMessage.cmake ├── FindwxWidgets.cmake ├── PCHSupport.cmake ├── cm.bat ├── cm.sh ├── cm64.bat ├── cm86.bat ├── cmAppleMac.sh ├── cmLinux.sh ├── wxModularHost.sln32 └── wxModularHost.sln64 ├── include ├── stdwx.cpp └── stdwx.h ├── wxGuiPluginBase ├── CMakeLists.txt ├── Declarations.h ├── wxGuiPluginBase.cpp ├── wxGuiPluginBase.h ├── wxGuiPluginBase.pjd ├── wxGuiPluginBase.rc ├── wxGuiPluginWindowBase.cpp └── wxGuiPluginWindowBase.h ├── wxModularCore ├── CMakeLists.txt ├── wxModularCore.cpp ├── wxModularCore.h ├── wxModularCoreSettings.cpp └── wxModularCoreSettings.h ├── wxModularHost ├── CMakeLists.txt ├── MainFrame.cpp ├── MainFrame.h ├── SampleModularCore.cpp ├── SampleModularCore.h ├── wxModularHost.pjd ├── wxModularHost.rc ├── wxModularHostApp.cpp └── wxModularHostApp.h └── wxNonGuiPluginBase ├── CMakeLists.txt ├── Declarations.h ├── wxNonGuiPluginBase.cpp └── wxNonGuiPluginBase.h /.github/workflows/wxGTK_x86_64.yml: -------------------------------------------------------------------------------- 1 | name: wxGTK_x86_64 2 | 3 | on: 4 | # push: 5 | # branches: '*' 6 | # pull_request: 7 | # branches: '*' 8 | # workflow_dispatch: 9 | # branches: '*' 10 | 11 | workflow_dispatch: 12 | 13 | jobs: 14 | build: 15 | 16 | runs-on: ubuntu-24.04 17 | 18 | steps: 19 | - name: Install boost 20 | uses: MarkusJx/install-boost@v2.4.5 21 | id: install-boost 22 | with: 23 | # REQUIRED: Specify the required boost version 24 | # A list of supported versions can be found here: 25 | # https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json 26 | boost_version: 1.86.0 27 | boost_install_dir: /tmp/wxModularAppOCX/boost/ 28 | 29 | - uses: actions/checkout@v4 30 | - name: Install GNU 13 compiler suite, GTK3, wxWidgets 3.2 31 | run: | 32 | sudo apt update 33 | sudo apt install -y gcc-13 g++-13 libgtk-3-dev libwxgtk3.2-dev 34 | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 110 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-12 35 | uname -a 36 | wx-config --list 37 | wx-config --cxxflags 38 | wx-config --libs 39 | g++ --version | grep g++ 40 | 41 | - name: Run CMake 42 | run: | 43 | cd build && ./cmLinux.sh && cd .. 44 | env: 45 | BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} 46 | 47 | - name: Run GNU Make with GNU compiler 48 | run: | 49 | cd build/LinuxRelease && make && cd ../.. 50 | cp --preserve=links /usr/lib/x86_64-linux-gnu/libwx*.so* build/bin/Release/ 51 | 52 | - uses: actions/upload-artifact@v4 53 | with: 54 | name: artifacts_wxGTK_Linux_x86_64 55 | path: build/bin/Release 56 | -------------------------------------------------------------------------------- /.github/workflows/wxMSW_x86_32_MSBuild.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | name: wxMSW_x86_32_MSBuild 7 | 8 | on: 9 | # push: 10 | # branches: [ "master" ] 11 | # pull_request: 12 | # branches: [ "master" ] 13 | workflow_dispatch: 14 | 15 | env: 16 | BUILD_CONFIGURATION: Debug 17 | BUILD_TYPE: Debug 18 | 19 | permissions: 20 | contents: read 21 | 22 | jobs: 23 | build: 24 | runs-on: windows-latest 25 | 26 | steps: 27 | - uses: actions/checkout@v4 28 | 29 | - name: Add MSBuild to PATH 30 | uses: microsoft/setup-msbuild@v1.0.2 31 | 32 | - name: Install boost 33 | uses: MarkusJx/install-boost@v2.4.5 34 | id: install-boost 35 | with: 36 | # REQUIRED: Specify the required boost version 37 | # A list of supported versions can be found here: 38 | # https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json 39 | boost_version: 1.86.0 40 | toolset: msvc 41 | 42 | - name: Install wxWidgets 43 | run: | 44 | mkdir wxWidgets_MSW32 | Out-Null 45 | cd wxWidgets_MSW32 46 | curl -OL https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.5/wxWidgets-3.2.5-headers.7z 47 | curl -OL https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.5/wxMSW-3.2.5_vc14x_Dev.7z 48 | 7z x wxWidgets-3.2.5-headers.7z 49 | 7z x wxMSW-3.2.5_vc14x_Dev.7z 50 | cd .. 51 | 52 | - name: Execute CMake 53 | run: cd build && cmd /c "set WXWIN=%cd%\..\wxWidgets_MSW32 && cm86.bat" && cd .. 54 | env: 55 | BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} 56 | 57 | - name: Run MSBuild 58 | run: | 59 | cd build\Win && msbuild wxModularHost.sln && cd ..\.. 60 | copy wxWidgets_MSW32\lib\vc14x_dll\*.dll build\bin\Debug 61 | 62 | - uses: actions/upload-artifact@v4 63 | with: 64 | name: artifacts_wxMSW_x86_32_MSBuild 65 | path: build/bin/Debug/ 66 | -------------------------------------------------------------------------------- /.github/workflows/wxMSW_x86_64_MSBuild.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | name: wxMSW_x86_64_MSBuild 7 | 8 | on: 9 | # push: 10 | # branches: [ "master" ] 11 | # pull_request: 12 | # branches: [ "master" ] 13 | workflow_dispatch: 14 | 15 | env: 16 | BUILD_CONFIGURATION: Debug 17 | BUILD_TYPE: Debug 18 | 19 | permissions: 20 | contents: read 21 | 22 | jobs: 23 | build: 24 | runs-on: windows-latest 25 | 26 | steps: 27 | - uses: actions/checkout@v4 28 | 29 | - name: Add MSBuild to PATH 30 | uses: microsoft/setup-msbuild@v1.0.2 31 | 32 | - name: Install boost 33 | uses: MarkusJx/install-boost@v2.4.5 34 | id: install-boost 35 | with: 36 | # REQUIRED: Specify the required boost version 37 | # A list of supported versions can be found here: 38 | # https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json 39 | boost_version: 1.86.0 40 | toolset: msvc 41 | 42 | - name: Install wxWidgets 43 | run: | 44 | mkdir wxWidgets_MSW64 | Out-Null 45 | cd wxWidgets_MSW64 46 | curl -OL https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.5/wxWidgets-3.2.5-headers.7z 47 | curl -OL https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.5/wxMSW-3.2.5_vc14x_x64_Dev.7z 48 | 7z x wxWidgets-3.2.5-headers.7z 49 | 7z x wxMSW-3.2.5_vc14x_x64_Dev.7z 50 | cd .. 51 | 52 | - name: Execute CMake 53 | run: cd build && cmd /c "set WXWIN=%cd%\..\wxWidgets_MSW64 && cm64.bat" && cd .. 54 | env: 55 | BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} 56 | 57 | - name: Run MSBuild 58 | run: | 59 | cd build\Win && msbuild wxModularHost.sln && cd ..\.. 60 | copy wxWidgets_MSW64\lib\vc14x_x64_dll\*.dll build\bin\Debug 61 | 62 | - uses: actions/upload-artifact@v4 63 | with: 64 | name: artifacts_wxMSW_x86_64_MSBuild 65 | path: build/bin/Debug/ 66 | -------------------------------------------------------------------------------- /.github/workflows/wxOSX_arm64.yml: -------------------------------------------------------------------------------- 1 | name: wxOSX_arm64 2 | 3 | on: 4 | # push: 5 | # branches: '*' 6 | # pull_request: 7 | # branches: '*' 8 | # workflow_dispatch: 9 | # branches: '*' 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: macos-14 16 | 17 | steps: 18 | - name: Install boost 19 | uses: MarkusJx/install-boost@v2.4.5 20 | id: install-boost 21 | with: 22 | # REQUIRED: Specify the required boost version 23 | # A list of supported versions can be found here: 24 | # https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json 25 | boost_version: 1.86.0 26 | boost_install_dir: /tmp/wxModularAppOCX/boost/ 27 | 28 | - uses: actions/checkout@v4 29 | - name: Install wxWidgets 30 | run: | 31 | curl -L https://download.osgeo.org/libtiff/tiff-4.6.0.tar.gz --output tiff-4.6.0.tar.gz 32 | tar xzf tiff-4.6.0.tar.gz 33 | cd tiff-4.6.0 34 | ./configure 35 | make -j$(getconf _NPROCESSORS_ONLN) 36 | sudo make install 37 | cd .. 38 | curl -L https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.5/wxWidgets-3.2.5.tar.bz2 --output wxWidgets-3.2.5.tar.bz2 39 | tar xjf wxWidgets-3.2.5.tar.bz2 40 | cd wxwidgets-3.2.5 41 | mkdir buildOSX 42 | cd buildOSX 43 | ../configure --enable-debug 44 | make -j$(getconf _NPROCESSORS_ONLN) 45 | sudo make install 46 | cd ../.. 47 | wx-config --list 48 | wx-config --cxxflags 49 | wx-config --libs 50 | 51 | - name: Run CMake 52 | run: | 53 | cd build 54 | chmod +x ./cmAppleMac.sh 55 | ./cmAppleMac.sh 56 | cd .. 57 | env: 58 | BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} 59 | 60 | - name: Run GNU Make with GNU compiler 61 | run: | 62 | cd build 63 | mkdir -p bin 64 | mkdir -p bin/Debug 65 | cd Mac 66 | make VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN) 67 | cd ../.. 68 | cp wxWidgets-3.2.5/buildOSX/lib/*.dylib build/bin/wxModularHost.app/Contents 69 | 70 | - uses: actions/upload-artifact@v4 71 | with: 72 | name: artifacts_wxOSX_arm64 73 | path: build/bin/wxModularHost.app/Contents 74 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | wxModularApp 2 | ============ 3 | 4 | Cross-Platform Modular Application (Main app + plugins) example for C++/wxWidgets 5 | 6 | Requirements 7 | ------------ 8 | * Compiled shared (DLL Debug/DLL Release) version of wxWidgets. [Git Master](https://github.com/wxWidgets/wxWidgets) or official [3.0.x](http://wxwidgets.org/downloads/) release should work fine. 9 | * [CMake](http://www.cmake.org/) - v3.16 or later is required on all platforms. It is used for creating 10 | * Visual Studio projects under Windows 11 | * Makefiles under Linux 12 | * XCode projects under OS X 13 | * Under Windows `%WXWIN%` environment variable is required. Should point to wxWidgets source folder (e.g. `C:\libs\wxWidgets-svn`) 14 | * Ensure that you have only `vc_dll` subfolder in `%WXWIN%/libs`. If you have `vc_lib*` folders (contain static build of wxWidgets) then rename them temporary. 15 | 16 | wxWidgets Build Commands for Linux and OS X 17 | ------------------------------------------- 18 | Debug: 19 | 20 | `configure --enable-shared --disable-static --enable-unicode --disable-compat28 --disable-final --enable-debug` 21 | 22 | Release: 23 | 24 | `configure --enable-shared --disable-static --enable-unicode --disable-compat28 --enable-final --disable-debug` 25 | 26 | Compilation under Windows 27 | ------------------------- 28 | * Open Visual Studio console ("Start menu -> VS2015 x86 Native Tools Command Prompt" or x64 native tools for x64 build) 29 | * Navigate to `/build` folder 30 | * Edit `cm86.bat` (or `cm64.bat` for x64 build, or `cm.bat` which auto-detects the platform) if needed and put the correct CMake generator name to the command line which executes CMake. You can find the list of CMake generators in CMake GUI or using the CMake command line. For Visual Studio 2019 this will be `Visual Studio 16 2019`. For older versions of Visual Studio it may vary depending on Visual Studio version and target architecture. 31 | * Execute `cm86.bat` (or `cm64.bat` for x64 build, or `cm.bat` which auto-detects the platform) 32 | * The batch file will execute CMake and after that you will get Visual Studio project files in /build/Win folder 33 | * Build the solution in Visual Studio or using msbuild 34 | 35 | Compilation under Linux 36 | ----------------------- 37 | * Open `/build` folder in console 38 | * Execute `cmLinux.sh` script 39 | * The script will create LinuxDebug and LinuxRelease folders with Makefiles. 40 | * Go to LinuxRelease (or to LinuxDebug for debug build) 41 | * Execute `make` 42 | 43 | Compilation under OS X 44 | ---------------------- 45 | * Open `/build` folder in terminal 46 | * Execute `cm.sh` script 47 | * The script will create XCode project in Mac subfolder 48 | * Go to Mac subfolder 49 | * Execute `xcodebuild build` command or build the project from XCode 50 | -------------------------------------------------------------------------------- /SampleGuiPlugin1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (SRCS 2 | SampleGuiPlugin1.cpp 3 | SampleGuiPlugin1Exports.cpp 4 | SampleGuiPluginWindow1.cpp) 5 | set (HEADERS 6 | SampleGuiPlugin1.h 7 | SampleGuiPluginWindow1.h) 8 | 9 | set(LIBRARY_NAME SampleGuiPlugin1) 10 | 11 | if(WIN32) 12 | set(SRCS ${SRCS} ${LIBRARY_NAME}.rc ${LIBRARY_NAME}.def) 13 | set(PREPROCESSOR_DEFINITIONS ${PREPROCESSOR_DEFINITIONS};/D_USRDLL;/D__STDC_CONSTANT_MACROS) 14 | set(LINK_DIRECTORIES 15 | ${PROJECT_ROOT_DIR}/wxGuiPluginBase/${OS_BASE_NAME}${LIB_SUFFIX}/$(ConfigurationName)) 16 | set(DEMO_LIBS wxGuiPluginBase.lib) 17 | endif(WIN32) 18 | if(LINUX OR APPLE) 19 | set(DEMO_LIBS wxGuiPluginBase) 20 | SET(CMAKE_SKIP_BUILD_RPATH FALSE) 21 | SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 22 | SET(CMAKE_INSTALL_RPATH ".:./../../") 23 | endif(LINUX OR APPLE) 24 | 25 | set(SRCS ${SRCS} ${HEADERS} 26 | ${PROJECT_ROOT_DIR}/include/stdwx.h 27 | ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 28 | 29 | add_definitions(${PREPROCESSOR_DEFINITIONS}) 30 | 31 | include_directories(${INCLUDE_DIRECTORIES} ${BASE_INCLUDE_DIRECTORIES} 32 | ${PROJECT_ROOT_DIR}/wxGuiPluginBase) 33 | 34 | link_directories(${LINK_DIRECTORIES}) 35 | 36 | add_library(${LIBRARY_NAME} SHARED ${SRCS}) 37 | 38 | set(DLL_DIR bin) 39 | if(APPLE) 40 | set(BUNDLE_SUBFOLDER 41 | "/$(CONFIGURATION)/${PROJECT_NAME}.app/Contents/PlugIns") 42 | endif(APPLE) 43 | if(WIN32) 44 | set(TARGET_LOCATION 45 | ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}/${CMAKE_CFG_INTDIR}/plugins/gui) 46 | elseif (LINUX) 47 | set(TARGET_LOCATION 48 | ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}${BUNDLE_SUBFOLDER}/plugins/gui) 49 | else() 50 | set(TARGET_LOCATION 51 | ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}${BUNDLE_SUBFOLDER}/gui) 52 | endif(WIN32) 53 | if(LINUX OR APPLE) 54 | get_target_property(RESULT_FULL_PATH ${LIBRARY_NAME} LOCATION) 55 | get_filename_component(RESULT_FILE_NAME ${RESULT_FULL_PATH} NAME) 56 | endif(LINUX OR APPLE) 57 | set_target_properties(${LIBRARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TARGET_LOCATION}) 58 | 59 | target_link_libraries(${LIBRARY_NAME} ${DEMO_LIBS} ${wxWidgets_LIBRARIES}) 60 | 61 | add_dependencies(${LIBRARY_NAME} wxGuiPluginBase) 62 | 63 | target_precompile_headers(${LIBRARY_NAME} PRIVATE ${PROJECT_ROOT_DIR}/include/stdwx.h ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 64 | 65 | if(APPLE) 66 | FOREACH(DEP_LIB ${DEMO_LIBS}) 67 | get_filename_component(ABS_ROOT_DIR ${PROJECT_ROOT_DIR} ABSOLUTE) 68 | set(LIBNAME_FULL "${ABS_ROOT_DIR}/${DEP_LIB}/${OS_BASE_NAME}${LIB_SUFFIX}/$(CONFIGURATION)/lib${DEP_LIB}.dylib") 69 | add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD 70 | COMMAND install_name_tool -change "${LIBNAME_FULL}" "@executable_path/../Frameworks/lib${DEP_LIB}.dylib" $) 71 | ENDFOREACH(DEP_LIB) 72 | endif(APPLE) 73 | if(LINUX OR APPLE) 74 | add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD 75 | COMMAND ${CMAKE_COMMAND} -E make_directory ${TARGET_LOCATION} 76 | COMMAND ${CMAKE_COMMAND} -E copy $ ${TARGET_LOCATION}/${RESULT_FILE_NAME} 77 | ) 78 | endif(LINUX OR APPLE) 79 | -------------------------------------------------------------------------------- /SampleGuiPlugin1/SampleGuiPlugin1.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include "SampleGuiPlugin1.h" 3 | #include "SampleGuiPluginWindow1.h" 4 | 5 | IMPLEMENT_DYNAMIC_CLASS(SampleGuiPlugin1, wxObject) 6 | 7 | SampleGuiPlugin1::SampleGuiPlugin1() 8 | : wxGuiPluginBase(NULL) 9 | { 10 | 11 | } 12 | 13 | SampleGuiPlugin1::SampleGuiPlugin1(wxEvtHandler * handler) 14 | : wxGuiPluginBase(handler) 15 | { 16 | } 17 | 18 | SampleGuiPlugin1::~SampleGuiPlugin1() 19 | { 20 | } 21 | 22 | wxString SampleGuiPlugin1::GetName() const 23 | { 24 | return _("GUI Plugin 1"); 25 | } 26 | 27 | wxString SampleGuiPlugin1::GetId() const 28 | { 29 | return wxT("{4E97DF66-5FBB-4719-AF17-76C1C82D3FE1}"); 30 | } 31 | 32 | wxWindow * SampleGuiPlugin1::CreatePanel(wxWindow * parent) 33 | { 34 | return new SampleGuiPluginWindow1(this, parent); 35 | } 36 | -------------------------------------------------------------------------------- /SampleGuiPlugin1/SampleGuiPlugin1.def: -------------------------------------------------------------------------------- 1 | LIBRARY "SampleGuiPlugin1" 2 | 3 | EXPORTS 4 | CreatePlugin=CreatePlugin 5 | DeletePlugin=DeletePlugin -------------------------------------------------------------------------------- /SampleGuiPlugin1/SampleGuiPlugin1.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class SampleGuiPlugin1 : public wxGuiPluginBase 6 | { 7 | DECLARE_DYNAMIC_CLASS(SampleGuiPlugin1) 8 | public: 9 | SampleGuiPlugin1(); 10 | SampleGuiPlugin1(wxEvtHandler * handler); 11 | virtual ~SampleGuiPlugin1(); 12 | 13 | virtual wxString GetName() const; 14 | virtual wxString GetId() const; 15 | virtual wxWindow * CreatePanel(wxWindow * parent); 16 | }; -------------------------------------------------------------------------------- /SampleGuiPlugin1/SampleGuiPlugin1.pjd: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 0 5 | "" 6 | "" 7 | "" 8 | "" 9 | "" 10 | 0 11 | 0 12 | 0 13 | 1 14 | 1 15 | 1 16 | 1 17 | 0 18 | "Volodymyr (T-Rex) Triapichko" 19 | "Volodymyr (T-Rex) Triapichko, 2013" 20 | "" 21 | 0 22 | 0 23 | 0 24 | 0 25 | "<All platforms>" 26 | "2.9.5" 27 | "Standard" 28 | "///////////////////////////////////////////////////////////////////////////// 29 | // Name: %HEADER-FILENAME% 30 | // Purpose: 31 | // Author: %AUTHOR% 32 | // Modified by: 33 | // Created: %DATE% 34 | // RCS-ID: 35 | // Copyright: %COPYRIGHT% 36 | // Licence: 37 | ///////////////////////////////////////////////////////////////////////////// 38 | 39 | " 40 | "///////////////////////////////////////////////////////////////////////////// 41 | // Name: %SOURCE-FILENAME% 42 | // Purpose: 43 | // Author: %AUTHOR% 44 | // Modified by: 45 | // Created: %DATE% 46 | // RCS-ID: 47 | // Copyright: %COPYRIGHT% 48 | // Licence: 49 | ///////////////////////////////////////////////////////////////////////////// 50 | 51 | " 52 | "///////////////////////////////////////////////////////////////////////////// 53 | // Name: %SYMBOLS-FILENAME% 54 | // Purpose: Symbols file 55 | // Author: %AUTHOR% 56 | // Modified by: 57 | // Created: %DATE% 58 | // RCS-ID: 59 | // Copyright: %COPYRIGHT% 60 | // Licence: 61 | ///////////////////////////////////////////////////////////////////////////// 62 | 63 | " 64 | "" 65 | "// For compilers that support precompilation, includes "wx/wx.h". 66 | #include "wx/wxprec.h" 67 | 68 | #ifdef __BORLANDC__ 69 | #pragma hdrstop 70 | #endif 71 | 72 | #ifndef WX_PRECOMP 73 | #include "wx/wx.h" 74 | #endif 75 | 76 | " 77 | " /// %BODY% 78 | " 79 | " 80 | /* 81 | * %BODY% 82 | */ 83 | 84 | " 85 | "app_resources.h" 86 | "app_resources.cpp" 87 | "AppResources" 88 | "app.h" 89 | "app.cpp" 90 | "Application" 91 | 0 92 | "" 93 | "<None>" 94 | "iso-8859-1" 95 | "utf-8" 96 | "utf-8" 97 | "" 98 | 0 99 | 0 100 | 4 101 | " " 102 | "" 103 | 0 104 | 0 105 | 1 106 | 0 107 | 1 108 | 1 109 | 0 110 | 1 111 | 0 112 | 0 113 |
114 | 115 | 116 | "" 117 | "data-document" 118 | "" 119 | "" 120 | 0 121 | 1 122 | 0 123 | 0 124 | 125 | "Configurations" 126 | "config-data-document" 127 | "" 128 | "" 129 | 0 130 | 1 131 | 0 132 | 0 133 | "" 134 | 1 135 | -8519680 136 | "" 137 | "Debug" 138 | "Unicode" 139 | "Static" 140 | "Modular" 141 | "GUI" 142 | "wxMSW" 143 | "Default" 144 | "Dynamic" 145 | "Yes" 146 | "No" 147 | "Yes" 148 | "No" 149 | "No" 150 | "Yes" 151 | "Yes" 152 | "Yes" 153 | "Yes" 154 | "Yes" 155 | "builtin" 156 | "Yes" 157 | "%EXECUTABLE%" 158 | "" 159 | "%AUTO%" 160 | "%AUTO%" 161 | "%AUTO%" 162 | "%AUTO%" 163 | "%WXVERSION%" 164 | "%AUTO%" 165 | "%AUTO%" 166 | "%AUTO%" 167 | "%AUTO%" 168 | "%AUTO%" 169 | "" 170 | "%AUTO%" 171 | "%AUTO%" 172 | "%AUTO%" 173 | "%AUTO%" 174 | "%AUTO%" 175 | "%AUTO%" 176 | "%AUTO%" 177 | "%AUTO%" 178 | "%AUTO%" 179 | "%AUTO%" 180 | "%AUTO%" 181 | "%AUTO%" 182 | "%AUTO%" 183 | "%AUTO%" 184 | "%AUTO%" 185 | "%AUTO%" 186 | "%AUTO%" 187 | "%AUTO%" 188 | "%AUTO%" 189 | "%AUTO%" 190 | "%AUTO%" 191 | "%AUTO%" 192 | 0 193 | 1 194 | 195 | 196 | 197 | 198 | 199 | 200 | "Projects" 201 | "root-document" 202 | "" 203 | "project" 204 | 1 205 | 1 206 | 0 207 | 1 208 | 209 | "Windows" 210 | "html-document" 211 | "" 212 | "dialogsfolder" 213 | 1 214 | 1 215 | 0 216 | 1 217 | 218 | "SampleGuiPluginWindow1" 219 | "dialog-document" 220 | "" 221 | "dialog" 222 | 0 223 | 1 224 | 0 225 | 0 226 | "wbDialogProxy" 227 | 10000 228 | 0 229 | "" 230 | 0 231 | "" 232 | "Standard" 233 | 0 234 | 0 235 | "ID_SAMPLEGUIPLUGINWINDOW1" 236 | 10000 237 | "SampleGuiPluginWindow1" 238 | "wxGuiPluginWindowBase" 239 | "wxPanel" 240 | "SampleGuiPluginWindow1.cpp" 241 | "SampleGuiPluginWindow1.h" 242 | "" 243 | "SampleGuiPluginWindow1" 244 | 1 245 | "" 246 | 0 247 | "" 248 | "" 249 | "" 250 | "" 251 | "" 252 | 0 253 | 1 254 | "<Any platform>" 255 | "" 256 | "" 257 | "" 258 | "" 259 | "" 260 | "" 261 | "Tiled" 262 | 0 263 | 0 264 | 0 265 | 0 266 | 0 267 | 0 268 | 0 269 | 0 270 | 0 271 | 1 272 | 0 273 | 0 274 | 0 275 | 0 276 | 0 277 | 0 278 | 0 279 | 0 280 | 0 281 | 0 282 | 0 283 | 1 284 | 0 285 | 0 286 | 0 287 | "" 288 | 0 289 | 1 290 | -1 291 | -1 292 | 400 293 | 300 294 | 0 295 | "" 296 | 297 | "wxBoxSizer V" 298 | "dialog-control-document" 299 | "" 300 | "sizer" 301 | 0 302 | 1 303 | 0 304 | 0 305 | "wbBoxSizerProxy" 306 | "Vertical" 307 | "" 308 | 0 309 | 0 310 | 0 311 | 0 312 | "<Any platform>" 313 | 314 | "wxStaticText: wxID_STATIC" 315 | "dialog-control-document" 316 | "" 317 | "statictext" 318 | 0 319 | 1 320 | 0 321 | 0 322 | "wbStaticTextProxy" 323 | "wxID_STATIC" 324 | 5105 325 | "" 326 | "wxStaticText" 327 | "wxStaticText" 328 | 1 329 | 0 330 | "" 331 | "" 332 | "" 333 | "Enter some text here:" 334 | -1 335 | "" 336 | "" 337 | "" 338 | "" 339 | "" 340 | 0 341 | 1 342 | "<Any platform>" 343 | "" 344 | "" 345 | "" 346 | "" 347 | "" 348 | "" 349 | "" 350 | 0 351 | 0 352 | 0 353 | 0 354 | 0 355 | 0 356 | 0 357 | 0 358 | 0 359 | 0 360 | 0 361 | 0 362 | 0 363 | 0 364 | "" 365 | -1 366 | -1 367 | -1 368 | -1 369 | "Left" 370 | "Centre" 371 | 0 372 | 5 373 | 1 374 | 1 375 | 1 376 | 0 377 | 0 378 | 0 379 | 0 380 | 0 381 | "" 382 | "" 383 | 384 | 385 | "wxTextCtrl: ID_SAMPLE_TEXTCTRL" 386 | "dialog-control-document" 387 | "" 388 | "textctrl" 389 | 0 390 | 1 391 | 0 392 | 0 393 | "wbTextCtrlProxy" 394 | "ID_SAMPLE_TEXTCTRL" 395 | 10001 396 | "" 397 | "wxTextCtrl" 398 | "wxTextCtrl" 399 | 1 400 | 0 401 | "" 402 | "" 403 | "m_SamppleTextCtrl" 404 | "Hello, GUI Plugin 2!" 405 | 0 406 | "" 407 | "" 408 | "" 409 | "" 410 | "" 411 | 0 412 | 1 413 | "<Any platform>" 414 | "" 415 | "" 416 | "" 417 | "" 418 | "" 419 | "" 420 | "" 421 | 0 422 | 0 423 | 0 424 | 0 425 | 0 426 | 0 427 | 0 428 | 0 429 | 0 430 | 0 431 | 0 432 | 0 433 | 0 434 | 0 435 | 0 436 | 0 437 | 0 438 | 0 439 | 0 440 | 0 441 | 0 442 | 0 443 | 0 444 | 0 445 | 0 446 | 0 447 | "" 448 | -1 449 | -1 450 | -1 451 | -1 452 | "Expand" 453 | "Centre" 454 | 0 455 | 5 456 | 1 457 | 1 458 | 1 459 | 0 460 | 0 461 | 0 462 | 0 463 | 0 464 | "" 465 | "" 466 | 467 | 468 | "wxButton: ID_SEND_EVENT_BUTTON" 469 | "dialog-control-document" 470 | "" 471 | "dialogcontrol" 472 | 0 473 | 1 474 | 0 475 | 0 476 | "wbButtonProxy" 477 | "wxEVT_COMMAND_BUTTON_CLICKED|OnSENDEVENTBUTTONClick|NONE||SampleGuiPluginWindow1" 478 | "ID_SEND_EVENT_BUTTON" 479 | 10002 480 | "" 481 | "wxButton" 482 | "wxButton" 483 | 1 484 | 0 485 | "" 486 | "" 487 | "" 488 | "Send event" 489 | 0 490 | "" 491 | "" 492 | "" 493 | "" 494 | "" 495 | "" 496 | "" 497 | "" 498 | "" 499 | "" 500 | "" 501 | "" 502 | 0 503 | 1 504 | "<Any platform>" 505 | 0 506 | 0 507 | 0 508 | 0 509 | 0 510 | 0 511 | 0 512 | 0 513 | 0 514 | "" 515 | -1 516 | -1 517 | -1 518 | -1 519 | "Centre" 520 | "Centre" 521 | 0 522 | 5 523 | 1 524 | 1 525 | 1 526 | 1 527 | 0 528 | 0 529 | 0 530 | 0 531 | "" 532 | "" 533 | 534 | 535 | 536 | 537 | 538 | "Sources" 539 | "html-document" 540 | "" 541 | "sourcesfolder" 542 | 1 543 | 1 544 | 0 545 | 1 546 | 547 | "SampleGuiPlugin1.rc" 548 | "source-editor-document" 549 | "SampleGuiPlugin1.rc" 550 | "source-editor" 551 | 0 552 | 0 553 | 1 554 | 0 555 | "10/9/2013" 556 | "" 557 | 558 | 559 | 560 | "Images" 561 | "html-document" 562 | "" 563 | "bitmapsfolder" 564 | 1 565 | 1 566 | 0 567 | 1 568 | 569 | 570 | 571 | 572 |
573 | -------------------------------------------------------------------------------- /SampleGuiPlugin1/SampleGuiPlugin1.rc: -------------------------------------------------------------------------------- 1 | #include "wx/msw/wx.rc" 2 | -------------------------------------------------------------------------------- /SampleGuiPlugin1/SampleGuiPlugin1Exports.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include 3 | #include "SampleGuiPlugin1.h" 4 | 5 | PLUGIN_EXPORTED_API wxGuiPluginBase * CreatePlugin() 6 | { 7 | return new SampleGuiPlugin1; 8 | } 9 | 10 | PLUGIN_EXPORTED_API void DeletePlugin(wxGuiPluginBase * plugin) 11 | { 12 | wxDELETE(plugin); 13 | } 14 | -------------------------------------------------------------------------------- /SampleGuiPlugin1/SampleGuiPluginWindow1.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Name: SampleGuiPluginWindow1.cpp 3 | // Purpose: 4 | // Author: Volodymyr (T-Rex) Triapichko 5 | // Modified by: 6 | // Created: 10/09/2013 00:01:49 7 | // RCS-ID: 8 | // Copyright: Volodymyr (T-Rex) Triapichko, 2013 9 | // Licence: 10 | ///////////////////////////////////////////////////////////////////////////// 11 | 12 | // For compilers that support precompilation, includes "wx/wx.h". 13 | #include "wx/wxprec.h" 14 | 15 | #ifdef __BORLANDC__ 16 | #pragma hdrstop 17 | #endif 18 | 19 | #ifndef WX_PRECOMP 20 | #include "wx/wx.h" 21 | #endif 22 | 23 | ////@begin includes 24 | ////@end includes 25 | 26 | #include "SampleGuiPluginWindow1.h" 27 | #include 28 | 29 | ////@begin XPM images 30 | ////@end XPM images 31 | 32 | 33 | /* 34 | * SampleGuiPluginWindow1 type definition 35 | */ 36 | 37 | IMPLEMENT_DYNAMIC_CLASS( SampleGuiPluginWindow1, wxGuiPluginWindowBase ) 38 | 39 | 40 | /* 41 | * SampleGuiPluginWindow1 event table definition 42 | */ 43 | 44 | BEGIN_EVENT_TABLE( SampleGuiPluginWindow1, wxGuiPluginWindowBase ) 45 | 46 | ////@begin SampleGuiPluginWindow1 event table entries 47 | EVT_BUTTON( ID_SEND_EVENT_BUTTON, SampleGuiPluginWindow1::OnSENDEVENTBUTTONClick ) 48 | ////@end SampleGuiPluginWindow1 event table entries 49 | 50 | END_EVENT_TABLE() 51 | 52 | 53 | /* 54 | * SampleGuiPluginWindow1 constructors 55 | */ 56 | 57 | SampleGuiPluginWindow1::SampleGuiPluginWindow1() 58 | { 59 | Init(); 60 | } 61 | 62 | SampleGuiPluginWindow1::SampleGuiPluginWindow1( wxGuiPluginBase * plugin, 63 | wxWindow* parent, wxWindowID id, 64 | const wxPoint& pos, const wxSize& size, 65 | long style ) 66 | { 67 | Init(); 68 | Create(plugin, parent, id, pos, size, style); 69 | } 70 | 71 | 72 | /* 73 | * SampleGuiPluginWindow1 creator 74 | */ 75 | 76 | bool SampleGuiPluginWindow1::Create(wxGuiPluginBase * plugin, 77 | wxWindow* parent, wxWindowID id, 78 | const wxPoint& pos, const wxSize& size, 79 | long style ) 80 | { 81 | wxGuiPluginWindowBase::Create(plugin, parent, id, pos, size, style ); 82 | 83 | CreateControls(); 84 | if (GetSizer()) 85 | { 86 | GetSizer()->SetSizeHints(this); 87 | } 88 | Centre(); 89 | return true; 90 | } 91 | 92 | 93 | /* 94 | * SampleGuiPluginWindow1 destructor 95 | */ 96 | 97 | SampleGuiPluginWindow1::~SampleGuiPluginWindow1() 98 | { 99 | ////@begin SampleGuiPluginWindow1 destruction 100 | ////@end SampleGuiPluginWindow1 destruction 101 | } 102 | 103 | 104 | /* 105 | * Member initialisation 106 | */ 107 | 108 | void SampleGuiPluginWindow1::Init() 109 | { 110 | ////@begin SampleGuiPluginWindow1 member initialisation 111 | m_SamppleTextCtrl = NULL; 112 | ////@end SampleGuiPluginWindow1 member initialisation 113 | } 114 | 115 | 116 | /* 117 | * Control creation for SampleGuiPluginWindow1 118 | */ 119 | 120 | void SampleGuiPluginWindow1::CreateControls() 121 | { 122 | ////@begin SampleGuiPluginWindow1 content construction 123 | SampleGuiPluginWindow1* itemGuiPluginWindowBase1 = this; 124 | 125 | wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); 126 | itemGuiPluginWindowBase1->SetSizer(itemBoxSizer2); 127 | 128 | wxStaticText* itemStaticText3 = new wxStaticText( itemGuiPluginWindowBase1, wxID_STATIC, _("Enter some text here:"), wxDefaultPosition, wxDefaultSize, 0 ); 129 | itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); 130 | 131 | m_SamppleTextCtrl = new wxTextCtrl( itemGuiPluginWindowBase1, ID_SAMPLE_TEXTCTRL, _("Hello, GUI Plugin 2!"), wxDefaultPosition, wxDefaultSize, 0 ); 132 | itemBoxSizer2->Add(m_SamppleTextCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); 133 | 134 | wxButton* itemButton5 = new wxButton( itemGuiPluginWindowBase1, ID_SEND_EVENT_BUTTON, _("Send event"), wxDefaultPosition, wxDefaultSize, 0 ); 135 | itemBoxSizer2->Add(itemButton5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); 136 | 137 | ////@end SampleGuiPluginWindow1 content construction 138 | } 139 | 140 | 141 | /* 142 | * Should we show tooltips? 143 | */ 144 | 145 | bool SampleGuiPluginWindow1::ShowToolTips() 146 | { 147 | return true; 148 | } 149 | 150 | /* 151 | * Get bitmap resources 152 | */ 153 | 154 | wxBitmap SampleGuiPluginWindow1::GetBitmapResource( const wxString& name ) 155 | { 156 | // Bitmap retrieval 157 | ////@begin SampleGuiPluginWindow1 bitmap retrieval 158 | wxUnusedVar(name); 159 | return wxNullBitmap; 160 | ////@end SampleGuiPluginWindow1 bitmap retrieval 161 | } 162 | 163 | /* 164 | * Get icon resources 165 | */ 166 | 167 | wxIcon SampleGuiPluginWindow1::GetIconResource( const wxString& name ) 168 | { 169 | // Icon retrieval 170 | ////@begin SampleGuiPluginWindow1 icon retrieval 171 | wxUnusedVar(name); 172 | return wxNullIcon; 173 | ////@end SampleGuiPluginWindow1 icon retrieval 174 | } 175 | 176 | 177 | /* 178 | * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SEND_EVENT_BUTTON 179 | */ 180 | 181 | void SampleGuiPluginWindow1::OnSENDEVENTBUTTONClick( wxCommandEvent& event ) 182 | { 183 | wxCommandEvent e(wxEVT_GUI_PLUGIN_INTEROP); 184 | e.SetString(m_SamppleTextCtrl->GetValue()); 185 | GetPlugin()->GetEventHandler()->AddPendingEvent(e); 186 | 187 | ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SEND_EVENT_BUTTON in SampleGuiPluginWindow1. 188 | // Before editing this code, remove the block markers. 189 | event.Skip(); 190 | ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SEND_EVENT_BUTTON in SampleGuiPluginWindow1. 191 | } 192 | 193 | -------------------------------------------------------------------------------- /SampleGuiPlugin1/SampleGuiPluginWindow1.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Name: SampleGuiPluginWindow1.h 3 | // Purpose: 4 | // Author: Volodymyr (T-Rex) Triapichko 5 | // Modified by: 6 | // Created: 10/09/2013 00:01:49 7 | // RCS-ID: 8 | // Copyright: Volodymyr (T-Rex) Triapichko, 2013 9 | // Licence: 10 | ///////////////////////////////////////////////////////////////////////////// 11 | 12 | #ifndef _SAMPLEGUIPLUGINWINDOW1_H_ 13 | #define _SAMPLEGUIPLUGINWINDOW1_H_ 14 | 15 | 16 | /*! 17 | * Includes 18 | */ 19 | 20 | ////@begin includes 21 | ////@end includes 22 | #include 23 | 24 | /*! 25 | * Forward declarations 26 | */ 27 | 28 | ////@begin forward declarations 29 | ////@end forward declarations 30 | 31 | /*! 32 | * Control identifiers 33 | */ 34 | 35 | ////@begin control identifiers 36 | #define ID_SAMPLEGUIPLUGINWINDOW1 10000 37 | #define ID_SAMPLE_TEXTCTRL 10001 38 | #define ID_SEND_EVENT_BUTTON 10002 39 | #define SYMBOL_SAMPLEGUIPLUGINWINDOW1_STYLE wxTAB_TRAVERSAL 40 | #define SYMBOL_SAMPLEGUIPLUGINWINDOW1_TITLE _("SampleGuiPluginWindow1") 41 | #define SYMBOL_SAMPLEGUIPLUGINWINDOW1_IDNAME ID_SAMPLEGUIPLUGINWINDOW1 42 | #define SYMBOL_SAMPLEGUIPLUGINWINDOW1_SIZE wxSize(400, 300) 43 | #define SYMBOL_SAMPLEGUIPLUGINWINDOW1_POSITION wxDefaultPosition 44 | ////@end control identifiers 45 | 46 | 47 | /*! 48 | * SampleGuiPluginWindow1 class declaration 49 | */ 50 | 51 | class SampleGuiPluginWindow1: public wxGuiPluginWindowBase 52 | { 53 | DECLARE_DYNAMIC_CLASS( SampleGuiPluginWindow1 ) 54 | DECLARE_EVENT_TABLE() 55 | 56 | public: 57 | /// Constructors 58 | SampleGuiPluginWindow1(); 59 | SampleGuiPluginWindow1(wxGuiPluginBase * plugin, wxWindow* parent, wxWindowID id = SYMBOL_SAMPLEGUIPLUGINWINDOW1_IDNAME, const wxPoint& pos = SYMBOL_SAMPLEGUIPLUGINWINDOW1_POSITION, const wxSize& size = SYMBOL_SAMPLEGUIPLUGINWINDOW1_SIZE, long style = SYMBOL_SAMPLEGUIPLUGINWINDOW1_STYLE ); 60 | 61 | /// Creation 62 | bool Create(wxGuiPluginBase * plugin, wxWindow* parent, wxWindowID id = SYMBOL_SAMPLEGUIPLUGINWINDOW1_IDNAME, const wxPoint& pos = SYMBOL_SAMPLEGUIPLUGINWINDOW1_POSITION, const wxSize& size = SYMBOL_SAMPLEGUIPLUGINWINDOW1_SIZE, long style = SYMBOL_SAMPLEGUIPLUGINWINDOW1_STYLE ); 63 | 64 | /// Destructor 65 | ~SampleGuiPluginWindow1(); 66 | 67 | /// Initialises member variables 68 | void Init(); 69 | 70 | /// Creates the controls and sizers 71 | void CreateControls(); 72 | 73 | ////@begin SampleGuiPluginWindow1 event handler declarations 74 | 75 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SEND_EVENT_BUTTON 76 | void OnSENDEVENTBUTTONClick( wxCommandEvent& event ); 77 | 78 | ////@end SampleGuiPluginWindow1 event handler declarations 79 | 80 | ////@begin SampleGuiPluginWindow1 member function declarations 81 | 82 | /// Retrieves bitmap resources 83 | wxBitmap GetBitmapResource( const wxString& name ); 84 | 85 | /// Retrieves icon resources 86 | wxIcon GetIconResource( const wxString& name ); 87 | ////@end SampleGuiPluginWindow1 member function declarations 88 | 89 | /// Should we show tooltips? 90 | static bool ShowToolTips(); 91 | 92 | ////@begin SampleGuiPluginWindow1 member variables 93 | wxTextCtrl* m_SamppleTextCtrl; 94 | ////@end SampleGuiPluginWindow1 member variables 95 | }; 96 | 97 | #endif 98 | // _SAMPLEGUIPLUGINWINDOW1_H_ 99 | -------------------------------------------------------------------------------- /SampleGuiPlugin2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (SRCS 2 | SampleGuiPlugin2.cpp 3 | SampleGuiPlugin2Exports.cpp 4 | SampleGuiPluginWindow2.cpp) 5 | set (HEADERS 6 | SampleGuiPlugin2.h 7 | SampleGuiPluginWindow2.h) 8 | 9 | set(LIBRARY_NAME SampleGuiPlugin2) 10 | 11 | if(WIN32) 12 | set(SRCS ${SRCS} ${LIBRARY_NAME}.def) 13 | set(PREPROCESSOR_DEFINITIONS ${PREPROCESSOR_DEFINITIONS};/D_USRDLL;/D__STDC_CONSTANT_MACROS) 14 | set(LINK_DIRECTORIES 15 | ${PROJECT_ROOT_DIR}/wxGuiPluginBase/${OS_BASE_NAME}${LIB_SUFFIX}/$(ConfigurationName)) 16 | set(DEMO_LIBS wxGuiPluginBase.lib) 17 | endif(WIN32) 18 | if(LINUX OR APPLE) 19 | set(DEMO_LIBS wxGuiPluginBase) 20 | SET(CMAKE_SKIP_BUILD_RPATH FALSE) 21 | SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 22 | SET(CMAKE_INSTALL_RPATH ".:./../../") 23 | endif(LINUX OR APPLE) 24 | 25 | set(SRCS ${SRCS} ${HEADERS} 26 | ${PROJECT_ROOT_DIR}/include/stdwx.h 27 | ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 28 | 29 | add_definitions(${PREPROCESSOR_DEFINITIONS}) 30 | 31 | include_directories(${INCLUDE_DIRECTORIES} ${BASE_INCLUDE_DIRECTORIES} 32 | ${PROJECT_ROOT_DIR}/wxGuiPluginBase) 33 | 34 | link_directories(${LINK_DIRECTORIES}) 35 | 36 | add_library(${LIBRARY_NAME} SHARED ${SRCS}) 37 | 38 | set(DLL_DIR bin) 39 | if(APPLE) 40 | set(BUNDLE_SUBFOLDER 41 | "/$(CONFIGURATION)/${PROJECT_NAME}.app/Contents/PlugIns") 42 | endif(APPLE) 43 | if(WIN32) 44 | set(TARGET_LOCATION 45 | ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}/${CMAKE_CFG_INTDIR}/plugins/gui) 46 | elseif (LINUX) 47 | set(TARGET_LOCATION 48 | ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}${BUNDLE_SUBFOLDER}/plugins/gui) 49 | else() 50 | set(TARGET_LOCATION 51 | ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}${BUNDLE_SUBFOLDER}/gui) 52 | endif(WIN32) 53 | if(LINUX OR APPLE) 54 | get_target_property(RESULT_FULL_PATH ${LIBRARY_NAME} LOCATION) 55 | get_filename_component(RESULT_FILE_NAME ${RESULT_FULL_PATH} NAME) 56 | endif(LINUX OR APPLE) 57 | 58 | set_target_properties(${LIBRARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TARGET_LOCATION}) 59 | 60 | target_link_libraries(${LIBRARY_NAME} ${DEMO_LIBS} ${wxWidgets_LIBRARIES}) 61 | 62 | add_dependencies(${LIBRARY_NAME} wxGuiPluginBase) 63 | 64 | target_precompile_headers(${LIBRARY_NAME} PRIVATE ${PROJECT_ROOT_DIR}/include/stdwx.h ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 65 | 66 | if(APPLE) 67 | FOREACH(DEP_LIB ${DEMO_LIBS}) 68 | get_filename_component(ABS_ROOT_DIR ${PROJECT_ROOT_DIR} ABSOLUTE) 69 | set(LIBNAME_FULL "${ABS_ROOT_DIR}/${DEP_LIB}/${OS_BASE_NAME}${LIB_SUFFIX}/$(CONFIGURATION)/lib${DEP_LIB}.dylib") 70 | add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD 71 | COMMAND install_name_tool -change "${LIBNAME_FULL}" "@executable_path/../Frameworks/lib${DEP_LIB}.dylib" $) 72 | ENDFOREACH(DEP_LIB) 73 | endif(APPLE) 74 | if(LINUX OR APPLE) 75 | add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD 76 | COMMAND ${CMAKE_COMMAND} -E make_directory ${TARGET_LOCATION} 77 | COMMAND ${CMAKE_COMMAND} -E copy $ ${TARGET_LOCATION}/${RESULT_FILE_NAME} 78 | ) 79 | endif(LINUX OR APPLE) 80 | -------------------------------------------------------------------------------- /SampleGuiPlugin2/SampleGuiPlugin2.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include "SampleGuiPlugin2.h" 3 | #include "SampleGuiPluginWindow2.h" 4 | 5 | IMPLEMENT_DYNAMIC_CLASS(SampleGuiPlugin2, wxObject) 6 | 7 | SampleGuiPlugin2::SampleGuiPlugin2() 8 | : wxGuiPluginBase(NULL) 9 | { 10 | 11 | } 12 | 13 | SampleGuiPlugin2::SampleGuiPlugin2(wxEvtHandler * handler) 14 | : wxGuiPluginBase(handler) 15 | { 16 | } 17 | 18 | SampleGuiPlugin2::~SampleGuiPlugin2() 19 | { 20 | } 21 | 22 | wxString SampleGuiPlugin2::GetName() const 23 | { 24 | return _("GUI Plugin 2"); 25 | } 26 | 27 | wxString SampleGuiPlugin2::GetId() const 28 | { 29 | return wxT("{1B226C84-6436-4092-9AB8-B2B0D6731EBE}"); 30 | } 31 | 32 | wxWindow * SampleGuiPlugin2::CreatePanel(wxWindow * parent) 33 | { 34 | return new SampleGuiPluginWindow2(this, parent); 35 | } 36 | -------------------------------------------------------------------------------- /SampleGuiPlugin2/SampleGuiPlugin2.def: -------------------------------------------------------------------------------- 1 | LIBRARY "SampleGuiPlugin2" 2 | 3 | EXPORTS 4 | CreatePlugin=CreatePlugin 5 | DeletePlugin=DeletePlugin -------------------------------------------------------------------------------- /SampleGuiPlugin2/SampleGuiPlugin2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class SampleGuiPlugin2 : public wxGuiPluginBase 6 | { 7 | DECLARE_DYNAMIC_CLASS(SampleGuiPlugin2) 8 | public: 9 | SampleGuiPlugin2(); 10 | SampleGuiPlugin2(wxEvtHandler * handler); 11 | virtual ~SampleGuiPlugin2(); 12 | 13 | virtual wxString GetName() const; 14 | virtual wxString GetId() const; 15 | virtual wxWindow * CreatePanel(wxWindow * parent); 16 | }; -------------------------------------------------------------------------------- /SampleGuiPlugin2/SampleGuiPlugin2.pjd: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 0 5 | "" 6 | "" 7 | "" 8 | "" 9 | "" 10 | 0 11 | 0 12 | 0 13 | 1 14 | 1 15 | 1 16 | 1 17 | 0 18 | "Volodymyr (T-Rex) Triapichko" 19 | "Volodymyr (T-Rex) Triapichko, 2013" 20 | "" 21 | 0 22 | 0 23 | 0 24 | 0 25 | "<All platforms>" 26 | "2.9.5" 27 | "Standard" 28 | "///////////////////////////////////////////////////////////////////////////// 29 | // Name: %HEADER-FILENAME% 30 | // Purpose: 31 | // Author: %AUTHOR% 32 | // Modified by: 33 | // Created: %DATE% 34 | // RCS-ID: 35 | // Copyright: %COPYRIGHT% 36 | // Licence: 37 | ///////////////////////////////////////////////////////////////////////////// 38 | 39 | " 40 | "///////////////////////////////////////////////////////////////////////////// 41 | // Name: %SOURCE-FILENAME% 42 | // Purpose: 43 | // Author: %AUTHOR% 44 | // Modified by: 45 | // Created: %DATE% 46 | // RCS-ID: 47 | // Copyright: %COPYRIGHT% 48 | // Licence: 49 | ///////////////////////////////////////////////////////////////////////////// 50 | 51 | " 52 | "///////////////////////////////////////////////////////////////////////////// 53 | // Name: %SYMBOLS-FILENAME% 54 | // Purpose: Symbols file 55 | // Author: %AUTHOR% 56 | // Modified by: 57 | // Created: %DATE% 58 | // RCS-ID: 59 | // Copyright: %COPYRIGHT% 60 | // Licence: 61 | ///////////////////////////////////////////////////////////////////////////// 62 | 63 | " 64 | "" 65 | "// For compilers that support precompilation, includes "wx/wx.h". 66 | #include "wx/wxprec.h" 67 | 68 | #ifdef __BORLANDC__ 69 | #pragma hdrstop 70 | #endif 71 | 72 | #ifndef WX_PRECOMP 73 | #include "wx/wx.h" 74 | #endif 75 | 76 | " 77 | " /// %BODY% 78 | " 79 | " 80 | /* 81 | * %BODY% 82 | */ 83 | 84 | " 85 | "app_resources.h" 86 | "app_resources.cpp" 87 | "AppResources" 88 | "app.h" 89 | "app.cpp" 90 | "Application" 91 | 0 92 | "" 93 | "<None>" 94 | "iso-8859-1" 95 | "utf-8" 96 | "utf-8" 97 | "" 98 | 0 99 | 0 100 | 4 101 | " " 102 | "" 103 | 0 104 | 0 105 | 1 106 | 0 107 | 1 108 | 1 109 | 0 110 | 1 111 | 0 112 | 0 113 |
114 | 115 | 116 | "" 117 | "data-document" 118 | "" 119 | "" 120 | 0 121 | 1 122 | 0 123 | 0 124 | 125 | "Configurations" 126 | "config-data-document" 127 | "" 128 | "" 129 | 0 130 | 1 131 | 0 132 | 0 133 | "" 134 | 1 135 | -8519680 136 | "" 137 | "Debug" 138 | "Unicode" 139 | "Static" 140 | "Modular" 141 | "GUI" 142 | "wxMSW" 143 | "Default" 144 | "Dynamic" 145 | "Yes" 146 | "No" 147 | "Yes" 148 | "No" 149 | "No" 150 | "Yes" 151 | "Yes" 152 | "Yes" 153 | "Yes" 154 | "Yes" 155 | "builtin" 156 | "Yes" 157 | "%EXECUTABLE%" 158 | "" 159 | "%AUTO%" 160 | "%AUTO%" 161 | "%AUTO%" 162 | "%AUTO%" 163 | "%WXVERSION%" 164 | "%AUTO%" 165 | "%AUTO%" 166 | "%AUTO%" 167 | "%AUTO%" 168 | "%AUTO%" 169 | "" 170 | "%AUTO%" 171 | "%AUTO%" 172 | "%AUTO%" 173 | "%AUTO%" 174 | "%AUTO%" 175 | "%AUTO%" 176 | "%AUTO%" 177 | "%AUTO%" 178 | "%AUTO%" 179 | "%AUTO%" 180 | "%AUTO%" 181 | "%AUTO%" 182 | "%AUTO%" 183 | "%AUTO%" 184 | "%AUTO%" 185 | "%AUTO%" 186 | "%AUTO%" 187 | "%AUTO%" 188 | "%AUTO%" 189 | "%AUTO%" 190 | "%AUTO%" 191 | "%AUTO%" 192 | 0 193 | 1 194 | 195 | 196 | 197 | 198 | 199 | 200 | "Projects" 201 | "root-document" 202 | "" 203 | "project" 204 | 1 205 | 1 206 | 0 207 | 1 208 | 209 | "Windows" 210 | "html-document" 211 | "" 212 | "dialogsfolder" 213 | 1 214 | 1 215 | 0 216 | 1 217 | 218 | "SampleGuiPluginWindow2" 219 | "dialog-document" 220 | "" 221 | "dialog" 222 | 0 223 | 1 224 | 0 225 | 0 226 | "wbDialogProxy" 227 | 10000 228 | 0 229 | "" 230 | 0 231 | "" 232 | "Standard" 233 | 0 234 | 0 235 | "wxEVT_DESTROY|OnDestroy|NONE||" 236 | "ID_SAMPLEGUIPLUGINWINDOW2" 237 | 10000 238 | "SampleGuiPluginWindow2" 239 | "wxGuiPluginWindowBase" 240 | "wxPanel" 241 | "SampleGuiPluginWindow2.cpp" 242 | "SampleGuiPluginWindow2.h" 243 | "" 244 | "SampleGuiPluginWindow2" 245 | 1 246 | "" 247 | 0 248 | "" 249 | "" 250 | "" 251 | "" 252 | "" 253 | 0 254 | 1 255 | "<Any platform>" 256 | "" 257 | "" 258 | "" 259 | "" 260 | "" 261 | "" 262 | "Tiled" 263 | 0 264 | 0 265 | 0 266 | 0 267 | 0 268 | 0 269 | 0 270 | 0 271 | 0 272 | 1 273 | 0 274 | 0 275 | 0 276 | 0 277 | 0 278 | 0 279 | 0 280 | 0 281 | 0 282 | 0 283 | 0 284 | 1 285 | 0 286 | 0 287 | 0 288 | "" 289 | 0 290 | 1 291 | -1 292 | -1 293 | 400 294 | 300 295 | 0 296 | "" 297 | 298 | "wxBoxSizer V" 299 | "dialog-control-document" 300 | "" 301 | "sizer" 302 | 0 303 | 1 304 | 0 305 | 0 306 | "wbBoxSizerProxy" 307 | "Vertical" 308 | "" 309 | 0 310 | 0 311 | 0 312 | 0 313 | "<Any platform>" 314 | 315 | "wxStaticText: wxID_STATIC" 316 | "dialog-control-document" 317 | "" 318 | "statictext" 319 | 0 320 | 1 321 | 0 322 | 0 323 | "wbStaticTextProxy" 324 | "wxID_STATIC" 325 | 5105 326 | "" 327 | "wxStaticText" 328 | "wxStaticText" 329 | 1 330 | 0 331 | "" 332 | "" 333 | "" 334 | "This text box receives messages from GUI Plugin 1:" 335 | -1 336 | "" 337 | "" 338 | "" 339 | "" 340 | "" 341 | 0 342 | 1 343 | "<Any platform>" 344 | "" 345 | "" 346 | "" 347 | "" 348 | "" 349 | "" 350 | "" 351 | 0 352 | 0 353 | 0 354 | 0 355 | 0 356 | 0 357 | 0 358 | 0 359 | 0 360 | 0 361 | 0 362 | 0 363 | 0 364 | 0 365 | "" 366 | -1 367 | -1 368 | -1 369 | -1 370 | "Left" 371 | "Centre" 372 | 0 373 | 5 374 | 1 375 | 1 376 | 1 377 | 0 378 | 0 379 | 0 380 | 0 381 | 0 382 | "" 383 | "" 384 | 385 | 386 | "wxTextCtrl: ID_GUI_PLUGIN2_MESSAGE_TEXTCTRL" 387 | "dialog-control-document" 388 | "" 389 | "textctrl" 390 | 0 391 | 1 392 | 0 393 | 0 394 | "wbTextCtrlProxy" 395 | "ID_GUI_PLUGIN2_MESSAGE_TEXTCTRL" 396 | 10001 397 | "" 398 | "wxTextCtrl" 399 | "wxTextCtrl" 400 | 1 401 | 0 402 | "" 403 | "" 404 | "m_MessageTextCtrl" 405 | "" 406 | 0 407 | "" 408 | "" 409 | "" 410 | "" 411 | "" 412 | 0 413 | 1 414 | "<Any platform>" 415 | "" 416 | "" 417 | "" 418 | "" 419 | "" 420 | "" 421 | "" 422 | 0 423 | 0 424 | 0 425 | 0 426 | 1 427 | 0 428 | 0 429 | 0 430 | 0 431 | 0 432 | 0 433 | 0 434 | 0 435 | 0 436 | 0 437 | 0 438 | 0 439 | 0 440 | 0 441 | 0 442 | 0 443 | 0 444 | 0 445 | 0 446 | 0 447 | 0 448 | "" 449 | -1 450 | -1 451 | -1 452 | -1 453 | "Expand" 454 | "Centre" 455 | 0 456 | 5 457 | 1 458 | 1 459 | 1 460 | 1 461 | 0 462 | 0 463 | 0 464 | 0 465 | "" 466 | "" 467 | 468 | 469 | 470 | 471 | 472 | "Sources" 473 | "html-document" 474 | "" 475 | "sourcesfolder" 476 | 1 477 | 1 478 | 0 479 | 1 480 | 481 | "SampleGuiPlugin2.rc" 482 | "source-editor-document" 483 | "SampleGuiPlugin2.rc" 484 | "source-editor" 485 | 0 486 | 0 487 | 1 488 | 0 489 | "18/9/2013" 490 | "" 491 | 492 | 493 | 494 | "Images" 495 | "html-document" 496 | "" 497 | "bitmapsfolder" 498 | 1 499 | 1 500 | 0 501 | 1 502 | 503 | 504 | 505 | 506 |
507 | -------------------------------------------------------------------------------- /SampleGuiPlugin2/SampleGuiPlugin2.rc: -------------------------------------------------------------------------------- 1 | #include "wx/msw/wx.rc" 2 | -------------------------------------------------------------------------------- /SampleGuiPlugin2/SampleGuiPlugin2Exports.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include 3 | #include "SampleGuiPlugin2.h" 4 | 5 | PLUGIN_EXPORTED_API wxGuiPluginBase * CreatePlugin() 6 | { 7 | return new SampleGuiPlugin2; 8 | } 9 | 10 | PLUGIN_EXPORTED_API void DeletePlugin(wxGuiPluginBase * plugin) 11 | { 12 | wxDELETE(plugin); 13 | } 14 | -------------------------------------------------------------------------------- /SampleGuiPlugin2/SampleGuiPluginWindow2.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Name: SampleGuiPluginWindow2.cpp 3 | // Purpose: 4 | // Author: Volodymyr (T-Rex) Triapichko 5 | // Modified by: 6 | // Created: 18/09/2013 22:40:39 7 | // RCS-ID: 8 | // Copyright: Volodymyr (T-Rex) Triapichko, 2013 9 | // Licence: 10 | ///////////////////////////////////////////////////////////////////////////// 11 | 12 | // For compilers that support precompilation, includes "wx/wx.h". 13 | #include "wx/wxprec.h" 14 | 15 | #ifdef __BORLANDC__ 16 | #pragma hdrstop 17 | #endif 18 | 19 | #ifndef WX_PRECOMP 20 | #include "wx/wx.h" 21 | #endif 22 | 23 | ////@begin includes 24 | ////@end includes 25 | 26 | #include "SampleGuiPluginWindow2.h" 27 | #include 28 | 29 | ////@begin XPM images 30 | ////@end XPM images 31 | 32 | 33 | /* 34 | * SampleGuiPluginWindow2 type definition 35 | */ 36 | 37 | IMPLEMENT_DYNAMIC_CLASS( SampleGuiPluginWindow2, wxGuiPluginWindowBase ) 38 | 39 | 40 | /* 41 | * SampleGuiPluginWindow2 event table definition 42 | */ 43 | 44 | BEGIN_EVENT_TABLE( SampleGuiPluginWindow2, wxGuiPluginWindowBase ) 45 | 46 | ////@begin SampleGuiPluginWindow2 event table entries 47 | EVT_WINDOW_DESTROY( SampleGuiPluginWindow2::OnDestroy ) 48 | ////@end SampleGuiPluginWindow2 event table entries 49 | 50 | END_EVENT_TABLE() 51 | 52 | 53 | /* 54 | * SampleGuiPluginWindow2 constructors 55 | */ 56 | 57 | SampleGuiPluginWindow2::SampleGuiPluginWindow2() 58 | { 59 | Init(); 60 | } 61 | 62 | SampleGuiPluginWindow2::SampleGuiPluginWindow2( wxGuiPluginBase * plugin, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) 63 | { 64 | Init(); 65 | Create(plugin, parent, id, pos, size, style); 66 | } 67 | 68 | 69 | /* 70 | * SampleGuiPluginWindow2 creator 71 | */ 72 | 73 | bool SampleGuiPluginWindow2::Create( wxGuiPluginBase * plugin, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) 74 | { 75 | wxGuiPluginWindowBase::Create(plugin, parent, id, pos, size, style ); 76 | 77 | CreateControls(); 78 | if (GetSizer()) 79 | { 80 | GetSizer()->SetSizeHints(this); 81 | } 82 | Centre(); 83 | return true; 84 | } 85 | 86 | 87 | /* 88 | * SampleGuiPluginWindow2 destructor 89 | */ 90 | 91 | SampleGuiPluginWindow2::~SampleGuiPluginWindow2() 92 | { 93 | ////@begin SampleGuiPluginWindow2 destruction 94 | ////@end SampleGuiPluginWindow2 destruction 95 | } 96 | 97 | 98 | /* 99 | * Member initialisation 100 | */ 101 | 102 | void SampleGuiPluginWindow2::Init() 103 | { 104 | ////@begin SampleGuiPluginWindow2 member initialisation 105 | m_MessageTextCtrl = NULL; 106 | ////@end SampleGuiPluginWindow2 member initialisation 107 | } 108 | 109 | 110 | /* 111 | * Control creation for SampleGuiPluginWindow2 112 | */ 113 | 114 | void SampleGuiPluginWindow2::CreateControls() 115 | { 116 | ////@begin SampleGuiPluginWindow2 content construction 117 | SampleGuiPluginWindow2* itemGuiPluginWindowBase1 = this; 118 | 119 | wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); 120 | itemGuiPluginWindowBase1->SetSizer(itemBoxSizer2); 121 | 122 | wxStaticText* itemStaticText3 = new wxStaticText( itemGuiPluginWindowBase1, wxID_STATIC, _("This text box receives messages from GUI Plugin 1:"), wxDefaultPosition, wxDefaultSize, 0 ); 123 | itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); 124 | 125 | m_MessageTextCtrl = new wxTextCtrl( itemGuiPluginWindowBase1, ID_GUI_PLUGIN2_MESSAGE_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); 126 | itemBoxSizer2->Add(m_MessageTextCtrl, 0, wxGROW|wxALL, 5); 127 | 128 | // Connect events and objects 129 | itemGuiPluginWindowBase1->Connect(ID_SAMPLEGUIPLUGINWINDOW2, wxEVT_DESTROY, wxWindowDestroyEventHandler(SampleGuiPluginWindow2::OnDestroy), NULL, this); 130 | ////@end SampleGuiPluginWindow2 content construction 131 | GetPlugin()->GetEventHandler()->Bind(wxEVT_GUI_PLUGIN_INTEROP, 132 | wxCommandEventHandler(SampleGuiPluginWindow2::OnInteropMessageReceived), this); 133 | } 134 | 135 | 136 | /* 137 | * Should we show tooltips? 138 | */ 139 | 140 | bool SampleGuiPluginWindow2::ShowToolTips() 141 | { 142 | return true; 143 | } 144 | 145 | /* 146 | * Get bitmap resources 147 | */ 148 | 149 | wxBitmap SampleGuiPluginWindow2::GetBitmapResource( const wxString& name ) 150 | { 151 | // Bitmap retrieval 152 | ////@begin SampleGuiPluginWindow2 bitmap retrieval 153 | wxUnusedVar(name); 154 | return wxNullBitmap; 155 | ////@end SampleGuiPluginWindow2 bitmap retrieval 156 | } 157 | 158 | /* 159 | * Get icon resources 160 | */ 161 | 162 | wxIcon SampleGuiPluginWindow2::GetIconResource( const wxString& name ) 163 | { 164 | // Icon retrieval 165 | ////@begin SampleGuiPluginWindow2 icon retrieval 166 | wxUnusedVar(name); 167 | return wxNullIcon; 168 | ////@end SampleGuiPluginWindow2 icon retrieval 169 | } 170 | 171 | void SampleGuiPluginWindow2::OnInteropMessageReceived(wxCommandEvent & event) 172 | { 173 | m_MessageTextCtrl->SetValue(event.GetString()); 174 | } 175 | 176 | 177 | /* 178 | * wxEVT_DESTROY event handler for ID_SAMPLEGUIPLUGINWINDOW2 179 | */ 180 | 181 | void SampleGuiPluginWindow2::OnDestroy( wxWindowDestroyEvent& event ) 182 | { 183 | GetPlugin()->GetEventHandler()->Unbind(wxEVT_GUI_PLUGIN_INTEROP, 184 | wxCommandEventHandler(SampleGuiPluginWindow2::OnInteropMessageReceived), this); 185 | ////@begin wxEVT_DESTROY event handler for ID_SAMPLEGUIPLUGINWINDOW2 in SampleGuiPluginWindow2. 186 | // Before editing this code, remove the block markers. 187 | event.Skip(); 188 | ////@end wxEVT_DESTROY event handler for ID_SAMPLEGUIPLUGINWINDOW2 in SampleGuiPluginWindow2. 189 | } 190 | 191 | -------------------------------------------------------------------------------- /SampleGuiPlugin2/SampleGuiPluginWindow2.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Name: SampleGuiPluginWindow2.h 3 | // Purpose: 4 | // Author: Volodymyr (T-Rex) Triapichko 5 | // Modified by: 6 | // Created: 18/09/2013 22:40:39 7 | // RCS-ID: 8 | // Copyright: Volodymyr (T-Rex) Triapichko, 2013 9 | // Licence: 10 | ///////////////////////////////////////////////////////////////////////////// 11 | 12 | #ifndef _SAMPLEGUIPLUGINWINDOW2_H_ 13 | #define _SAMPLEGUIPLUGINWINDOW2_H_ 14 | 15 | 16 | /*! 17 | * Includes 18 | */ 19 | 20 | ////@begin includes 21 | ////@end includes 22 | #include 23 | 24 | /*! 25 | * Forward declarations 26 | */ 27 | 28 | ////@begin forward declarations 29 | ////@end forward declarations 30 | 31 | /*! 32 | * Control identifiers 33 | */ 34 | 35 | ////@begin control identifiers 36 | #define ID_SAMPLEGUIPLUGINWINDOW2 10000 37 | #define ID_GUI_PLUGIN2_MESSAGE_TEXTCTRL 10001 38 | #define SYMBOL_SAMPLEGUIPLUGINWINDOW2_STYLE wxTAB_TRAVERSAL 39 | #define SYMBOL_SAMPLEGUIPLUGINWINDOW2_TITLE _("SampleGuiPluginWindow2") 40 | #define SYMBOL_SAMPLEGUIPLUGINWINDOW2_IDNAME ID_SAMPLEGUIPLUGINWINDOW2 41 | #define SYMBOL_SAMPLEGUIPLUGINWINDOW2_SIZE wxSize(400, 300) 42 | #define SYMBOL_SAMPLEGUIPLUGINWINDOW2_POSITION wxDefaultPosition 43 | ////@end control identifiers 44 | 45 | 46 | /*! 47 | * SampleGuiPluginWindow2 class declaration 48 | */ 49 | 50 | class SampleGuiPluginWindow2: public wxGuiPluginWindowBase 51 | { 52 | DECLARE_DYNAMIC_CLASS( SampleGuiPluginWindow2 ) 53 | DECLARE_EVENT_TABLE() 54 | 55 | public: 56 | /// Constructors 57 | SampleGuiPluginWindow2(); 58 | SampleGuiPluginWindow2( wxGuiPluginBase * plugin, wxWindow* parent, wxWindowID id = SYMBOL_SAMPLEGUIPLUGINWINDOW2_IDNAME, const wxPoint& pos = SYMBOL_SAMPLEGUIPLUGINWINDOW2_POSITION, const wxSize& size = SYMBOL_SAMPLEGUIPLUGINWINDOW2_SIZE, long style = SYMBOL_SAMPLEGUIPLUGINWINDOW2_STYLE ); 59 | 60 | /// Creation 61 | bool Create( wxGuiPluginBase * plugin, wxWindow* parent, wxWindowID id = SYMBOL_SAMPLEGUIPLUGINWINDOW2_IDNAME, const wxPoint& pos = SYMBOL_SAMPLEGUIPLUGINWINDOW2_POSITION, const wxSize& size = SYMBOL_SAMPLEGUIPLUGINWINDOW2_SIZE, long style = SYMBOL_SAMPLEGUIPLUGINWINDOW2_STYLE ); 62 | 63 | /// Destructor 64 | ~SampleGuiPluginWindow2(); 65 | 66 | /// Initialises member variables 67 | void Init(); 68 | 69 | /// Creates the controls and sizers 70 | void CreateControls(); 71 | 72 | ////@begin SampleGuiPluginWindow2 event handler declarations 73 | 74 | /// wxEVT_DESTROY event handler for ID_SAMPLEGUIPLUGINWINDOW2 75 | void OnDestroy( wxWindowDestroyEvent& event ); 76 | 77 | ////@end SampleGuiPluginWindow2 event handler declarations 78 | void OnInteropMessageReceived(wxCommandEvent & event); 79 | 80 | ////@begin SampleGuiPluginWindow2 member function declarations 81 | 82 | /// Retrieves bitmap resources 83 | wxBitmap GetBitmapResource( const wxString& name ); 84 | 85 | /// Retrieves icon resources 86 | wxIcon GetIconResource( const wxString& name ); 87 | ////@end SampleGuiPluginWindow2 member function declarations 88 | 89 | /// Should we show tooltips? 90 | static bool ShowToolTips(); 91 | 92 | ////@begin SampleGuiPluginWindow2 member variables 93 | wxTextCtrl* m_MessageTextCtrl; 94 | ////@end SampleGuiPluginWindow2 member variables 95 | }; 96 | 97 | #endif 98 | // _SAMPLEGUIPLUGINWINDOW2_H_ 99 | -------------------------------------------------------------------------------- /SampleNonGuiPlugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (SRCS 2 | SampleNonGuiPlugin.cpp 3 | SampleNonGuiPluginExports.cpp) 4 | set (HEADERS 5 | SampleNonGuiPlugin.h) 6 | 7 | set(LIBRARY_NAME SampleNonGuiPlugin) 8 | 9 | if(WIN32) 10 | set(SRCS ${SRCS} ${LIBRARY_NAME}.def) 11 | set(PREPROCESSOR_DEFINITIONS ${PREPROCESSOR_DEFINITIONS};/D_USRDLL;/D__STDC_CONSTANT_MACROS) 12 | set(LINK_DIRECTORIES 13 | ${PROJECT_ROOT_DIR}/wxNonGuiPluginBase/${OS_BASE_NAME}${LIB_SUFFIX}/$(ConfigurationName)) 14 | set(DEMO_LIBS wxNonGuiPluginBase.lib) 15 | endif(WIN32) 16 | if(LINUX OR APPLE) 17 | set(DEMO_LIBS wxNonGuiPluginBase) 18 | SET(CMAKE_SKIP_BUILD_RPATH FALSE) 19 | SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 20 | if(LINUX) 21 | SET(CMAKE_INSTALL_RPATH ".:./../../") 22 | else() 23 | SET(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks") 24 | endif(LINUX) 25 | endif(LINUX OR APPLE) 26 | 27 | set(SRCS ${SRCS} ${HEADERS} 28 | ${PROJECT_ROOT_DIR}/include/stdwx.h 29 | ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 30 | 31 | add_definitions(${PREPROCESSOR_DEFINITIONS}) 32 | 33 | include_directories(${INCLUDE_DIRECTORIES} ${BASE_INCLUDE_DIRECTORIES} 34 | ${PROJECT_ROOT_DIR}/wxNonGuiPluginBase) 35 | 36 | link_directories(${LINK_DIRECTORIES}) 37 | 38 | add_library(${LIBRARY_NAME} SHARED ${SRCS}) 39 | 40 | set(DLL_DIR bin) 41 | if(APPLE) 42 | set(BUNDLE_SUBFOLDER 43 | "/$(CONFIGURATION)/${PROJECT_NAME}.app/Contents/PlugIns") 44 | endif(APPLE) 45 | if(WIN32) 46 | set(TARGET_LOCATION 47 | ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}/${CMAKE_CFG_INTDIR}/plugins/nongui) 48 | elseif (LINUX) 49 | set(TARGET_LOCATION 50 | ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}${BUNDLE_SUBFOLDER}/plugins/nongui) 51 | else() 52 | set(TARGET_LOCATION 53 | ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}${BUNDLE_SUBFOLDER}/nongui) 54 | endif(WIN32) 55 | if(LINUX OR APPLE) 56 | get_target_property(RESULT_FULL_PATH ${LIBRARY_NAME} LOCATION) 57 | get_filename_component(RESULT_FILE_NAME ${RESULT_FULL_PATH} NAME) 58 | endif(LINUX OR APPLE) 59 | set_target_properties(${LIBRARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TARGET_LOCATION}) 60 | 61 | target_link_libraries(${LIBRARY_NAME} ${DEMO_LIBS} ${wxWidgets_LIBRARIES}) 62 | 63 | add_dependencies(${LIBRARY_NAME} wxNonGuiPluginBase) 64 | 65 | target_precompile_headers(${LIBRARY_NAME} PRIVATE ${PROJECT_ROOT_DIR}/include/stdwx.h ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 66 | 67 | if(APPLE) 68 | FOREACH(DEP_LIB ${DEMO_LIBS}) 69 | get_filename_component(ABS_ROOT_DIR ${PROJECT_ROOT_DIR} ABSOLUTE) 70 | set(LIBNAME_FULL "${ABS_ROOT_DIR}/${DEP_LIB}/${OS_BASE_NAME}${LIB_SUFFIX}/$(CONFIGURATION)/lib${DEP_LIB}.dylib") 71 | add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD 72 | COMMAND install_name_tool -change "${LIBNAME_FULL}" "@executable_path/../Frameworks/lib${DEP_LIB}.dylib" $) 73 | ENDFOREACH(DEP_LIB) 74 | endif(APPLE) 75 | if(LINUX OR APPLE) 76 | add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD 77 | COMMAND ${CMAKE_COMMAND} -E make_directory ${TARGET_LOCATION} 78 | COMMAND ${CMAKE_COMMAND} -E copy $ 79 | ${TARGET_LOCATION}/${RESULT_FILE_NAME} 80 | ) 81 | endif(LINUX OR APPLE) 82 | -------------------------------------------------------------------------------- /SampleNonGuiPlugin/SampleNonGuiPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include "SampleNonGuiPlugin.h" 3 | 4 | IMPLEMENT_DYNAMIC_CLASS(SampleNonGuiPlugin, wxObject) 5 | 6 | SampleNonGuiPlugin::SampleNonGuiPlugin() 7 | { 8 | } 9 | 10 | SampleNonGuiPlugin::~SampleNonGuiPlugin() 11 | { 12 | } 13 | 14 | int SampleNonGuiPlugin::Work() 15 | { 16 | return 10; 17 | } 18 | -------------------------------------------------------------------------------- /SampleNonGuiPlugin/SampleNonGuiPlugin.def: -------------------------------------------------------------------------------- 1 | LIBRARY "SampleNonGuiPlugin" 2 | 3 | EXPORTS 4 | CreatePlugin=CreatePlugin 5 | DeletePlugin=DeletePlugin -------------------------------------------------------------------------------- /SampleNonGuiPlugin/SampleNonGuiPlugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class SampleNonGuiPlugin : public wxNonGuiPluginBase 6 | { 7 | DECLARE_DYNAMIC_CLASS(SampleNonGuiPlugin) 8 | public: 9 | SampleNonGuiPlugin(); 10 | virtual ~SampleNonGuiPlugin(); 11 | 12 | virtual int Work(); 13 | }; -------------------------------------------------------------------------------- /SampleNonGuiPlugin/SampleNonGuiPluginExports.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include 3 | #include "SampleNonGuiPlugin.h" 4 | 5 | PLUGIN_EXPORTED_API wxNonGuiPluginBase * CreatePlugin() 6 | { 7 | return new SampleNonGuiPlugin; 8 | } 9 | 10 | PLUGIN_EXPORTED_API void DeletePlugin(wxNonGuiPluginBase * plugin) 11 | { 12 | wxDELETE(plugin); 13 | } 14 | -------------------------------------------------------------------------------- /build/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.0) 2 | 3 | include(PCHSupport.cmake) 4 | 5 | # We will generate both Debug and Release project files at the same time 6 | # for Windows and OS X 7 | if(WIN32 OR APPLE) 8 | set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) 9 | set(LIB_SUFFIX "") 10 | endif(WIN32 OR APPLE) 11 | 12 | # For Linux we will need to execute CMake twice in order to generate 13 | # Debug and Release versions of Makefiles 14 | if(UNIX AND NOT APPLE) 15 | set(LINUX ON) 16 | set(LIB_SUFFIX /${CMAKE_BUILD_TYPE}) 17 | endif(UNIX AND NOT APPLE) 18 | 19 | set(PROJECT_NAME wxModularHost) 20 | project(${PROJECT_NAME}) 21 | 22 | # If there are any additional CMake modules (e.g. module which searches 23 | # for OpenCV or for DirectShow libs), then CMake should start searching 24 | # for them in current folder 25 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) 26 | 27 | if(APPLE) 28 | set(OS_BASE_NAME Mac) 29 | set(CMAKE_OSX_SYSROOT "macosx10.8") 30 | endif(APPLE) 31 | if(LINUX) 32 | set(OS_BASE_NAME Linux) 33 | endif(LINUX) 34 | if(WIN32) 35 | set(OS_BASE_NAME Win) 36 | endif(WIN32) 37 | 38 | # Here we specify the list of wxWidgets libs which we will use in our project 39 | set(wxWidgets_USE_LIBS base core adv aui net gl xml propgrid html) 40 | 41 | # Here we specify that we need DLL version of wxWidgets libs and dynamic CRT 42 | # This is a MUST for applications with plugins. Both app and DLL plugin MUST 43 | # use the same instance of wxWidgets and the same event loop. 44 | set(BUILD_SHARED_LIBS 1) 45 | 46 | # Find wxWidgets library on current PC 47 | # You should have %WXWIN% environment variable which should point to the 48 | # directory where wxWidgets source code is placed. 49 | # wxWidgets libs MUST be compiled for both Debug and Release versions 50 | find_package(wxWidgets REQUIRED) 51 | 52 | 53 | # For some reason CMake generates wrong list of definitions. 54 | # Each item should start with /D but it does not. 55 | # We need to fix that manually 56 | set(wxWidgets_DEFINITIONS_TEMP) 57 | foreach(DEFINITION ${wxWidgets_DEFINITIONS}) 58 | 59 | if(NOT ${DEFINITION} MATCHES "/D.*") 60 | set(DEFINITION "/D${DEFINITION}") 61 | endif() 62 | set(wxWidgets_DEFINITIONS_TEMP ${wxWidgets_DEFINITIONS_TEMP} 63 | ${DEFINITION}) 64 | endforeach(${DEFINITION}) 65 | set(wxWidgets_DEFINITIONS ${wxWidgets_DEFINITIONS_TEMP}) 66 | 67 | # Here we add some definitions which prevent Visual Studio from 68 | # generating tons of warnings about unsecure function calls. 69 | # See http://msdn.microsoft.com/en-us/library/ttcz0bys.aspx 70 | if(WIN32) 71 | set(wxWidgets_DEFINITIONS ${wxWidgets_DEFINITIONS}; 72 | /D_CRT_SECURE_NO_DEPRECATE; 73 | /D_CRT_NONSTDC_NO_DEPRECATE; 74 | /D_UNICODE) 75 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4996") 76 | endif(WIN32) 77 | 78 | # Since we are going to use wxWidgets in all subrojects, 79 | # it's OK to create the variable which will contain 80 | # common preprocessor definitions. This variable will be 81 | # used in subprojects. 82 | set(PREPROCESSOR_DEFINITIONS ${PREPROCESSOR_DEFINITIONS}; 83 | ${wxWidgets_DEFINITIONS}) 84 | 85 | # Variable which points to root folder of our source code 86 | set(PROJECT_ROOT_DIR ${PROJECT_SOURCE_DIR}/..) 87 | 88 | # If any ThirdParty libraries are going to be 89 | # used in our project then it would be better to put 90 | # them into separate subfolder. We will create 91 | # the variable which points to this subfolder. 92 | set(THIRD_PARTY_DIR ${PROJECT_ROOT_DIR}/ThirdParty) 93 | 94 | set(BASE_INCLUDE_DIRECTORIES ${PROJECT_ROOT_DIR}/include) 95 | 96 | # Add wxWidgets include paths to the list of 97 | # include directories for all projects. 98 | include_directories(${wxWidgets_INCLUDE_DIRS}) 99 | 100 | if(WIN32 OR LINUX) 101 | set(CMAKE_CXX_FLAGS_DEBUG 102 | "${CMAKE_CXX_FLAGS_DEBUG} 103 | /D__WXDEBUG__=1" ) 104 | endif(WIN32 OR LINUX) 105 | 106 | # Now we can include all our subprojects. 107 | # CMake will generate project files for them 108 | add_subdirectory (../wxModularHost 109 | ../../wxModularHost/${OS_BASE_NAME}${LIB_SUFFIX}) 110 | add_subdirectory (../wxModularCore 111 | ../../wxModularCore/${OS_BASE_NAME}${LIB_SUFFIX}) 112 | 113 | add_subdirectory (../wxNonGuiPluginBase 114 | ../../wxNonGuiPluginBase/${OS_BASE_NAME}${LIB_SUFFIX}) 115 | add_subdirectory (../SampleNonGuiPlugin 116 | ../../SampleNonGuiPlugin/${OS_BASE_NAME}${LIB_SUFFIX}) 117 | 118 | add_subdirectory (../wxGuiPluginBase 119 | ../../wxGuiPluginBase/${OS_BASE_NAME}${LIB_SUFFIX}) 120 | add_subdirectory (../SampleGuiPlugin1 121 | ../../SampleGuiPlugin1/${OS_BASE_NAME}${LIB_SUFFIX}) 122 | add_subdirectory (../SampleGuiPlugin2 123 | ../../SampleGuiPlugin2/${OS_BASE_NAME}${LIB_SUFFIX}) 124 | -------------------------------------------------------------------------------- /build/FindPackageHandleStandardArgs.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | #[=======================================================================[.rst: 5 | FindPackageHandleStandardArgs 6 | ----------------------------- 7 | 8 | This module provides functions intended to be used in :ref:`Find Modules` 9 | implementing :command:`find_package()` calls. 10 | 11 | .. command:: find_package_handle_standard_args 12 | 13 | This command handles the ``REQUIRED``, ``QUIET`` and version-related 14 | arguments of :command:`find_package`. It also sets the 15 | ``_FOUND`` variable. The package is considered found if all 16 | variables listed contain valid results, e.g. valid filepaths. 17 | 18 | There are two signatures: 19 | 20 | .. code-block:: cmake 21 | 22 | find_package_handle_standard_args( 23 | (DEFAULT_MSG|) 24 | ... 25 | ) 26 | 27 | find_package_handle_standard_args( 28 | [FOUND_VAR ] 29 | [REQUIRED_VARS ...] 30 | [VERSION_VAR ] 31 | [HANDLE_VERSION_RANGE] 32 | [HANDLE_COMPONENTS] 33 | [CONFIG_MODE] 34 | [NAME_MISMATCHED] 35 | [REASON_FAILURE_MESSAGE ] 36 | [FAIL_MESSAGE ] 37 | ) 38 | 39 | The ``_FOUND`` variable will be set to ``TRUE`` if all 40 | the variables ``...`` are valid and any optional 41 | constraints are satisfied, and ``FALSE`` otherwise. A success or 42 | failure message may be displayed based on the results and on 43 | whether the ``REQUIRED`` and/or ``QUIET`` option was given to 44 | the :command:`find_package` call. 45 | 46 | The options are: 47 | 48 | ``(DEFAULT_MSG|)`` 49 | In the simple signature this specifies the failure message. 50 | Use ``DEFAULT_MSG`` to ask for a default message to be computed 51 | (recommended). Not valid in the full signature. 52 | 53 | ``FOUND_VAR `` 54 | .. deprecated:: 3.3 55 | 56 | Specifies either ``_FOUND`` or 57 | ``_FOUND`` as the result variable. This exists only 58 | for compatibility with older versions of CMake and is now ignored. 59 | Result variables of both names are always set for compatibility. 60 | 61 | ``REQUIRED_VARS ...`` 62 | Specify the variables which are required for this package. 63 | These may be named in the generated failure message asking the 64 | user to set the missing variable values. Therefore these should 65 | typically be cache entries such as ``FOO_LIBRARY`` and not output 66 | variables like ``FOO_LIBRARIES``. 67 | 68 | .. versionchanged:: 3.18 69 | If ``HANDLE_COMPONENTS`` is specified, this option can be omitted. 70 | 71 | ``VERSION_VAR `` 72 | Specify the name of a variable that holds the version of the package 73 | that has been found. This version will be checked against the 74 | (potentially) specified required version given to the 75 | :command:`find_package` call, including its ``EXACT`` option. 76 | The default messages include information about the required 77 | version and the version which has been actually found, both 78 | if the version is ok or not. 79 | 80 | ``HANDLE_VERSION_RANGE`` 81 | .. versionadded:: 3.19 82 | 83 | Enable handling of a version range, if one is specified. Without this 84 | option, a developer warning will be displayed if a version range is 85 | specified. 86 | 87 | ``HANDLE_COMPONENTS`` 88 | Enable handling of package components. In this case, the command 89 | will report which components have been found and which are missing, 90 | and the ``_FOUND`` variable will be set to ``FALSE`` 91 | if any of the required components (i.e. not the ones listed after 92 | the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are 93 | missing. 94 | 95 | ``CONFIG_MODE`` 96 | Specify that the calling find module is a wrapper around a 97 | call to ``find_package( NO_MODULE)``. This implies 98 | a ``VERSION_VAR`` value of ``_VERSION``. The command 99 | will automatically check whether the package configuration file 100 | was found. 101 | 102 | ``REASON_FAILURE_MESSAGE `` 103 | .. versionadded:: 3.16 104 | 105 | Specify a custom message of the reason for the failure which will be 106 | appended to the default generated message. 107 | 108 | ``FAIL_MESSAGE `` 109 | Specify a custom failure message instead of using the default 110 | generated message. Not recommended. 111 | 112 | ``NAME_MISMATCHED`` 113 | .. versionadded:: 3.17 114 | 115 | Indicate that the ```` does not match 116 | ``${CMAKE_FIND_PACKAGE_NAME}``. This is usually a mistake and raises a 117 | warning, but it may be intentional for usage of the command for components 118 | of a larger package. 119 | 120 | Example for the simple signature: 121 | 122 | .. code-block:: cmake 123 | 124 | find_package_handle_standard_args(LibXml2 DEFAULT_MSG 125 | LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) 126 | 127 | The ``LibXml2`` package is considered to be found if both 128 | ``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. 129 | Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found 130 | and ``REQUIRED`` was used, it fails with a 131 | :command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was 132 | used or not. If it is found, success will be reported, including 133 | the content of the first ````. On repeated CMake runs, 134 | the same message will not be printed again. 135 | 136 | .. note:: 137 | 138 | If ```` does not match ``CMAKE_FIND_PACKAGE_NAME`` for the 139 | calling module, a warning that there is a mismatch is given. The 140 | ``FPHSA_NAME_MISMATCHED`` variable may be set to bypass the warning if using 141 | the old signature and the ``NAME_MISMATCHED`` argument using the new 142 | signature. To avoid forcing the caller to require newer versions of CMake for 143 | usage, the variable's value will be used if defined when the 144 | ``NAME_MISMATCHED`` argument is not passed for the new signature (but using 145 | both is an error).. 146 | 147 | Example for the full signature: 148 | 149 | .. code-block:: cmake 150 | 151 | find_package_handle_standard_args(LibArchive 152 | REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR 153 | VERSION_VAR LibArchive_VERSION) 154 | 155 | In this case, the ``LibArchive`` package is considered to be found if 156 | both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. 157 | Also the version of ``LibArchive`` will be checked by using the version 158 | contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, 159 | the default messages will be printed. 160 | 161 | Another example for the full signature: 162 | 163 | .. code-block:: cmake 164 | 165 | find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) 166 | find_package_handle_standard_args(Automoc4 CONFIG_MODE) 167 | 168 | In this case, a ``FindAutmoc4.cmake`` module wraps a call to 169 | ``find_package(Automoc4 NO_MODULE)`` and adds an additional search 170 | directory for ``automoc4``. Then the call to 171 | ``find_package_handle_standard_args`` produces a proper success/failure 172 | message. 173 | 174 | .. command:: find_package_check_version 175 | 176 | .. versionadded:: 3.19 177 | 178 | Helper function which can be used to check if a ```` is valid 179 | against version-related arguments of :command:`find_package`. 180 | 181 | .. code-block:: cmake 182 | 183 | find_package_check_version( 184 | [HANDLE_VERSION_RANGE] 185 | [RESULT_MESSAGE_VARIABLE ] 186 | ) 187 | 188 | The ```` will hold a boolean value giving the result of the check. 189 | 190 | The options are: 191 | 192 | ``HANDLE_VERSION_RANGE`` 193 | Enable handling of a version range, if one is specified. Without this 194 | option, a developer warning will be displayed if a version range is 195 | specified. 196 | 197 | ``RESULT_MESSAGE_VARIABLE `` 198 | Specify a variable to get back a message describing the result of the check. 199 | 200 | Example for the usage: 201 | 202 | .. code-block:: cmake 203 | 204 | find_package_check_version(1.2.3 result HANDLE_VERSION_RANGE 205 | RESULT_MESSAGE_VARIABLE reason) 206 | if (result) 207 | message (STATUS "${reason}") 208 | else() 209 | message (FATAL_ERROR "${reason}") 210 | endif() 211 | #]=======================================================================] 212 | 213 | include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) 214 | 215 | 216 | cmake_policy(PUSH) 217 | # numbers and boolean constants 218 | cmake_policy (SET CMP0012 NEW) 219 | # IN_LIST operator 220 | cmake_policy (SET CMP0057 NEW) 221 | 222 | 223 | # internal helper macro 224 | macro(_FPHSA_FAILURE_MESSAGE _msg) 225 | set (__msg "${_msg}") 226 | if (FPHSA_REASON_FAILURE_MESSAGE) 227 | string(APPEND __msg "\n Reason given by package: ${FPHSA_REASON_FAILURE_MESSAGE}\n") 228 | elseif(NOT DEFINED PROJECT_NAME) 229 | string(APPEND __msg "\n" 230 | "Hint: The project() command has not yet been called. It sets up system-specific search paths.") 231 | endif() 232 | if (${_NAME}_FIND_REQUIRED) 233 | message(FATAL_ERROR "${__msg}") 234 | else () 235 | if (NOT ${_NAME}_FIND_QUIETLY) 236 | message(STATUS "${__msg}") 237 | endif () 238 | endif () 239 | endmacro() 240 | 241 | 242 | # internal helper macro to generate the failure message when used in CONFIG_MODE: 243 | macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) 244 | # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: 245 | if(${_NAME}_CONFIG) 246 | _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") 247 | else() 248 | # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. 249 | # List them all in the error message: 250 | if(${_NAME}_CONSIDERED_CONFIGS) 251 | set(configsText "") 252 | list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) 253 | math(EXPR configsCount "${configsCount} - 1") 254 | foreach(currentConfigIndex RANGE ${configsCount}) 255 | list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) 256 | list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) 257 | string(APPEND configsText "\n ${filename} (version ${version})") 258 | endforeach() 259 | if (${_NAME}_NOT_FOUND_MESSAGE) 260 | if (FPHSA_REASON_FAILURE_MESSAGE) 261 | string(PREPEND FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}\n ") 262 | else() 263 | set(FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}") 264 | endif() 265 | else() 266 | string(APPEND configsText "\n") 267 | endif() 268 | _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:${configsText}") 269 | 270 | else() 271 | # Simple case: No Config-file was found at all: 272 | _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") 273 | endif() 274 | endif() 275 | endmacro() 276 | 277 | 278 | function(FIND_PACKAGE_CHECK_VERSION version result) 279 | cmake_parse_arguments (PARSE_ARGV 2 FPCV "HANDLE_VERSION_RANGE;NO_AUTHOR_WARNING_VERSION_RANGE" "RESULT_MESSAGE_VARIABLE" "") 280 | 281 | if (FPCV_UNPARSED_ARGUMENTS) 282 | message (FATAL_ERROR "find_package_check_version(): ${FPCV_UNPARSED_ARGUMENTS}: unexpected arguments") 283 | endif() 284 | if ("RESULT_MESSAGE_VARIABLE" IN_LIST FPCV_KEYWORDS_MISSING_VALUES) 285 | message (FATAL_ERROR "find_package_check_version(): RESULT_MESSAGE_VARIABLE expects an argument") 286 | endif() 287 | 288 | set (${result} FALSE PARENT_SCOPE) 289 | if (FPCV_RESULT_MESSAGE_VARIABLE) 290 | unset (${FPCV_RESULT_MESSAGE_VARIABLE} PARENT_SCOPE) 291 | endif() 292 | 293 | if (_CMAKE_FPHSA_PACKAGE_NAME) 294 | set (package "${_CMAKE_FPHSA_PACKAGE_NAME}") 295 | elseif (CMAKE_FIND_PACKAGE_NAME) 296 | set (package "${CMAKE_FIND_PACKAGE_NAME}") 297 | else() 298 | message (FATAL_ERROR "find_package_check_version(): Cannot be used outside a 'Find Module'") 299 | endif() 300 | 301 | if (NOT FPCV_NO_AUTHOR_WARNING_VERSION_RANGE 302 | AND ${package}_FIND_VERSION_RANGE AND NOT FPCV_HANDLE_VERSION_RANGE) 303 | message(AUTHOR_WARNING 304 | "`find_package()` specify a version range but the option " 305 | "HANDLE_VERSION_RANGE` is not passed to `find_package_check_version()`. " 306 | "Only the lower endpoint of the range will be used.") 307 | endif() 308 | 309 | 310 | set (version_ok FALSE) 311 | unset (version_msg) 312 | 313 | if (FPCV_HANDLE_VERSION_RANGE AND ${package}_FIND_VERSION_RANGE) 314 | if ((${package}_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" 315 | AND version VERSION_GREATER_EQUAL ${package}_FIND_VERSION_MIN) 316 | AND ((${package}_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" 317 | AND version VERSION_LESS_EQUAL ${package}_FIND_VERSION_MAX) 318 | OR (${package}_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" 319 | AND version VERSION_LESS ${package}_FIND_VERSION_MAX))) 320 | set (version_ok TRUE) 321 | set(version_msg "(found suitable version \"${version}\", required range is \"${${package}_FIND_VERSION_RANGE}\")") 322 | else() 323 | set(version_msg "Found unsuitable version \"${version}\", required range is \"${${package}_FIND_VERSION_RANGE}\"") 324 | endif() 325 | elseif (DEFINED ${package}_FIND_VERSION) 326 | if(${package}_FIND_VERSION_EXACT) # exact version required 327 | # count the dots in the version string 328 | string(REGEX REPLACE "[^.]" "" version_dots "${version}") 329 | # add one dot because there is one dot more than there are components 330 | string(LENGTH "${version_dots}." version_dots) 331 | if (version_dots GREATER ${package}_FIND_VERSION_COUNT) 332 | # Because of the C++ implementation of find_package() ${package}_FIND_VERSION_COUNT 333 | # is at most 4 here. Therefore a simple lookup table is used. 334 | if (${package}_FIND_VERSION_COUNT EQUAL 1) 335 | set(version_regex "[^.]*") 336 | elseif (${package}_FIND_VERSION_COUNT EQUAL 2) 337 | set(version_regex "[^.]*\\.[^.]*") 338 | elseif (${package}_FIND_VERSION_COUNT EQUAL 3) 339 | set(version_regex "[^.]*\\.[^.]*\\.[^.]*") 340 | else() 341 | set(version_regex "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") 342 | endif() 343 | string(REGEX REPLACE "^(${version_regex})\\..*" "\\1" version_head "${version}") 344 | if (NOT ${package}_FIND_VERSION VERSION_EQUAL version_head) 345 | set(version_msg "Found unsuitable version \"${version}\", but required is exact version \"${${package}_FIND_VERSION}\"") 346 | else () 347 | set(version_ok TRUE) 348 | set(version_msg "(found suitable exact version \"${version}\")") 349 | endif () 350 | else () 351 | if (NOT ${package}_FIND_VERSION VERSION_EQUAL version) 352 | set(version_msg "Found unsuitable version \"${version}\", but required is exact version \"${${package}_FIND_VERSION}\"") 353 | else () 354 | set(version_ok TRUE) 355 | set(version_msg "(found suitable exact version \"${version}\")") 356 | endif () 357 | endif () 358 | else() # minimum version 359 | if (${package}_FIND_VERSION VERSION_GREATER version) 360 | set(version_msg "Found unsuitable version \"${version}\", but required is at least \"${${package}_FIND_VERSION}\"") 361 | else() 362 | set(version_ok TRUE) 363 | set(version_msg "(found suitable version \"${version}\", minimum required is \"${${package}_FIND_VERSION}\")") 364 | endif() 365 | endif() 366 | else () 367 | set(version_ok TRUE) 368 | set(version_msg "(found version \"${version}\")") 369 | endif() 370 | 371 | set (${result} ${version_ok} PARENT_SCOPE) 372 | if (FPCV_RESULT_MESSAGE_VARIABLE) 373 | set (${FPCV_RESULT_MESSAGE_VARIABLE} "${version_msg}" PARENT_SCOPE) 374 | endif() 375 | endfunction() 376 | 377 | 378 | function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) 379 | 380 | # Set up the arguments for `cmake_parse_arguments`. 381 | set(options CONFIG_MODE HANDLE_COMPONENTS NAME_MISMATCHED HANDLE_VERSION_RANGE) 382 | set(oneValueArgs FAIL_MESSAGE REASON_FAILURE_MESSAGE VERSION_VAR FOUND_VAR) 383 | set(multiValueArgs REQUIRED_VARS) 384 | 385 | # Check whether we are in 'simple' or 'extended' mode: 386 | set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) 387 | list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) 388 | 389 | unset(FPHSA_NAME_MISMATCHED_override) 390 | if (DEFINED FPHSA_NAME_MISMATCHED) 391 | # If the variable NAME_MISMATCHED variable is set, error if it is passed as 392 | # an argument. The former is for old signatures, the latter is for new 393 | # signatures. 394 | list(FIND ARGN "NAME_MISMATCHED" name_mismatched_idx) 395 | if (NOT name_mismatched_idx EQUAL "-1") 396 | message(FATAL_ERROR 397 | "The `NAME_MISMATCHED` argument may only be specified by the argument or " 398 | "the variable, not both.") 399 | endif () 400 | 401 | # But use the variable if it is not an argument to avoid forcing minimum 402 | # CMake version bumps for calling modules. 403 | set(FPHSA_NAME_MISMATCHED_override "${FPHSA_NAME_MISMATCHED}") 404 | endif () 405 | 406 | if(${INDEX} EQUAL -1) 407 | set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) 408 | set(FPHSA_REQUIRED_VARS ${ARGN}) 409 | set(FPHSA_VERSION_VAR) 410 | else() 411 | cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) 412 | 413 | if(FPHSA_UNPARSED_ARGUMENTS) 414 | message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") 415 | endif() 416 | 417 | if(NOT FPHSA_FAIL_MESSAGE) 418 | set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") 419 | endif() 420 | 421 | # In config-mode, we rely on the variable _CONFIG, which is set by find_package() 422 | # when it successfully found the config-file, including version checking: 423 | if(FPHSA_CONFIG_MODE) 424 | list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) 425 | list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) 426 | set(FPHSA_VERSION_VAR ${_NAME}_VERSION) 427 | endif() 428 | 429 | if(NOT FPHSA_REQUIRED_VARS AND NOT FPHSA_HANDLE_COMPONENTS) 430 | message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") 431 | endif() 432 | endif() 433 | 434 | if (DEFINED FPHSA_NAME_MISMATCHED_override) 435 | set(FPHSA_NAME_MISMATCHED "${FPHSA_NAME_MISMATCHED_override}") 436 | endif () 437 | 438 | if (DEFINED CMAKE_FIND_PACKAGE_NAME 439 | AND NOT FPHSA_NAME_MISMATCHED 440 | AND NOT _NAME STREQUAL CMAKE_FIND_PACKAGE_NAME) 441 | message(AUTHOR_WARNING 442 | "The package name passed to `find_package_handle_standard_args` " 443 | "(${_NAME}) does not match the name of the calling package " 444 | "(${CMAKE_FIND_PACKAGE_NAME}). This can lead to problems in calling " 445 | "code that expects `find_package` result variables (e.g., `_FOUND`) " 446 | "to follow a certain pattern.") 447 | endif () 448 | 449 | if (${_NAME}_FIND_VERSION_RANGE AND NOT FPHSA_HANDLE_VERSION_RANGE) 450 | message(AUTHOR_WARNING 451 | "`find_package()` specify a version range but the module ${_NAME} does " 452 | "not support this capability. Only the lower endpoint of the range " 453 | "will be used.") 454 | endif() 455 | 456 | # to propagate package name to FIND_PACKAGE_CHECK_VERSION 457 | set(_CMAKE_FPHSA_PACKAGE_NAME "${_NAME}") 458 | 459 | # now that we collected all arguments, process them 460 | 461 | if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") 462 | set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") 463 | endif() 464 | 465 | if (FPHSA_REQUIRED_VARS) 466 | list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) 467 | endif() 468 | 469 | string(TOUPPER ${_NAME} _NAME_UPPER) 470 | string(TOLOWER ${_NAME} _NAME_LOWER) 471 | 472 | if(FPHSA_FOUND_VAR) 473 | set(_FOUND_VAR_UPPER ${_NAME_UPPER}_FOUND) 474 | set(_FOUND_VAR_MIXED ${_NAME}_FOUND) 475 | if(FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_MIXED OR FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_UPPER) 476 | set(_FOUND_VAR ${FPHSA_FOUND_VAR}) 477 | else() 478 | message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_FOUND_VAR_MIXED}\" and \"${_FOUND_VAR_UPPER}\" are valid names.") 479 | endif() 480 | else() 481 | set(_FOUND_VAR ${_NAME_UPPER}_FOUND) 482 | endif() 483 | 484 | # collect all variables which were not found, so they can be printed, so the 485 | # user knows better what went wrong (#6375) 486 | set(MISSING_VARS "") 487 | set(DETAILS "") 488 | # check if all passed variables are valid 489 | set(FPHSA_FOUND_${_NAME} TRUE) 490 | foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) 491 | if(NOT ${_CURRENT_VAR}) 492 | set(FPHSA_FOUND_${_NAME} FALSE) 493 | string(APPEND MISSING_VARS " ${_CURRENT_VAR}") 494 | else() 495 | string(APPEND DETAILS "[${${_CURRENT_VAR}}]") 496 | endif() 497 | endforeach() 498 | if(FPHSA_FOUND_${_NAME}) 499 | set(${_NAME}_FOUND TRUE) 500 | set(${_NAME_UPPER}_FOUND TRUE) 501 | else() 502 | set(${_NAME}_FOUND FALSE) 503 | set(${_NAME_UPPER}_FOUND FALSE) 504 | endif() 505 | 506 | # component handling 507 | unset(FOUND_COMPONENTS_MSG) 508 | unset(MISSING_COMPONENTS_MSG) 509 | 510 | if(FPHSA_HANDLE_COMPONENTS) 511 | foreach(comp ${${_NAME}_FIND_COMPONENTS}) 512 | if(${_NAME}_${comp}_FOUND) 513 | 514 | if(NOT DEFINED FOUND_COMPONENTS_MSG) 515 | set(FOUND_COMPONENTS_MSG "found components:") 516 | endif() 517 | string(APPEND FOUND_COMPONENTS_MSG " ${comp}") 518 | 519 | else() 520 | 521 | if(NOT DEFINED MISSING_COMPONENTS_MSG) 522 | set(MISSING_COMPONENTS_MSG "missing components:") 523 | endif() 524 | string(APPEND MISSING_COMPONENTS_MSG " ${comp}") 525 | 526 | if(${_NAME}_FIND_REQUIRED_${comp}) 527 | set(${_NAME}_FOUND FALSE) 528 | string(APPEND MISSING_VARS " ${comp}") 529 | endif() 530 | 531 | endif() 532 | endforeach() 533 | set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") 534 | string(APPEND DETAILS "[c${COMPONENT_MSG}]") 535 | endif() 536 | 537 | # version handling: 538 | set(VERSION_MSG "") 539 | set(VERSION_OK TRUE) 540 | 541 | # check that the version variable is not empty to avoid emitting a misleading 542 | # message (i.e. `Found unsuitable version ""`) 543 | if (DEFINED ${_NAME}_FIND_VERSION) 544 | if(DEFINED ${FPHSA_VERSION_VAR}) 545 | if(NOT "${${FPHSA_VERSION_VAR}}" STREQUAL "") 546 | set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}}) 547 | if (FPHSA_HANDLE_VERSION_RANGE) 548 | set (FPCV_HANDLE_VERSION_RANGE HANDLE_VERSION_RANGE) 549 | else() 550 | set(FPCV_HANDLE_VERSION_RANGE NO_AUTHOR_WARNING_VERSION_RANGE) 551 | endif() 552 | find_package_check_version ("${_FOUND_VERSION}" VERSION_OK RESULT_MESSAGE_VARIABLE VERSION_MSG 553 | ${FPCV_HANDLE_VERSION_RANGE}) 554 | else() 555 | set(VERSION_OK FALSE) 556 | endif() 557 | endif() 558 | if("${${FPHSA_VERSION_VAR}}" STREQUAL "") 559 | # if the package was not found, but a version was given, add that to the output: 560 | if(${_NAME}_FIND_VERSION_EXACT) 561 | set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") 562 | elseif (FPHSA_HANDLE_VERSION_RANGE AND ${_NAME}_FIND_VERSION_RANGE) 563 | set(VERSION_MSG "(Required is version range \"${${_NAME}_FIND_VERSION_RANGE}\")") 564 | else() 565 | set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") 566 | endif() 567 | endif() 568 | else () 569 | # Check with DEFINED as the found version may be 0. 570 | if(DEFINED ${FPHSA_VERSION_VAR}) 571 | set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")") 572 | endif() 573 | endif () 574 | 575 | if(VERSION_OK) 576 | string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]") 577 | else() 578 | set(${_NAME}_FOUND FALSE) 579 | endif() 580 | 581 | 582 | # print the result: 583 | if (${_NAME}_FOUND) 584 | FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") 585 | else () 586 | 587 | if(FPHSA_CONFIG_MODE) 588 | _FPHSA_HANDLE_FAILURE_CONFIG_MODE() 589 | else() 590 | if(NOT VERSION_OK) 591 | set(RESULT_MSG) 592 | if (_FIRST_REQUIRED_VAR) 593 | string (APPEND RESULT_MSG "found ${${_FIRST_REQUIRED_VAR}}") 594 | endif() 595 | if (COMPONENT_MSG) 596 | if (RESULT_MSG) 597 | string (APPEND RESULT_MSG ", ") 598 | endif() 599 | string (APPEND RESULT_MSG "${FOUND_COMPONENTS_MSG}") 600 | endif() 601 | _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (${RESULT_MSG})") 602 | else() 603 | _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}") 604 | endif() 605 | endif() 606 | 607 | endif () 608 | 609 | set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) 610 | set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) 611 | endfunction() 612 | 613 | 614 | cmake_policy(POP) 615 | -------------------------------------------------------------------------------- /build/FindPackageMessage.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | #[=======================================================================[.rst: 5 | FindPackageMessage 6 | ------------------ 7 | 8 | .. code-block:: cmake 9 | 10 | find_package_message( "message for user" "find result details") 11 | 12 | This function is intended to be used in FindXXX.cmake modules files. 13 | It will print a message once for each unique find result. This is 14 | useful for telling the user where a package was found. The first 15 | argument specifies the name (XXX) of the package. The second argument 16 | specifies the message to display. The third argument lists details 17 | about the find result so that if they change the message will be 18 | displayed again. The macro also obeys the QUIET argument to the 19 | find_package command. 20 | 21 | Example: 22 | 23 | .. code-block:: cmake 24 | 25 | if(X11_FOUND) 26 | find_package_message(X11 "Found X11: ${X11_X11_LIB}" 27 | "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") 28 | else() 29 | ... 30 | endif() 31 | #]=======================================================================] 32 | 33 | function(find_package_message pkg msg details) 34 | # Avoid printing a message repeatedly for the same find result. 35 | if(NOT ${pkg}_FIND_QUIETLY) 36 | string(REPLACE "\n" "" details "${details}") 37 | set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) 38 | if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") 39 | # The message has not yet been printed. 40 | string(STRIP "${msg}" msg) 41 | message(STATUS "${msg}") 42 | 43 | # Save the find details in the cache to avoid printing the same 44 | # message again. 45 | set("${DETAILS_VAR}" "${details}" 46 | CACHE INTERNAL "Details about finding ${pkg}") 47 | endif() 48 | endif() 49 | endfunction() 50 | -------------------------------------------------------------------------------- /build/PCHSupport.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find precompiled headers support for GCC 3.4 and 4.x 2 | # Once done this will define: 3 | # 4 | # Variable: 5 | # PCHSupport_FOUND 6 | # 7 | # Macro: 8 | # ADD_PRECOMPILED_HEADER _targetName _input _dowarn 9 | # ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use _dowarn 10 | # ADD_NATIVE_PRECOMPILED_HEADER _targetName _input _dowarn 11 | # GET_NATIVE_PRECOMPILED_HEADER _targetName _input 12 | 13 | # SET_PRECOMPILED_HEADER: 14 | # this was written by Ronnie for a staright forward call to set pch in Visual Studio 15 | # which requires setting a create with a cpp file 16 | # for other platforms this simply falls back to ADD_NATIVE_PRECOMPILED_HEADER 17 | # SET_PRECOMPILED_HEADER targetName hFileName cppFileName 18 | 19 | IF(CMAKE_COMPILER_IS_GNUCXX) 20 | 21 | EXEC_PROGRAM( 22 | ${CMAKE_CXX_COMPILER} 23 | ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion 24 | OUTPUT_VARIABLE gcc_compiler_version) 25 | #MESSAGE("GCC Version: ${gcc_compiler_version}") 26 | IF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") 27 | SET(PCHSupport_FOUND TRUE) 28 | ELSE(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") 29 | IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") 30 | SET(PCHSupport_FOUND TRUE) 31 | ENDIF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") 32 | ENDIF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") 33 | 34 | SET(_PCH_include_prefix "-I") 35 | 36 | ELSE(CMAKE_COMPILER_IS_GNUCXX) 37 | IF(WIN32) 38 | SET(PCHSupport_FOUND TRUE) # for experimental msvc support 39 | SET(_PCH_include_prefix "/I") 40 | ELSE(WIN32) 41 | SET(PCHSupport_FOUND FALSE) 42 | ENDIF(WIN32) 43 | ENDIF(CMAKE_COMPILER_IS_GNUCXX) 44 | 45 | 46 | MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) 47 | 48 | 49 | STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) 50 | SET(${_out_compile_flags} ${${_flags_var_name}} ) 51 | 52 | IF(CMAKE_COMPILER_IS_GNUCXX) 53 | 54 | GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) 55 | IF(${_targetType} STREQUAL SHARED_LIBRARY) 56 | LIST(APPEND ${_out_compile_flags} "${${_out_compile_flags}} -fPIC") 57 | ENDIF(${_targetType} STREQUAL SHARED_LIBRARY) 58 | 59 | ELSE(CMAKE_COMPILER_IS_GNUCXX) 60 | ## TODO ... ? or does it work out of the box 61 | ENDIF(CMAKE_COMPILER_IS_GNUCXX) 62 | 63 | GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES ) 64 | FOREACH(item ${DIRINC}) 65 | LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}${item}") 66 | ENDFOREACH(item) 67 | 68 | GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) 69 | #MESSAGE("_directory_flags ${_directory_flags}" ) 70 | LIST(APPEND ${_out_compile_flags} ${_directory_flags}) 71 | LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS} ) 72 | 73 | SEPARATE_ARGUMENTS(${_out_compile_flags}) 74 | 75 | ENDMACRO(_PCH_GET_COMPILE_FLAGS) 76 | 77 | 78 | MACRO(_PCH_WRITE_PCHDEP_CXX _targetName _include_file _dephelp) 79 | 80 | SET(${_dephelp} ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch_dephelp.cxx) 81 | FILE(WRITE ${${_dephelp}} 82 | "#include \"${_include_file}\" 83 | int testfunction() 84 | { 85 | return 0; 86 | } 87 | " 88 | ) 89 | 90 | ENDMACRO(_PCH_WRITE_PCHDEP_CXX ) 91 | 92 | MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _output) 93 | 94 | FILE(TO_NATIVE_PATH ${_input} _native_input) 95 | FILE(TO_NATIVE_PATH ${_output} _native_output) 96 | 97 | 98 | IF(CMAKE_COMPILER_IS_GNUCXX) 99 | IF(CMAKE_CXX_COMPILER_ARG1) 100 | # remove leading space in compiler argument 101 | STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1}) 102 | 103 | SET(${out_command} 104 | ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input} 105 | ) 106 | ELSE(CMAKE_CXX_COMPILER_ARG1) 107 | SET(${out_command} 108 | ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input} 109 | ) 110 | ENDIF(CMAKE_CXX_COMPILER_ARG1) 111 | ELSE(CMAKE_COMPILER_IS_GNUCXX) 112 | 113 | SET(_dummy_str "#include <${_input}>") 114 | FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pch_dummy.cpp ${_dummy_str}) 115 | 116 | SET(${out_command} 117 | ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} /c /Fp${_native_output} /Yc${_native_input} pch_dummy.cpp 118 | ) 119 | #/out:${_output} 120 | 121 | ENDIF(CMAKE_COMPILER_IS_GNUCXX) 122 | 123 | ENDMACRO(_PCH_GET_COMPILE_COMMAND ) 124 | 125 | 126 | 127 | MACRO(_PCH_GET_TARGET_COMPILE_FLAGS _cflags _header_name _pch_path _dowarn ) 128 | 129 | FILE(TO_NATIVE_PATH ${_pch_path} _native_pch_path) 130 | 131 | IF(CMAKE_COMPILER_IS_GNUCXX) 132 | # for use with distcc and gcc >4.0.1 if preprocessed files are accessible 133 | # on all remote machines set 134 | # PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess 135 | # if you want warnings for invalid header files (which is very inconvenient 136 | # if you have different versions of the headers for different build types 137 | # you may set _pch_dowarn 138 | IF (_dowarn) 139 | SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -include ${CMAKE_CURRENT_BINARY_DIR}/${_header_name} -Winvalid-pch " ) 140 | ELSE (_dowarn) 141 | SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -include ${CMAKE_CURRENT_BINARY_DIR}/${_header_name} " ) 142 | ENDIF (_dowarn) 143 | ELSE(CMAKE_COMPILER_IS_GNUCXX) 144 | 145 | set(${_cflags} "/Fp${_native_pch_path} /Yu${_header_name}" ) 146 | 147 | ENDIF(CMAKE_COMPILER_IS_GNUCXX) 148 | 149 | ENDMACRO(_PCH_GET_TARGET_COMPILE_FLAGS ) 150 | 151 | MACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output) 152 | GET_FILENAME_COMPONENT(_name ${_input} NAME) 153 | GET_FILENAME_COMPONENT(_path ${_input} PATH) 154 | SET(_output "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch/${_targetName}_${CMAKE_BUILD_TYPE}.h++") 155 | ENDMACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input) 156 | 157 | 158 | MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use ) 159 | 160 | # to do: test whether compiler flags match between target _targetName 161 | # and _pch_output_to_use 162 | GET_FILENAME_COMPONENT(_name ${_input} NAME) 163 | 164 | IF( "${ARGN}" STREQUAL "0") 165 | SET(_dowarn 0) 166 | ELSE( "${ARGN}" STREQUAL "0") 167 | SET(_dowarn 1) 168 | ENDIF("${ARGN}" STREQUAL "0") 169 | 170 | 171 | _PCH_GET_TARGET_COMPILE_FLAGS(_target_cflags ${_name} ${_pch_output_to_use} ${_dowarn}) 172 | # MESSAGE("Add flags ${_target_cflags} to ${_targetName} " ) 173 | SET_TARGET_PROPERTIES(${_targetName} 174 | PROPERTIES 175 | COMPILE_FLAGS ${_target_cflags} 176 | ) 177 | 178 | ADD_CUSTOM_TARGET(pch_Generate_${_targetName} 179 | DEPENDS ${_pch_output_to_use} 180 | ) 181 | 182 | ADD_DEPENDENCIES(${_targetName} pch_Generate_${_targetName} ) 183 | 184 | ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET) 185 | 186 | MACRO(ADD_PRECOMPILED_HEADER _targetName _input) 187 | 188 | SET(_PCH_current_target ${_targetName}) 189 | 190 | IF(NOT CMAKE_BUILD_TYPE) 191 | MESSAGE(FATAL_ERROR 192 | "This is the ADD_PRECOMPILED_HEADER macro. " 193 | "You must set CMAKE_BUILD_TYPE!" 194 | ) 195 | ENDIF(NOT CMAKE_BUILD_TYPE) 196 | 197 | IF( "${ARGN}" STREQUAL "0") 198 | SET(_dowarn 0) 199 | ELSE( "${ARGN}" STREQUAL "0") 200 | SET(_dowarn 1) 201 | ENDIF("${ARGN}" STREQUAL "0") 202 | 203 | 204 | GET_FILENAME_COMPONENT(_name ${_input} NAME) 205 | GET_FILENAME_COMPONENT(_path ${_input} PATH) 206 | GET_PRECOMPILED_HEADER_OUTPUT( ${_targetName} ${_input} _output) 207 | 208 | GET_FILENAME_COMPONENT(_outdir ${_output} PATH ) 209 | 210 | GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) 211 | _PCH_WRITE_PCHDEP_CXX(${_targetName} ${_input} _pch_dephelp_cxx) 212 | 213 | IF(${_targetType} STREQUAL SHARED_LIBRARY) 214 | ADD_LIBRARY(${_targetName}_pch_dephelp SHARED ${_pch_dephelp_cxx} ) 215 | ELSE(${_targetType} STREQUAL SHARED_LIBRARY) 216 | ADD_LIBRARY(${_targetName}_pch_dephelp STATIC ${_pch_dephelp_cxx}) 217 | ENDIF(${_targetType} STREQUAL SHARED_LIBRARY) 218 | 219 | FILE(MAKE_DIRECTORY ${_outdir}) 220 | 221 | 222 | _PCH_GET_COMPILE_FLAGS(_compile_FLAGS) 223 | 224 | #MESSAGE("_compile_FLAGS: ${_compile_FLAGS}") 225 | #message("COMMAND ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}") 226 | SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${_name} PROPERTIES GENERATED 1) 227 | ADD_CUSTOM_COMMAND( 228 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_name} 229 | COMMAND ${CMAKE_COMMAND} -E copy ${_input} ${CMAKE_CURRENT_BINARY_DIR}/${_name} # ensure same directory! Required by gcc 230 | DEPENDS ${_input} 231 | ) 232 | 233 | #message("_command ${_input} ${_output}") 234 | _PCH_GET_COMPILE_COMMAND(_command ${CMAKE_CURRENT_BINARY_DIR}/${_name} ${_output} ) 235 | 236 | #message(${_input} ) 237 | #message("_output ${_output}") 238 | 239 | ADD_CUSTOM_COMMAND( 240 | OUTPUT ${_output} 241 | COMMAND ${_command} 242 | DEPENDS ${_input} ${CMAKE_CURRENT_BINARY_DIR}/${_name} ${_targetName}_pch_dephelp 243 | ) 244 | 245 | 246 | ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_input} ${_output} ${_dowarn}) 247 | ENDMACRO(ADD_PRECOMPILED_HEADER) 248 | 249 | 250 | # Generates the use of precompiled in a target, 251 | # without using depency targets (2 extra for each target) 252 | # Using Visual, must also add ${_targetName}_pch to sources 253 | # Not needed by Xcode 254 | 255 | MACRO(GET_NATIVE_PRECOMPILED_HEADER _targetName _input) 256 | 257 | if(CMAKE_GENERATOR MATCHES Visual*) 258 | 259 | SET(_dummy_str "#include \"${_input}\"\n" 260 | "// This is required to suppress LNK4221. Very annoying.\n" 261 | "void *g_${_targetName}Dummy = 0\;\n") 262 | 263 | # Use of cxx extension for generated files (as Qt does) 264 | SET(${_targetName}_pch ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch.cxx) 265 | if(EXISTS ${${_targetName}_pch}) 266 | # Check if contents is the same, if not rewrite 267 | # todo 268 | else(EXISTS ${${_targetName}_pch}) 269 | FILE(WRITE ${${_targetName}_pch} ${_dummy_str}) 270 | endif(EXISTS ${${_targetName}_pch}) 271 | endif(CMAKE_GENERATOR MATCHES Visual*) 272 | 273 | ENDMACRO(GET_NATIVE_PRECOMPILED_HEADER) 274 | 275 | 276 | MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input) 277 | 278 | IF( "${ARGN}" STREQUAL "0") 279 | SET(_dowarn 0) 280 | ELSE( "${ARGN}" STREQUAL "0") 281 | SET(_dowarn 1) 282 | ENDIF("${ARGN}" STREQUAL "0") 283 | 284 | if(CMAKE_GENERATOR MATCHES Visual*) 285 | # Auto include the precompile (useful for moc processing, since the use of 286 | # precompiled is specified at the target level 287 | # and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt) 288 | 289 | GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) 290 | if (${oldProps} MATCHES NOTFOUND) 291 | SET(oldProps "") 292 | endif(${oldProps} MATCHES NOTFOUND) 293 | 294 | SET(newProperties "${oldProps} /Yu\"${_input}\" /FI\"${_input}\"") 295 | SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}") 296 | 297 | #also inlude ${oldProps} to have the same compile options 298 | SET_SOURCE_FILES_PROPERTIES(${${_targetName}_pch} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_input}\"") 299 | 300 | else(CMAKE_GENERATOR MATCHES Visual*) 301 | 302 | if (CMAKE_GENERATOR MATCHES Xcode) 303 | # For Xcode, cmake needs my patch to process 304 | # GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties 305 | 306 | GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) 307 | if (${oldProps} MATCHES NOTFOUND) 308 | SET(oldProps "") 309 | endif(${oldProps} MATCHES NOTFOUND) 310 | 311 | # When buiding out of the tree, precompiled may not be located 312 | # Use full path instead. 313 | GET_FILENAME_COMPONENT(fullPath ${_input} ABSOLUTE) 314 | 315 | SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}") 316 | SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") 317 | 318 | else (CMAKE_GENERATOR MATCHES Xcode) 319 | 320 | #Fallback to the "old" precompiled suppport 321 | #ADD_PRECOMPILED_HEADER(${_targetName} ${_input} ${_dowarn}) 322 | endif(CMAKE_GENERATOR MATCHES Xcode) 323 | endif(CMAKE_GENERATOR MATCHES Visual*) 324 | 325 | ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER) 326 | 327 | MACRO(SET_PRECOMPILED_HEADER targetName hFileName cppFileName) 328 | ADD_NATIVE_PRECOMPILED_HEADER(${targetName} ${hFileName}) 329 | if(WIN32) 330 | GET_TARGET_PROPERTY(oldProps "${cppFileName}" COMPILE_FLAGS) 331 | if (${oldProps} MATCHES NOTFOUND) 332 | SET(oldProps "") 333 | endif(${oldProps} MATCHES NOTFOUND) 334 | SET_SOURCE_FILES_PROPERTIES(${cppFileName} PROPERTIES COMPILE_FLAGS "${oldprops} /Yc\"${hFileName}\"") 335 | endif(WIN32) 336 | ENDMACRO(SET_PRECOMPILED_HEADER) 337 | -------------------------------------------------------------------------------- /build/cm.bat: -------------------------------------------------------------------------------- 1 | rem @echo off 2 | IF "%1" == "" GOTO NO_PARAMS 3 | IF "%1" == "x86" GOTO CMAKE_86 4 | IF "%1" == "86" GOTO CMAKE_86 5 | IF "%1" == "32" GOTO CMAKE_86 6 | IF "%1" == "x64" GOTO CMAKE_64 7 | IF "%1" == "64" GOTO CMAKE_64 8 | 9 | ECHO %1 10 | ECHO "Nothing to do" 11 | GOTO End 12 | 13 | :CMAKE_86 14 | ECHO "Configuring for x86" 15 | cm86.bat 16 | GOTO End 17 | :CMAKE_64 18 | ECHO "Configuring for x64" 19 | cm64.bat 20 | GOTO End 21 | :NO_PARAMS 22 | ECHO "No parameters specified" 23 | IF EXIST "%ProgramW6432%" GOTO CMAKE_64 24 | GOTO CMAKE_86 25 | :End 26 | -------------------------------------------------------------------------------- /build/cm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -dr Mac 4 | mkdir Mac 5 | cd Mac 6 | cmake ../ -G "Xcode" 7 | cd .. 8 | -------------------------------------------------------------------------------- /build/cm64.bat: -------------------------------------------------------------------------------- 1 | rem @echo off 2 | rmdir /S /Q Win 3 | mkdir Win 4 | cd Win 5 | cmake ../ -G "Visual Studio 17 2022" 6 | copy ..\wxModularHost.sln64 .\wxModularHost.sln 7 | cd .. 8 | -------------------------------------------------------------------------------- /build/cm86.bat: -------------------------------------------------------------------------------- 1 | rem @echo off 2 | rmdir /S /Q Win 3 | mkdir Win 4 | cd Win 5 | cmake ../ -G "Visual Studio 17 2022" -A Win32 6 | copy ..\wxModularHost.sln32 .\wxModularHost.sln 7 | cd .. 8 | -------------------------------------------------------------------------------- /build/cmAppleMac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -dr Mac 4 | mkdir Mac 5 | cd Mac 6 | cmake ../ -DCMAKE_CXX_STANDARD_LIBRARIES="-lwx_osx_cocoau_aui-3.2" 7 | cd .. 8 | -------------------------------------------------------------------------------- /build/cmLinux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo OS Type: $OSTYPE 3 | 4 | # ---------------------------------- 5 | # build Debug configuration makefile 6 | # ---------------------------------- 7 | echo building Debug configuration makefile 8 | echo directory "LinuxDebug" 9 | rm -dr "LinuxDebug" 10 | mkdir "LinuxDebug" 11 | cd "LinuxDebug" 12 | cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Debug ../ 13 | # cmake -DCMAKE_BUILD_TYPE:STRING=Debug ../ 14 | cd .. 15 | 16 | # ---------------------------------- 17 | # build Release configuration makefile 18 | # ---------------------------------- 19 | echo building Release configuration makefile 20 | echo directory "LinuxRelease" 21 | rm -dr "LinuxRelease" 22 | mkdir "LinuxRelease" 23 | cd "LinuxRelease" 24 | cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release ../ 25 | # cmake -DCMAKE_BUILD_TYPE:STRING=Release ../ 26 | cd .. 27 | 28 | -------------------------------------------------------------------------------- /build/wxModularHost.sln32: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ALL_BUILD", "ALL_BUILD.vcxproj", "{2DE4A902-0D74-3DF1-BBB3-6F1E75BC5C87}" 5 | ProjectSection(ProjectDependencies) = postProject 6 | {85E2C45A-3E70-38FB-80FC-42B0F7BA4014} = {85E2C45A-3E70-38FB-80FC-42B0F7BA4014} 7 | {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5} = {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5} 8 | {A793772E-ACC6-4B21-80A4-F4A7952754AC} = {A793772E-ACC6-4B21-80A4-F4A7952754AC} 9 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 10 | {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD} = {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD} 11 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD} = {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD} 12 | {47ABA340-A92C-3524-9020-D816EB794174} = {47ABA340-A92C-3524-9020-D816EB794174} 13 | EndProjectSection 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleGuiPlugin1", "..\..\SampleGuiPlugin1\Win\SampleGuiPlugin1.vcxproj", "{85E2C45A-3E70-38FB-80FC-42B0F7BA4014}" 16 | ProjectSection(ProjectDependencies) = postProject 17 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 18 | EndProjectSection 19 | EndProject 20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleGuiPlugin2", "..\..\SampleGuiPlugin2\Win\SampleGuiPlugin2.vcxproj", "{DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5}" 21 | ProjectSection(ProjectDependencies) = postProject 22 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 23 | EndProjectSection 24 | EndProject 25 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZERO_CHECK", "ZERO_CHECK.vcxproj", "{B9B972FB-3C1F-3FE3-85BD-E714A07BC659}" 26 | ProjectSection(ProjectDependencies) = postProject 27 | EndProjectSection 28 | EndProject 29 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mswplugin_csharp", "..\..\mswplugin_csharp\Win\mswplugin_csharp.csproj", "{E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD}" 30 | ProjectSection(ProjectDependencies) = postProject 31 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 32 | EndProjectSection 33 | EndProject 34 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxModularCore", "..\..\wxModularCore\Win\wxModularCore.vcxproj", "{ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD}" 35 | ProjectSection(ProjectDependencies) = postProject 36 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 37 | EndProjectSection 38 | EndProject 39 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxModularHost", "..\..\wxModularHost\Win\wxModularHost.vcxproj", "{47ABA340-A92C-3524-9020-D816EB794174}" 40 | ProjectSection(ProjectDependencies) = postProject 41 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 42 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD} = {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD} 43 | EndProjectSection 44 | EndProject 45 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "mswplugin_vb", "..\..\mswplugin_vb\mswplugin_vb.vbproj", "{A793772E-ACC6-4B21-80A4-F4A7952754AC}" 46 | EndProject 47 | Global 48 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 49 | Debug|Win32 = Debug|Win32 50 | Release|Win32 = Release|Win32 51 | EndGlobalSection 52 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 53 | {2DE4A902-0D74-3DF1-BBB3-6F1E75BC5C87}.Debug|Win32.ActiveCfg = Debug|Win32 54 | {2DE4A902-0D74-3DF1-BBB3-6F1E75BC5C87}.Release|Win32.ActiveCfg = Release|Win32 55 | {85E2C45A-3E70-38FB-80FC-42B0F7BA4014}.Debug|Win32.ActiveCfg = Debug|Win32 56 | {85E2C45A-3E70-38FB-80FC-42B0F7BA4014}.Debug|Win32.Build.0 = Debug|Win32 57 | {85E2C45A-3E70-38FB-80FC-42B0F7BA4014}.Release|Win32.ActiveCfg = Release|Win32 58 | {85E2C45A-3E70-38FB-80FC-42B0F7BA4014}.Release|Win32.Build.0 = Release|Win32 59 | {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5}.Debug|Win32.ActiveCfg = Debug|Win32 60 | {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5}.Debug|Win32.Build.0 = Debug|Win32 61 | {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5}.Release|Win32.ActiveCfg = Release|Win32 62 | {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5}.Release|Win32.Build.0 = Release|Win32 63 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659}.Debug|Win32.ActiveCfg = Debug|Win32 64 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659}.Debug|Win32.Build.0 = Debug|Win32 65 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659}.Release|Win32.ActiveCfg = Release|Win32 66 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659}.Release|Win32.Build.0 = Release|Win32 67 | {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD}.Debug|Win32.ActiveCfg = Debug|Win32 68 | {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD}.Debug|Win32.Build.0 = Debug|Win32 69 | {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD}.Release|Win32.ActiveCfg = Release|Win32 70 | {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD}.Release|Win32.Build.0 = Release|Win32 71 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD}.Debug|Win32.ActiveCfg = Debug|Win32 72 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD}.Debug|Win32.Build.0 = Debug|Win32 73 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD}.Release|Win32.ActiveCfg = Release|Win32 74 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD}.Release|Win32.Build.0 = Release|Win32 75 | {47ABA340-A92C-3524-9020-D816EB794174}.Debug|Win32.ActiveCfg = Debug|Win32 76 | {47ABA340-A92C-3524-9020-D816EB794174}.Debug|Win32.Build.0 = Debug|Win32 77 | {47ABA340-A92C-3524-9020-D816EB794174}.Release|Win32.ActiveCfg = Release|Win32 78 | {47ABA340-A92C-3524-9020-D816EB794174}.Release|Win32.Build.0 = Release|Win32 79 | {A793772E-ACC6-4B21-80A4-F4A7952754AC}.Debug|Win32.ActiveCfg = Debug|Win32 80 | {A793772E-ACC6-4B21-80A4-F4A7952754AC}.Debug|Win32.Build.0 = Debug|Win32 81 | {A793772E-ACC6-4B21-80A4-F4A7952754AC}.Release|Win32.ActiveCfg = Release|Win32 82 | {A793772E-ACC6-4B21-80A4-F4A7952754AC}.Release|Win32.Build.0 = Release|Win32 83 | EndGlobalSection 84 | GlobalSection(ExtensibilityGlobals) = postSolution 85 | SolutionGuid = {FAC590C9-0DBB-386A-90AD-E57D0D314630} 86 | EndGlobalSection 87 | GlobalSection(ExtensibilityAddIns) = postSolution 88 | EndGlobalSection 89 | EndGlobal 90 | -------------------------------------------------------------------------------- /build/wxModularHost.sln64: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ALL_BUILD", "ALL_BUILD.vcxproj", "{2DE4A902-0D74-3DF1-BBB3-6F1E75BC5C87}" 5 | ProjectSection(ProjectDependencies) = postProject 6 | {85E2C45A-3E70-38FB-80FC-42B0F7BA4014} = {85E2C45A-3E70-38FB-80FC-42B0F7BA4014} 7 | {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5} = {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5} 8 | {A793772E-ACC6-4B21-80A4-F4A7952754AC} = {A793772E-ACC6-4B21-80A4-F4A7952754AC} 9 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 10 | {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD} = {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD} 11 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD} = {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD} 12 | {47ABA340-A92C-3524-9020-D816EB794174} = {47ABA340-A92C-3524-9020-D816EB794174} 13 | EndProjectSection 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleGuiPlugin1", "..\..\SampleGuiPlugin1\Win\SampleGuiPlugin1.vcxproj", "{85E2C45A-3E70-38FB-80FC-42B0F7BA4014}" 16 | ProjectSection(ProjectDependencies) = postProject 17 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 18 | EndProjectSection 19 | EndProject 20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleGuiPlugin2", "..\..\SampleGuiPlugin2\Win\SampleGuiPlugin2.vcxproj", "{DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5}" 21 | ProjectSection(ProjectDependencies) = postProject 22 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 23 | EndProjectSection 24 | EndProject 25 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZERO_CHECK", "ZERO_CHECK.vcxproj", "{B9B972FB-3C1F-3FE3-85BD-E714A07BC659}" 26 | ProjectSection(ProjectDependencies) = postProject 27 | EndProjectSection 28 | EndProject 29 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mswplugin_csharp", "..\..\mswplugin_csharp\Win\mswplugin_csharp.csproj", "{E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD}" 30 | ProjectSection(ProjectDependencies) = postProject 31 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 32 | EndProjectSection 33 | EndProject 34 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxModularCore", "..\..\wxModularCore\Win\wxModularCore.vcxproj", "{ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD}" 35 | ProjectSection(ProjectDependencies) = postProject 36 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 37 | EndProjectSection 38 | EndProject 39 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxModularHost", "..\..\wxModularHost\Win\wxModularHost.vcxproj", "{47ABA340-A92C-3524-9020-D816EB794174}" 40 | ProjectSection(ProjectDependencies) = postProject 41 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} = {B9B972FB-3C1F-3FE3-85BD-E714A07BC659} 42 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD} = {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD} 43 | EndProjectSection 44 | EndProject 45 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "mswplugin_vb", "..\..\mswplugin_vb\mswplugin_vb.vbproj", "{A793772E-ACC6-4B21-80A4-F4A7952754AC}" 46 | EndProject 47 | Global 48 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 49 | Debug|x64 = Debug|x64 50 | Release|x64 = Release|x64 51 | EndGlobalSection 52 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 53 | {2DE4A902-0D74-3DF1-BBB3-6F1E75BC5C87}.Debug|x64.ActiveCfg = Debug|x64 54 | {2DE4A902-0D74-3DF1-BBB3-6F1E75BC5C87}.Release|x64.ActiveCfg = Release|x64 55 | {85E2C45A-3E70-38FB-80FC-42B0F7BA4014}.Debug|x64.ActiveCfg = Debug|x64 56 | {85E2C45A-3E70-38FB-80FC-42B0F7BA4014}.Debug|x64.Build.0 = Debug|x64 57 | {85E2C45A-3E70-38FB-80FC-42B0F7BA4014}.Release|x64.ActiveCfg = Release|x64 58 | {85E2C45A-3E70-38FB-80FC-42B0F7BA4014}.Release|x64.Build.0 = Release|x64 59 | {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5}.Debug|x64.ActiveCfg = Debug|x64 60 | {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5}.Debug|x64.Build.0 = Debug|x64 61 | {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5}.Release|x64.ActiveCfg = Release|x64 62 | {DB9A1667-1D3A-3B2E-803D-86D7EB3E85C5}.Release|x64.Build.0 = Release|x64 63 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659}.Debug|x64.ActiveCfg = Debug|x64 64 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659}.Debug|x64.Build.0 = Debug|x64 65 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659}.Release|x64.ActiveCfg = Release|x64 66 | {B9B972FB-3C1F-3FE3-85BD-E714A07BC659}.Release|x64.Build.0 = Release|x64 67 | {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD}.Debug|x64.ActiveCfg = Debug|x64 68 | {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD}.Debug|x64.Build.0 = Debug|x64 69 | {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD}.Release|x64.ActiveCfg = Release|x64 70 | {E6CD9F9A-05BD-38E0-9F64-B3F8B7610FBD}.Release|x64.Build.0 = Release|x64 71 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD}.Debug|x64.ActiveCfg = Debug|x64 72 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD}.Debug|x64.Build.0 = Debug|x64 73 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD}.Release|x64.ActiveCfg = Release|x64 74 | {ED4A979D-43E8-3D24-97E0-53E2D2C7B5BD}.Release|x64.Build.0 = Release|x64 75 | {47ABA340-A92C-3524-9020-D816EB794174}.Debug|x64.ActiveCfg = Debug|x64 76 | {47ABA340-A92C-3524-9020-D816EB794174}.Debug|x64.Build.0 = Debug|x64 77 | {47ABA340-A92C-3524-9020-D816EB794174}.Release|x64.ActiveCfg = Release|x64 78 | {47ABA340-A92C-3524-9020-D816EB794174}.Release|x64.Build.0 = Release|x64 79 | {A793772E-ACC6-4B21-80A4-F4A7952754AC}.Debug|x64.ActiveCfg = Debug|x64 80 | {A793772E-ACC6-4B21-80A4-F4A7952754AC}.Debug|x64.Build.0 = Debug|x64 81 | {A793772E-ACC6-4B21-80A4-F4A7952754AC}.Release|x64.ActiveCfg = Release|x64 82 | {A793772E-ACC6-4B21-80A4-F4A7952754AC}.Release|x64.Build.0 = Release|x64 83 | EndGlobalSection 84 | GlobalSection(ExtensibilityGlobals) = postSolution 85 | SolutionGuid = {FAC590C9-0DBB-386A-90AD-E57D0D314630} 86 | EndGlobalSection 87 | GlobalSection(ExtensibilityAddIns) = postSolution 88 | EndGlobalSection 89 | EndGlobal 90 | -------------------------------------------------------------------------------- /include/stdwx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | -------------------------------------------------------------------------------- /include/stdwx.h: -------------------------------------------------------------------------------- 1 | #ifndef IFLOOR_STDWX_H_ 2 | #define IFLOOR_STDWX_H_ 3 | 4 | #if defined(WIN32) || defined(WINDOWS) 5 | #include 6 | #include 7 | #define PLUGIN_EXPORTED_API WXEXPORT 8 | #else 9 | #define PLUGIN_EXPORTED_API extern "C" 10 | #endif 11 | 12 | // SYSTEM INCLUDES 13 | // For compilers that support precompilation, includes "wx/wx.h". 14 | #include "wx/wxprec.h" 15 | #ifdef __BORLANDC__ 16 | #pragma hdrstop 17 | #endif 18 | //#ifndef WX_PRECOMP 19 | #include "wx/wx.h" 20 | //#endif 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | // APPLICATION INCLUDES 50 | #endif 51 | -------------------------------------------------------------------------------- /wxGuiPluginBase/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (SRCS 2 | wxGuiPluginBase.cpp 3 | wxGuiPluginWindowBase.cpp) 4 | set (HEADERS 5 | Declarations.h 6 | wxGuiPluginBase.h 7 | wxGuiPluginWindowBase.h) 8 | 9 | set(LIBRARY_NAME wxGuiPluginBase) 10 | 11 | if(WIN32) 12 | set(SRCS ${SRCS} ${LIBRARY_NAME}.rc) 13 | # Only for Windows: 14 | # we add additional preprocessor definitons 15 | set(PREPROCESSOR_DEFINITIONS ${PREPROCESSOR_DEFINITIONS}; 16 | /D_USRDLL;/DDEMO_PLUGIN_EXPORTS;/D__STDC_CONSTANT_MACROS) 17 | endif(WIN32) 18 | 19 | # Add 2 files for precompiled headers 20 | set(SRCS ${SRCS} ${HEADERS} 21 | ${PROJECT_ROOT_DIR}/include/stdwx.h 22 | ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 23 | 24 | # Set preprocessor definitions 25 | add_definitions(${PREPROCESSOR_DEFINITIONS}) 26 | # Set include directories 27 | include_directories(${INCLUDE_DIRECTORIES} ${BASE_INCLUDE_DIRECTORIES}) 28 | # Set library search paths 29 | link_directories(${LINK_DIRECTORIES}) 30 | # Setup the project name and assign the source files for this project 31 | add_library(${LIBRARY_NAME} SHARED ${SRCS}) 32 | 33 | #Setup the output folder 34 | set(DLL_DIR bin) 35 | set(TARGET_LOCATION ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}) 36 | if(APPLE) 37 | set(TARGET_LOCATION 38 | ${TARGET_LOCATION}/$(CONFIGURATION)/${PROJECT_NAME}.app/Contents/Frameworks) 39 | endif(APPLE) 40 | if(LINUX OR APPLE) 41 | get_target_property(RESULT_FULL_PATH ${LIBRARY_NAME} LOCATION) 42 | get_filename_component(RESULT_FILE_NAME ${RESULT_FULL_PATH} NAME) 43 | endif(LINUX OR APPLE) 44 | set_target_properties(${LIBRARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TARGET_LOCATION}) 45 | 46 | # Set additional dependencies 47 | target_link_libraries(${LIBRARY_NAME} ${wxWidgets_LIBRARIES}) 48 | 49 | # Setup precompiled headers 50 | target_precompile_headers(${LIBRARY_NAME} PRIVATE ${PROJECT_ROOT_DIR}/include/stdwx.h ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 51 | 52 | if(LINUX OR APPLE) 53 | add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD 54 | COMMAND ${CMAKE_COMMAND} -E copy $ ${TARGET_LOCATION}/${RESULT_FILE_NAME} 55 | ) 56 | endif(LINUX OR APPLE) 57 | -------------------------------------------------------------------------------- /wxGuiPluginBase/Declarations.h: -------------------------------------------------------------------------------- 1 | #ifndef _DECLARATIONS_H 2 | #define _DECLARATIONS_H 3 | 4 | #if defined(__WXMSW__) 5 | #ifdef DEMO_PLUGIN_EXPORTS 6 | #define DEMO_API __declspec(dllexport) 7 | #else 8 | #define DEMO_API __declspec(dllimport) 9 | #endif 10 | #else 11 | #define DEMO_API 12 | #endif 13 | 14 | #endif // _DECLARATIONS_H 15 | -------------------------------------------------------------------------------- /wxGuiPluginBase/wxGuiPluginBase.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include "wxGuiPluginBase.h" 3 | 4 | DEFINE_EVENT_TYPE(wxEVT_GUI_PLUGIN_INTEROP) 5 | 6 | IMPLEMENT_ABSTRACT_CLASS(wxGuiPluginBase, wxObject) 7 | 8 | wxGuiPluginBase::wxGuiPluginBase(wxEvtHandler * handler) 9 | : m_Handler(handler) 10 | { 11 | } 12 | 13 | wxGuiPluginBase::~wxGuiPluginBase() 14 | { 15 | } 16 | 17 | wxEvtHandler * wxGuiPluginBase::GetEventHandler() 18 | { 19 | return m_Handler; 20 | } 21 | 22 | void wxGuiPluginBase::SetEventHandler(wxEvtHandler * handler) 23 | { 24 | m_Handler = handler; 25 | } -------------------------------------------------------------------------------- /wxGuiPluginBase/wxGuiPluginBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Declarations.h" 4 | 5 | class DEMO_API wxGuiPluginBase : public wxObject 6 | { 7 | DECLARE_ABSTRACT_CLASS(wxGuiPluginBase) 8 | public: 9 | wxGuiPluginBase(wxEvtHandler * handler); 10 | virtual ~wxGuiPluginBase(); 11 | 12 | virtual wxString GetName() const = 0; 13 | virtual wxString GetId() const = 0; 14 | virtual wxWindow * CreatePanel(wxWindow * parent) = 0; 15 | 16 | wxEvtHandler * GetEventHandler(); 17 | virtual void SetEventHandler(wxEvtHandler * handler); 18 | protected: 19 | wxEvtHandler * m_Handler; 20 | }; 21 | 22 | DECLARE_EXPORTED_EVENT_TYPE(DEMO_API, wxEVT_GUI_PLUGIN_INTEROP, wxEVT_USER_FIRST + 100) 23 | 24 | typedef wxGuiPluginBase * (*CreateGuiPlugin_function)(); 25 | typedef void (*DeleteGuiPlugin_function)(wxGuiPluginBase * plugin); -------------------------------------------------------------------------------- /wxGuiPluginBase/wxGuiPluginBase.pjd: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 0 5 | "" 6 | "" 7 | "" 8 | "" 9 | "" 10 | 0 11 | 0 12 | 0 13 | 1 14 | 1 15 | 1 16 | 1 17 | 0 18 | "Volodymyr (T-Rex) Triapichko" 19 | "Volodymyr (T-Rex) Triapichko, 2013" 20 | "" 21 | 0 22 | 0 23 | 0 24 | 0 25 | "<All platforms>" 26 | "2.9.5" 27 | "Standard" 28 | "///////////////////////////////////////////////////////////////////////////// 29 | // Name: %HEADER-FILENAME% 30 | // Purpose: 31 | // Author: %AUTHOR% 32 | // Modified by: 33 | // Created: %DATE% 34 | // RCS-ID: 35 | // Copyright: %COPYRIGHT% 36 | // Licence: 37 | ///////////////////////////////////////////////////////////////////////////// 38 | 39 | " 40 | "///////////////////////////////////////////////////////////////////////////// 41 | // Name: %SOURCE-FILENAME% 42 | // Purpose: 43 | // Author: %AUTHOR% 44 | // Modified by: 45 | // Created: %DATE% 46 | // RCS-ID: 47 | // Copyright: %COPYRIGHT% 48 | // Licence: 49 | ///////////////////////////////////////////////////////////////////////////// 50 | 51 | " 52 | "///////////////////////////////////////////////////////////////////////////// 53 | // Name: %SYMBOLS-FILENAME% 54 | // Purpose: Symbols file 55 | // Author: %AUTHOR% 56 | // Modified by: 57 | // Created: %DATE% 58 | // RCS-ID: 59 | // Copyright: %COPYRIGHT% 60 | // Licence: 61 | ///////////////////////////////////////////////////////////////////////////// 62 | 63 | " 64 | "" 65 | "// For compilers that support precompilation, includes "wx/wx.h". 66 | #include "wx/wxprec.h" 67 | 68 | #ifdef __BORLANDC__ 69 | #pragma hdrstop 70 | #endif 71 | 72 | #ifndef WX_PRECOMP 73 | #include "wx/wx.h" 74 | #endif 75 | 76 | " 77 | " /// %BODY% 78 | " 79 | " 80 | /* 81 | * %BODY% 82 | */ 83 | 84 | " 85 | "app_resources.h" 86 | "app_resources.cpp" 87 | "AppResources" 88 | "app.h" 89 | "app.cpp" 90 | "Application" 91 | 0 92 | "" 93 | "<None>" 94 | "iso-8859-1" 95 | "utf-8" 96 | "utf-8" 97 | "" 98 | 0 99 | 0 100 | 4 101 | " " 102 | "" 103 | 0 104 | 0 105 | 1 106 | 0 107 | 1 108 | 1 109 | 0 110 | 1 111 | 0 112 | 0 113 |
114 | 115 | 116 | "" 117 | "data-document" 118 | "" 119 | "" 120 | 0 121 | 1 122 | 0 123 | 0 124 | 125 | "Configurations" 126 | "config-data-document" 127 | "" 128 | "" 129 | 0 130 | 1 131 | 0 132 | 0 133 | "" 134 | 1 135 | 0 136 | 137 | 138 | 139 | 140 | 141 | 142 | "Projects" 143 | "root-document" 144 | "" 145 | "project" 146 | 1 147 | 1 148 | 0 149 | 1 150 | 151 | "Windows" 152 | "html-document" 153 | "" 154 | "dialogsfolder" 155 | 1 156 | 1 157 | 0 158 | 1 159 | 160 | "wxGuiPluginWindowBase: ID_WXGUIPLUGINWINDOWBASE" 161 | "dialog-document" 162 | "" 163 | "panel" 164 | 0 165 | 1 166 | 0 167 | 0 168 | "wbPanelProxy" 169 | 10000 170 | 0 171 | "" 172 | 0 173 | "" 174 | "Standard" 175 | 0 176 | 0 177 | "m_Plugin|wxGuiPluginBase *|Plugin||0|0|" 178 | "ID_WXGUIPLUGINWINDOWBASE" 179 | 10000 180 | "" 181 | "wxGuiPluginWindowBase" 182 | "wxPanel" 183 | 0 184 | 1 185 | "wxGuiPluginWindowBase.cpp" 186 | "wxGuiPluginWindowBase.h" 187 | "" 188 | "" 189 | "" 190 | "" 191 | "" 192 | "" 193 | 0 194 | "" 195 | "" 196 | "" 197 | "" 198 | "" 199 | 0 200 | 1 201 | "<Any platform>" 202 | "" 203 | "Tiled" 204 | 1 205 | 0 206 | 0 207 | 0 208 | 0 209 | 0 210 | 0 211 | 0 212 | 0 213 | 0 214 | 0 215 | 0 216 | 0 217 | 1 218 | 0 219 | 0 220 | 0 221 | "" 222 | 1 223 | -1 224 | -1 225 | -1 226 | -1 227 | "Centre" 228 | "Centre" 229 | 0 230 | 5 231 | 1 232 | 1 233 | 1 234 | 1 235 | 0 236 | 0 237 | 0 238 | 0 239 | "" 240 | "" 241 | "" 242 | 243 | 244 | 245 | "Sources" 246 | "html-document" 247 | "" 248 | "sourcesfolder" 249 | 1 250 | 1 251 | 0 252 | 1 253 | 254 | "wxGuiPluginBase.rc" 255 | "source-editor-document" 256 | "wxGuiPluginBase.rc" 257 | "source-editor" 258 | 0 259 | 0 260 | 1 261 | 0 262 | "9/9/2013" 263 | "" 264 | 265 | 266 | 267 | "Images" 268 | "html-document" 269 | "" 270 | "bitmapsfolder" 271 | 1 272 | 1 273 | 0 274 | 1 275 | 276 | 277 | 278 | 279 |
280 | -------------------------------------------------------------------------------- /wxGuiPluginBase/wxGuiPluginBase.rc: -------------------------------------------------------------------------------- 1 | #include "wx/msw/wx.rc" 2 | -------------------------------------------------------------------------------- /wxGuiPluginBase/wxGuiPluginWindowBase.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Name: wxGuiPluginWindowBase.cpp 3 | // Purpose: 4 | // Author: Volodymyr (T-Rex) Triapichko 5 | // Modified by: 6 | // Created: 09/09/2013 23:54:21 7 | // RCS-ID: 8 | // Copyright: Volodymyr (T-Rex) Triapichko, 2013 9 | // Licence: 10 | ///////////////////////////////////////////////////////////////////////////// 11 | 12 | // For compilers that support precompilation, includes "wx/wx.h". 13 | #include "wx/wxprec.h" 14 | 15 | #ifdef __BORLANDC__ 16 | #pragma hdrstop 17 | #endif 18 | 19 | #ifndef WX_PRECOMP 20 | #include "wx/wx.h" 21 | #endif 22 | 23 | ////@begin includes 24 | ////@end includes 25 | 26 | #include "wxGuiPluginWindowBase.h" 27 | #include "wxGuiPluginBase.h" 28 | 29 | ////@begin XPM images 30 | ////@end XPM images 31 | 32 | 33 | /* 34 | * wxGuiPluginWindowBase type definition 35 | */ 36 | 37 | IMPLEMENT_DYNAMIC_CLASS( wxGuiPluginWindowBase, wxPanel ) 38 | 39 | 40 | /* 41 | * wxGuiPluginWindowBase event table definition 42 | */ 43 | 44 | BEGIN_EVENT_TABLE( wxGuiPluginWindowBase, wxPanel ) 45 | 46 | ////@begin wxGuiPluginWindowBase event table entries 47 | ////@end wxGuiPluginWindowBase event table entries 48 | 49 | END_EVENT_TABLE() 50 | 51 | 52 | /* 53 | * wxGuiPluginWindowBase constructors 54 | */ 55 | 56 | wxGuiPluginWindowBase::wxGuiPluginWindowBase() 57 | { 58 | Init(); 59 | } 60 | 61 | wxGuiPluginWindowBase::wxGuiPluginWindowBase(wxGuiPluginBase * plugin, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) 62 | { 63 | Init(); 64 | Create(plugin, parent, id, pos, size, style); 65 | } 66 | 67 | 68 | /* 69 | * wxGuiPluginWindowBase creator 70 | */ 71 | 72 | bool wxGuiPluginWindowBase::Create(wxGuiPluginBase * plugin, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) 73 | { 74 | m_Plugin = plugin; 75 | ////@begin wxGuiPluginWindowBase creation 76 | wxPanel::Create(parent, id, pos, size, style); 77 | CreateControls(); 78 | ////@end wxGuiPluginWindowBase creation 79 | return true; 80 | } 81 | 82 | 83 | /* 84 | * wxGuiPluginWindowBase destructor 85 | */ 86 | 87 | wxGuiPluginWindowBase::~wxGuiPluginWindowBase() 88 | { 89 | ////@begin wxGuiPluginWindowBase destruction 90 | ////@end wxGuiPluginWindowBase destruction 91 | } 92 | 93 | 94 | /* 95 | * Member initialisation 96 | */ 97 | 98 | void wxGuiPluginWindowBase::Init() 99 | { 100 | ////@begin wxGuiPluginWindowBase member initialisation 101 | ////@end wxGuiPluginWindowBase member initialisation 102 | } 103 | 104 | 105 | /* 106 | * Control creation for wxGuiPluginWindowBase 107 | */ 108 | 109 | void wxGuiPluginWindowBase::CreateControls() 110 | { 111 | ////@begin wxGuiPluginWindowBase content construction 112 | ////@end wxGuiPluginWindowBase content construction 113 | } 114 | 115 | 116 | /* 117 | * Should we show tooltips? 118 | */ 119 | 120 | bool wxGuiPluginWindowBase::ShowToolTips() 121 | { 122 | return true; 123 | } 124 | 125 | /* 126 | * Get bitmap resources 127 | */ 128 | 129 | wxBitmap wxGuiPluginWindowBase::GetBitmapResource( const wxString& name ) 130 | { 131 | // Bitmap retrieval 132 | ////@begin wxGuiPluginWindowBase bitmap retrieval 133 | wxUnusedVar(name); 134 | return wxNullBitmap; 135 | ////@end wxGuiPluginWindowBase bitmap retrieval 136 | } 137 | 138 | /* 139 | * Get icon resources 140 | */ 141 | 142 | wxIcon wxGuiPluginWindowBase::GetIconResource( const wxString& name ) 143 | { 144 | // Icon retrieval 145 | ////@begin wxGuiPluginWindowBase icon retrieval 146 | wxUnusedVar(name); 147 | return wxNullIcon; 148 | ////@end wxGuiPluginWindowBase icon retrieval 149 | } 150 | -------------------------------------------------------------------------------- /wxGuiPluginBase/wxGuiPluginWindowBase.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Name: wxGuiPluginWindowBase.h 3 | // Purpose: 4 | // Author: Volodymyr (T-Rex) Triapichko 5 | // Modified by: 6 | // Created: 09/09/2013 23:54:21 7 | // RCS-ID: 8 | // Copyright: Volodymyr (T-Rex) Triapichko, 2013 9 | // Licence: 10 | ///////////////////////////////////////////////////////////////////////////// 11 | 12 | #ifndef _WXGUIPLUGINWINDOWBASE_H_ 13 | #define _WXGUIPLUGINWINDOWBASE_H_ 14 | 15 | 16 | /*! 17 | * Includes 18 | */ 19 | 20 | ////@begin includes 21 | ////@end includes 22 | #include "Declarations.h" 23 | 24 | /*! 25 | * Forward declarations 26 | */ 27 | 28 | ////@begin forward declarations 29 | class wxGuiPluginWindowBase; 30 | ////@end forward declarations 31 | class wxGuiPluginBase; 32 | 33 | /*! 34 | * Control identifiers 35 | */ 36 | 37 | ////@begin control identifiers 38 | #define ID_WXGUIPLUGINWINDOWBASE 10000 39 | #define SYMBOL_WXGUIPLUGINWINDOWBASE_STYLE wxNO_BORDER|wxTAB_TRAVERSAL 40 | #define SYMBOL_WXGUIPLUGINWINDOWBASE_IDNAME ID_WXGUIPLUGINWINDOWBASE 41 | #define SYMBOL_WXGUIPLUGINWINDOWBASE_SIZE wxDefaultSize 42 | #define SYMBOL_WXGUIPLUGINWINDOWBASE_POSITION wxDefaultPosition 43 | ////@end control identifiers 44 | 45 | 46 | /*! 47 | * wxGuiPluginWindowBase class declaration 48 | */ 49 | 50 | class DEMO_API wxGuiPluginWindowBase: public wxPanel 51 | { 52 | DECLARE_DYNAMIC_CLASS( wxGuiPluginWindowBase ) 53 | DECLARE_EVENT_TABLE() 54 | 55 | public: 56 | /// Constructors 57 | wxGuiPluginWindowBase(); 58 | wxGuiPluginWindowBase(wxGuiPluginBase * plugin, 59 | wxWindow* parent, 60 | wxWindowID id = ID_WXGUIPLUGINWINDOWBASE, 61 | const wxPoint& pos = wxDefaultPosition, 62 | const wxSize& size = wxDefaultSize, 63 | long style = wxNO_BORDER|wxTAB_TRAVERSAL); 64 | 65 | /// Creation 66 | bool Create(wxGuiPluginBase * plugin, 67 | wxWindow* parent, 68 | wxWindowID id = ID_WXGUIPLUGINWINDOWBASE, 69 | const wxPoint& pos = wxDefaultPosition, 70 | const wxSize& size = wxDefaultSize, 71 | long style = wxNO_BORDER|wxTAB_TRAVERSAL); 72 | 73 | /// Destructor 74 | ~wxGuiPluginWindowBase(); 75 | 76 | /// Initialises member variables 77 | void Init(); 78 | 79 | /// Creates the controls and sizers 80 | void CreateControls(); 81 | 82 | ////@begin wxGuiPluginWindowBase event handler declarations 83 | 84 | ////@end wxGuiPluginWindowBase event handler declarations 85 | 86 | ////@begin wxGuiPluginWindowBase member function declarations 87 | 88 | wxGuiPluginBase * GetPlugin() const { return m_Plugin ; } 89 | void SetPlugin(wxGuiPluginBase * value) { m_Plugin = value ; } 90 | 91 | /// Retrieves bitmap resources 92 | wxBitmap GetBitmapResource( const wxString& name ); 93 | 94 | /// Retrieves icon resources 95 | wxIcon GetIconResource( const wxString& name ); 96 | ////@end wxGuiPluginWindowBase member function declarations 97 | 98 | /// Should we show tooltips? 99 | static bool ShowToolTips(); 100 | 101 | ////@begin wxGuiPluginWindowBase member variables 102 | wxGuiPluginBase * m_Plugin; 103 | ////@end wxGuiPluginWindowBase member variables 104 | }; 105 | 106 | #endif 107 | // _WXGUIPLUGINWINDOWBASE_H_ 108 | -------------------------------------------------------------------------------- /wxModularCore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (SRCS 2 | wxModularCore.cpp 3 | wxModularCoreSettings.cpp) 4 | set (HEADERS 5 | wxModularCore.h 6 | wxModularCoreSettings.h) 7 | 8 | set(LIBRARY_NAME wxModularCore) 9 | 10 | if(WIN32) 11 | set(PREPROCESSOR_DEFINITIONS ${PREPROCESSOR_DEFINITIONS};/D__STDC_CONSTANT_MACROS) 12 | endif(WIN32) 13 | 14 | set(SRCS ${SRCS} ${HEADERS} 15 | ${PROJECT_ROOT_DIR}/include/stdwx.h 16 | ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 17 | 18 | add_definitions(${PREPROCESSOR_DEFINITIONS}) 19 | 20 | include_directories(${INCLUDE_DIRECTORIES} ${BASE_INCLUDE_DIRECTORIES}) 21 | 22 | link_directories(${LINK_DIRECTORIES}) 23 | 24 | add_library(${LIBRARY_NAME} STATIC ${SRCS}) 25 | 26 | set(DLL_DIR bin) 27 | set(TARGET_LOCATION ${PROJECT_SOURCE_DIR}/${DLL_DIR}/${CMAKE_CFG_INTDIR}) 28 | set_target_properties(${LIBRARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TARGET_LOCATION}) 29 | 30 | target_precompile_headers(${LIBRARY_NAME} PRIVATE ${PROJECT_ROOT_DIR}/include/stdwx.h ${PROJECT_ROOT_DIR}/include/stdwx.cpp) -------------------------------------------------------------------------------- /wxModularCore/wxModularCore.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include "wxModularCore.h" 3 | #include "wxModularCoreSettings.h" 4 | #include 5 | 6 | WX_DEFINE_LIST(wxDynamicLibraryList); 7 | 8 | 9 | wxModularCore::wxModularCore() 10 | : m_Settings(new wxModularCoreSettings), m_Handler(new wxEvtHandler) 11 | { 12 | // This will allow to delete all objects from this list automatically 13 | m_DllList.DeleteContents(true); 14 | } 15 | 16 | wxModularCore::~wxModularCore() 17 | { 18 | wxDELETE(m_Handler); 19 | wxDELETE(m_Settings); 20 | } 21 | 22 | void wxModularCore::Clear() 23 | { 24 | UnloadAllPlugins(); 25 | // TODO: Add the code which resets the object to initial state 26 | } 27 | 28 | wxString wxModularCore::GetPluginsPath(bool forceProgramPath) const 29 | { 30 | #if defined(__WXMAC__) 31 | return wxStandardPaths::Get().GetPluginsDir(); 32 | #else 33 | wxString path; 34 | if (m_Settings->GetStoreInAppData() && !forceProgramPath) 35 | path = wxStandardPaths::Get().GetConfigDir(); 36 | else 37 | path = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()); 38 | wxFileName fn; 39 | fn.AssignDir(path); 40 | fn.AppendDir(wxT("plugins")); 41 | return fn.GetFullPath(); 42 | #endif 43 | } 44 | 45 | wxString wxModularCore::GetPluginExt() 46 | { 47 | return 48 | #if defined(__WXMSW__) 49 | wxT("dll"); 50 | #elif defined(__WXGTK__) 51 | wxT("so"); 52 | #elif defined(__WXMAC__) 53 | wxT("dylib"); 54 | #else 55 | wxEmptyString; 56 | #endif 57 | } 58 | -------------------------------------------------------------------------------- /wxModularCore/wxModularCore.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // We need to keep the list of loaded DLLs 4 | WX_DECLARE_LIST(wxDynamicLibrary, wxDynamicLibraryList); 5 | 6 | class wxModularCoreSettings; 7 | 8 | class wxModularCore 9 | { 10 | public: 11 | wxModularCore(); 12 | virtual ~wxModularCore(); 13 | 14 | virtual wxString GetPluginsPath(bool forceProgramPath) const; 15 | virtual wxString GetPluginExt(); 16 | 17 | virtual bool LoadAllPlugins(bool forceProgramPath) = 0; 18 | virtual bool UnloadAllPlugins() = 0; 19 | virtual void Clear(); 20 | protected: 21 | 22 | wxDynamicLibraryList m_DllList; 23 | 24 | wxModularCoreSettings * m_Settings; 25 | wxEvtHandler * m_Handler; 26 | 27 | template 29 | bool RegisterPlugin(PluginType * plugin, 30 | PluginListType & list) 31 | { 32 | list.Append(plugin); 33 | return true; 34 | } 35 | 36 | template 40 | bool UnRegisterPlugin( 41 | PluginType * plugin, 42 | PluginListType & container, 43 | PluginToDllDictionaryType & pluginMap) 44 | { 45 | typename PluginListType::compatibility_iterator it = 46 | container.Find(plugin); 47 | if (it == NULL) 48 | return false; 49 | 50 | do 51 | { 52 | wxDynamicLibrary * dll = (wxDynamicLibrary *)pluginMap[plugin]; 53 | if (!dll) // Probably plugin was not loaded from dll 54 | break; 55 | 56 | wxDYNLIB_FUNCTION(DeletePluginFunctionType, 57 | DeletePlugin, *dll); 58 | if (pfnDeletePlugin) 59 | { 60 | pfnDeletePlugin(plugin); 61 | container.Erase(it); 62 | pluginMap.erase(plugin); 63 | return true; 64 | } 65 | } while (false); 66 | 67 | // If plugin is not loaded from DLL (e.g. embedded into executable) 68 | wxDELETE(plugin); 69 | container.Erase(it); 70 | 71 | return true; 72 | } 73 | 74 | template 78 | bool UnloadPlugins(PluginListType & list, 79 | PluginToDllDictionaryType & pluginDictoonary) 80 | { 81 | bool result = true; 82 | PluginType * plugin = NULL; 83 | while (list.GetFirst() && (plugin = 84 | list.GetFirst()->GetData())) 85 | { 86 | result &= UnRegisterPlugin(plugin, 90 | list, pluginDictoonary); 91 | } 92 | return result; 93 | } 94 | 95 | template 99 | bool LoadPlugins(const wxString & pluginsDirectory, 100 | PluginListType & list, 101 | PluginToDllDictionaryType & pluginDictionary, 102 | const wxString & subFolder) 103 | { 104 | wxFileName fn; 105 | fn.AssignDir(pluginsDirectory); 106 | wxLogDebug(wxT("%s"), fn.GetFullPath().data()); 107 | fn.AppendDir(subFolder); 108 | wxLogDebug(wxT("%s"), fn.GetFullPath().data()); 109 | if (!fn.DirExists()) 110 | return false; 111 | 112 | if(!wxDirExists(fn.GetFullPath())) return false; 113 | wxString wildcard = wxString::Format(wxT("*.%s"), 114 | GetPluginExt().GetData()); 115 | wxArrayString pluginPaths; 116 | wxDir::GetAllFiles(fn.GetFullPath(), 117 | &pluginPaths, wildcard); 118 | for(size_t i = 0; i < pluginPaths.GetCount(); ++i) 119 | { 120 | wxString fileName = pluginPaths[i]; 121 | wxDynamicLibrary * dll = new wxDynamicLibrary(fileName); 122 | if (dll->IsLoaded()) 123 | { 124 | wxDYNLIB_FUNCTION(CreatePluginFunctionType, 125 | CreatePlugin, *dll); 126 | if (pfnCreatePlugin) 127 | { 128 | PluginType * plugin = pfnCreatePlugin(); 129 | RegisterPlugin(plugin, list); 130 | m_DllList.Append(dll); 131 | pluginDictionary[plugin] = dll; 132 | } 133 | else 134 | wxDELETE(dll); 135 | } 136 | } 137 | return true; 138 | } 139 | 140 | }; 141 | -------------------------------------------------------------------------------- /wxModularCore/wxModularCoreSettings.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include "wxModularCoreSettings.h" 3 | 4 | wxModularCoreSettings::wxModularCoreSettings() 5 | : m_bStoreInAppData(false) 6 | { 7 | 8 | } 9 | 10 | wxModularCoreSettings::wxModularCoreSettings(const wxModularCoreSettings & settings) 11 | { 12 | CopyFrom(settings); 13 | } 14 | 15 | wxModularCoreSettings & wxModularCoreSettings::operator = (const wxModularCoreSettings & settings) 16 | { 17 | if (this != &settings) 18 | { 19 | CopyFrom(settings); 20 | } 21 | return *this; 22 | } 23 | 24 | wxModularCoreSettings::~wxModularCoreSettings() 25 | { 26 | 27 | } 28 | 29 | void wxModularCoreSettings::CopyFrom(const wxModularCoreSettings & settings) 30 | { 31 | m_bStoreInAppData = settings.m_bStoreInAppData; 32 | } 33 | 34 | void wxModularCoreSettings::SetStoreInAppData(const bool & value) 35 | { 36 | m_bStoreInAppData = value; 37 | } 38 | 39 | bool wxModularCoreSettings::GetStoreInAppData() const 40 | { 41 | return m_bStoreInAppData; 42 | } -------------------------------------------------------------------------------- /wxModularCore/wxModularCoreSettings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class wxModularCoreSettings 4 | { 5 | public: 6 | wxModularCoreSettings(); 7 | wxModularCoreSettings(const wxModularCoreSettings & settings); 8 | wxModularCoreSettings & operator = (const wxModularCoreSettings & settings); 9 | virtual ~wxModularCoreSettings(); 10 | 11 | void SetStoreInAppData(const bool & val); 12 | bool GetStoreInAppData() const; 13 | protected: 14 | virtual void CopyFrom(const wxModularCoreSettings & settings); 15 | private: 16 | bool m_bStoreInAppData; // Should we store data in Application Data folder or in .exe folder 17 | }; -------------------------------------------------------------------------------- /wxModularHost/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | MainFrame.cpp 3 | SampleModularCore.cpp 4 | wxModularHostApp.cpp) 5 | set(HEADERS 6 | MainFrame.h 7 | SampleModularCore.h 8 | wxModularHostApp.h) 9 | 10 | 11 | execute_process( 12 | COMMAND wx-config --libs aui 13 | RESULT_VARIABLE wxWidgets_aui_lib_result 14 | OUTPUT_VARIABLE wxWidgets_aui_lib_output 15 | ERROR_VARIABLE wxWidgets_aui_lib_error 16 | OUTPUT_STRIP_TRAILING_WHITESPACE 17 | ) 18 | 19 | if(NOT ${wxWidgets_aui_lib_result} EQUAL 0) 20 | message(FATAL_ERROR "wx-config failed: ${wxWidgets_aui_lib_error}") 21 | else() 22 | message(STATUS "wx-config output: ${wxWidgets_aui_lib_output}") 23 | endif() 24 | 25 | set(INCLUDE_DIRECTORIES ${BASE_INCLUDE_DIRECTORIES} 26 | ${PROJECT_ROOT_DIR}/wxModularCore 27 | ${PROJECT_ROOT_DIR}/wxNonGuiPluginBase 28 | ${PROJECT_ROOT_DIR}/wxGuiPluginBase) 29 | 30 | if(WIN32) 31 | set(SRCS ${SRCS} wxModularHost.rc) 32 | set(PREPROCESSOR_DEFINITIONS ${PREPROCESSOR_DEFINITIONS}; 33 | /D_USRDLL; 34 | /DwxUSE_NO_MANIFEST=1; 35 | /D__STDC_CONSTANT_MACROS) 36 | set(LINK_DIRECTORIES 37 | ${PROJECT_ROOT_DIR}/wxNonGuiPluginBase/${OS_BASE_NAME}${LIB_SUFFIX}/$(ConfigurationName) 38 | ${PROJECT_ROOT_DIR}/wxGuiPluginBase/${OS_BASE_NAME}${LIB_SUFFIX}/$(ConfigurationName) 39 | ${PROJECT_ROOT_DIR}/wxModularCore/${OS_BASE_NAME}${LIB_SUFFIX}/$(ConfigurationName)) 40 | set(DEMO_LIBS wxModularCore.lib wxNonGuiPluginBase.lib wxGuiPluginBase.lib) 41 | endif(WIN32) 42 | if(LINUX OR APPLE) 43 | set(LINK_DIRECTORIES 44 | ${PROJECT_ROOT_DIR}/wxNonGuiPluginBase/${OS_BASE_NAME}${LIB_SUFFIX} 45 | ${PROJECT_ROOT_DIR}/wxGuiPluginBase/${OS_BASE_NAME}${LIB_SUFFIX} 46 | ${PROJECT_ROOT_DIR}/wxModularCore/${OS_BASE_NAME}${LIB_SUFFIX}) 47 | set(DEMO_LIBS_SHARED wxNonGuiPluginBase wxGuiPluginBase) 48 | set(DEMO_LIBS wxModularCore ${DEMO_LIBS_SHARED}) 49 | endif(LINUX OR APPLE) 50 | 51 | set(LIBS ${DEMO_LIBS} ${wxWidgets_LIBRARIES} ${wxWidgets_aui_lib_output}) 52 | 53 | set(EXECUTABLE_NAME wxModularHost) 54 | 55 | add_definitions(${PREPROCESSOR_DEFINITIONS}) 56 | include_directories(${INCLUDE_DIRECTORIES} ${BASE_INCLUDE_DIRECTORIES}) 57 | link_directories(${LINK_DIRECTORIES}) 58 | 59 | if(WIN32) 60 | set(EXECUTABLE_TYPE WIN32) 61 | endif(WIN32) 62 | if(APPLE) 63 | set(MACOSX_BUNDLE YES) 64 | set(EXECUTABLE_TYPE MACOSX_BUNDLE) 65 | set(CMAKE_INSTALL_PATH "@loader_path") 66 | endif(APPLE) 67 | if(LINUX) 68 | set(EXECUTABLE_TYPE "") 69 | endif(LINUX) 70 | 71 | set(SRCS ${SRCS} ${HEADERS} 72 | ${PROJECT_ROOT_DIR}/include/stdwx.h 73 | ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 74 | 75 | set(PROJECT_FILES ${SRCS}) 76 | add_executable(${EXECUTABLE_NAME} ${EXECUTABLE_TYPE} ${PROJECT_FILES}) 77 | 78 | set(EXE_DIR bin) 79 | set(TARGET_LOCATION ${PROJECT_SOURCE_DIR}/${EXE_DIR}${LIB_SUFFIX}) 80 | set_target_properties(${EXECUTABLE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TARGET_LOCATION}) 81 | if(APPLE) 82 | set(CMAKE_MACOSX_RPATH 1) 83 | set(MACOSX_RPATH TRUE) 84 | set_target_properties( 85 | ${EXECUTABLE_NAME} PROPERTIES 86 | INSTALL_RPATH "@loader_path/../Frameworks") 87 | endif(APPLE) 88 | 89 | target_link_libraries(${EXECUTABLE_NAME} ${LIBS}) 90 | 91 | add_dependencies(${EXECUTABLE_NAME} wxModularCore) 92 | 93 | target_precompile_headers(${EXECUTABLE_NAME} PRIVATE ${PROJECT_ROOT_DIR}/include/stdwx.h ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 94 | 95 | if(APPLE) 96 | FOREACH(DEP_LIB ${DEMO_LIBS_SHARED}) 97 | get_filename_component(ABS_ROOT_DIR ${PROJECT_ROOT_DIR} ABSOLUTE) 98 | set(LIBNAME_FULL "${ABS_ROOT_DIR}/${DEP_LIB}/${OS_BASE_NAME}${LIB_SUFFIX}/$(CONFIGURATION)/lib${DEP_LIB}.dylib") 99 | add_custom_command(TARGET ${EXECUTABLE_NAME} POST_BUILD 100 | COMMAND install_name_tool -change "${LIBNAME_FULL}" "@executable_path/../Frameworks/lib${DEP_LIB}.dylib" $) 101 | ENDFOREACH(DEP_LIB) 102 | endif(APPLE) 103 | -------------------------------------------------------------------------------- /wxModularHost/MainFrame.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Name: MainFrame.cpp 3 | // Purpose: 4 | // Author: Volodymyr (T-Rex) Triapichko 5 | // Modified by: 6 | // Created: 02/08/2013 21:20:05 7 | // RCS-ID: 8 | // Copyright: Volodymyr (T-Rex) Triapichko, 2013 9 | // Licence: 10 | ///////////////////////////////////////////////////////////////////////////// 11 | 12 | // For compilers that support precompilation, includes "wx/wx.h". 13 | #include "stdwx.h" 14 | 15 | #ifdef __BORLANDC__ 16 | #pragma hdrstop 17 | #endif 18 | 19 | #ifndef WX_PRECOMP 20 | #include "wx/wx.h" 21 | #endif 22 | 23 | ////@begin includes 24 | #include "wx/imaglist.h" 25 | ////@end includes 26 | 27 | #include "MainFrame.h" 28 | #include "wxModularHostApp.h" 29 | #include "SampleModularCore.h" 30 | 31 | ////@begin XPM images 32 | ////@end XPM images 33 | 34 | 35 | /* 36 | * MainFrame type definition 37 | */ 38 | 39 | IMPLEMENT_CLASS( MainFrame, wxFrame ) 40 | 41 | 42 | /* 43 | * MainFrame event table definition 44 | */ 45 | 46 | BEGIN_EVENT_TABLE( MainFrame, wxFrame ) 47 | 48 | ////@begin MainFrame event table entries 49 | ////@end MainFrame event table entries 50 | 51 | END_EVENT_TABLE() 52 | 53 | 54 | /* 55 | * MainFrame constructors 56 | */ 57 | 58 | MainFrame::MainFrame() 59 | { 60 | Init(); 61 | } 62 | 63 | MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) 64 | { 65 | Init(); 66 | Create( parent, id, caption, pos, size, style ); 67 | } 68 | 69 | 70 | /* 71 | * MainFrame creator 72 | */ 73 | 74 | bool MainFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) 75 | { 76 | ////@begin MainFrame creation 77 | wxFrame::Create( parent, id, caption, pos, size, style ); 78 | 79 | CreateControls(); 80 | Centre(); 81 | ////@end MainFrame creation 82 | return true; 83 | } 84 | 85 | 86 | /* 87 | * MainFrame destructor 88 | */ 89 | 90 | MainFrame::~MainFrame() 91 | { 92 | ////@begin MainFrame destruction 93 | GetAuiManager().UnInit(); 94 | ////@end MainFrame destruction 95 | } 96 | 97 | 98 | /* 99 | * Member initialisation 100 | */ 101 | 102 | void MainFrame::Init() 103 | { 104 | ////@begin MainFrame member initialisation 105 | m_Notebook = NULL; 106 | ////@end MainFrame member initialisation 107 | } 108 | 109 | 110 | /* 111 | * Control creation for MainFrame 112 | */ 113 | 114 | void MainFrame::CreateControls() 115 | { 116 | ////@begin MainFrame content construction 117 | MainFrame* itemFrame1 = this; 118 | 119 | GetAuiManager().SetManagedWindow(this); 120 | 121 | wxMenuBar* menuBar = new wxMenuBar; 122 | wxMenu* itemMenu4 = new wxMenu; 123 | itemMenu4->Append(wxID_EXIT, _("Exit\tAlt+F4"), wxEmptyString, wxITEM_NORMAL); 124 | menuBar->Append(itemMenu4, _("File")); 125 | itemFrame1->SetMenuBar(menuBar); 126 | 127 | wxStatusBar* itemStatusBar2 = new wxStatusBar( itemFrame1, ID_STATUSBAR, wxST_SIZEGRIP|wxNO_BORDER ); 128 | itemStatusBar2->SetFieldsCount(2); 129 | itemFrame1->SetStatusBar(itemStatusBar2); 130 | 131 | m_Notebook = new wxAuiNotebook( itemFrame1, ID_AUINOTEBOOK, wxDefaultPosition, wxDefaultSize, wxAUI_NB_DEFAULT_STYLE|wxAUI_NB_TOP|wxNO_BORDER ); 132 | 133 | itemFrame1->GetAuiManager().AddPane(m_Notebook, wxAuiPaneInfo() 134 | .Name(_T("Pane1")).Centre().CaptionVisible(false).CloseButton(false).DestroyOnClose(false).Resizable(true).Floatable(false)); 135 | 136 | GetAuiManager().Update(); 137 | 138 | ////@end MainFrame content construction 139 | AddPagesFromGuiPlugins(); 140 | 141 | } 142 | 143 | 144 | /* 145 | * Should we show tooltips? 146 | */ 147 | 148 | bool MainFrame::ShowToolTips() 149 | { 150 | return true; 151 | } 152 | 153 | /* 154 | * Get bitmap resources 155 | */ 156 | 157 | wxBitmap MainFrame::GetBitmapResource( const wxString& name ) 158 | { 159 | // Bitmap retrieval 160 | ////@begin MainFrame bitmap retrieval 161 | wxUnusedVar(name); 162 | return wxNullBitmap; 163 | ////@end MainFrame bitmap retrieval 164 | } 165 | 166 | /* 167 | * Get icon resources 168 | */ 169 | 170 | wxIcon MainFrame::GetIconResource( const wxString& name ) 171 | { 172 | // Icon retrieval 173 | ////@begin MainFrame icon retrieval 174 | wxUnusedVar(name); 175 | return wxNullIcon; 176 | ////@end MainFrame icon retrieval 177 | } 178 | 179 | void MainFrame::AddPagesFromGuiPlugins() 180 | { 181 | SampleModularCore * pluginManager = wxGetApp().GetPluginManager(); 182 | for(wxGuiPluginBaseList::Node * node = pluginManager->GetGuiPlugins().GetFirst(); 183 | node; node = node->GetNext()) 184 | { 185 | wxGuiPluginBase * plugin = node->GetData(); 186 | if(plugin) 187 | { 188 | wxWindow * page = plugin->CreatePanel(m_Notebook); 189 | if(page) 190 | { 191 | m_Notebook->AddPage(page, plugin->GetName()); 192 | } 193 | } 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /wxModularHost/MainFrame.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Name: MainFrame.h 3 | // Purpose: 4 | // Author: Volodymyr (T-Rex) Triapichko 5 | // Modified by: 6 | // Created: 02/08/2013 21:20:05 7 | // RCS-ID: 8 | // Copyright: Volodymyr (T-Rex) Triapichko, 2013 9 | // Licence: 10 | ///////////////////////////////////////////////////////////////////////////// 11 | 12 | #ifndef _MAINFRAME_H_ 13 | #define _MAINFRAME_H_ 14 | 15 | 16 | /*! 17 | * Includes 18 | */ 19 | 20 | ////@begin includes 21 | #include "wx/aui/framemanager.h" 22 | #include "wx/frame.h" 23 | #include "wx/statusbr.h" 24 | #include "wx/aui/auibook.h" 25 | ////@end includes 26 | 27 | /*! 28 | * Forward declarations 29 | */ 30 | 31 | ////@begin forward declarations 32 | class wxAuiNotebook; 33 | ////@end forward declarations 34 | 35 | /*! 36 | * Control identifiers 37 | */ 38 | 39 | ////@begin control identifiers 40 | #define SYMBOL_MAINFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX 41 | #define SYMBOL_MAINFRAME_TITLE _("MainFrame") 42 | #define SYMBOL_MAINFRAME_IDNAME ID_MAINFRAME 43 | #define SYMBOL_MAINFRAME_SIZE wxSize(600, 450) 44 | #define SYMBOL_MAINFRAME_POSITION wxDefaultPosition 45 | ////@end control identifiers 46 | 47 | 48 | /*! 49 | * MainFrame class declaration 50 | */ 51 | 52 | class MainFrame: public wxFrame 53 | { 54 | DECLARE_CLASS( MainFrame ) 55 | DECLARE_EVENT_TABLE() 56 | 57 | public: 58 | /// Constructors 59 | MainFrame(); 60 | MainFrame( wxWindow* parent, wxWindowID id = SYMBOL_MAINFRAME_IDNAME, const wxString& caption = SYMBOL_MAINFRAME_TITLE, const wxPoint& pos = SYMBOL_MAINFRAME_POSITION, const wxSize& size = SYMBOL_MAINFRAME_SIZE, long style = SYMBOL_MAINFRAME_STYLE ); 61 | 62 | bool Create( wxWindow* parent, wxWindowID id = SYMBOL_MAINFRAME_IDNAME, const wxString& caption = SYMBOL_MAINFRAME_TITLE, const wxPoint& pos = SYMBOL_MAINFRAME_POSITION, const wxSize& size = SYMBOL_MAINFRAME_SIZE, long style = SYMBOL_MAINFRAME_STYLE ); 63 | 64 | /// Destructor 65 | ~MainFrame(); 66 | 67 | /// Initialises member variables 68 | void Init(); 69 | 70 | /// Creates the controls and sizers 71 | void CreateControls(); 72 | 73 | void AddPagesFromGuiPlugins(); 74 | 75 | ////@begin MainFrame event handler declarations 76 | 77 | ////@end MainFrame event handler declarations 78 | 79 | ////@begin MainFrame member function declarations 80 | 81 | /// Returns the AUI manager object 82 | wxAuiManager& GetAuiManager() { return m_auiManager; } 83 | 84 | /// Retrieves bitmap resources 85 | wxBitmap GetBitmapResource( const wxString& name ); 86 | 87 | /// Retrieves icon resources 88 | wxIcon GetIconResource( const wxString& name ); 89 | ////@end MainFrame member function declarations 90 | 91 | /// Should we show tooltips? 92 | static bool ShowToolTips(); 93 | 94 | ////@begin MainFrame member variables 95 | wxAuiManager m_auiManager; 96 | wxAuiNotebook* m_Notebook; 97 | /// Control identifiers 98 | enum { 99 | ID_MAINFRAME = 10000, 100 | ID_STATUSBAR = 10001, 101 | ID_AUINOTEBOOK = 10003 102 | }; 103 | ////@end MainFrame member variables 104 | }; 105 | 106 | #endif 107 | // _MAINFRAME_H_ 108 | -------------------------------------------------------------------------------- /wxModularHost/SampleModularCore.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include "SampleModularCore.h" 3 | #include 4 | 5 | WX_DEFINE_LIST(wxNonGuiPluginBaseList); 6 | WX_DEFINE_LIST(wxGuiPluginBaseList); 7 | 8 | SampleModularCore::~SampleModularCore() 9 | { 10 | Clear(); 11 | } 12 | 13 | bool SampleModularCore::LoadAllPlugins(bool forceProgramPath) 14 | { 15 | wxString pluginsRootDir = GetPluginsPath(forceProgramPath); 16 | bool result = true; 17 | result &= LoadPlugins(pluginsRootDir, 21 | m_NonGuiPlugins, 22 | m_MapNonGuiPluginsDll, 23 | wxT("nongui")); 24 | result &= LoadPlugins(pluginsRootDir, 28 | m_GuiPlugins, 29 | m_MapGuiPluginsDll, 30 | wxT("gui")); 31 | // You can implement other logic which takes in account 32 | // the result of LoadPlugins() calls 33 | for(wxGuiPluginBaseList::Node * node = m_GuiPlugins.GetFirst(); 34 | node; node = node->GetNext()) 35 | { 36 | wxGuiPluginBase * plugin = node->GetData(); 37 | plugin->SetEventHandler(m_Handler); 38 | } 39 | return true; 40 | } 41 | 42 | bool SampleModularCore::UnloadAllPlugins() 43 | { 44 | return 45 | UnloadPlugins(m_NonGuiPlugins, 49 | m_MapNonGuiPluginsDll) && 50 | UnloadPlugins(m_GuiPlugins, 54 | m_MapGuiPluginsDll); 55 | } 56 | 57 | const wxNonGuiPluginBaseList & SampleModularCore::GetNonGuiPlugins() const 58 | { 59 | return m_NonGuiPlugins; 60 | } 61 | 62 | const wxGuiPluginBaseList & SampleModularCore::GetGuiPlugins() const 63 | { 64 | return m_GuiPlugins; 65 | } -------------------------------------------------------------------------------- /wxModularHost/SampleModularCore.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | // We need to know which DLL produced the specific plugin object. 8 | WX_DECLARE_HASH_MAP(wxNonGuiPluginBase*, wxDynamicLibrary*, \ 9 | wxPointerHash, wxPointerEqual, \ 10 | wxNonGuiPluginToDllDictionary); 11 | WX_DECLARE_HASH_MAP(wxGuiPluginBase*, wxDynamicLibrary*, \ 12 | wxPointerHash, wxPointerEqual, \ 13 | wxGuiPluginToDllDictionary); 14 | // And separate list of loaded plugins for faster access. 15 | WX_DECLARE_LIST(wxNonGuiPluginBase, wxNonGuiPluginBaseList); 16 | WX_DECLARE_LIST(wxGuiPluginBase, wxGuiPluginBaseList); 17 | 18 | class SampleModularCore : public wxModularCore 19 | { 20 | public: 21 | virtual ~SampleModularCore(); 22 | virtual bool LoadAllPlugins(bool forceProgramPath); 23 | virtual bool UnloadAllPlugins(); 24 | 25 | const wxNonGuiPluginBaseList & GetNonGuiPlugins() const; 26 | const wxGuiPluginBaseList & GetGuiPlugins() const; 27 | private: 28 | wxNonGuiPluginToDllDictionary m_MapNonGuiPluginsDll; 29 | wxNonGuiPluginBaseList m_NonGuiPlugins; 30 | wxGuiPluginToDllDictionary m_MapGuiPluginsDll; 31 | wxGuiPluginBaseList m_GuiPlugins; 32 | }; -------------------------------------------------------------------------------- /wxModularHost/wxModularHost.rc: -------------------------------------------------------------------------------- 1 | #include "wx/msw/wx.rc" 2 | -------------------------------------------------------------------------------- /wxModularHost/wxModularHostApp.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Name: wxModularHostApp.cpp 3 | // Purpose: 4 | // Author: Volodymyr (T-Rex) Triapichko 5 | // Modified by: 6 | // Created: 02/08/2013 21:14:33 7 | // RCS-ID: 8 | // Copyright: Volodymyr (T-Rex) Triapichko, 2013 9 | // Licence: 10 | ///////////////////////////////////////////////////////////////////////////// 11 | 12 | // For compilers that support precompilation, includes "wx/wx.h". 13 | #include "stdwx.h" 14 | 15 | #ifdef __BORLANDC__ 16 | #pragma hdrstop 17 | #endif 18 | 19 | #ifndef WX_PRECOMP 20 | #include "wx/wx.h" 21 | #endif 22 | 23 | ////@begin includes 24 | ////@end includes 25 | 26 | #include "wxModularHostApp.h" 27 | #include "SampleModularCore.h" 28 | 29 | ////@begin XPM images 30 | ////@end XPM images 31 | 32 | 33 | /* 34 | * Application instance implementation 35 | */ 36 | 37 | ////@begin implement app 38 | IMPLEMENT_APP( wxModularHostApp ) 39 | ////@end implement app 40 | 41 | 42 | /* 43 | * wxModularHostApp type definition 44 | */ 45 | 46 | IMPLEMENT_CLASS( wxModularHostApp, wxApp ) 47 | 48 | 49 | /* 50 | * wxModularHostApp event table definition 51 | */ 52 | 53 | BEGIN_EVENT_TABLE( wxModularHostApp, wxApp ) 54 | 55 | ////@begin wxModularHostApp event table entries 56 | ////@end wxModularHostApp event table entries 57 | 58 | END_EVENT_TABLE() 59 | 60 | 61 | /* 62 | * Constructor for wxModularHostApp 63 | */ 64 | 65 | wxModularHostApp::wxModularHostApp() 66 | { 67 | Init(); 68 | } 69 | 70 | 71 | /* 72 | * Member initialisation 73 | */ 74 | 75 | void wxModularHostApp::Init() 76 | { 77 | ////@begin wxModularHostApp member initialisation 78 | m_PluginManager = new SampleModularCore; 79 | ////@end wxModularHostApp member initialisation 80 | } 81 | 82 | /* 83 | * Initialisation for wxModularHostApp 84 | */ 85 | 86 | bool wxModularHostApp::OnInit() 87 | { 88 | #if wxUSE_XPM 89 | wxImage::AddHandler(new wxXPMHandler); 90 | #endif 91 | #if wxUSE_LIBPNG 92 | wxImage::AddHandler(new wxPNGHandler); 93 | #endif 94 | #if wxUSE_LIBJPEG 95 | wxImage::AddHandler(new wxJPEGHandler); 96 | #endif 97 | #if wxUSE_GIF 98 | wxImage::AddHandler(new wxGIFHandler); 99 | #endif 100 | TestNonGuiPlugins(); 101 | 102 | MainFrame* mainWindow = new MainFrame( NULL ); 103 | mainWindow->Show(true); 104 | 105 | return true; 106 | } 107 | 108 | 109 | /* 110 | * Cleanup for wxModularHostApp 111 | */ 112 | 113 | int wxModularHostApp::OnExit() 114 | { 115 | wxDELETE(m_PluginManager); 116 | ////@begin wxModularHostApp cleanup 117 | return wxApp::OnExit(); 118 | ////@end wxModularHostApp cleanup 119 | } 120 | 121 | void wxModularHostApp::TestNonGuiPlugins() 122 | { 123 | if(m_PluginManager) 124 | { 125 | if(m_PluginManager->LoadAllPlugins(true)) 126 | { 127 | for(wxNonGuiPluginBaseList::Node * node = 128 | m_PluginManager->GetNonGuiPlugins().GetFirst(); node; node = node->GetNext()) 129 | { 130 | wxNonGuiPluginBase * plugin = node->GetData(); 131 | if(plugin) 132 | { 133 | wxLogDebug(wxT("Non-GUI plugin returns %i"), plugin->Work()); 134 | } 135 | } 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /wxModularHost/wxModularHostApp.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Name: wxModularHostApp.h 3 | // Purpose: 4 | // Author: Volodymyr (T-Rex) Triapichko 5 | // Modified by: 6 | // Created: 02/08/2013 21:14:33 7 | // RCS-ID: 8 | // Copyright: Volodymyr (T-Rex) Triapichko, 2013 9 | // Licence: 10 | ///////////////////////////////////////////////////////////////////////////// 11 | 12 | #ifndef _WXMODULARHOSTAPP_H_ 13 | #define _WXMODULARHOSTAPP_H_ 14 | 15 | 16 | /*! 17 | * Includes 18 | */ 19 | 20 | ////@begin includes 21 | #include "wx/image.h" 22 | #include "MainFrame.h" 23 | ////@end includes 24 | 25 | /*! 26 | * Forward declarations 27 | */ 28 | 29 | ////@begin forward declarations 30 | ////@end forward declarations 31 | class SampleModularCore; 32 | 33 | /*! 34 | * Control identifiers 35 | */ 36 | 37 | ////@begin control identifiers 38 | ////@end control identifiers 39 | 40 | /*! 41 | * wxModularHostApp class declaration 42 | */ 43 | 44 | class wxModularHostApp: public wxApp 45 | { 46 | DECLARE_CLASS( wxModularHostApp ) 47 | DECLARE_EVENT_TABLE() 48 | 49 | public: 50 | /// Constructor 51 | wxModularHostApp(); 52 | 53 | void Init(); 54 | 55 | /// Initialises the application 56 | virtual bool OnInit(); 57 | 58 | void TestNonGuiPlugins(); 59 | 60 | /// Called on exit 61 | virtual int OnExit(); 62 | 63 | ////@begin wxModularHostApp event handler declarations 64 | 65 | ////@end wxModularHostApp event handler declarations 66 | 67 | ////@begin wxModularHostApp member function declarations 68 | 69 | SampleModularCore * GetPluginManager() const { return m_PluginManager ; } 70 | void SetPluginManager(SampleModularCore * value) { m_PluginManager = value ; } 71 | 72 | ////@end wxModularHostApp member function declarations 73 | 74 | ////@begin wxModularHostApp member variables 75 | SampleModularCore * m_PluginManager; 76 | ////@end wxModularHostApp member variables 77 | }; 78 | 79 | /*! 80 | * Application instance declaration 81 | */ 82 | 83 | ////@begin declare app 84 | DECLARE_APP(wxModularHostApp) 85 | ////@end declare app 86 | 87 | #endif 88 | // _WXMODULARHOSTAPP_H_ 89 | -------------------------------------------------------------------------------- /wxNonGuiPluginBase/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (SRCS 2 | wxNonGuiPluginBase.cpp) 3 | set (HEADERS 4 | Declarations.h 5 | wxNonGuiPluginBase.h) 6 | 7 | set(LIBRARY_NAME wxNonGuiPluginBase) 8 | 9 | if(WIN32) 10 | # Only for Windows: 11 | # we add additional preprocessor definitons 12 | set(PREPROCESSOR_DEFINITIONS ${PREPROCESSOR_DEFINITIONS}; 13 | /D_USRDLL;/DDEMO_PLUGIN_EXPORTS;/D__STDC_CONSTANT_MACROS) 14 | endif(WIN32) 15 | 16 | # Add 2 files for precompiled headers 17 | set(SRCS ${SRCS} ${HEADERS} 18 | ${PROJECT_ROOT_DIR}/include/stdwx.h 19 | ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 20 | 21 | # Set preprocessor definitions 22 | add_definitions(${PREPROCESSOR_DEFINITIONS}) 23 | # Set include directories 24 | include_directories(${INCLUDE_DIRECTORIES} ${BASE_INCLUDE_DIRECTORIES}) 25 | # Set library search paths 26 | link_directories(${LINK_DIRECTORIES}) 27 | # Setup the project name and assign the source files for this project 28 | add_library(${LIBRARY_NAME} SHARED ${SRCS}) 29 | 30 | #Setup the output folder 31 | set(DLL_DIR bin) 32 | set(TARGET_LOCATION ${PROJECT_SOURCE_DIR}/${DLL_DIR}${LIB_SUFFIX}) 33 | if(APPLE) 34 | set(TARGET_LOCATION 35 | ${TARGET_LOCATION}/$(CONFIGURATION)/${PROJECT_NAME}.app/Contents/Frameworks) 36 | set(CMAKE_INSTALL_PATH "@loader_path/../Frameworks") 37 | endif(APPLE) 38 | if(LINUX OR APPLE) 39 | get_target_property(RESULT_FULL_PATH ${LIBRARY_NAME} LOCATION) 40 | get_filename_component(RESULT_FILE_NAME ${RESULT_FULL_PATH} NAME) 41 | endif(LINUX OR APPLE) 42 | set_target_properties(${LIBRARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TARGET_LOCATION}) 43 | 44 | # Set additional dependencies 45 | target_link_libraries(${LIBRARY_NAME} ${wxWidgets_LIBRARIES}) 46 | 47 | # Setup precompiled headers 48 | target_precompile_headers(${LIBRARY_NAME} PRIVATE ${PROJECT_ROOT_DIR}/include/stdwx.h ${PROJECT_ROOT_DIR}/include/stdwx.cpp) 49 | 50 | if(APPLE) 51 | get_filename_component(ABSOLUTE_PATH "${RESULT_FULL_PATH}" ABSOLUTE) 52 | add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD 53 | COMMAND install_name_tool -change "${ABSOLUTE_PATH}" "@loader_path/../Frameworks/${RESULT_FILE_NAME}" $ 54 | ) 55 | endif(APPLE) 56 | 57 | if(LINUX OR APPLE) 58 | add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD 59 | COMMAND ${CMAKE_COMMAND} -E copy $ ${TARGET_LOCATION}/${RESULT_FILE_NAME} 60 | ) 61 | endif(LINUX OR APPLE) 62 | -------------------------------------------------------------------------------- /wxNonGuiPluginBase/Declarations.h: -------------------------------------------------------------------------------- 1 | #ifndef _DECLARATIONS_H 2 | #define _DECLARATIONS_H 3 | 4 | #if defined(__WXMSW__) 5 | #ifdef DEMO_PLUGIN_EXPORTS 6 | #define DEMO_API __declspec(dllexport) 7 | #else 8 | #define DEMO_API __declspec(dllimport) 9 | #endif 10 | #else 11 | #define DEMO_API 12 | #endif 13 | 14 | #endif // _DECLARATIONS_H 15 | -------------------------------------------------------------------------------- /wxNonGuiPluginBase/wxNonGuiPluginBase.cpp: -------------------------------------------------------------------------------- 1 | #include "stdwx.h" 2 | #include "wxNonGuiPluginBase.h" 3 | 4 | IMPLEMENT_ABSTRACT_CLASS(wxNonGuiPluginBase, wxObject) 5 | 6 | wxNonGuiPluginBase::wxNonGuiPluginBase() 7 | { 8 | } 9 | 10 | wxNonGuiPluginBase::~wxNonGuiPluginBase() 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /wxNonGuiPluginBase/wxNonGuiPluginBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Declarations.h" 4 | 5 | class DEMO_API wxNonGuiPluginBase : public wxObject 6 | { 7 | DECLARE_ABSTRACT_CLASS(wxNonGuiPluginBase) 8 | public: 9 | wxNonGuiPluginBase(); 10 | virtual ~wxNonGuiPluginBase(); 11 | 12 | virtual int Work() = 0; 13 | }; 14 | 15 | typedef wxNonGuiPluginBase * (*CreatePlugin_function)(); 16 | typedef void (*DeletePlugin_function)(wxNonGuiPluginBase * plugin); --------------------------------------------------------------------------------