diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-12-02 16:09:06 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-12-02 16:11:58 +0300 |
commit | 956bd92a6036ce3e47047dfdbee68f447c23b61d (patch) | |
tree | c1d6508d1bc2247d0e18658ad519fd26757532d9 /CMakeLists.txt | |
parent | ca3d014bd1358abfb2708bf33742f70ab26d7b96 (diff) |
Buildbot: Initial work to move linux build environment to CMake
This is so called "seems to work in dry tests" commit which is aimed to switch
linux release environment to CMake.
Some notes:
- There's no special handle of libstdc++, but it wasn't really static for quite
some time in SCons configuration and nobody really complained.
- It was quite tricky to get OpenMP linked statically with just using some
configuration so we went ahead and added a special option to CMake now which is
only exist on Linux and advertised as shouldn't be used.
- Packing is happening manually in slave_pack.py. This is because we have to add
some really special files to the archive (mesa libraries for example) which we
can't really handle from CMake/CPack in a nice generic way.
Don't think it's bad approach, at least crappynness is localized and it's not
_that_ crappy anyway.
- Windows buildbot should keep working, but needs doublechecing. It's just a
build folder changed, but you never know what it might imply.
- Some further tweaks are likely needed to ensure all builders are working.
Thanks Campbell for assistance in this patch!
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 10c2f65e84a..039a745070d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,6 +267,10 @@ if(NOT WITH_AUDASPACE) endif() option(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" ON) +if(UNIX AND NOT APPLE) + option(WITH_OPENMP_STATIC "Link OpenMP statically (only used by the release environment)" OFF) + mark_as_advanced(WITH_OPENMP_STATIC) +endif() if(WITH_X11) option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON) @@ -865,13 +869,9 @@ endif() if(UNIX AND NOT APPLE) macro(find_package_wrapper) if(WITH_STATIC_LIBS) - set(_cmake_find_library_suffixes_back ${CMAKE_FIND_LIBRARY_SUFFIXES}) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif() - find_package(${ARGV}) - if(WITH_STATIC_LIBS) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_cmake_find_library_suffixes_back}) - unset(_cmake_find_library_suffixes_back) + find_package_static(${ARGV}) + else() + find_package(${ARGV}) endif() endmacro() @@ -2458,8 +2458,18 @@ endif() if(WITH_OPENMP) find_package(OpenMP) if(OPENMP_FOUND) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + if(NOT WITH_OPENMP_STATIC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + else() + # Typically avoid adding flags as defines but we can't + # ass OpenMP flags to the linker for static builds, meaning + # we can't add any OpenMP related flags to CFLAGS variables + # since they're passed to the linker as well. + add_definitions("${OpenMP_C_FLAGS}") + + find_library_static(OpenMP_LIBRARIES gomp) + endif() else() set(WITH_OPENMP OFF) endif() |