Jump to content

Mangos with cmake


Guest tizbac

Recommended Posts

  • 1 month later...

hello, i hope you are still here, or someone with cmake experience is here,

i tested your cmakelists.txt and changed some stuff

diff:

--- pastebin.php?dl=f350ad0db   2009-01-17 16:20:58.000000000 +0100
+++ CMakeLists.txt      2009-01-17 16:16:25.000000000 +0100
@@ -41,6 +41,9 @@
src/game/ArenaTeamHandler.cpp
src/game/AuctionHouse.cpp
src/game/Bag.cpp
+src/game/BattleGroundDS.cpp
+src/game/BattleGroundRV.cpp
+src/game/BattleGroundSA.cpp
src/game/BattleGround.cpp
src/game/BattleGroundAA.cpp
src/game/BattleGroundAB.cpp
@@ -157,9 +160,8 @@
src/game/WorldSocket.cpp
src/game/WorldSocketMgr.cpp
src/game/debugcmds.cpp
-src/game/tools.cpp
 )
-add_library( mangosscript SHARED 
+add_library( mangosscript SHARED
src/bindings/universal/ScriptMgr.cpp
src/bindings/universal/Scripts/sc_default.cpp
src/bindings/universal/Scripts/sc_defines.cpp
@@ -696,4 +698,4 @@
SET_TARGET_PROPERTIES( ace PROPERTIES COMPILE_FLAGS -fPIC )
install( TARGETS mangos-worldd mangos-realmd ZThread mangosscript
        RUNTIME DESTINATION /usr/local/bin
-        LIBRARY DESTINATION /usr/local/lib )
\\ No newline at end of file
+        LIBRARY DESTINATION /usr/local/lib )

but i get some error, after compiling, and don't know how this can be solved:

Scanning dependencies of target ace

[  4%] Building CXX object CMakeFiles/ace.dir/dep/ACE_wrappers/ace/ACE.o
In file included from /home/mangos/mangos/source/./dep/ACE_wrappers/ace/config-lite.h:24,
                from /home/mangos/mangos/source/./dep/ACE_wrappers/ace/ACE.h:25,
                from /home/mangos/mangos/source/dep/ACE_wrappers/ace/ACE.cpp:3:
/home/mangos/mangos/source/./dep/ACE_wrappers/ace/config-macros.h:27:24: error: ace/config.h: No such file or directory
In file included from /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4/backward/new.h:33,
                from /home/mangos/mangos/source/./dep/ACE_wrappers/ace/Global_Macros.h:912,
                from /home/mangos/mangos/source/./dep/ACE_wrappers/ace/Flag_Manip.h:26,
                from /home/mangos/mangos/source/./dep/ACE_wrappers/ace/ACE.h:32,
                from /home/mangos/mangos/source/dep/ACE_wrappers/ace/ACE.cpp:3:
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
/home/mangos/mangos/source/./dep/ACE_wrappers/ace/os_include/os_signal.h:239: error: declaration of C function 'int sigwait(sigset_t*)' conflicts with
/usr/include/signal.h:272: error: previous declaration 'int sigwait(const sigset_t*, int*)' here
/home/mangos/mangos/source/./dep/ACE_wrappers/ace/os_include/os_ucontext.h:40: error: conflicting declaration 'typedef int ucontext_t'
/usr/include/sys/ucontext.h:127: error: 'ucontext_t' has a previous declaration as 'typedef struct ucontext ucontext_t'
/home/mangos/mangos/source/./dep/ACE_wrappers/ace/os_include/sys/os_socket.h:44: error: redefinition of 'struct msghdr'
/usr/include/bits/socket.h:217: error: previous definition of 'struct msghdr'
/home/mangos/mangos/source/./dep/ACE_wrappers/ace/os_include/os_time.h:58: error: redefinition of 'struct timespec'
/usr/include/time.h:122: error: previous definition of 'struct timespec'
/home/mangos/mangos/source/./dep/ACE_wrappers/ace/os_include/os_time.h:64: error: invalid type in declaration before ';' token
/home/mangos/mangos/source/./dep/ACE_wrappers/ace/OS_NS_signal.h:51: error: using typedef-name 'siginfo_t' after 'struct'
/usr/include/bits/siginfo.h:108: error: 'siginfo_t' has a previous declaration here
/home/mangos/mangos/source/./dep/ACE_wrappers/ace/os_include/os_sched.h:44: error: conflicting declaration 'typedef struct cpu_set_t cpu_set_t'
/usr/include/bits/sched.h:118: error: 'cpu_set_t' has a previous declaration as 'typedef struct cpu_set_t cpu_set_t'
/home/mangos/mangos/source/./dep/ACE_wrappers/ace/os_include/os_stropts.h:99: error: redefinition of 'struct strbuf'
/usr/include/bits/stropts.h:181: error: previous definition of 'struct strbuf'
make[2]: *** [CMakeFiles/ace.dir/dep/ACE_wrappers/ace/ACE.o] Error 1
make[1]: *** [CMakeFiles/ace.dir/all] Error 2
make: *** [all] Error 2

it would be great if mangos can be configured this way, it looks very easy to edit and configured everything in 5seconds - i think the old autoconf way needs at least some minutes

Link to comment
Share on other sites

  • 2 weeks later...

ok, this time it reaches the src/game dir (don't know what the previous problem was, maybe i had a dirty working-dir :/)

but i still had to uncomment all "dirent"-includes (i think this cmake-files doesn't call the ace/configure-linux-generic script)

now it goes until:

[ 71%] Building CXX object CMakeFiles/mangosgame.dir/src/game/Level0.o

/home/mangos/mangos/mangos/src/game/Level0.cpp:31:26: error: SystemConfig.h: No such file or directory

/home/mangos/mangos/mangos/src/game/Level0.cpp:32:22: error: revision.h: No such file or directory

also i haven't found revision.h in the cmakelist, and don't know how this can be fixed, cause this file seems to be virtual created by a makefile

Link to comment
Share on other sites

There is problem with ACE because you need to build the ace/config.h file ( which is what autoheader does, ACE offers also a way to build without automake, just using GNU make, infact automake support is experimental and not complete ).

Anyway if using cmake you need a way to generate some headers that normally autoheader and configure generate, like ./dep/ACE_wrappers/ace/config.h ./config.h ./src/shared/SystemConfig.h.

Link to comment
Share on other sites

  • 4 weeks later...

hello, i know now how it's possible to use genrevision and Systemconfig.h.in for generating other things (looked a bit at trinity :) )

my cmakelists looks like this:

http://mangos-files.eu/patches/cmake/CMakeLists.txt

i get this error when make compiles ace:

http://mangos-files.eu/patches/cmake/error

i managed to compile until linking everything with the patch at the end of error2:

http://mangos-files.eu/patches/cmake/error2

but as you see, there still is a problem with my custom-change

somebody can tell me how ./dep/ACE_wrappers/ace/config.h and ./config.h

will be created? i don't understand much about those makefiles/automake - but maybe this hint will help writing the cmakelists

(*still hoping someone skilled with cmake will finish this* :) )

Link to comment
Share on other sites

  • 3 weeks later...

I know this is a slighty older thread..

but is anyone still interested in cmake over autotools? I see more and more projects leaving autotools for cmake and wondering if it's still a feasible thing?

I was considering making an attempt on my own, if only to learn cmake..

thoughts?

Link to comment
Share on other sites

i will be happy too, if cmake will be possible - i like most, that the makefiles are realy readable and understandable with cmake also i could configure mangos in a couple of seconds, the old autotools needed over a minute..

but currently this cmake here doesn't work :-/

Link to comment
Share on other sites

I've started a little bit, though, I will admit, most the the grunt work is blatantly ripped from Trinity.. heh

cmake is for sure faster and easier to work with (with at least modifying) cmake clocked in at:

real 0m0.355s

user 0m0.236s

sys 0m0.116s

whereas autotools:

real 0m58.991s

user 0m55.263s

sys 0m1.500s

AND the configure script:

real 1m13.355s

user 0m42.051s

sys 0m19.305s

a 2 minute PLUS difference.

This of course is with a vanilla mangos, no sd2, etc..

I'll keep toying around and making sure i've got everything covered. I'll make a git fork to share here soon too :D

There are advantages I think, cmake is a bit easier with syntax, so other projects and core additions once they make the change would have an easier time (in my view anyway) patching in (for makefiles). Plus, the eyecandy of the build is nice (colored output, progress %, etc) I find the build error messages are cleaner too, instead of staring at the matrix when something goes wrong lol.

Link to comment
Share on other sites

Well I've got something working, it compiles, however i've not tested this past that..

There is problem with ACE because you need to build the ace/config.h file ( which is what autoheader does, ACE offers also a way to build without automake, just using GNU make, infact automake support is experimental and not complete ).

Anyway if using cmake you need a way to generate some headers that normally autoheader and configure generate, like ./dep/ACE_wrappers/ace/config.h ./config.h ./src/shared/SystemConfig.h.

I didn't run across any problems with ace, however the src/shared/SystemConfig.h gave me troubles.. I cheated for now to just get it to compile by renaming SystemConfig.h.in to simply SystemConfig.h - I really don't know the full extent of what that will break (I'm guessing it will just spit out @VERSION@ rather than the actual version #.. i dunno, that is above me.

you can see what I have at http://github.com/ghoti/mangos - please be gentle, Im quite new at this (as you can tell by the million "typo" or "forgot this file" commits lol

As I said before, I blatantly ripped most of this from Trinity and just tweaked and changed a lot

Link to comment
Share on other sites

i'm not exactly sure what this does, but i think this can configure this systemconfig.h.in file

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/shared/SystemConfig.h.in

${CMAKE_CURRENT_BINARY_DIR}/src/shared/SystemConfig.h)

and thank you for the work - i will test it soon :)

Link to comment
Share on other sites

mh it doesn't seem to work if i follow the readme, it still writes cmake files into the mangosroot:

balrok@webserver:~/mangos$ mkdir build
balrok@webserver:~/mangos$ cd build/
balrok@webserver:~/mangos/build$ cmake ../
.
.
.
-- Build files have been written to: /home/balrok/mangos

balrok@webserver:~/mangos/build$ cd ../
balrok@webserver:~/mangos$ make
[  0%] Built target genrev
[  0%] Built target revision.h
[  4%] Built target g3dlite
[ 11%] Built target mangossockets
[ 16%] Built target zlib
[ 26%] Built target ZThread
[ 26%] Building CXX object src/framework/CMakeFiles/mangosframework.dir/Policies/ObjectLifeTime.cpp.o
In file included from /home/balrok/mangos/src/framework/Policies/ObjectLifeTime.h:23,
                from /home/balrok/mangos/src/framework/Policies/ObjectLifeTime.cpp:20:
/home/balrok/mangos/src/framework/Platform/Define.h:24:29: error: ace/Basic_Types.h: No such file or directory
/home/balrok/mangos/src/framework/Platform/Define.h:25:28: error: ace/ACE_export.h: No such file or directory
In file included from /home/balrok/mangos/src/framework/Policies/ObjectLifeTime.h:23,
                from /home/balrok/mangos/src/framework/Policies/ObjectLifeTime.cpp:20:
/home/balrok/mangos/src/framework/Platform/Define.h:109: error: ‘ACE_INT64’ does not name a type
/home/balrok/mangos/src/framework/Platform/Define.h:110: error: ‘ACE_INT32’ does not name a type
/home/balrok/mangos/src/framework/Platform/Define.h:111: error: ‘ACE_INT16’ does not name a type
/home/balrok/mangos/src/framework/Platform/Define.h:112: error: ‘ACE_INT8’ does not name a type
/home/balrok/mangos/src/framework/Platform/Define.h:113: error: ‘ACE_UINT64’ does not name a type
/home/balrok/mangos/src/framework/Platform/Define.h:114: error: ‘ACE_UINT32’ does not name a type
/home/balrok/mangos/src/framework/Platform/Define.h:115: error: ‘ACE_UINT16’ does not name a type
/home/balrok/mangos/src/framework/Platform/Define.h:116: error: ‘ACE_UINT8’ does not name a type
/home/balrok/mangos/src/framework/Platform/Define.h:119: error: ‘uint16’ does not name a type
/home/balrok/mangos/src/framework/Platform/Define.h:120: error: ‘uint32’ does not name a type
/home/balrok/mangos/src/framework/Platform/Define.h:123: error: ‘uint64’ does not name a type
make[2]: *** [src/framework/CMakeFiles/mangosframework.dir/Policies/ObjectLifeTime.cpp.o] Error 1
make[1]: *** [src/framework/CMakeFiles/mangosframework.dir/all] Error 2
make: *** [all] Error 2
balrok@webserver:~/mangos$ 

the same error also comes if i do "cmake ." and then "make" in mangosroot

Link to comment
Share on other sites

It looks like ACE is broken afterall... it lied to me. (does it revert to the distro ACE if it cannot find the header's mentioned above? i really dunno)

I guess until we fgure out how to properly build ace with cmake the distro versions will have to suffice :-\\

for ubuntu that is libace-dev - the question is, has mangos made any changes to ace that the distro versions wouldn't have?

i'm not exactly sure what this does, but i think this can configure this systemconfig.h.in file

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/shared/SystemConfig.h.in

${CMAKE_CURRENT_BINARY_DIR}/src/shared/SystemConfig.h)

can this same method be applied to the ACE headers as well? I guess i need to read the ace help files and get to learnin' ;-p

Link to comment
Share on other sites

I have not tackled the ACE issues yet (probably should tho, heh), but I was able to merge commits from mangos and edit the CMake files very easily.. I guess It is a proof of concept that managing cmake is easy enough, the bonus for sql updates is that there is no need to edit/commit the makefile for the sql/updates folder (one line in the CMake handles all *.sql in the dir :D)

On to the ACE stuff now

Link to comment
Share on other sites

  • 11 months later...
  • 2 months later...
  • 3 weeks later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use