Skip to content

Commit

Permalink
illumos port. (supertuxkart#4732)
Browse files Browse the repository at this point in the history
overcoming sun constant defined in this platform.
forcing 64 bits build as angelscript assembly is incorrect for 32 bits.
  • Loading branch information
devnexen authored and remihb committed Jan 9, 2024
1 parent f3e6ca1 commit 82f2517
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 15 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ if(UNIX OR MINGW)
endif()
endif()

if(UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
find_package(PkgConfig REQUIRED)

if(NOT PKGCONFIG_FOUND)
Expand Down Expand Up @@ -363,6 +363,11 @@ elseif(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") # Enable multi-processor compilation (faster)
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "SunOs")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
endif()


# Build the angelscript library if not in system
if(USE_SYSTEM_ANGELSCRIPT)
Expand Down Expand Up @@ -691,6 +696,10 @@ if(NOT SERVER_ONLY)
endif()
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries(supertuxkart nsl socket vorbisfile)
endif()

if (USE_DNS_C)
target_link_libraries(supertuxkart dnsc)
else()
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindFreetype.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if(WIN32)
find_library(FREETYPE_LIBRARY NAMES freetype libfreetype PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
set(FREETYPE_FOUND 1)
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
elseif(APPLE)
elseif(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
find_path(FREETYPE_INCLUDE_DIRS NAMES ft2build.h PATH_SUFFIXES freetype2 include/freetype2 include)
find_library(FREETYPE_LIBRARY NAMES freetype)
set(FREETYPE_FOUND 1)
Expand Down
2 changes: 1 addition & 1 deletion lib/irrlicht/source/Irrlicht/CFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ IFileList* CFileSystem::createFileList(const io::path& directory)
size = buf.st_size;
isDirectory = S_ISDIR(buf.st_mode);
}
#if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__) && !defined(__HAIKU__)
#if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__) && !defined(__HAIKU__) && !defined(__sun)
// only available on some systems
else
{
Expand Down
6 changes: 3 additions & 3 deletions src/graphics/irr_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2278,15 +2278,15 @@ bool IrrDriver::OnEvent(const irr::SEvent &event)
scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos,
float energy, float radius,
float r, float g, float b,
bool sun, scene::ISceneNode* parent)
bool sun_, scene::ISceneNode* parent)
{
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
if (parent == NULL) parent = m_scene_manager->getRootSceneNode();
LightNode *light = NULL;

if (!sun)
if (!sun_)
light = new LightNode(m_scene_manager, parent, energy, radius,
r, g, b);
else
Expand All @@ -2297,7 +2297,7 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos,

m_lights.push_back(light);

if (sun)
if (sun_)
{
m_renderer->addSunLight(pos);
}
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/irr_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ class IrrDriver : public IEventReceiver, public NoCopy
// ------------------------------------------------------------------------
scene::ISceneNode *addLight(const core::vector3df &pos, float energy,
float radius, float r, float g, float b,
bool sun = false,
bool sun_ = false,
scene::ISceneNode* parent = NULL);
// ------------------------------------------------------------------------
void clearLights();
Expand Down
6 changes: 3 additions & 3 deletions src/graphics/post_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,17 +1078,17 @@ void PostProcessing::renderGodRays(scene::ICameraSceneNode * const camnode,
const SColor col = track->getGodRaysColor();

// The sun interposer
SP::SPDynamicDrawCall* sun = irr_driver->getSunInterposer();
SP::SPDynamicDrawCall* sun_ = irr_driver->getSunInterposer();
// This will only do thing when you update the sun position
sun->uploadInstanceData();
sun_->uploadInstanceData();
SP::SPShader* glow_shader = SP::getGlowShader();
glow_shader->use();
SP::SPUniformAssigner* glow_color_assigner = glow_shader
->getUniformAssigner("col");
assert(glow_color_assigner != NULL);
video::SColorf cf(track->getGodRaysColor());
glow_color_assigner->setValue(core::vector3df(cf.r, cf.g, cf.b));
sun->draw();
sun_->draw();
glow_shader->unuse();
glDisable(GL_DEPTH_TEST);

Expand Down
6 changes: 3 additions & 3 deletions src/tracks/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2135,9 +2135,9 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
#ifndef SERVER_ONLY
if (!CVS->isGLSL())
{
scene::ILightSceneNode *sun = (scene::ILightSceneNode *) m_sun;
scene::ILightSceneNode *sun_ = (scene::ILightSceneNode *) m_sun;

sun->setLightType(video::ELT_DIRECTIONAL);
sun_->setLightType(video::ELT_DIRECTIONAL);

// The angle of the light is rather important - let the sun
// point towards (0,0,0).
Expand All @@ -2148,7 +2148,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
else
m_sun->setRotation((-m_sun_position).getHorizontalAngle());

sun->getLightData().SpecularColor = m_sun_specular_color;
sun_->getLightData().SpecularColor = m_sun_specular_color;
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions src/utils/crash_reporting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@
path = realpath("/proc/self/exe", NULL);
#elif defined(__NetBSD__)
path = realpath("/proc/curproc/exe", NULL);
#elif defined(__sun)
path = realpath("/proc/self/path/a.out", NULL);
#elif defined(__APPLE__)
path = (char*)malloc(PATH_MAX+1);
uint32_t len = PATH_MAX;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/vs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# include <windows.h>
#endif

#if (defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)) || defined(__NetBSD__) || defined(__APPLE__)
#if (defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)) || defined(__NetBSD__) || defined(__APPLE__) || defined(__sun)
# include <pthread.h>
#endif

Expand Down Expand Up @@ -95,7 +95,7 @@ namespace VS
static void setThreadName(const char* name)
{
#if defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
#if __GLIBC__ > 2 || __GLIBC_MINOR__ > 11
#if __GLIBC__ > 2 || __GLIBC_MINOR__ > 11 || defined(__sun)
pthread_setname_np(pthread_self(), name);
#endif
#elif defined(__FreeBSD__) || defined(__DragonFly__)
Expand Down

0 comments on commit 82f2517

Please sign in to comment.