mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Try to find pre-compiled wxwidgets on system during build
This commit is contained in:
27
.github/workflows/build.yml
vendored
27
.github/workflows/build.yml
vendored
@@ -246,12 +246,35 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Install GTK3
|
# - name: Install GTK
|
||||||
|
# run: |
|
||||||
|
# sudo apt-cache search libwxgt*
|
||||||
|
# sudo apt-cache search libgtk*
|
||||||
|
# sudo apt install -y libwxgtk3.0-gtk3-dev libgtk-3-dev
|
||||||
|
# if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
|
- name: Install wxWidgets (Windows)
|
||||||
|
working-directory: samples/${{ matrix.sample }}
|
||||||
|
run: |
|
||||||
|
vcpkg install wxwidgets
|
||||||
|
vcpkg integrate install
|
||||||
|
if: ${{ matrix.sample == 'CPlusPlusWidgets' && matrix.os == 'windows-latest' }}
|
||||||
|
|
||||||
|
- name: Install wxWidgets (MacOS)
|
||||||
|
run: brew install wxwidgets
|
||||||
|
if: ${{ matrix.sample == 'CPlusPlusWidgets' && matrix.os == 'macos-latest' }}
|
||||||
|
|
||||||
|
- name: Install wxWidgets (Linux)
|
||||||
run: |
|
run: |
|
||||||
sudo apt-cache search libwxgt*
|
sudo apt-cache search libwxgt*
|
||||||
sudo apt-cache search libgtk*
|
sudo apt-cache search libgtk*
|
||||||
sudo apt install -y libwxgtk3.0-gtk3-dev libgtk-3-dev
|
sudo apt install -y libwxgtk3.0-gtk3-dev libgtk-3-dev
|
||||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
if: ${{ matrix.sample == 'CPlusPlusWidgets' && matrix.os == 'ubuntu-latest' }}
|
||||||
|
|
||||||
|
# - name: Install wxWidgets
|
||||||
|
# run: |
|
||||||
|
# vcpkg install wxwidgets
|
||||||
|
# vcpkg integrate install
|
||||||
|
|
||||||
- name: Install VPK
|
- name: Install VPK
|
||||||
run: dotnet tool install -g vpk
|
run: dotnet tool install -g vpk
|
||||||
- name: Pack Sample (Windows)
|
- name: Pack Sample (Windows)
|
||||||
|
|||||||
3
samples/CPlusPlusWidgets/.gitignore
vendored
3
samples/CPlusPlusWidgets/.gitignore
vendored
@@ -5,4 +5,5 @@ build-rel
|
|||||||
cmake-build-debug
|
cmake-build-debug
|
||||||
cmake-build-release
|
cmake-build-release
|
||||||
.vscode
|
.vscode
|
||||||
.idea
|
.idea
|
||||||
|
wxWidgets
|
||||||
@@ -9,33 +9,45 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
|
|
||||||
set(wxBUILD_SHARED OFF)
|
set(wxBUILD_SHARED OFF)
|
||||||
|
|
||||||
message(STATUS "Fetching wxWidgets...")
|
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/wxWidgets")
|
||||||
|
set(wxWidgets_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wxWidgets")
|
||||||
|
set(wxWidgets_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wxWidgets/lib/vc14x_x64_dll")
|
||||||
|
set(wxWidgets_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/wxWidgets/include")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(wxWidgets COMPONENTS net core base)
|
||||||
|
if(wxWidgets_USE_FILE) # not defined in CONFIG mode
|
||||||
|
include(${wxWidgets_USE_FILE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT wxWidgets_FOUND)
|
||||||
|
message(STATUS "wxWidgets not found. Fetching wxWidgets from git...")
|
||||||
|
FetchContent_Declare(
|
||||||
|
wxWidgets
|
||||||
|
GIT_REPOSITORY https://github.com/wxWidgets/wxWidgets.git
|
||||||
|
GIT_SHALLOW ON
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(wxWidgets)
|
||||||
|
set(wxWidgets_LIBRARIES wxcore wxnet)
|
||||||
|
endif()
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
wxWidgets
|
|
||||||
GIT_REPOSITORY https://github.com/wxWidgets/wxWidgets.git
|
|
||||||
GIT_SHALLOW ON
|
|
||||||
)
|
|
||||||
FetchContent_MakeAvailable(wxWidgets)
|
|
||||||
|
|
||||||
# include the Velopack library (headers + precompiled lib)
|
# include the Velopack library (headers + precompiled lib)
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../src/lib-cpp/include")
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../src/lib-cpp/include")
|
||||||
set(VELOPACK_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug/velopack_libc.dll.lib")
|
set(VELOPACK_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug/velopack_libc.dll.lib")
|
||||||
set(VELOPACK_DLL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug/velopack_libc.dll")
|
set(VELOPACK_DLL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug/velopack_libc.dll")
|
||||||
|
|
||||||
# add sources and executable
|
|
||||||
set(SRCS main.cpp)
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# the WIN32 is needed for Windows in order for it to look for WinMain
|
# the WIN32 is needed for Windows in order for it to look for WinMain
|
||||||
# instead of the main function. This is ignored on other systems,
|
# instead of the main function. This is ignored on other systems,
|
||||||
# so it works on all platforms
|
# so it works on all platforms
|
||||||
add_executable(main WIN32 ${SRCS} main.exe.manifest)
|
add_executable(main WIN32 main.cpp main.exe.manifest)
|
||||||
else()
|
else()
|
||||||
add_executable(main ${SRCS})
|
add_executable(main main.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(main PRIVATE RELEASES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/releases")
|
target_compile_definitions(main PRIVATE RELEASES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/releases")
|
||||||
target_link_libraries(main PRIVATE wxcore wxnet "${VELOPACK_LIB_PATH}")
|
target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES} "${VELOPACK_LIB_PATH}")
|
||||||
|
|
||||||
# copy velopack dll to output directory
|
# copy velopack dll to output directory
|
||||||
add_custom_command(TARGET main POST_BUILD
|
add_custom_command(TARGET main POST_BUILD
|
||||||
|
|||||||
Reference in New Issue
Block a user