Commit 6ff0c1ee authored by Jason Rhinelander's avatar Jason Rhinelander

Updated build to use system's liberis

parent 5276bc4a
......@@ -15,6 +15,9 @@
# Test output
a.out
# Compiled .ycm_extra_conf.py
/.ycm_extra_conf.pyc
# vim swap files
.*.swp
.swp
......@@ -24,4 +27,4 @@ a.out
# Build files
/build/
/build[0-9]/
/gcc-build/
/*-build/
import os
import ycm_core
flags = [
'-Wall',
'-Wextra',
'-std=c++11',
'-I', 'include'
]
# Try to invoke pkg-config to get the addition include directories needed for
# cairomm, gtkmm, and eris
try:
morelibs = subprocess.check_output(
["pkg-config", "--cflags-only-I", "liberis"]).split()
for lib in morelibs:
if lib.startswith('-I'):
flags.append('-I')
flags.append(lib.replace('-I', '', 1))
except Exception:
pass
def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break
if new_flag:
new_flags.append( new_flag )
return new_flags
def FlagsForFile( filename, **kwargs ):
final_flags = MakeRelativePathsInFlagsAbsolute( flags, DirectoryOfThisScript() )
return {
'flags': final_flags,
'do_cache': True
}
......@@ -26,20 +26,14 @@ file(GLOB voting_R src/*.R)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/results)
# Add eris
# If we're building in "foo", look for ../eris/foo for eris build dir, then
# fall back to ../eris/build if that doesn't work.
get_filename_component(BUILD_BASENAME "${CMAKE_BINARY_DIR}" NAME)
set(ERIS_INCLUDE eris/include)
set(ERIS_BUILD_SAME "eris/${BUILD_BASENAME}")
set(ERIS_BUILD_BUILD eris/build)
include_directories(${ERIS_INCLUDE})
find_library(
ERIS_LIB
NAMES eris
HINTS "${ERIS_BUILD_SAME}" "${ERIS_BUILD_BUILD}")
set(CMAKE_CXX_FLAGS "-std=c++11 -march=native -O3 ${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
# Use pkg-config to find the includes/libs for eris
find_package(PkgConfig REQUIRED)
pkg_check_modules(ERIS REQUIRED liberis)
include_directories(${ERIS_INCLUDE_DIRS})
link_directories(${ERIS_LIBRARY_DIRS})
add_definitions(${ERIS_CFLAGS_OTHER})
set(CMAKE_CXX_FLAGS "-std=c++11 -march=native -O3 -Wall -Wextra ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -DERIS_DEBUG")
add_library(voting ${voting_src})
......@@ -47,7 +41,7 @@ add_library(voting ${voting_src})
foreach(v_src ${voting_scripts})
get_filename_component(v "${v_src}" NAME_WE)
add_executable("${v}" "${v_src}")
target_link_libraries("${v}" ${ERIS_LIB})
target_link_libraries("${v}" ${ERIS_LIBRARIES})
target_link_libraries("${v}" voting)
endforeach()
......@@ -57,21 +51,3 @@ endforeach()
add_subdirectory(doc EXCLUDE_FROM_ALL)
#add_library(eris SHARED ${eris_src})
#set_target_properties(eris PROPERTIES
# VERSION "${LIBERIS_CURRENT}.${LIBERIS_AGE}.${LIBERIS_REVISION}"
# SOVERSION "${LIBERIS_CURRENT}"
#)
#
#add_subdirectory(scratch)
#
#add_subdirectory(doc EXCLUDE_FROM_ALL)
#
#enable_testing()
#
#add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
#add_subdirectory(tests EXCLUDE_FROM_ALL)
#
#add_custom_target(examples)
#add_subdirectory(examples EXCLUDE_FROM_ALL)
../eris
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment