Jump to content

Compiling through GCC/Clang


Mechami

Recommended Posts

Posted

Heyo, new here.

Just found out about OpenJK and have already made some changes I'd like to test.

The problem is I don't have Visual Studio currently and I'm wondering if it's possible to compile with GCC or Clang instead.

Posted

On Linux and OSX, yes, clang or gcc work just fine :) On Windows, using mingw with gcc, I believe there are some problems but these may have been unknowingly fixed at some point.

Posted

GCC is fine with C++11 if you use the -std=c++11 switch.

I don't think it's used anywhere, though. It was written in 2003.

Futuza likes this
Posted

GCC is fine with C++11 if you use the -std=c++11 switch.

I don't think it's used anywhere, though. It was written in 2003.

It could be used as an update feature though...I just don't know if anyone was bothering to do that or not.  Since ya know, smart pointers and auto are pretty cool 'n stuff.  Though personally I'd advise against it since its from 2003, ye should stick to the original.

 

Also I thought GCC had some issues with certain things in C++11, (I could be totally off the wall though).

JKG Developer

Posted

I'm looking through CmakeLists and I found that if I generate MSYS makefiles Cmake will append MSVC's /arch:SSE2 flags.

# Common settings
if(WIN32)
    if(WIN64)
        if(MSVC)
            set(SharedDefines "WIN64" "_CRT_SECURE_NO_WARNINGS")
        else(MSVC)
            set(SharedDefines "WIN64")
            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
        endif(MSVC)
    else(WIN64)
        if(MSVC)
            set(SharedDefines "_CRT_SECURE_NO_WARNINGS")
            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
        endif(MSVC)
    endif(WIN64)

 

If we're compiling for Windows then check to see if we're compiling for x86-64.
If we are then check to see if we're compiling with MSVC.
If MSVC is the working compiler then define WIN64 and disable warnings, otherwise still define WIN64 but define compiler flags for MSVC even though MSVC is not the working compiler.

Why is Cmake being told to generate compiler flags for MSVC if MSVC was already established to not be the working compiler?

Posted

else(MSVC) != else if (MSVC)

 

older CMAKE versions require the else() blocks and endif() blocks to contain the same thing that they were opened with.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...