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

Cmake unify usage of prebuilt libraries #9177

Merged

Conversation

vovkasm
Copy link
Contributor

@vovkasm vovkasm commented Nov 20, 2014

Cmake build system: unify usage of prebuilt libraries

This patch unify usage of external libs while building process. And should simplify future development. Also some small fixes that I was need to include because can’t test without them.

  1. By default use our prebuilt libs. (exception is mingw for witch we don’t have prebuilt libs, so try to find system installed pkgs)
  2. Allow to set -DUSE_PREBUILT_LIBS=NO to force finding external deps in system (as other soft with cmake Find* modules)
  3. Add some missing deps and link errors.
  4. Build luasocket on Linux and Mingw
  5. Build test executables on Mingw
  6. Situation with unzip. For now we have modified minizip sources from official zlib contrib/minizip folder, most systems package unmodified version from this sources. But MSYS2 package more modern «version» from github.com/nmoinvaz/minizip repo (in quotes, because repo contains no branches or tags, so no real released versions). So… we use own sources mostly with one exception - mingw, where MSYS2 package fresh version.
  7. protobuf. We use own sources, because version packaged with other systems can be incompatible with generated protobuf interfaces (witch itself has not committed sources). (I mean file: cocos/editor-support/cocostudio/CSParseBinary.pb.cc)
  8. Connect new audio engine to build.
  9. On Win, test executable not search Resources folder, so install resources in same folder, as executable.

This can be tested on:

  • MSYS2. mingw32: build success, tests runnable.
  • MSYS2. mingw64: build success, tests runnable.
  • Arch Linux 64. USE_PREBUILT_LIBS=YES. success, runnable (also not all deps was prebuilt, zlib not prebuilded, fontconfig not prebuilded)
  • Arch Linux 64. USE_PREBUILT_LIBS=NO. success, runnable.
  • Mac. USE_PREBUILT_LIBS=YES. success, runnable.
  • Mac. USE_PREBUILT_LIBS=NO. (with all deps installed from Homebrew). success, runnable.

Lua tests currently build, but runs for me only on some configs (but this can be fixed in next patches).

vovkasm and others added 30 commits November 15, 2014 10:27
* introduce config variable USE_PREBUILT_LIBS (default: ON). When OFF, cmake will not use prebuilt libs, only try find system installed libraries.
* FindGLFW3.cmake now search our prebuilt library (if USE_PREBULT_LIBS)
* FindFreetype.cmake also

This and next changes should simplify our CMakeLists.txt files and USE_PREBUILT_LIBS config allow external package developers to integrate cocos to their packaging system.
* Introduce config variable USE_WEBP (ON by default, but disabled for unsupported archs WINRT and WP8)
* Set CC_USE_WEBP define according to USE_WEBP variable
* add WebP include directories to search patch only for libcocos compilation (it not used in public headers)
* cmake/Modules/FindChipmunk.cmake now can find prebuilt chipmunk libs
* follow USE_CHIPMUNK variable (although at the moment cocos can't build without chipmunk)
* come cleanups and formatting
* should be included as simple "tinyxml2.h", but on some files was "tinyxml2/tinyxml2.h", replace this.
* Add cmake/Modules/FindTinyXML2.cmake
* As tinyxml2 for now has not prebuilt, instead sources included, add their as subdirectory if USE_PREBUILT_LIBS
…CP_USE_CGPOINTS=0, or chipmunk will try use apple defined geometry types that conflicts with cocos types.
No sure about to remove comment, because it important, but work in this direction in progress now, so I remove it also.
But disable finding until bug with protobuf versions will be resolved.
1. Add cmake module for finding minizip in system
2. Check that system installed minizip recent enough for us
3. As right minizip exists only for MSYS2 (mingw), use our embedded version on all other platforms
4. Correctly include minizip as <minizip/unzip.h> if it is found from system (make it compatible to current build system, so by default all should stay same)
5. Remove one unused include of unzip.h
…-config first, this teoretically can find also dependant libs).
Test another way to customize our prebuilt paths...
Cleanups.
Vladimir Timofeev and others added 9 commits November 18, 2014 17:27
…tatic library in some find* modules we try to use pkg-config first, it is chance to get dependency info
… can not link this libs). Eliminate some Find* modules, we can tune prebuilts without modify their code.
Now build system looks more maintanable.
I test with mac, going to test with other platforms.

* All prebuilt libs config moved to
   cmake/Modules/CocosUsePrebuiltLibs.cmake
* Wrap plain find_package to our cocos_find_package. It will not try to
   call find_package if USE_PREBUILT_LIBS and <pkg>_FOUND set to true.
* Other small fixes.
Conflicts:
	CMakeLists.txt
@martell
Copy link
Contributor

martell commented Nov 20, 2014

Regarding number 7.
#9109

* v3:
  Use version 22 for external dependencies
…stream v3 I fetched some strange commit for that module)
@vovkasm
Copy link
Contributor Author

vovkasm commented Nov 20, 2014

Thank you @martell! So when new library will be committed, we will simply remove protobuf from deps.

ricardoquesada added a commit that referenced this pull request Nov 20, 2014
…ibraries

Cmake unify usage of prebuilt libraries
@ricardoquesada ricardoquesada merged commit 2e64e24 into cocos2d:v3 Nov 20, 2014
@ricardoquesada
Copy link
Contributor

Thanks, great work!

cocos-travis-mac pushed a commit to cocos-travis-mac/cocos2d-x that referenced this pull request Nov 20, 2014
…built-libraries

Cmake unify usage of prebuilt libraries
@zilongshanren
Copy link
Member

@vovkasm
Hi, This patch break the linux CI server. Could you please take a look at the error message and send another patch to fix it?
Thanks.

@vovkasm
Copy link
Contributor Author

vovkasm commented Nov 24, 2014

@AndyQue, yes... Sorry for that (
I will send fixes today!

@zilongshanren
Copy link
Member

@vovkasm
Thanks, our Linux CI machine is CentOS 6.5 and the CMake version is 2.8.8.

And here is the error message link: http://115.28.72.132:8000/job/cocos-2dx-pull-request-build/6043/node=linux_centos/console

@vovkasm
Copy link
Contributor Author

vovkasm commented Nov 24, 2014

Thanks, for information. @AndyQue, can you please in addition say, how dependencies installed to Linux CI? Are they preinstalled or some script exists?

@vovkasm vovkasm mentioned this pull request Nov 24, 2014
@vovkasm
Copy link
Contributor Author

vovkasm commented Nov 24, 2014

Done: #9218
I've test with centos, but some libraries (glew and glfw) was installed from source because I can't find any reasonable versions of it in system repos. gcc also was used from devtoolset-2.

If needed, I have shell script, that install all deps and requirements on centos 6.5. I used it to configure virtualbox vm from vagrant.

@vovkasm vovkasm deleted the cmake-unify-usage-of-prebuilt-libraries branch December 13, 2014 17:19
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

4 participants