Created
October 20, 2015 03:01
-
-
Save BradNeuberg/42f3d6b8e8f7bb3fb121 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.3) | |
# Don't try to create universal binaries on Mac OS X, as this causes compilation problems. | |
# On Darwin, the CMakeDetermineSystem.cmake module sets system processor values | |
# using 'uname -p'. On Intel Macs, at least, this always returns "i386" which | |
# is technically not what we want. We want 'uname -m' which returns the machine | |
# architecture. On 64-bit architectures this is the value we want for "host" builds. | |
if(APPLE) | |
exec_program(/usr/bin/uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) | |
# If we aren't cross-compiling then the two are equal. | |
if(NOT CMAKE_CROSSCOMPILING) | |
set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") | |
endif() | |
endif() | |
# target cpu | |
set(cpu ${CMAKE_SYSTEM_PROCESSOR}) | |
if(cpu STREQUAL "powerpc") | |
set(cpu "ppc") | |
elseif(cpu MATCHES "i.86") | |
set(cpu "x86") | |
endif() | |
message(STATUS "System processor settings: host=${CMAKE_HOST_SYSTEM_PROCESSOR}, target=${CMAKE_SYSTEM_PROCESSOR}, cpu=${cpu}") | |
set(CMAKE_OSX_ARCHITECTURES x86_64) | |
project(selective_search) | |
execute_process(COMMAND python2.7-config --cflags OUTPUT_VARIABLE PYTHON_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) | |
execute_process(COMMAND python2.7-config --ldflags OUTPUT_VARIABLE PYTHON_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) | |
set(BOOST_LIBS "-lboost_system -lboost_python -lboost_numpy") | |
set(SUPPRESS_WARNING "-Wall -Wno-unused-function -Wno-unused-variable -Wno-unused-local-typedefs") | |
# Uncomment this if you have trouble finding your pyconfig.h file; update the path | |
# to wherever your Python include files are. | |
#include_directories("/usr/include/python2.7") | |
include_directories("segment") | |
set(CMAKE_CXX_FLAGS "-fPIC -O3 -std=c++11 ${PYTHON_CFLAGS} ${SUPPRESS_WARNING}") | |
set(CMAKE_SHARED_LINKER_FLAGS "${PYTHON_LDFLAGS} -shared -fPIC") | |
add_library(segment SHARED segment_py.cpp) | |
set_target_properties(segment PROPERTIES COMPILE_FLAGS "-arch x86_64" | |
LINK_FLAGS "-arch x86_64") | |
target_link_libraries(segment ${BOOST_LIBS}) | |
#set_target_properties(segment PROPERTIES PREFIX "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment