MichaelWallace30 / CommProtocol

SImple generic Protocol for communication
2 stars 8 forks source link

x64 #12

Closed MichaelWallace30 closed 8 years ago

MichaelWallace30 commented 8 years ago

Visual Studio doesn't like -m32 or -m64 and ignores it, yet when I try to build as x64 it freaks out if I use these. I'm not sure if your intention was for both windows and unix, but it will need to be removed for visual studio.

option(build32 "Build library in 32 bit" OFF) option(build64 "Build library in 64 bit" ON)

CheezBoiger commented 8 years ago

Apparently there are alot of issues revolving around this, the reason is that MSVC does ignore those commands, builds it in default 32bit, and sets all the links and includes for that specific binary build.

The fastest way to build this in 64bit is to create a build folder, command line into that folder, and run

cmake -G "Visual Studio 12 2013 Win64" ../

Visual Studio is a pain in the ass when it comes to cmake stuff.

When you manually set it to build x64 bit, you run it typically as

cmake ../

make sure you create a new build to x64 and copy the settings from Win32 build. OF course now you have to deal with a small problem, the threads will still be targeting win32, so you have to go to Project->NGCP_LIB Properties->Linker->Command Line and in the additional commands log below, remove /machine:X86 from there.

After that, it seemed to build just fine for me. Yea Visual Studio sucks when it comes to cmake.

CheezBoiger commented 8 years ago

We will have to check for the compiler that is being used by the user, and somehow tell the cmake build to set the options as x64 instead, which shouldn't bee to hard.

CheezBoiger commented 8 years ago

This is only if it is Visual studio though, i don't see problems arising from any other compiler.

MichaelWallace30 commented 8 years ago

Its weird because why is it adding the machine:X86 when we do -m32 or -m64. If they do visual studio they can just switch the build mode them self.

CheezBoiger commented 8 years ago

They can but we need those for linux and mac, the last lib was improperly designed it required you to relink everything after building x86 and switching in visual studio, our library doesnt have you do this. Every compiler has a different command to build , im sure clang will have different options, since it was built using LLVM, but it is extensible enough use gcc commands.

We can disable the commands though, preventing it from sending it to visual studio compiler, by checking the compiler type in cmake.

MichaelWallace30 commented 8 years ago

Its not a big deal right now, but it will be (UGV). We should just check if its visual studio and not add those commands.