Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure builds for Windows users #37

Open
StarJade-Park opened this issue Mar 25, 2022 · 5 comments
Open

How to configure builds for Windows users #37

StarJade-Park opened this issue Mar 25, 2022 · 5 comments

Comments

@StarJade-Park
Copy link

StarJade-Park commented Mar 25, 2022

There are probably still people who want to run this project on Windows. So I tell you how I tried

It works in VS2022 (msvc v143), so it works in most cases

  1. Clone this project and install Panda3D(1.10.9)
    git clone https://github.com/lettier/3d-game-shaders-for-beginners.git
    
  2. Open the visual studio
  3. Create new c++ empty project
    • project name: whatever you want
    • location: {cloned directory}\demonstration
    • check "place solution and project in the same directory"
  4. Move demonstration\src\main.cxx to the project directoy
  5. Add to the project by 'Add Existing File'
  6. Open main.cxx and comment out #include <unistd.h>
  7. Change "Debug" to "Release" below the menu bar
  8. Open up the project configuration pages
  9. Change output directory to $(SolutionDir)..\ in the General tab
  10. Add PATH=C:\Panda3D-1.10.9-x64\bin;%PATH% in the Debugging tab -> Environment
  11. Add C:\Panda3D-1.10.9-x64\include in the VC++ directory tab -> External include directoies
  12. Add C:\Panda3D-1.10.9-x64\lib in the VC++ directories tab -> Library directories
  13. Add the path below in the Linker tab -> input -> Additional Dependencies
    C:\Panda3D-1.10.9-x64\lib\libp3framework.lib
    C:\Panda3D-1.10.9-x64\lib\libpanda.lib
    C:\Panda3D-1.10.9-x64\lib\libpandaexpress.lib
    C:\Panda3D-1.10.9-x64\lib\libp3dtool.lib
    C:\Panda3D-1.10.9-x64\lib\libpandaphysics.lib
    C:\Panda3D-1.10.9-x64\lib\libp3dtoolconfig.lib
    C:\Panda3D-1.10.9-x64\lib\libp3openal_audio.lib
    
  14. Build the project
  15. Execute the binary file (.exe) created in {cloned directory}\demonstration
@Nebe
Copy link

Nebe commented Apr 9, 2022

Thank you for the detailed instructions.

For those using CMake:
Here is my solution to avoid manual project configuration.
See CMakeLists.txt for usage instructions.

@just44fun
Copy link

don't forget to choose the solution platform to x64 if the original is x86

@CesarO-k
Copy link

CesarO-k commented Sep 6, 2022

If using a different version of Panda3D, please note the filename prefix, may be different from “Panda3D-1.10.9-x64”

@dmitrykolesnikovich
Copy link

@StarJade-Park thanks to make this explicit for newbies. very appreciated!

@NPatch
Copy link

NPatch commented Apr 21, 2023

Minor nitpick.

C:\Panda3D-1.10.9-x64\lib\libp3framework.lib
C:\Panda3D-1.10.9-x64\lib\libpanda.lib
C:\Panda3D-1.10.9-x64\lib\libpandaexpress.lib
C:\Panda3D-1.10.9-x64\lib\libp3dtool.lib
C:\Panda3D-1.10.9-x64\lib\libpandaphysics.lib
C:\Panda3D-1.10.9-x64\lib\libp3dtoolconfig.lib
C:\Panda3D-1.10.9-x64\lib\libp3openal_audio.lib

You don't have to hardcode the path. Since we define the path in the Additional Lib Directories, they will be found there.

Also, if you don't want to change the output directory, change current working directory in Debugging settings to $(ProjectDir)demonstration. Sidenote, this will work for everything apart Shaders. Shader::load expects a path next to the executable, so change the relative paths in loadShader by appending "../../demonstration/" to the "shaders/..." strings. I didn't go through the code, perhaps sth changes cwd prior to loading shaders and it's not a Shader::load issue.

UPDATE:
Upon further investigation, the prc file contains a model path ($MAIN_DIR) which seems to be the place that VFS defaults to and that MAIN_DIR points to the binary's path and is set here:
https://github.com/panda3d/panda3d/blob/4da2059758267a91cfa7fc91bc77b9332eb280dd/dtool/src/dtoolutil/executionEnvironment.cxx#L296

All loaders seem to call upon VFS (VirtualFileSystem) to resolve the relative filenames, although shader is the only place vfs::find_file is called, while all the others call resolve_filename which internally calls find_file....

VFS internally has its own cwd. Although I didn't figure out why the rest of the assets resolve properly while the shaders don't.
I think I'll stop here. To do anything further, I'd have to rebuild panda and navigate using debugger to make any sense and it just sounds like a lot of work xD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants