Skip to content

Commit

Permalink
Fix/linux compilation (#3)
Browse files Browse the repository at this point in the history
* Added Linux fixes for missing or broken files from the original repo.

* Clarified some platform-specific things

* Shortened primary README title

* Added index to README

* Removed Windows specific duplicate info from top section
  • Loading branch information
Mudbill authored Sep 25, 2020
1 parent d5bc79c commit 2e85504
Show file tree
Hide file tree
Showing 14 changed files with 189 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ bld/
[Ll]og/
[Ll]ogs/
amnesia/_temp/
amnesia/src/*.bin*
*.a

# CMake build files
CMakeFiles/
Expand Down
7 changes: 3 additions & 4 deletions HPL2/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@ target_link_libraries(HPL2
)


if(APPLE)
if(APPLE)
# helper function to copy the needed frameworks in at build time
SET(HPL2_FRAMEWORKS ${HPL2_FRAMEWORKS} CACHE STRING "HPL2 copy frameworks")
SET(HPL2_LIBRARIES libSDL2.dylib libIL.1.dylib)
SET(HPL2_LIBRARIES libSDL2.dylib libIL.1.dylib)
SET(HPL2_LIBRARIES ${HPL2_LIBRARIES} CACHE STRING "HPL2 copy libs")
mark_as_advanced(HPL2_FRAMEWORKS HPL2_LIBRARIES)

Expand Down Expand Up @@ -344,7 +344,6 @@ FUNCTION(AddTestTarget target_name)
)
ENDFUNCTION()

add_subdirectory(../tests tests)
add_subdirectory(../tools tools)


set(CMAKE_CXX_FLAGS "-fpermissive -no-pie")
32 changes: 32 additions & 0 deletions HPL2/core/sources/BuildID_HPL2_0_Linux.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright © 2009-2020 Frictional Games
*
* This file is part of Amnesia: The Dark Descent.
*
* Amnesia: The Dark Descent is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Amnesia: The Dark Descent is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Amnesia: The Dark Descent. If not, see <https://www.gnu.org/licenses/>.
*/

//////////////////////////////////////////////////
// File autogenerated by buildcounter
// Do not hand edit! (preferably)
//////////////////////////////////////////////////
#include "./BuildID_HPL2_0.h"

static char gsBuildID[16] = "20160407093727";

const char* GetBuildID_HPL2_0()
{
return gsBuildID;
}

1 change: 1 addition & 0 deletions HPL2/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ add_executable(MshConverter
)
target_link_libraries(MshConverter HPL2)

set(CMAKE_CXX_FLAGS "-fpermissive -no-pie")
1 change: 1 addition & 0 deletions HPL2/tools/editors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,4 @@ AddToolTarget(MaterialEditor

# vim: noet ts=4:

set(CMAKE_CXX_FLAGS "-fpermissive -no-pie")
32 changes: 32 additions & 0 deletions HPL2/tools/editors/leveleditor/BuildID_LevelEditor_Linux.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright © 2009-2020 Frictional Games
*
* This file is part of Amnesia: The Dark Descent.
*
* Amnesia: The Dark Descent is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Amnesia: The Dark Descent is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Amnesia: The Dark Descent. If not, see <https://www.gnu.org/licenses/>.
*/

//////////////////////////////////////////////////
// File autogenerated by buildcounter
// Do not hand edit! (preferably)
//////////////////////////////////////////////////
#include "./BuildID_LevelEditor.h"

static char gsBuildID[16] = "20101027185544";

const char* GetBuildID_LevelEditor()
{
return gsBuildID;
}

32 changes: 32 additions & 0 deletions HPL2/tools/editors/materialeditor/BuildID_MaterialEditor_Linux.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright © 2009-2020 Frictional Games
*
* This file is part of Amnesia: The Dark Descent.
*
* Amnesia: The Dark Descent is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Amnesia: The Dark Descent is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Amnesia: The Dark Descent. If not, see <https://www.gnu.org/licenses/>.
*/

//////////////////////////////////////////////////
// File autogenerated by buildcounter
// Do not hand edit! (preferably)
//////////////////////////////////////////////////
#include "./BuildID_MaterialEditor.h"

static char gsBuildID[16] = "20100917115138";

const char* GetBuildID_MaterialEditor()
{
return gsBuildID;
}

32 changes: 32 additions & 0 deletions HPL2/tools/editors/modeleditor/BuildID_ModelEditor_Linux.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright © 2009-2020 Frictional Games
*
* This file is part of Amnesia: The Dark Descent.
*
* Amnesia: The Dark Descent is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Amnesia: The Dark Descent is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Amnesia: The Dark Descent. If not, see <https://www.gnu.org/licenses/>.
*/

//////////////////////////////////////////////////
// File autogenerated by buildcounter
// Do not hand edit! (preferably)
//////////////////////////////////////////////////
#include "./BuildID_ModelEditor.h"

static char gsBuildID[16] = "20100917115135";

const char* GetBuildID_ModelEditor()
{
return gsBuildID;
}

32 changes: 32 additions & 0 deletions HPL2/tools/editors/particleeditor/BuildID_ParticleEditor_Linux.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright © 2009-2020 Frictional Games
*
* This file is part of Amnesia: The Dark Descent.
*
* Amnesia: The Dark Descent is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Amnesia: The Dark Descent is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Amnesia: The Dark Descent. If not, see <https://www.gnu.org/licenses/>.
*/

//////////////////////////////////////////////////
// File autogenerated by buildcounter
// Do not hand edit! (preferably)
//////////////////////////////////////////////////
#include "./BuildID_ParticleEditor.h"

static char gsBuildID[16] = "20100917115133";

const char* GetBuildID_ParticleEditor()
{
return gsBuildID;
}

41 changes: 17 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Amnesia: The Dark Descent Source Code - HPL Chad Gang Fork
# Amnesia: The Dark Descent - HPL Chad Gang Fork

This is a fork of the Amnesia the Dark Descent repository from FrictionalGames. We will mostly play with different parts of the engine and perhaps even fix some bugs :)

## Project Overview
The game is built from two separate solutions: The HPL2 Engine and the game itself.
## Index

* [Windows](#project-overview-windows) - Compiling instructions for Windows.
* [Linux](#building--playing-linux) - Compiling instructions for Linux.

## Prerequisites

- A copy of Amnesia: the Dark Descent (For playing the game)
- Visual Studio 2010 (For compiling the engine)
- Visual Studio 2017 (For compiling the game)
- CMake
- Visual Studio 2010 (Windows, for compiling the engine)
- Visual Studio 2017 (Windows, for compiling the game)
- CMake, Make (Linux, for compiling)

## Project Overview
## Project Overview (Windows)
The game is built from two separate solutions: The engine solution named `HPL2_2010` and the main game solution named `Lux`.
The project also includes all the different editors and additional tools, such as the Level Editor and the Model Editor.

Expand Down Expand Up @@ -57,31 +59,22 @@ Copy `Amnesia.exe` into your Amnesia game folder and launch it. The main menu sh

## Building & Playing (Linux)

There are quite a few extra steps required to be able to successfully build everything on Linux. This is partially due to incorrect configuration in the default repository.
There are a few extra steps required to be able to successfully build everything on Linux compared to Windows.

### Building the Engine, Game & Editors

0. Ensure you have `make` and `cmake` installed.
1. Clone the project and enter the folder
2. Extract `./HPL2/dependencies.zip` to the same folder it's in
3. Edit `./HPL2/core/CMakeLists.txt` and remove the line near the bottom about adding the `../tests` subdirectory.
4. Open a terminal in `./amnesia/src` and run `cmake .`
5. Search for "BuildID" in the file system and you will see 5 sets of .h and .cpp files. The .cpp filenames end with "Win32". Create duplicates of these files and rename from "Win32" to "Linux". For example: `BuildID_HPL2_0_Win32.cpp` > `BuildID_HPL2_0_Linux.cpp`.
6. Add the following CMake line into the files listed below: `set(CMAKE_CXX_FLAGS "-fpermissive -no-pie")`
- `./amnesia/src/CMakeLists.txt`
- `./amnesia/src/launcher/CMakeLists.txt`
- `./amnesia/src/game/CMakeLists.txt`
- `./HPL2/core/CMakeLists.txt`
- `./HPL2/tools/CMakeLists.txt`
- `./HPL2/tools/editors/CMakeLists.txt`
7. Open a terminal in `./HPL2/dependencies/lib/linux/lib64` and run ([credit](https://github.com/FrictionalGames/AmnesiaTheDarkDescent/pull/2#issuecomment-697648592)):
1. Ensure you have `make` and `cmake` installed.
2. Clone the project and enter the folder
3. Extract `./HPL2/dependencies.zip` to the same folder it's in
4. Open a terminal in `./HPL2/dependencies/lib/linux/lib64` and run ([credit](https://github.com/FrictionalGames/AmnesiaTheDarkDescent/pull/2#issuecomment-697648592)):

```
for f in `file * | grep ASCII | cut -d: -f1`; do ln -fs `cut -d' ' -f2 $f` $f; done
```
8. With a terminal in `./amnesia/src` do `make` (or use `make -jX` where X is the number of jobs you want to run to speed things up, based on your CPU threads)
9. The build will compile and the resulting binaries will be found in `./amnesia/src`
5. Open a terminal in `./amnesia/src` and run `cmake .`
6. With a terminal in `./amnesia/src` do `make` (or use `make -jX` where X is the number of jobs you want to run to speed things up, based on your CPU threads)
7. The build should compile and the resulting binaries will be found in `./amnesia/src`
### Playing the Game
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions amnesia/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ endif()
add_custom_target(GameRelease
DEPENDS Amnesia Launcher
)

set(CMAKE_CXX_FLAGS "-fpermissive -no-pie")
2 changes: 2 additions & 0 deletions amnesia/src/game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ IF(APPLE)
ENDIF()

# vim: noet ts=4:

set(CMAKE_CXX_FLAGS "-fpermissive -no-pie")
1 change: 1 addition & 0 deletions amnesia/src/launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ add_executable(Launcher
target_link_libraries(Launcher HPL2 ${FLTK_IMAGES_LIBRARY} ${FLTK_LIBRARY} X11 Xext Xft fontconfig ${JPEG_LIBRARY})

# vim: et ts=4
set(CMAKE_CXX_FLAGS "-fpermissive -no-pie")

0 comments on commit 2e85504

Please sign in to comment.