Skip to content

Commit

Permalink
Merge pull request #158 from verrasse/verrasse-fix-missing-dlls
Browse files Browse the repository at this point in the history
 verrasse contributed: Fixed missing DLLs & DLL export symbols for Windows builds
  • Loading branch information
kk49 authored Mar 25, 2024
2 parents ce24cd8 + 5805398 commit 9b08875
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
17 changes: 17 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ build_script:
nmake
mkdir C:\prj\deca\root
mkdir C:\prj\deca\root\bin
mkdir C:\prj\deca\root\lib
Expand All @@ -47,6 +49,21 @@ build_script:
copy C:\prj\deca\build\cpp\process_image\process_image* C:\prj\deca\root\lib\
copy C:\prj\deca\build\extern\HavokLib\source\havok.dll C:\prj\deca\root\bin\
copy C:\prj\deca\build\extern\HavokLib\3rd_party\PreCore\precore6.dll C:\prj\deca\root\bin\
copy C:\prj\deca\build\extern\HavokLib\3rd_party\PreCore\3rd_party\glm\glm\glm_shared.dll C:\prj\deca\root\bin\
copy C:\prj\deca\build\extern\HavokLib\3rd_party\PreCore\3rd_party\pugixml\pugixml1.dll C:\prj\deca\root\bin\
echo UN-PATCH external libs
cd c:\prj\deca\extern\HavokLib\3rd_party\PreCore
git apply -R c:\prj\deca\patch\pre_core.patch
echo SETUP PYTHON
Expand Down
10 changes: 10 additions & 0 deletions cpp/process_image/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ project(process_image)

# gcc -fPIC -shared -O3 deca/process_image.c -o process_image.so

# Some versions of CMake don't define _USRDLL and _WINDLL macros for a shared libraries.
# It will cause lack of __declspec(dllexport) declaration and produce an empty DLLs on Windows.
# We should add _USRDLL and _WINDLL flags here for MSVC.
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_C_FLAGS_DEBUG "/D_USRDLL /D_WINDLL /MT")
set(CMAKE_C_FLAGS_RELEASE "/D_USRDLL /D_WINDLL /MT")
set(CMAKE_CXX_FLAGS_DEBUG "/D_USRDLL /D_WINDLL /MT")
set(CMAKE_CXX_FLAGS_RELEASE "/D_USRDLL /D_WINDLL /MT")
endif()

add_library(
process_image
SHARED
Expand Down
4 changes: 2 additions & 2 deletions python/deca/deca/dxgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,9 @@ def process_image(*args, **kwargs):

if process_image_func is None:
# "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
# "cl.exe /D_USRDLL /D_WINDLL deca/process_image.c /link /DLL /OUT:process_image.dll"
# "cl.exe /D_USRDLL /D_WINDLL cpp/process_image/src/process_image.c /link /DLL /OUT:process_image.dll"

# gcc -fPIC -shared -O3 deca/process_image.c -o process_image.so
# gcc -fPIC -shared -O3 cpp/process_image/src/process_image.c -o process_image.so
paths = [
"process_image.dll",
os.path.join(lib_path, "process_image.dll"),
Expand Down

0 comments on commit 9b08875

Please sign in to comment.