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

Add Linux support to the project #13

Closed
wants to merge 9 commits into from

Conversation

marian-bielcik
Copy link

@marian-bielcik marian-bielcik commented Jan 1, 2019

Hi Cherno,

  1. added support for Linux to the premake5.lua file
  2. changed the "Hazel/Hazel/src/Hazel/Events/Event.h" to fix gcc compile error:
    src/Hazel/Events/Event.h:32:83: error: pasting "::" and "WindowResize" does not give a valid preprocessing token
    #define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::##type; }
  3. changed files: "Hazel/src/Hazel/Core.h" and "Hazel/src/Hazel/EntryPoint.h" to add support for Linux

Thanks.
Marian

@@ -1,6 +1,6 @@
#pragma once

#ifdef HZ_PLATFORM_WINDOWS
#if defined HZ_PLATFORM_WINDOWS
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit redundant to do platform checks when the code is the same for both platforms right now.

if there are divergences later on then they can be added at that point in time.

TLDR; may as well just remove the if platform checks for now. 😄

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Cherno,

  1. added support for Linux to the premake5.lua file
  2. changed the "Hazel/Hazel/src/Hazel/Events/Event.h" to fix gcc compile error:
    src/Hazel/Events/Event.h:32:83: error: pasting "::" and "WindowResize" does not give a valid preprocessing token
    #define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::##type; }
  3. changed files: "Hazel/src/Hazel/Core.h" and "Hazel/src/Hazel/EntryPoint.h" to add support for Linux

Thanks.
Marian

#define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::##type; }
#define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::type; }
I am using gcc on windows i just delete '##', it works

@TheCherno
Copy link
Owner

Can you please update this branch and make sure it's ready to merge? I'd be keen to merge this in. 🙂

@cubedtear cubedtear mentioned this pull request Feb 3, 2019
3 tasks
@cubedtear
Copy link

I updated this PR on #27

@VictorQRS
Copy link

As this PR is already updated on #27 , perhaps this one should be closed as it is obsolete, right?

@ritobanrc
Copy link

On Manjaro 18.0.3, I am getting an error after running premake5 gmake and make:

==== Building GLFW (debug) ====
==== Building Glad (debug) ====
==== Building ImGui (debug) ====
==== Building Hazel (debug) ====
Linking Hazel
/usr/bin/ld: vendor/imgui/bin/Debug-linux-x86_64/ImGui/libImGui.a(imgui.o): relocation R_X86_64_PC32 against symbol `GImGui' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:121: ../bin/Debug-linux-x86_64/Hazel/libHazel.so] Error 1
make: *** [Makefile:62: Hazel] Error 2

@cubedtear
Copy link

@ritobanrc this is already fixed on PR #27 (I myself use manjar too, so it should work for you aswell)

@DaveAxiom
Copy link
Contributor

I cloned the latest marian-bielcik/Hazel branch and found it works with a minor modification.

I cloned the project.

git clone https://github.com/marian-bielcik/Hazel.git marian-test
cd marian-test

Modified ./Hazel/vendor/imgui/premake5.lua by appending:

    filter "system:linux"
	pic "on"

Ran premake with make.

premake5 gmake
make

And Sandbox compiled properly!

It was cubedtear's branch that worked for me a few months ago. I contributed a little documentation to his branch too. I attempted to rebase cubetear's branch from TheCherno's latest work but I found myself stuck after making some modifications. Now I'm wondering what the differences are between the @cubedtear and @marian-bielcik branches.

@Gaztin
Copy link
Collaborator

Gaztin commented May 20, 2019

Closing since this has been moved to #27

@Gaztin Gaztin closed this May 20, 2019
@DaveAxiom
Copy link
Contributor

This branch looks to be the most promising Pull Request for Linux support! The latest repository is 3 commits behind. A proper repository clone compiles and runs fine on my system. The submodule links need to be changed to point back to TheCherno's repositories.

@LovelySanta LovelySanta mentioned this pull request Jul 11, 2019
7 tasks
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

Successfully merging this pull request may close these issues.

None yet

9 participants