build: ensure zydis statically links when we want it to (#1599)

* build: ensure `zydis` statically links when we want it to

* test

* test-static

* revert the static test commit

* build: don't generate cmake twice on release builds
This commit is contained in:
Tyler Wilding
2022-07-03 20:26:04 -04:00
committed by GitHub
parent 417d0951de
commit 7f05974956
5 changed files with 14 additions and 9 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ jobs:
# TODO - CMake - replace with presets!
- name: CMake Generation - Clang - ASAN
if: matrix.compiler == 'clang'
if: matrix.compiler == 'clang' && startsWith(github.ref, 'refs/tags/') == false
env:
CC: clang
CXX: clang++
+1 -1
View File
@@ -53,7 +53,7 @@ jobs:
- name: CMake Generation - Clang
shell: cmd
if: matrix.compiler == 'clang'
if: matrix.compiler == 'clang' && startsWith(github.ref, 'refs/tags/') == false
run: cmake -B build --preset=Release-clang -DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe .
- name: CMake Generation - Clang - Statically Linked
+6 -5
View File
@@ -15,9 +15,8 @@ endif()
# Potentially statically build the project
option(STATICALLY_LINK "Build for release purposes (statically link everything)" OFF)
message(STATUS "Statically Link? ${STATICALLY_LINK}")
if(STATICALLY_LINK)
message(STATUS "Statically linking project")
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
@@ -206,10 +205,12 @@ add_subdirectory(third-party/discord-rpc EXCLUDE_FROM_ALL)
option(ZYDIS_BUILD_TOOLS "Zydis: Build tools" OFF)
option(ZYDIS_BUILD_EXAMPLES "Zydis: Build examples" OFF)
if(BUILD_SHARED_LIBS)
option(ZYDIS_BUILD_SHARED_LIB "Zydis: Build shared library" ON)
else()
if(STATICALLY_LINK)
message(STATUS "Statically linking zydis")
option(ZYDIS_BUILD_SHARED_LIB "Zydis: Build shared library" OFF)
else()
message(STATUS "dynamically linking zydis")
option(ZYDIS_BUILD_SHARED_LIB "Zydis: Build shared library" ON)
endif()
add_subdirectory(third-party/zydis EXCLUDE_FROM_ALL)
+5 -2
View File
@@ -12,7 +12,9 @@
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"INSTALL_GTEST": "True",
"ASAN_BUILD": "OFF"
"ASAN_BUILD": "OFF",
"STATICALLY_LINK": "OFF",
"ZYDIS_BUILD_SHARED_LIB": "ON"
}
},
{
@@ -82,7 +84,8 @@
"description": "Build with Clang as Release but statically linked",
"inherits": ["base-release", "base-clang"],
"cacheVariables": {
"STATICALLY_LINK": "true"
"STATICALLY_LINK": "true",
"ZYDIS_BUILD_SHARED_LIB": "OFF"
}
},
{
+1
View File
@@ -97,6 +97,7 @@ endif ()
# Library configuration #
# =============================================================================================== #
message(STATUS "zydis: dynamically link? ${ZYDIS_BUILD_SHARED_LIB}")
if (ZYDIS_BUILD_SHARED_LIB)
add_library("Zydis" SHARED)
else ()