Files
multithread_experiments/CMakeLists.txt
2020-07-17 17:47:35 +03:00

49 lines
1.8 KiB
CMake

cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0020 NEW)
project(multithread_experiments)
find_package(SM REQUIRED)
if (CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -fPIC -std=c++11")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3 -fPIC")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fPIC -std=c++11")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fPIC")
endif()
include_directories(experiments ${SMBRICKS_INCLUDES} ${PIP_INCLUDES} ${PROJECT_SOURCE_DIR})
if(WIN32)
include_directories(can)
add_subdirectory(can)
add_custom_target(copy_dependencies
COMMAND ${CMAKE_COMMAND} -E copy ${PCAN_LIB} ${CMAKE_CURRENT_BINARY_DIR}/PCANBasic${CMAKE_SHARED_LIBRARY_SUFFIX}
COMMAND ${CMAKE_COMMAND} -E copy ${VSCAN_LIB} ${CMAKE_CURRENT_BINARY_DIR}/vs_can_api${CMAKE_SHARED_LIBRARY_SUFFIX})
add_executable(can_send_multithread experiments/can_send_multithread.cpp)
target_link_libraries(can_send_multithread can)
add_dependencies(can_send_multithread copy_dependencies)
add_executable(can_send experiments/can_send.cpp)
target_link_libraries(can_send can)
add_dependencies(can_send copy_dependencies)
endif()
add_executable(mutex experiments/mutex.cpp)
target_link_libraries(mutex ${PIP_LIBRARY} ${PIP_CONCURRENT_LIBRARY})
add_executable(mutex_multithread experiments/mutex_multithread.cpp)
target_link_libraries(mutex_multithread ${PIP_LIBRARY} ${PIP_CONCURRENT_LIBRARY})
add_executable(vectors experiments/vectors.cpp)
target_link_libraries(vectors ${PIP_LIBRARY})
add_executable(block_choice experiments/block_choice.cpp)
target_link_libraries(block_choice ${PIP_LIBRARY})
add_executable(smbusdata_crash_test experiments/smbusdata_crash_test.cpp)
target_link_libraries(smbusdata_crash_test SMBricks_shared ${PIP_LIBRARY} ${PIP_CONCURRENT_LIBRARY} ${PIP_CRYPT_LIBRARY})