summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/GetGitRevisionDescription.cmake135
-rw-r--r--cmake/apple.cmake24
-rw-r--r--cmake/mingw-w64-debug.cmake38
-rw-r--r--cmake/mingw-w64.cmake3
-rw-r--r--cmake/tarball.cmake8
5 files changed, 101 insertions, 107 deletions
diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake
index e16d8c37..e4ac79c0 100644
--- a/cmake/GetGitRevisionDescription.cmake
+++ b/cmake/GetGitRevisionDescription.cmake
@@ -31,7 +31,7 @@
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
- return()
+ return()
endif()
set(__get_git_revision_description YES)
@@ -40,84 +40,83 @@ set(__get_git_revision_description YES)
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
- set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}")
- set(GIT_DIR "${GIT_PARENT_DIR}/.git")
- while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
- set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
- get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
- if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
- # We have reached the root directory, we are not in git
- set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
- set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
- return()
- endif()
- set(GIT_DIR "${GIT_PARENT_DIR}/.git")
- endwhile()
- set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
- if(NOT EXISTS "${GIT_DATA}")
- file(MAKE_DIRECTORY "${GIT_DATA}")
- endif()
+ set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}")
+ set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+ while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
+ set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
+ get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
+ if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
+ # We have reached the root directory, we are not in git
+ set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+ set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+ set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+ endwhile()
+ set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
+ if(NOT EXISTS "${GIT_DATA}")
+ file(MAKE_DIRECTORY "${GIT_DATA}")
+ endif()
- if(NOT EXISTS "${GIT_DIR}/HEAD")
- return()
- endif()
- set(HEAD_FILE "${GIT_DATA}/HEAD")
- configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
+ if(NOT EXISTS "${GIT_DIR}/HEAD")
+ return()
+ endif()
+ set(HEAD_FILE "${GIT_DATA}/HEAD")
+ configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
- configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
- "${GIT_DATA}/grabRef.cmake"
- @ONLY)
- include("${GIT_DATA}/grabRef.cmake")
+ configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
+ "${GIT_DATA}/grabRef.cmake"
+ @ONLY)
+ include("${GIT_DATA}/grabRef.cmake")
- set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
- set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
+ set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
+ set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
- if(NOT GIT_FOUND)
- find_package(Git QUIET)
- endif()
- get_git_head_revision(refspec hash)
- if(NOT GIT_FOUND)
- set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
- return()
- endif()
- if(NOT hash)
- set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
- return()
- endif()
+ if(NOT GIT_FOUND)
+ find_package(Git QUIET)
+ endif()
+ #get_git_head_revision(refspec hash)
+ if(NOT GIT_FOUND)
+ set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+ #if(NOT hash)
+ # set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
+ # return()
+ #endif()
- # TODO sanitize
- #if((${ARGN}" MATCHES "&&") OR
- # (ARGN MATCHES "||") OR
- # (ARGN MATCHES "\\;"))
- # message("Please report the following error to the project!")
- # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
- #endif()
+ # TODO sanitize
+ #if((${ARGN}" MATCHES "&&") OR
+ # (ARGN MATCHES "||") OR
+ # (ARGN MATCHES "\\;"))
+ # message("Please report the following error to the project!")
+ # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
+ #endif()
- #message(STATUS "Arguments to execute_process: ${ARGN}")
+ #message(STATUS "Arguments to execute_process: ${ARGN}")
- execute_process(COMMAND
- "${GIT_EXECUTABLE}"
- describe
- ${hash}
- ${ARGN}
- WORKING_DIRECTORY
- "${CMAKE_SOURCE_DIR}"
- RESULT_VARIABLE
- res
- OUTPUT_VARIABLE
- out
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(NOT res EQUAL 0)
- set(out "${out}-${res}-NOTFOUND")
- endif()
+ execute_process(COMMAND
+ "${GIT_EXECUTABLE}"
+ describe
+ ${ARGN}
+ WORKING_DIRECTORY
+ "${CMAKE_SOURCE_DIR}"
+ RESULT_VARIABLE
+ res
+ OUTPUT_VARIABLE
+ out
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT res EQUAL 0)
+ set(out "${out}-${res}-NOTFOUND")
+ endif()
- set(${_var} "${out}" PARENT_SCOPE)
+ set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
- git_describe(out ${ARGN})
- set(${_var} "${out}" PARENT_SCOPE)
+ git_describe(out ${ARGN})
+ set(${_var} "${out}" PARENT_SCOPE)
endfunction()
diff --git a/cmake/apple.cmake b/cmake/apple.cmake
new file mode 100644
index 00000000..054e1ae5
--- /dev/null
+++ b/cmake/apple.cmake
@@ -0,0 +1,24 @@
+SET(CMAKE_SYSTEM_NAME Darwin)
+SET(CMAKE_SYSTEM_VERSION 1)
+
+SET(CMAKE_C_COMPILER ${c}cc)
+SET(CMAKE_CXX_COMPILER ${c}c++)
+set(CMAKE_LINKER ${c}c++)
+
+set(CMAKE_OSX_ARCHITECTURES x86_64)
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8)
+# change this
+set(CMAKE_OSX_SYSROOT /var/root/MacOSX10.8.sdk)
+
+set(fpu "-fno-math-errno -funsafe-math-optimizations -fno-signed-zeros")
+set(cpu "-O3 -DNDEBUG -flto ${fpu}")
+set(cxx "-std=c++11 -stdlib=libc++")
+
+set(CFLAGS-OVERRIDE "" CACHE STRING "")
+
+set(CMAKE_C_FLAGS_RELEASE "${cpu} ${CFLAGS-OVERRIDE}" CACHE STRING "" FORCE)
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${cxx}" CACHE STRING "" FORCE)
+set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${cpu} ${CFLAGS-OVERRIDE}" CACHE STRING "" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} CACHE STRING "" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} CACHE STRING "" FORCE)
+set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
diff --git a/cmake/mingw-w64-debug.cmake b/cmake/mingw-w64-debug.cmake
deleted file mode 100644
index 7a371e5d..00000000
--- a/cmake/mingw-w64-debug.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-# this file only serves as toolchain file when specified so explicitly
-# when building the software. from repository's root directory:
-# mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/../cmake/mingw-w64.cmake
-# -sh 20140922
-
-SET(CMAKE_SYSTEM_NAME Windows)
-SET(CMAKE_SYSTEM_VERSION 1)
-
-# specify the cross compiler
-set(c i686-w64-mingw32-)
-
-SET(CMAKE_C_COMPILER ${c}gcc)
-SET(CMAKE_CXX_COMPILER ${c}g++)
-set(CMAKE_RC_COMPILER ${c}windres)
-set(CMAKE_LINKER ${c}ld)
-set(CMAKE_AR ${c}gcc-ar CACHE STRING "" FORCE)
-set(CMAKE_NM ${c}gcc-nm CACHE STRING "" FORCE)
-set(CMAKE_RANLIB ${c}gcc-ranlib CACHE STRING "" FORCE)
-
-SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
-
-# search for programs in the host directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-# don't poison with system compile-time data
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
-set(cpu "-O2 -march=i686 -mtune=corei7-avx -ffast-math -mfpmath=both -msse -msse2 -mno-sse3 -mno-avx")
-set(rice "-ggdb")
-
-set(CFLAGS-OVERRIDE "" CACHE STRING "")
-
-set(CMAKE_C_FLAGS_RELEASE "${rice} ${cpu} ${CFLAGS-OVERRIDE}" CACHE STRING "" FORCE)
-set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE)
-set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${cpu} ${CFLAGS-OVERRIDE}" CACHE STRING "" FORCE)
-set(CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} CACHE STRING "" FORCE)
-set(CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} CACHE STRING "" FORCE)
-set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake
index f8ee1d41..1f60993a 100644
--- a/cmake/mingw-w64.cmake
+++ b/cmake/mingw-w64.cmake
@@ -26,7 +26,8 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# oldest CPU supported here is Northwood-based Pentium 4. -sh 20150811
-set(cpu "-O3 -march=pentium4 -mtune=corei7-avx -ffast-math -mfpmath=both -msse -msse2 -mno-sse3")
+set(fpu "-ffast-math -fno-finite-math-only -mfpmath=both")
+set(cpu "-O3 -march=pentium4 -mtune=corei7-avx ${fpu} -msse -msse2 -mno-sse3")
set(CFLAGS-OVERRIDE "" CACHE STRING "")
diff --git a/cmake/tarball.cmake b/cmake/tarball.cmake
new file mode 100644
index 00000000..5761e24a
--- /dev/null
+++ b/cmake/tarball.cmake
@@ -0,0 +1,8 @@
+execute_process(COMMAND cmake ${CMAKE_BINARY_DIR} RESULT_VARIABLE ret)
+if(NOT ret EQUAL 0)
+ message(FATAL_ERROR "can't regen")
+endif()
+execute_process(COMMAND cmake --build ${CMAKE_BINARY_DIR} --target tarball-real2)
+if(NOT ret EQUAL 0)
+ message(FATAL_ERROR "can't make tarball")
+endif()