Skip to content

Commit

Permalink
add vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
hggq committed Jan 1, 2024
1 parent 174e9d5 commit 7426a4c
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 108 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/vcpkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: windows
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: windows-latest
strategy:
matrix:
arch: [amd64]
ssl: [ ON ]
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- name: Restore vcpkg packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
powershell Invoke-WebRequest -OutFile vcpkg2023.zip https://github.com/microsoft/vcpkg/archive/refs/tags/2023.12.12.zip
unzip vcpkg2023.zip
cd vcpkg-2023.12.12
bootstrap-vcpkg.bat
vcpkg integrate install
vcpkg integrate project
vcpkg install
cd ${{ github.workspace }}
powershell Invoke-WebRequest -OutFile zlib.zip https://www.zlib.net/zlib13.zip
unzip zlib.zip
Move-Item -Path ./zlib-1.3 -Destination ./zlib
cd zlib
cmake .
make
cd ${{ github.workspace }}
# - uses: xmake-io/github-action-setup-xmake@v1
# with:
# xmake-version: branch@dev
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
# - name: download mysql
# run: |
# powershell Invoke-WebRequest -OutFile mysql.zip https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.35-winx64.zip
# unzip mysql.zip
# Move-Item -Path ./mysql-8.0.35-winx64/include -Destination ./
# Move-Item -Path ./mysql-8.0.35-winx64/lib -Destination ./
# ls include
- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v3

- name: Enable Developer Command Prompt
uses: ilammy/[email protected]
with:
arch: ${{ matrix.arch }}
- name: List files in the repository
run: |
unzip asio.zip
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
- name: Build
run: |
cmake . -B ${{github.workspace}} -DENABLE_VCPKG=ON -DZLIB_INCLUDE_DIR=zlib -DZLIB_LIBRARY=zlib -DCMAKE_TOOLCHAIN_FILE=D:/a/paozhu/paozhu/vcpkg-2023.12.12/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_BUILD_TYPE=Debug -G Ninja
- name: Build
run: cmake --build ${{github.workspace}} --config Debug
18 changes: 0 additions & 18 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,6 @@ jobs:
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
# - name: Restore vcpkg packages
# working-directory: ${{env.GITHUB_WORKSPACE}}
# run: |
# powershell Invoke-WebRequest -OutFile vcpkg2023.zip https://github.com/microsoft/vcpkg/archive/refs/tags/2023.12.12.zip
# unzip vcpkg2023.zip
# cd vcpkg-2023.12.12
# bootstrap-vcpkg.bat
# vcpkg integrate install
# vcpkg integrate project
# vcpkg install
# cd ${{ github.workspace }}
# powershell Invoke-WebRequest -OutFile zlib.zip https://www.zlib.net/zlib13.zip
# unzip zlib.zip
# Move-Item -Path ./zlib-1.3 -Destination ./zlib
# cd zlib
# cmake .
# make
# cd ${{ github.workspace }}
- uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: branch@dev
Expand Down
90 changes: 0 additions & 90 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,88 +25,6 @@ if is_plat("mingw") then
end

add_requires("openssl","asio","zlib", "brotli")
-- --mysql
-- if is_plat("windows") then
-- package("mysql")
-- add_configs("shared", {description = "Download shared binaries.", default = true, type = "boolean", readonly = true})
-- set_urls("https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-$(version).tar.gz")
-- add_versions("8.0.31", "67bb8cba75b28e95c7f7948563f01fb84528fcbb1a35dba839d4ce44fe019baa")
-- add_deps("cmake")
-- on_load("windows",function(package)
-- package:add("deps", "boost")
-- package:add("deps", "openssl")
-- package:add("deps", "zlib")
-- package:add("deps", "zstd")
-- package:add("deps", "lz4")
-- end)

-- add_includedirs("include", "include/mysql")

-- on_install("mysql", function (package)
-- io.gsub("CMakeLists.txt", "ADD_SUBDIRECTORY%(storage/ndb%)", "")
-- local configs = {"-DCOMPILATION_COMMENT=XMake",
-- "-DDEFAULT_CHARSET=utf8",
-- "-DDEFAULT_COLLATION=utf8_general_ci",
-- "-DINSTALL_DOCDIR=share/doc/#{name}",
-- "-DINSTALL_INCLUDEDIR=include/mysql",
-- "-DINSTALL_INFODIR=share/info",
-- "-DINSTALL_MANDIR=share/man",
-- "-DINSTALL_MYSQLSHAREDIR=share/mysql",
-- "-DWITH_EDITLINE=bundled",
-- "-DWITH_UNIT_TESTS=OFF",
-- "-DDISABLE_SHARED=OFF",
-- "-DWITH_LZ4='system'",
-- "-DWITH_ZSTD='system'",
-- "-DWITH_ZLIB='system'",
-- "-DWINDOWS_RUNTIME_MD=ON" .. (is_plat("windows") and package:config("vs_runtime"):startswith("MD") and "ON" or "OFF"),
-- "-DWITHOUT_SERVER=ON"}
-- io.replace("cmake/ssl.cmake","IF(NOT OPENSSL_APPLINK_C)","IF(FALSE AND NOT OPENSSL_APPLINK_C)", {plain = true})
-- for _, removelib in ipairs({"icu", "libevent", "re2", "rapidjson", "protobuf", "libedit"}) do
-- io.replace("CMakeLists.txt", "MYSQL_CHECK_" .. string.upper(removelib) .. "()\n", "", {plain = true})
-- io.replace("CMakeLists.txt", "INCLUDE(" .. removelib .. ")\n", "", {plain = true})
-- io.replace("CMakeLists.txt", "WARN_MISSING_SYSTEM_" .. string.upper(removelib) .. "(" .. string.upper(removelib) .. "_WARN_GIVEN)", "# WARN_MISSING_SYSTEM_" .. string.upper(removelib) .. "(" .. string.upper(removelib) .. "_WARN_GIVEN)", {plain = true})
-- io.replace("CMakeLists.txt", "SET(" .. string.upper(removelib) .. "_WARN_GIVEN)", "# SET(" .. string.upper(removelib) .. "_WARN_GIVEN)", {plain = true})
-- end
-- os.rmdir("extra")
-- for _, folder in ipairs({"client", "man", "mysql-test", "libbinlogstandalone"}) do
-- os.rmdir(folder)
-- io.replace("CMakeLists.txt", "ADD_SUBDIRECTORY(" .. folder .. ")\n", "", {plain = true})
-- end
-- os.rmdir("storage/ndb")
-- for _, line in ipairs({"INCLUDE(cmake/boost.cmake)\n", "MYSQL_CHECK_EDITLINE()\n"}) do
-- io.replace("CMakeLists.txt", line, "", {plain = true})
-- end
-- io.replace("libbinlogevents/CMakeLists.txt", "INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libbinlogevents/include)", "MY_INCLUDE_SYSTEM_DIRECTORIES(LZ4)\nINCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libbinlogevents/include)", {plain = true})
-- io.replace("cmake/install_macros.cmake", " INSTALL_DEBUG_SYMBOLS("," # INSTALL_DEBUG_SYMBOLS(", {plain = true})
-- import("package.tools.cmake").install(package, configs)
-- if package:is_plat("windows") then
-- if package:config("shared") then
-- os.rm(package:installdir(path.join("lib", "mysqlclient.lib")))
-- os.cp(package:installdir(path.join("lib", "libmysql.dll")), package:installdir("bin"))
-- else
-- os.rm(package:installdir(path.join("lib", "libmysql.lib")))
-- os.rm(package:installdir(path.join("lib", "libmysql.dll")))
-- end
-- else
-- if package:config("shared") then
-- os.rm(package:installdir(path.join("lib", "*.a")))
-- os.cp(package:installdir(path.join("lib", "*.so.*")), package:installdir("bin"))
-- else
-- os.rm(package:installdir(path.join("lib", "*.so.*")))
-- end
-- end
-- end)

-- package_end()
-- add_requires("mysql");
-- end


-- if !is_plat("windows") then
-- add_requires("openssl","mysql","asio","zlib", "brotli")
-- end



add_includedirs("common")
add_includedirs("controller")
Expand Down Expand Up @@ -185,10 +103,6 @@ target("paozhu")
for _, linkdir in ipairs({"./lib"}) do
if os.isdir(linkdir) then
target:add("linkdirs", linkdir)
--target:add_deps("links", "mysqlclient")
-- target:add_ldflags("-Llib", "-lmysqlclient")
--target:add_links("links", "mysqlclient")
--add_links("./lib/mysqlclient.lib")
target:add("links", "mysqlclient")
end
end
Expand Down Expand Up @@ -223,10 +137,6 @@ target("paozhu_cli")
for _, linkdir in ipairs({"./lib"}) do
if os.isdir(linkdir) then
target:add("linkdirs", linkdir)
--target:add_deps("links", "mysqlclient")
--target:add_ldflags("-Llib", "-lmysqlclient")
--target:add_links("links", "mysqlclient")
--add_links("./lib/mysqlclient.lib")
target:add("links", "mysqlclient")
end
end
Expand Down

0 comments on commit 7426a4c

Please sign in to comment.