Skip to content

Commit

Permalink
Added support FreeBSD. Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tx00100xt committed Dec 20, 2022
1 parent 1c681e8 commit 590a0fb
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 31 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ All notable changes to this project will be documented in this file.
- Added hud_bShowScore console variable.
- Fixed old scripts for AMD cards.

## 2022-11-30 - 2022-12-10
## 2022-11-30 - 2022-12-20
- Added support Windows.

- Added support FreeBSD.
84 changes: 83 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,52 @@ cd SeriousSamClassic/SamTSE/Sources
./build-linux64.sh -DRPI4=TRUE # use build-linux32.sh for 32-bits
```

### FreeBSD

#### Setting up the repository

Type this in your terminal:

```
git clone https://github.com/tx00100xt/SeriousSamClassic-VK.git SeriousSamClassic-VK
```

#### Copy official game data (optional)

If you have access to a copy of the game (either by CD or through Steam),
you can copy the *.gro files from the game directory to the repository.
(SeriousSamClassic/SamTFE is the directory of the game Serious Sam Classic The First Encounter, SeriousSamClassic/SamTSE is the directory of the game Serious Sam Classic The Second Encounter)

#### Building (only for SS:TFE)

Type this in your terminal:

```
cd SeriousSamClassic-VK/SamTFE/Sources
cp -vfr Entities/PlayerWeapons_old.es Entities/PlayerWeapons.es
mkdir cmake-build
cd cmake-build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTFE=TRUE ..
make -j4
cp -v SeriousSam DedicatedServer MakeFONT ecc ../../Bin
cp -v Debug/*.so ../../Bin
```

#### Building (only for SS:TSE)

Type this in your terminal:

```
cd SeriousSamClassic-VK/SamTSE/Sources
cp -vfr EntitiesMP/PlayerWeapons_old.es EntitiesMP/PlayerWeapons.es
mkdir cmake-build
cd cmake-build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
make -j4
cp -v SeriousSam DedicatedServer MakeFONT ecc ../../Bin
cp -v Debug/*.so ../../Bin
```

Note that the CD version of SS:TSE used MP3 for music. You will need to build / get `libamp11lib.so` and copy it inside `Bin` with the other libs to have music. Steam version uses ogg and doesn't need this library.

Running
Expand Down Expand Up @@ -199,6 +245,8 @@ Remark: -JD- and VITEK is author this mod for windows.

![XPLUS Sacred Yards](https://raw.githubusercontent.com/tx00100xt/SeriousSamClassic-VK/main/Images/samxplus_3.png)

### Linux

#### Building XPLUS (only for SS:TFE)

Type this in your terminal:
Expand All @@ -207,10 +255,28 @@ Type this in your terminal:
cd SeriousSamClassic-VK/SamTFE/Sources
./build-linux64xplus.sh -DTFE=TRUE # use build-linux32xplus.sh for 32-bits
```

### FreeBSD

#### Building XPLUS (only for SS:TFE)

Type this in your terminal:

```
cd SeriousSamClassic-VK/SamTFE/Sources
cp -vfr Entities/PlayerWeaponsHD.es Entities/PlayerWeapons.es
mkdir cmake-build
cd cmake-build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTFE=TRUE ..
make -j4
cp -v Debug/*.so ../../Mods/XPLUS/Bin
```
Download:
[Xplus TFE from Google Drive] or [Xplus TFE from pCloud], and unpack to SeriousSamClassic/SamTFE/Mods directory.
To start the modification, use the game menu - item Modification.

### Linux

#### Building XPLUS (only for SS:TSE)

Type this in your terminal:
Expand All @@ -219,13 +285,28 @@ Type this in your terminal:
cd SeriousSamClassic-VK/SamTSE/Sources
./build-linux64xplus.sh # use build-linux32xplus.sh for 32-bits
```

### FreeBSD

#### Building XPLUS (only for SS:TSE)

Type this in your terminal:

```
cd SeriousSamClassic-VK/SamTSE/Sources
cp -vfr EntitiesMP/PlayerWeaponsHD.es EntitiesMP/PlayerWeapons.es
mkdir cmake-build
cd cmake-build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
make -j4
cp -v Debug/*.so ../../Mods/XPLUS/Bin
```
Download:
[Xplus TSE from Google Drive] or [Xplus TSE from pCloud],, and unpack to SeriousSamClassic/SamTSE/Mods directory.
To start the modification, use the game menu - item Modification.

Building demo version of the game
---------------------------------

To build the demo version of the game, official demo files for Windows and official patches for the game from Croteam are used.
These files are automatically downloaded and unpacked in demo build scripts.

Expand Down Expand Up @@ -255,6 +336,7 @@ Supported Architectures
Supported OS
-----------
* `Linux`
* `FreeBSD`
* `Windows`
* `Raspberry PI OS`

Expand Down
28 changes: 16 additions & 12 deletions SamTFE/Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ project(SeriousEngine)
# Use system SDL2 is on by default
option(USE_SYSTEM_SDL2 "Use systems sdl2 development files" On)
option(USE_SYSTEM_ZLIB "Use systems zlib development files" On)
option(USE_SYSTEM_VULKAN "Use systems vulkan development files" On)
option(USE_CCACHE "Set to ON to use ccache if present in the system" ${USE_CCACHE})


Expand Down Expand Up @@ -60,6 +61,15 @@ if(USE_SYSTEM_ZLIB)
endif()
endif()

if(USE_SYSTEM_VULKAN)
find_package(Vulkan REQUIRED)
if(Vulkan_FOUND)
include_directories(${Vulkan_INCLUDE_DIRS})
else()
message(FATAL_ERROR "Error! USE_SYSTEM_VULKAN is set but neccessary developer files are missing")
endif()
endif()

# RAKE! Where to install the binaries.
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local" OR CMAKE_INSTALL_PREFIX STREQUAL "") # Only works for linux since I don't
# know what default is for windows/macos/freebsd.
Expand Down Expand Up @@ -100,18 +110,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(DEBUG TRUE)
endif()

## Find Vulkan for MACOSX
if(MACOSX)
if(NOT USE_SYSTEM_Vulkan)
find_package(Vulkan REQUIRED)
if(Vulkan_FOUND)
include_directories(${Vulkan_INCLUDE_DIR})
else()
message(FATAL_ERROR "Error USE_SYSTEM_Vulkan is set but neccessary developer files are missing")
endif()
endif()
endif()

## ** RAKE! start compiler specific flags section **
## ** RAKE! Borrowed from dhewm3 project, need to **
## ** RAKE! clean up for SeriousEngine use. Also **
Expand Down Expand Up @@ -1012,6 +1010,7 @@ target_link_libraries(${ENGINELIB} engine_safemath)
if(FREEBSD)
target_link_libraries(${ENGINELIB} ${SDL2_LIBRARY})
target_link_libraries(${ENGINELIB} ${ZLIB_LIBRARIES})
target_link_libraries(${ENGINELIB} ${Vulkan_LIBRARY})
endif()
if(MACOSX)
if(USE_SYSTEM_SDL2) # use sdl2 framework on system
Expand All @@ -1029,8 +1028,13 @@ endif()
if(RPI4)
target_link_libraries(${ENGINELIB} "rt")
endif()

if(FREEBSD)
set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,-rpath,$ORIGIN")
else()
target_link_libraries(${ENGINELIB} vulkan)
set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,-lvulkan,-rpath,$ORIGIN")
endif()

add_executable(SeriousSam
#${ENGINE_SRCS}
Expand Down
6 changes: 5 additions & 1 deletion SamTFE/Sources/Engine/Base/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,11 @@ CTimer::CTimer(BOOL bInterrupt /*=TRUE*/)

if (SDL_Init(SDL_INIT_TIMER) == -1) FatalError(TRANS("Cannot initialize multimedia timer!"));
tm_TimerID = SDL_AddTimer(ULONG(TickQuantum*1000.0f), CTimer_TimerFunc_SDL, NULL);
if( tm_TimerID==NULL) FatalError(TRANS("Cannot initialize multimedia timer!"));
#ifdef PLATFORM_FREEBSD
if( tm_TimerID==0x00) FatalError(TRANS("Cannot initialize multimedia timer!"));
#else
if( tm_TimerID==NULL) FatalError(TRANS("Cannot initialize multimedia timer!"));
#endif
#endif

// make sure that timer interrupt is ticking
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/Engine/Base/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ MY_STATIC_ASSERT(size_tSize, sizeof(size_t) == sizeof(void*));
}

typedef uint64_t __uint64;
#if (!defined __INTEL_COMPILER)
#if (!defined __INTEL_COMPILER) && (!defined PLATFORM_FREEBSD)
typedef int64_t __int64;
#endif

Expand Down
73 changes: 73 additions & 0 deletions SamTFE/Sources/cmake/FindVulkan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindVulkan
# ----------
#
# Try to find Vulkan
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if
# Vulkan has been found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables::
#
# Vulkan_FOUND - True if Vulkan was found
# Vulkan_INCLUDE_DIRS - include directories for Vulkan
# Vulkan_LIBRARIES - link against this library to use Vulkan
#
# The module will also define two cache variables::
#
# Vulkan_INCLUDE_DIR - the Vulkan include directory
# Vulkan_LIBRARY - the path to the Vulkan library
#
if(WIN32)
find_path(Vulkan_INCLUDE_DIR
NAMES vulkan/vulkan.h
HINTS
"$ENV{VULKAN_SDK}/Include"
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(Vulkan_LIBRARY
NAMES vulkan-1
HINTS
"$ENV{VULKAN_SDK}/Lib"
"$ENV{VULKAN_SDK}/Bin"
)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
find_library(Vulkan_LIBRARY
NAMES vulkan-1
HINTS
"$ENV{VULKAN_SDK}/Lib32"
"$ENV{VULKAN_SDK}/Bin32"
NO_SYSTEM_ENVIRONMENT_PATH
)
endif()
else()
find_path(Vulkan_INCLUDE_DIR
NAMES vulkan/vulkan.h
HINTS
"$ENV{VULKAN_SDK}/include")
find_library(Vulkan_LIBRARY
NAMES vulkan
HINTS
"$ENV{VULKAN_SDK}/lib")
endif()
set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})
set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vulkan
DEFAULT_MSG
Vulkan_LIBRARY Vulkan_INCLUDE_DIR)
mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY)
if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan)
add_library(Vulkan::Vulkan UNKNOWN IMPORTED)
set_target_properties(Vulkan::Vulkan PROPERTIES
IMPORTED_LOCATION "${Vulkan_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
endif()
28 changes: 16 additions & 12 deletions SamTSE/Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ project(SeriousEngine)
# Use system SDL2 is on by default
option(USE_SYSTEM_SDL2 "Use systems sdl2 development files" On)
option(USE_SYSTEM_ZLIB "Use systems zlib development files" On)
option(USE_SYSTEM_VULKAN "Use systems vulkan development files" On)
option(USE_CCACHE "Set to ON to use ccache if present in the system" ${USE_CCACHE})


Expand Down Expand Up @@ -60,6 +61,15 @@ if(USE_SYSTEM_ZLIB)
endif()
endif()

if(USE_SYSTEM_VULKAN)
find_package(Vulkan REQUIRED)
if(Vulkan_FOUND)
include_directories(${Vulkan_INCLUDE_DIRS})
else()
message(FATAL_ERROR "Error! USE_SYSTEM_VULKAN is set but neccessary developer files are missing")
endif()
endif()

# RAKE! Where to install the binaries.
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local" OR CMAKE_INSTALL_PREFIX STREQUAL "") # Only works for linux since I don't
# know what default is for windows/macos/freebsd.
Expand Down Expand Up @@ -100,18 +110,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(DEBUG TRUE)
endif()

## Find Vulkan for MACOSX
if(MACOSX)
if(NOT USE_SYSTEM_Vulkan)
find_package(Vulkan REQUIRED)
if(Vulkan_FOUND)
include_directories(${Vulkan_INCLUDE_DIR})
else()
message(FATAL_ERROR "Error USE_SYSTEM_Vulkan is set but neccessary developer files are missing")
endif()
endif()
endif()

## ** RAKE! start compiler specific flags section **
## ** RAKE! Borrowed from dhewm3 project, need to **
## ** RAKE! clean up for SeriousEngine use. Also **
Expand Down Expand Up @@ -1012,6 +1010,7 @@ target_link_libraries(${ENGINELIB} engine_safemath)
if(FREEBSD)
target_link_libraries(${ENGINELIB} ${SDL2_LIBRARY})
target_link_libraries(${ENGINELIB} ${ZLIB_LIBRARIES})
target_link_libraries(${ENGINELIB} ${Vulkan_LIBRARY})
endif()
if(MACOSX)
if(USE_SYSTEM_SDL2) # use sdl2 framework on system
Expand All @@ -1029,8 +1028,13 @@ endif()
if(RPI4)
target_link_libraries(${ENGINELIB} "rt")
endif()

if(FREEBSD)
set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,-rpath,$ORIGIN")
else()
target_link_libraries(${ENGINELIB} vulkan)
set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,-lvulkan,-rpath,$ORIGIN")
endif()

add_executable(SeriousSam
#${ENGINE_SRCS}
Expand Down
6 changes: 5 additions & 1 deletion SamTSE/Sources/Engine/Base/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,11 @@ CTimer::CTimer(BOOL bInterrupt /*=TRUE*/)

if (SDL_Init(SDL_INIT_TIMER) == -1) FatalError(TRANS("Cannot initialize multimedia timer!"));
tm_TimerID = SDL_AddTimer(ULONG(TickQuantum*1000.0f), CTimer_TimerFunc_SDL, NULL);
if( tm_TimerID==NULL) FatalError(TRANS("Cannot initialize multimedia timer!"));
#ifdef PLATFORM_FREEBSD
if( tm_TimerID==0x00) FatalError(TRANS("Cannot initialize multimedia timer!"));
#else
if( tm_TimerID==NULL) FatalError(TRANS("Cannot initialize multimedia timer!"));
#endif
#endif

// make sure that timer interrupt is ticking
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/Engine/Base/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ MY_STATIC_ASSERT(size_tSize, sizeof(size_t) == sizeof(void*));
}

typedef uint64_t __uint64;
#if (!defined __INTEL_COMPILER)
#if (!defined __INTEL_COMPILER) && (!defined PLATFORM_FREEBSD)
typedef int64_t __int64;
#endif

Expand Down
Loading

0 comments on commit 590a0fb

Please sign in to comment.