Linux cmake build workflow
But for building on Windows, we needed to add some env variables in the workflow
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
WXWIN: C:/wxWidgets-3.2.6
wxWidgets_ROOT_DIR: C:/wxWidgets-3.2.6
wxWidgets_LIBRARIES: C:/wxWidgets-3.2.6/include
wxWidgets_INCLUDE_DIRS: C:/wxWidgets-3.2.6/lib/vc14x_x64_dll
ARCH: x64
or else the find_package would complain about not finding wxWidgets_LIBRARIES and wxWidgets_INCLUDE_DIRS
Also,
cmake -G"Visual Studio 17 2022" -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
to specify which version of Visual Studio to use - and for this version, the default toolset is 14.3 which is the one used to build this set of wxwidgets binaries.
https://docs.wxwidgets.org/3.2.1/plat_msw_binaries.html
https://docs.wxwidgets.org/3.2.1/plat_msw_binaries.html
But we also had to add a dummy main() to get rid of a linker error, but that breaks the Linux build.
/home/runner/work/wxOCVWarp/wxOCVWarp/hello.cpp:78:5: error: conflicting declaration of C function ‘int main()’
78 | int main() { return 0;}
| ^~~~
In file included from /usr/include/wx-3.0/wx/wx.h:25,
from /home/runner/work/wxOCVWarp/wxOCVWarp/hello.cpp:3:
/home/runner/work/wxOCVWarp/wxOCVWarp/hello.cpp:11:1: note: previous declaration ‘int main(int, char**)’
11 | wxIMPLEMENT_APP(MyApp);
| ^~~~~~~~~~~~~~~
gmake[2]: *** [CMakeFiles/OCVWarp.dir/build.make:79: CMakeFiles/OCVWarp.dir/hello.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/OCVWarp.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
So, wrapped an ifdef around the dummy main(), and all is well.
#ifdef _WIN64
int main() { return 0;}
#endif
No comments:
Post a Comment