project-navigation
Personal tools

Author Topic: Using cmake to setup build env  (Read 35905 times)

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: Using cmake to setup build env
« Reply #15 on: August 25, 2015, 01:52:48 am »
- UFODED: Dedicated server
- UFOMODEL: Tool for pre-compiling lightmaps for models
- UFOSLICER: Tool for creating fancy map overviews

The latter two I cannot describe better. :)

-geever

Offline hwoarangmy

  • Rookie
  • ***
  • Posts: 84
    • View Profile
Re: Using cmake to setup build env
« Reply #16 on: August 26, 2015, 10:14:44 pm »
I'm done with cmake. I could build all the projects on:
- MinGW32 with WinXP
- MinGW64 with Win7
- GCC with Ubuntu
- MSVC with win7 (except uforadiant as there are too many dependencies related to GTK)

I had to make some changes to allow compilation with MSVC. Moreover, this compiler has seen a few problems I've fixed.

I've also created a bundle with mingw/msvc dependencies. If the path is given to cmake (by filling corresponding field or by creating an env variable), all the dependencies should be found automatically.

Do you want me to create a github pull request ?
« Last Edit: August 26, 2015, 10:16:15 pm by hwoarangmy »

Offline hwoarangmy

  • Rookie
  • ***
  • Posts: 84
    • View Profile
Re: Using cmake to setup build env
« Reply #17 on: August 26, 2015, 10:52:46 pm »
Note that I've updated my fork (after rebasing) if you want to try:
https://github.com/hwoarangmy/ufoai

Offline hwoarangmy

  • Rookie
  • ***
  • Posts: 84
    • View Profile
Re: Using cmake to setup build env
« Reply #18 on: August 27, 2015, 08:39:23 pm »
I've updated my repo to allow to output executables in the correct directory when using MSVC (instead of Debug/Release)

Offline hwoarangmy

  • Rookie
  • ***
  • Posts: 84
    • View Profile
Re: Using cmake to setup build env
« Reply #19 on: September 05, 2015, 08:14:25 pm »
BTW, I've also made a bundle with the dependencies only. It allows to compile everything with MinGW and everything excepted uforadiant with MSVC 2013.

Note that to use it, with cmake, you can set cmake variable UFOAI_DEPENDENCIES_DIR to where you unzip the bundle.
You can also create a windows env variable UFOAI_DEPS set to where you unzip the bundle to help cmake find the dependencies.

Do you want me to upload it somewhere ?

Offline anonymissimus

  • Sergeant
  • *****
  • Posts: 347
    • View Profile
Re: Using cmake to setup build env
« Reply #20 on: September 07, 2015, 07:37:14 pm »
UFO:AI supports win xp, MSVC 2013 does not. Should work with an older MSVC version too. Needs to be 2008 then, as 2010 and 2012 are not recommendable I hear. (I know 2010 - unstable and slow)

Says the lazy one who's nitpicking about your probably amazing work.
« Last Edit: September 07, 2015, 07:41:50 pm by anonymissimus »

Offline hwoarangmy

  • Rookie
  • ***
  • Posts: 84
    • View Profile
Re: Using cmake to setup build env
« Reply #21 on: September 07, 2015, 08:41:55 pm »
Well, I'm talking about MSVC2013 because that's what I have. But it might work with an older version I've not tried ^^

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Using cmake to setup build env
« Reply #22 on: September 16, 2015, 09:18:48 pm »
Sorry for the late answer

So its ready for Pull request? (or I could just lift it from your repo too) and yes having the dependencies bundle would be nice, but I'm not sure where you should upload it to.

Offline hwoarangmy

  • Rookie
  • ***
  • Posts: 84
    • View Profile
Re: Using cmake to setup build env
« Reply #23 on: September 16, 2015, 09:44:15 pm »
I've uploaded the bundle. You can get it and upload it wherever you want
http://dl.free.fr/nUwn4l4zh

I'm currently compiling after rebase. I will create the PR as soon as I've checked it still compiles

Offline hwoarangmy

  • Rookie
  • ***
  • Posts: 84
    • View Profile
Re: Using cmake to setup build env
« Reply #24 on: September 16, 2015, 10:35:50 pm »
I confirm it still compiles. The pull request is created. You can review it ^^

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Using cmake to setup build env
« Reply #25 on: September 17, 2015, 08:23:42 pm »
Very nice job. It would be cool if the cmake file could get some more love though. Using:

  add_library(common ${COMMON_SRC})
  target_link_libraries(common ${COMMON_DEPS})

  add_executable(ufoded ${UFODED_SRC})
  target_link_libraries(ufoded common)

would greatly reduce compile times.

Offline hwoarangmy

  • Rookie
  • ***
  • Posts: 84
    • View Profile
Re: Using cmake to setup build env
« Reply #26 on: September 17, 2015, 09:56:19 pm »
Using:

  add_library(common ${COMMON_SRC})
  target_link_libraries(common ${COMMON_DEPS})

  add_executable(ufoded ${UFODED_SRC})
  target_link_libraries(ufoded common)

would greatly reduce compile times.
I'm comfortable with C/C++ but I'm not a cmake expert and I didn't look into UFOAI code very deep (only for the errors the compiler was complaining about).
However, every projects do not share the same common sources files. Using a project with the common sources would decrease compile time but increase executables size since they will embed not wanted stuff. That's a choice to make ^^

BTW, same goes for "shared" sources I guess.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Using cmake to setup build env
« Reply #27 on: September 17, 2015, 10:00:06 pm »
true - but the symbols are stripped anyway.

I did something for my sideproject at https://github.com/mgerhardy/caveexpress - the cmake scripts will try to find a system wide installed lib, if not found, it will pick the embedded one. This would be cool for linux.

Would also be cool to get some feedback from some Xcode users whether the cmake script works for them.

Offline hwoarangmy

  • Rookie
  • ***
  • Posts: 84
    • View Profile
Re: Using cmake to setup build env
« Reply #28 on: September 17, 2015, 10:02:02 pm »
« Last Edit: September 17, 2015, 10:04:52 pm by hwoarangmy »

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Using cmake to setup build env
« Reply #29 on: September 17, 2015, 10:07:25 pm »
That's what I meant.