Commit 63f330fa authored by Dominik Charousset's avatar Dominik Charousset

Update CMake setup

parent 95e01a3d
...@@ -7,21 +7,20 @@ file(GLOB LIBCAF_OPENCL_HDRS "caf/opencl/*.hpp") ...@@ -7,21 +7,20 @@ file(GLOB LIBCAF_OPENCL_HDRS "caf/opencl/*.hpp")
add_custom_target(libcaf_opencl) add_custom_target(libcaf_opencl)
if (OpenCL_LIBRARIES) # list cpp files excluding platform-dependent files
# list cpp files excluding platform-dependent files set (LIBCAF_OPENCL_SRCS
set (LIBCAF_OPENCL_SRCS
src/global.cpp src/global.cpp
src/metainfo.cpp src/metainfo.cpp
src/program.cpp src/program.cpp
src/opencl_err.cpp src/opencl_err.cpp
src/platform.cpp src/platform.cpp
src/device.cpp) src/device.cpp)
# build shared library if not compiling static only # build shared library if not compiling static only
if(NOT CAF_BUILD_STATIC_ONLY) if(NOT CAF_BUILD_STATIC_ONLY)
add_library(libcaf_opencl_shared SHARED ${LIBCAF_OPENCL_SRCS} add_library(libcaf_opencl_shared SHARED ${LIBCAF_OPENCL_SRCS}
${LIBCAF_OPENCL_HDRS} ${OpenCL_INCLUDE_DIRS}) ${LIBCAF_OPENCL_HDRS} ${OpenCL_INCLUDE_DIRS})
target_link_libraries(libcaf_opencl_shared ${LD_FLAGS} target_link_libraries(libcaf_opencl_shared ${LD_FLAGS}
${LIBCAF_CORE_LIBRARY} ${CAF_LIBRARY_CORE}
${OpenCL_LIBRARIES}) ${OpenCL_LIBRARIES})
set_target_properties(libcaf_opencl_shared set_target_properties(libcaf_opencl_shared
PROPERTIES PROPERTIES
...@@ -31,16 +30,18 @@ if (OpenCL_LIBRARIES) ...@@ -31,16 +30,18 @@ if (OpenCL_LIBRARIES)
if(NOT WIN32) if(NOT WIN32)
install(TARGETS libcaf_opencl_shared LIBRARY DESTINATION lib) install(TARGETS libcaf_opencl_shared LIBRARY DESTINATION lib)
endif() endif()
endif() endif()
# build static library only if --build-static or --build-static-only was set # build static library only if --build-static or --build-static-only was set
if(CAF_BUILD_STATIC_ONLY OR CAF_BUILD_STATIC) if(CAF_BUILD_STATIC_ONLY OR CAF_BUILD_STATIC)
add_library(libcaf_opencl_static STATIC ${LIBCAF_OPENCL_HDRS} ${LIBCAF_OPENCL_SRCS}) add_library(libcaf_opencl_static STATIC ${LIBCAF_OPENCL_HDRS} ${LIBCAF_OPENCL_SRCS})
target_link_libraries(libcaf_opencl_static ${LD_FLAGS}
${CAF_LIBRARY_CORE_STATIC}
${OpenCL_LIBRARIES})
set_target_properties(libcaf_opencl_static PROPERTIES OUTPUT_NAME caf_opencl_static) set_target_properties(libcaf_opencl_static PROPERTIES OUTPUT_NAME caf_opencl_static)
install(TARGETS libcaf_opencl_static ARCHIVE DESTINATION lib) install(TARGETS libcaf_opencl_static ARCHIVE DESTINATION lib)
endif()
link_directories(${LD_DIRS})
include_directories(. ${INCLUDE_DIRS})
endif() endif()
link_directories(${LD_DIRS})
include_directories(. ${INCLUDE_DIRS})
# install includes # install includes
install(DIRECTORY caf/ DESTINATION include/caf FILES_MATCHING PATTERN "*.hpp") install(DIRECTORY caf/ DESTINATION include/caf FILES_MATCHING PATTERN "*.hpp")
install(DIRECTORY cppa/ DESTINATION include/cppa FILES_MATCHING PATTERN "*.hpp")
...@@ -13,7 +13,7 @@ if(OpenCL_LIBRARIES) ...@@ -13,7 +13,7 @@ if(OpenCL_LIBRARIES)
add_executable(${name} ${folder}/${name}.cpp ${ARGN}) add_executable(${name} ${folder}/${name}.cpp ${ARGN})
target_link_libraries(${name} target_link_libraries(${name}
${LD_FLAGS} ${LD_FLAGS}
${LIBCAF_LIBRARIES} ${CAF_LIBRARIES}
${PTHREAD_LIBRARIES} ${PTHREAD_LIBRARIES}
${WSLIB} ${WSLIB}
${OpenCL_LIBRARIES}) ${OpenCL_LIBRARIES})
......
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