Author Topic: Compiling NAS2D  (Read 4014 times)

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Compiling NAS2D
« on: September 29, 2018, 08:23:06 PM »
I was trying to compile OutpostHD using VS17 (still using the VS15 toolsets though). It looks like I have to compile NAS2D first. I pulled NAS2D and attempted to compile. I received the following errors:

Error   C1083   Cannot open include file: 'GL/glew.h': No such file or directory   ogl_renderer.cpp   11   
Error   C1083   Cannot open include file: 'GL/glew.h': No such file or directory   image.cpp   19   
Error   C1083   Cannot open include file: 'GL/glew.h': No such file or directory   font.cpp   17   
Error   C1083   Cannot open include file: 'physfs.h': No such file or directory           filesystem.cpp   14   
Error   C1083   Cannot open include file: 'SDL.h': timer.cpp   13   
Error   C1083   Cannot open include file: 'SDL.h': sound.cpp   16   
Error   C1083   Cannot open include file: 'SDL.h': music.cpp   16   
Error   C1083   Cannot open include file: 'SDL.h': mixer_sdl.cpp   23   
Error   C1083   Cannot open include file: 'SDL.h': game.cpp   21   
Error   C1083   Cannot open include file: 'SDL.h': fpscounter.cpp   13   
Error   C1083   Cannot open include file: 'SDL.h': eventhandler.cpp   12   

I'm guessing that I need to pull a couple of NUGET packages manually?

Thanks,
Brett

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 2352
  • OPHD Lead Developer
    • LairWorks Entertainment
Re: Compiling NAS2D
« Reply #1 on: September 30, 2018, 01:58:49 AM »
Unfamiliar with nuget.

But basically you're missing dependencies: SDL 2.0.5+ and GLEW. Will also need PhysicsFS, SDL_TTF, SDL_Mixer, SDL_Image.

Once you have those and the project configuration points to the right directories to pull headers/libraries, it should build without trouble on VS2015/VS2017.

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Compiling NAS2D
« Reply #2 on: September 30, 2018, 12:17:50 PM »
Nuget is a packet manager for Visual Studio. I found all the dependencies needed had Nuget packages available. Nuget is included with Visual Studio. Right click on the project -> Manage Nuget Packages.

The idea is that you use it to fetch all the project dependencies instead of manually finding and downloading them. It also gives someone else detailed knowledge of which specific version of each dependency your project requires.

Nuget will create a file called packages.config in XML form containing which packages and their versions are required. It will place the fetched packages in a folder called packages. If you add the packages folder to the .gitignore, it will keep all the actual downloaded packages outside of the project. When the project is first opened in Visual Studio, Visual Studio will automatically fetch the packages listed in packages.config for you.

This is the package list I used to compile NAS2D. I'm not sure why it is pulling so many different versions of SDL (2.0.4, 2.0.5, and 2.0.8). Otherwise seems to be working???

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="freetype.redist" version="2.6.2.1" targetFramework="native" />
  <package id="glew" version="1.9.0.1" targetFramework="native" />
  <package id="glew.redist" version="1.9.0.1" targetFramework="native" />
  <package id="physfs.v140" version="2.0.3.1" targetFramework="native" />
  <package id="sdl2.new" version="2.0.8" targetFramework="native" />
  <package id="sdl2.new.redist" version="2.0.8" targetFramework="native" />
  <package id="sdl2.redist" version="2.0.5" targetFramework="native" />
  <package id="sdl2.v140.redist" version="2.0.4" targetFramework="native" />
  <package id="sdl2_ttf.v140" version="2.0.14" targetFramework="native" />
  <package id="sdl2_ttf.v140.redist" version="2.0.14" targetFramework="native" />
  <package id="vii.SDL2_image" version="2.0.3" targetFramework="native" />
  <package id="vii.SDL2_image.redist" version="2.0.3" targetFramework="native" />
  <package id="vii.SDL2_mixer" version="2.0.2" targetFramework="native" />
  <package id="vii.SDL2_mixer.redist" version="2.0.2" targetFramework="native" />
</packages>

---

I'm trying to compile OutpostHD now. It appears to requires SDL in addition to NAS2D.

I have the following errors right now:

Error   RC2135   file not found: C:\Dev\OPHD\proj\vc14\editor.ico   StructureAligner   C:\ . . . \OPHD\proj\vc14\StructureAligner\StructureAligner.rc   54
Error   C2338   Can't use evil method   ui_builder   c:\ . . . \ophd\nas2d-core\include\nas2d\delegate.h   364
Error   LNK1104   cannot open file 'glew32.lib'   OPHD   C:\ . . . \OPHD\proj\vc14\LINK   1

I have a glew.lib available from Nuget's download of Glew in a folder called win32. I'm thinking about just trying to rename this file to glew32.lib and seeing if it works.

StuctureAligner is throwing the static_assert about an 'evil method'.

Is there a post somewhere that discusses where to get the graphics?

Thanks. Sorry for peppering with questions.

-Brett

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 2352
  • OPHD Lead Developer
    • LairWorks Entertainment
Re: Compiling NAS2D
« Reply #3 on: September 30, 2018, 01:05:53 PM »
Don't bother trying to build StructureAligner or UI_Builder -- both projects are horribly out of date and aren't even very useful anymore. They're also completely broken when building with current versions of NAS2D.

For graphics, there isn't a post... gimme a moment and I'll upload an updated package of the OPHD assets...

https://www.outpost2.net/files/ophd/data.7z [broken link]

Has all of the updated assets.
« Last Edit: August 03, 2022, 01:57:52 PM by leeor_net »

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Compiling NAS2D
« Reply #4 on: September 30, 2018, 04:51:04 PM »
NAS2D has a build going on AppVeyor that pulls in dependencies using Nuget. The details should be in the proj/vc14/ folder, which includes the packages.config.

I would love if someone more experienced with Nuget could go over that part and possibly clean things up. I had to use a hacky Remote Desktop procedure with the AppVeyor CI build to get the Nuget package part working.

It does appear there is an extra version of SDL in that list. I've also noticed there doesn't seem to be official packages for some of the dependencies, which means package selection might be not so great.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Compiling NAS2D
« Reply #5 on: October 06, 2018, 01:05:08 AM »
Hey, curious if you managed to get the project compiled, or if you found a way to minimize those seemingly duplicate SDL dependencies.

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Compiling NAS2D
« Reply #6 on: October 06, 2018, 11:11:51 AM »
No, I haven't been working on it. I seem to only have time to devote to one project at a time for Outpost 2. I have been working on a BitmapFile and IndexedBitmapReader for OP2Utility and trying to keep up with some of Angellus' work on the level template.

I did notice the packages.config file that Hooman added to use with AppVeyor. For some reason, Visual Studio did not download these packages when I pulled the REPO. I think my next step would be to download a clean copy of the NAS2D repo and see what is going on (may have been operator error on my part).

-Brett