wxAutoExcel 2.0.0 Installation Process using Visual Studio 2022 - Example

This forum is reserved for everything you want to talk about. It could be about programming, opinions, open source programs, development in general, or just cool stuff to share!
Post Reply
carlosrnardi
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Dec 31, 2020 4:32 pm

wxAutoExcel 2.0.0 Installation Process using Visual Studio 2022 - Example

Post by carlosrnardi »

I build the wxAutoExcel static libraries using Visual Studio 2022 thru CMake and I would like to share the steps I used. If anybody else wants to make any comment on different ways to accomplish the same thing it will be welcome.

/* considering You have Visual Studio 2022 installed with C++ packets and wxWidgets already build */

01 - Download wxAutoExcel Source Code
wxAutoExcel Github repository - https://github.com/PBfordev/wxAutoExcel
There are many different ways to download it, I just download the zip file with all repository content.
Image

If You plan to use MingW and CodeBlocks there is a very good guide written by the same person who creates wxAutoExcel here - https://github.com/PBfordev/wxpbguide

02 - Extract files
In my case, I extracted the library in my drive f:\dev and rename the folder to wxAutoExcel.
Image

03 - CMake Configuration file[CMakeSettings.json]
This is how I configured my CMakeSettings.json, with this configuration is easy to generate libraries in x86/x64 with/without debug.

Put this configuration filehttps://github.com/carlosrnardi/General ... tings.json in the wxAutoExcel folder before open Visual Studio.

* I've disabled the samples build, if You want to have the examples built, just remove that variable from the example file or change CMake configuration using Visual Studio manage configurations option.

Code: Select all

{
  "configurations": [
    {
      "name": "x86",
      "generator": "Ninja",
      "configurationType": "Release",
      "inheritEnvironments": [ "msvc_x86" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "wxAutoExcel_BUILD_BUILD_SAMPLES",
          "value": "False",
          "type": "BOOL"
        },
        {
          "name": "wxWidgets_USE_REL_AND_DBG",
          "value": "true",
          "type": "BOOL"
        }
      ]
    },
    {
      "name": "x86-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "msvc_x86" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "wxAutoExcel_BUILD_BUILD_SAMPLES",
          "value": "False",
          "type": "BOOL"
        },
        {
          "name": "wxWidgets_USE_REL_AND_DBG",
          "value": "true",
          "type": "BOOL"
        }
      ]
    },
    {
      "name": "x64",
      "generator": "Ninja",
      "configurationType": "Release",
      "inheritEnvironments": [ "msvc_x64_x64" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "wxAutoExcel_BUILD_BUILD_SAMPLES",
          "value": "False",
          "type": "BOOL"
        },
        {
          "name": "wxWidgets_USE_REL_AND_DBG",
          "value": "true",
          "type": "BOOL"
        }
      ]
    },
    {
      "name": "x64-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "msvc_x64_x64" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "wxAutoExcel_BUILD_BUILD_SAMPLES",
          "value": "False",
          "type": "BOOL"
        },
        {
          "name": "wxWidgets_USE_REL_AND_DBG",
          "value": "true",
          "type": "BOOL"
        }
      ]
    }
  ]
}
04 - Open Visual Studio 2022
You can right-click inside the folder and open Visual Studio from there
Image

05 - Compile time
Now just select the type of build You want and just build. I recommend You to compile all types and have all libraries ready for all cases.

06 - Rename Libraries
In order to make it simple to switch between Release and Debug mode, I changed the library's file names to have the same name, then I can point to different folders in my project configuration in order to use the correct library.

wxAutoExcel folder tree -
wxAutoExcel
├── [build]
│   ├── [CMake]
│   └── [tools]
├── CMakeSettings.json <- New configuration file
├── [docs]
│   └── [doxygen]
├── [include]
│   └── [wx]
├── [out]
│   └── [build]
│   ├── [x64]
│   │   ├── [.cmake]
│   │   │   └── ...
│   │   ├── [CMakeFiles]
│   │   │   ├── ...
│   │   ├── [lib]
│   │   │   └── wxAutoExcel20.lib
│   │   └── [Testing]
│   ├── [x64-Debug]
│   │   ├── [.cmake]
│   │   │   └── ...
│   │   ├── [CMakeFiles]
│   │   │   ├── ...
│   │   ├── [lib]
│   │   │   └── wxAutoExcel20d.lib -> rename to wxAutoExcel20.lib
│   │   └── [Testing]
│   ├── [x86]
│   │   ├── [.cmake]
│   │   │   └── ...
│   │   ├── [CMakeFiles]
│   │   │   ├── ...
│   │   ├── [lib]
│   │   │   └── wxAutoExcel20.lib
│   │   └── [Testing]
│   └── [x86-Debug]
│      ├── [.cmake]
│      │   └── ...
│      ├── [CMakeFiles]
│      │   ├── ...
│   ├── [lib]
│   │   └── wxAutoExcel20d.lib -> rename to wxAutoExcel20.lib
│      └── [Testing]
├── [samples]
│   └── ...
├── [src]
├── [util]
│   └── ...
└── [.vs]

07 - Windows Setup - Environment Variables
In my setup, I have chosen to create Environment variables to make it easy to configure Visual Studio to find the library's path.

Access - Edit the system environment variables

WXEXCEL - [path to]\wxAutoExcel

Image
Image
Image

Hope that helps!
Post Reply