Skip to content

Commit

Permalink
Merge pull request #254 from madsbk/master
Browse files Browse the repository at this point in the history
project(BOHRIUM) must come before include(UseMultiArch)
  • Loading branch information
madsbk committed Feb 23, 2017
2 parents 658d0aa + 3895df9 commit a456a8a
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 98 deletions.
40 changes: 17 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Shared modules
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
include(FeatureSummary)

# Write all compile commands to 'compile_commands.json', which can be used by YouCompleteMe
# and other auto-completion software
set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")

# For the Clion IDE
ADD_CUSTOM_TARGET(run_install COMMAND ${CMAKE_MAKE_PROGRAM} install)

# UseMultiArch sets variable
# CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu
# depending on the platform; use this path
# for platform-specific binaries.
#
# CMAKE_INSTALL_LIBDIR_NOARCH to lib or lib64 depending on the platform;
# use this path for architecture-independent
# files.
include(UseMultiArch)
message(STATUS "CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}")

# We need this before 'project(BOHRIUM)' since cmake defines CMAKE_BUILD_TYPE at project()
if(DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are:
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used), Debug, Release, RelWithDebInfo, and MinSizeRel.")
Expand All @@ -31,9 +10,24 @@ else()
endif()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")

# We need this before 'project(BOHRIUM)' since cmake defines CMAKE_BUILD_TYPE at project()
# Everyting else should come after 'project(BOHRIUM)' since 'project()' defines many of the CMAKE_BUILD_* vars
project(BOHRIUM)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Shared modules
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
include(FeatureSummary)
include(LibVsLib64) # Sets LIBDIR

message(STATUS "LIBDIR: ${LIBDIR}")

# Write all compile commands to 'compile_commands.json', which can be used by YouCompleteMe
# and other auto-completion software
set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")

# For the Clion IDE
ADD_CUSTOM_TARGET(run_install COMMAND ${CMAKE_MAKE_PROGRAM} install)

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # .local is default
set (CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "The install prefix (default path is ~/.local)" FORCE)
endif()
Expand Down
2 changes: 1 addition & 1 deletion bridge/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ add_dependencies(bhc BXX)

# Finally, let's install the compiled library and the combined header file
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/out/bhc.h DESTINATION include/bohrium COMPONENT bohrium)
install(TARGETS bhc DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bhc DESTINATION ${LIBDIR} COMPONENT bohrium)
4 changes: 2 additions & 2 deletions bridge/npbackend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if(PYTHONINTERP_FOUND AND NUMPY_FOUND AND SWIG_FOUND AND CYTHON_FOUND AND NUMPY_
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS bhc
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} DESTINATION . COMPONENT bohrium)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LIBDIR} DESTINATION . COMPONENT bohrium)
else()
if (NOT NUMPY_INCLUDE_DIRS)
message(STATUS "The Python/NumPy bridge cannot be built, because the numpy headers are missing")
Expand Down Expand Up @@ -63,7 +63,7 @@ if(${PYTHON_VERSION_MAJOR} EQUAL "2")
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS bhc
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LIBDIR}
DESTINATION .
COMPONENT bohrium3
PATTERN "python2.*" EXCLUDE) # we don't want python2 installed again
Expand Down
15 changes: 15 additions & 0 deletions cmake/Modules/LibVsLib64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# - Sets LIBDIR to 'lib' or 'lib64'

if (EXISTS "/etc/debian_version") # Debian or Ubuntu?
set (_libdir_def "lib")
elseif (EXISTS "/etc/fedora-release" OR
EXISTS "/etc/redhat-release" OR
EXISTS "/etc/slackware-version" OR
EXISTS "/etc/gentoo-release")
set (_libdir_def "lib64")
else ()
set (_libdir_def "lib")
endif()

set (LIBDIR "${_libdir_def}" CACHE PATH "Library Directory")
mark_as_advanced (LIBDIR)
49 changes: 0 additions & 49 deletions cmake/Modules/UseMultiArch.cmake

This file was deleted.

16 changes: 8 additions & 8 deletions config.ini.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ opencl = bcexp, bccon, node, opencl, openmp
# Managers #
############
[node]
impl = ${CMAKE_INSTALL_PREFIX}/lib/libbh_vem_node${CMAKE_SHARED_LIBRARY_SUFFIX}
impl = ${CMAKE_INSTALL_PREFIX}/${LIBDIR}/libbh_vem_node${CMAKE_SHARED_LIBRARY_SUFFIX}
timing = false

[proxy]
address = localhost
port = 4200
impl = ${CMAKE_INSTALL_PREFIX}/lib/libbh_vem_proxy${CMAKE_SHARED_LIBRARY_SUFFIX}
impl = ${CMAKE_INSTALL_PREFIX}/${LIBDIR}/libbh_vem_proxy${CMAKE_SHARED_LIBRARY_SUFFIX}


#############################
# Filters - Helpers / Tools #
#############################
[pprint]
impl = ${CMAKE_INSTALL_PREFIX}/lib/libbh_filter_pprint${CMAKE_SHARED_LIBRARY_SUFFIX}
impl = ${CMAKE_INSTALL_PREFIX}/${LIBDIR}/libbh_filter_pprint${CMAKE_SHARED_LIBRARY_SUFFIX}

###################################
# Filters - Bytecode transformers #
###################################
[bccon]
impl = ${CMAKE_INSTALL_PREFIX}/lib/libbh_filter_bccon${CMAKE_SHARED_LIBRARY_SUFFIX}
impl = ${CMAKE_INSTALL_PREFIX}/${LIBDIR}/libbh_filter_bccon${CMAKE_SHARED_LIBRARY_SUFFIX}
collect = true
stupidmath = true
muladd = true
Expand All @@ -42,7 +42,7 @@ timing = false
verbose = false

[bcexp]
impl = ${CMAKE_INSTALL_PREFIX}/lib/libbh_filter_bcexp${CMAKE_SHARED_LIBRARY_SUFFIX}
impl = ${CMAKE_INSTALL_PREFIX}/${LIBDIR}/libbh_filter_bcexp${CMAKE_SHARED_LIBRARY_SUFFIX}
matmul = true
powk = true
sign = false
Expand All @@ -52,15 +52,15 @@ timing = false
verbose = false

[noneremover]
impl = ${CMAKE_INSTALL_PREFIX}/lib/libbh_filter_noneremover${CMAKE_SHARED_LIBRARY_SUFFIX}
impl = ${CMAKE_INSTALL_PREFIX}/${LIBDIR}/libbh_filter_noneremover${CMAKE_SHARED_LIBRARY_SUFFIX}
timing = false
verbose = false

###########
# Engines #
###########
[openmp]
impl = ${CMAKE_INSTALL_PREFIX}/lib/libbh_ve_openmp${CMAKE_SHARED_LIBRARY_SUFFIX}
impl = ${CMAKE_INSTALL_PREFIX}/${LIBDIR}/libbh_ve_openmp${CMAKE_SHARED_LIBRARY_SUFFIX}
verbose = false
# Profiling statistics
prof = false
Expand All @@ -77,7 +77,7 @@ libs = ${OPENMP_LIBS}
strides_as_variables = true

[opencl]
impl = ${CMAKE_INSTALL_PREFIX}/lib/libbh_ve_opencl${CMAKE_SHARED_LIBRARY_SUFFIX}
impl = ${CMAKE_INSTALL_PREFIX}/${LIBDIR}/libbh_ve_opencl${CMAKE_SHARED_LIBRARY_SUFFIX}
verbose = false
# Profiling statistics
prof = false
Expand Down
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ target_link_libraries(bh ${Boost_LIBRARIES}) # A shit ton of stuff depends on
set(CORE_LINK_FLAGS "" CACHE STRING "Link flags to use when creating _bh.so (e.g. -static-libgcc -static-libstdc++)")
target_link_libraries(bh ${CORE_LINK_FLAGS})

install(TARGETS bh DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh DESTINATION ${LIBDIR} COMPONENT bohrium)
install(DIRECTORY ${BOHRIUM_SOURCE_DIR}/include/ DESTINATION include/bohrium COMPONENT bohrium)
install(DIRECTORY ${INCLUDE_DIR}/ DESTINATION include/bohrium COMPONENT bohrium)
2 changes: 1 addition & 1 deletion extmethods/blas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if(CBLAS_FOUND)
include_directories(${CBLAS_INCLUDES})
target_link_libraries(bh_blas ${CBLAS_LIBRARIES})

install(TARGETS bh_blas DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh_blas DESTINATION ${LIBDIR} COMPONENT bohrium)

set(OPENMP_LIBS ${OPENMP_LIBS} "${CMAKE_INSTALL_PREFIX}/lib/libbh_blas${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE)
else()
Expand Down
2 changes: 1 addition & 1 deletion extmethods/clblas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if(CLBLAS_FOUND)
include_directories(${CLBLAS_INCLUDES})
target_link_libraries(bh_clblas ${CLBLAS_LIBRARIES})

install(TARGETS bh_clblas DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh_clblas DESTINATION ${LIBDIR} COMPONENT bohrium)

set(OPENCL_LIBS ${OPENCL_LIBS} "${CMAKE_INSTALL_PREFIX}/lib/libbh_clblas${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE)
else()
Expand Down
2 changes: 1 addition & 1 deletion extmethods/fftw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if(FFTW_FOUND)
set(LIBS ${LIBS} ${FFTW_LIBRARIES})
target_link_libraries(bh_fftw ${LIBS})

install(TARGETS bh_fftw DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh_fftw DESTINATION ${LIBDIR} COMPONENT bohrium)

set(OPENMP_LIBS ${OPENMP_LIBS} "${CMAKE_INSTALL_PREFIX}/lib/libbh_fftw${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE)
else()
Expand Down
2 changes: 1 addition & 1 deletion extmethods/visualizer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if (GLUT_FOUND AND OPENGL_FOUND)
#We depend on bh.so
target_link_libraries(bh_visualizer bh ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})

install(TARGETS bh_visualizer DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium-visualizer)
install(TARGETS bh_visualizer DESTINATION ${LIBDIR} COMPONENT bohrium-visualizer)

# Add visualizer to OpenMP and OpenCL libs
set(OPENMP_LIBS ${OPENMP_LIBS} "${CMAKE_INSTALL_PREFIX}/lib/libbh_visualizer${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE)
Expand Down
2 changes: 1 addition & 1 deletion filter/bccon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ add_library(bh_filter_bccon SHARED ${SRC})

target_link_libraries(bh_filter_bccon bh) # We depend on bh.so

install(TARGETS bh_filter_bccon DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh_filter_bccon DESTINATION ${LIBDIR} COMPONENT bohrium)
2 changes: 1 addition & 1 deletion filter/bcexp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ add_library(bh_filter_bcexp SHARED ${SRC})

target_link_libraries(bh_filter_bcexp bh) # We depend on bh.so

install(TARGETS bh_filter_bcexp DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh_filter_bcexp DESTINATION ${LIBDIR} COMPONENT bohrium)
2 changes: 1 addition & 1 deletion filter/noneremover/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ add_library(bh_filter_noneremover SHARED ${SRC})
#We depend on bh.so
target_link_libraries(bh_filter_noneremover bh)

install(TARGETS bh_filter_noneremover DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh_filter_noneremover DESTINATION ${LIBDIR} COMPONENT bohrium)
2 changes: 1 addition & 1 deletion filter/pprint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ add_library(bh_filter_pprint SHARED ${SRC})
#We depend on bh.so
target_link_libraries(bh_filter_pprint bh)

install(TARGETS bh_filter_pprint DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh_filter_pprint DESTINATION ${LIBDIR} COMPONENT bohrium)
2 changes: 1 addition & 1 deletion ve/opencl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ add_library(bh_ve_opencl SHARED ${SRC})

target_link_libraries(bh_ve_opencl bh ${OPENCL_LIBRARIES})

install(TARGETS bh_ve_opencl DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium-opencl)
install(TARGETS bh_ve_opencl DESTINATION ${LIBDIR} COMPONENT bohrium-opencl)
6 changes: 3 additions & 3 deletions ve/openmp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ add_library(bh_ve_openmp SHARED ${SRC})

target_link_libraries(bh_ve_openmp bh)

install(TARGETS bh_ve_openmp DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh_ve_openmp DESTINATION ${LIBDIR} COMPONENT bohrium)


#
Expand Down Expand Up @@ -66,7 +66,7 @@ if(APPLE)
#
set(VE_OPENMP_COMPILER_INC "")
set(VE_OPENMP_COMPILER_FLG "-x c -dynamiclib -arch x86_64")
set(VE_OPENMP_COMPILER_LIB "-lm -L${VE_OPENMP_COMPILER_INC}/lib -lbh")
set(VE_OPENMP_COMPILER_LIB "-lm -L${VE_OPENMP_COMPILER_INC}/${LIBDIR} -lbh")
set(VE_OPENMP_COMPILER_EXT "")
else()
#
Expand Down Expand Up @@ -94,7 +94,7 @@ endif()
set(VE_OPENMP_COMPILER_CMD "${CMAKE_C_COMPILER}" CACHE STRING "VE_OPENMP: JIT-Compiler")
set(VE_OPENMP_COMPILER_INC "-I${CMAKE_INSTALL_PREFIX}/share/bohrium/include")
set(VE_OPENMP_COMPILER_INC "${VE_OPENMP_COMPILER_INC}" CACHE STRING "VE_OPENMP: JIT-Compiler includes")
set(VE_OPENMP_COMPILER_LIB "-lm -L${CMAKE_INSTALL_PREFIX}/lib -lbh" CACHE STRING "VE_OPENMP: JIT-Compiler libraries")
set(VE_OPENMP_COMPILER_LIB "-lm -L${CMAKE_INSTALL_PREFIX}/${LIBDIR} -lbh" CACHE STRING "VE_OPENMP: JIT-Compiler libraries")
set(VE_OPENMP_COMPILER_FLG "${VE_OPENMP_COMPILER_FLG}" CACHE STRING "VE_OPENMP: JIT-Compiler flags")
set(VE_OPENMP_COMPILER_OPENMP ${OPENMP_FOUND} CACHE BOOL "VE_OPENMP: JIT-Compiler use OpenMP")
set(VE_OPENMP_COMPILER_OPENMP_SIMD ${OPENMP_SIMD_FOUND} CACHE BOOL "VE_OPENMP: JIT-Compiler use OpenMP-SIMD")
Expand Down
2 changes: 1 addition & 1 deletion vem/node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ add_library(bh_vem_node SHARED ${SRC})
#We depend on bh.so
target_link_libraries(bh_vem_node bh)

install(TARGETS bh_vem_node DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh_vem_node DESTINATION ${LIBDIR} COMPONENT bohrium)
2 changes: 1 addition & 1 deletion vem/proxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ add_executable(bh_proxy_backend backend.cpp)
target_link_libraries(bh_vem_proxy bh ${ZLIB_LIBRARIES})
target_link_libraries(bh_proxy_backend bh_vem_proxy bh ${ZLIB_LIBRARIES})

install(TARGETS bh_vem_proxy DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bohrium)
install(TARGETS bh_vem_proxy DESTINATION ${LIBDIR} COMPONENT bohrium)
install(TARGETS bh_proxy_backend DESTINATION bin COMPONENT bohrium)

0 comments on commit a456a8a

Please sign in to comment.