Skip to content

Instantly share code, notes, and snippets.

@taless474
Created September 26, 2019 15:30
Show Gist options
  • Save taless474/a5bcc7018826d77b2ad6082dede97dac to your computer and use it in GitHub Desktop.
Save taless474/a5bcc7018826d77b2ad6082dede97dac to your computer and use it in GitHub Desktop.
prog cmake
cmake_minimum_required(VERSION 3.3.2)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(APP1_BLAZE_TENSOR_DIR "Path to BlazeTensor" "")
project(blaze_app_1 CXX)
find_package(HPX REQUIRED)
find_package(blaze NO_CMAKE_PACKAGE_REGISTRY)
if(NOT blaze_FOUND)
message(FATAL_ERROR "Blaze could not be found. Please specify blaze_DIR to assist locating it.")
endif()
add_hpx_executable(
app1
SOURCES prog.cpp s1.cpp s2.cpp
HEADERS dbg.h
COMPONENT_DEPENDENCIES iostreams
DEPENDENCIES blaze::blaze
)
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY
VS_STARTUP_PROJECT app1)
string(REPLACE "/lib/cmake/HPX" "" HPX_ROOTPATH ${HPX_DIR})
string(REPLACE "/" "\\" HPX_ROOTPATH ${HPX_ROOTPATH})
add_custom_command(TARGET app1 PRE_BUILD
COMMAND xcopy /D /Y ${HPX_ROOTPATH}\\$(Configuration)\\bin\\*.dll $(TargetDir)
COMMENT "Copying files from HPX for $(Configuration) configuration")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_library(app1::blaze_tensor INTERFACE IMPORTED)
set_property(TARGET app1::blaze_tensor PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${APP1_BLAZE_TENSOR_DIR})
target_link_libraries(app1 PRIVATE app1::blaze_tensor)
target_compile_definitions(app1 PRIVATE BLAZE_USE_HPX_THREADS)
if (MSVC)
# windows.h conflicts with STL's min and max
target_compile_definitions(app1 PRIVATE NOMINMAX _CRT_SECURE_NO_WARNINGS)
# warning C4146: unary minus operator applied to unsigned type, result still unsigned
target_compile_options(app1 PRIVATE /wd4146)
# warning C4244: conversion from 'uint64_t' to 'int', possible loss of data
target_compile_options(app1 PRIVATE /wd4244)
# warning C4267: conversion from 'size_t' to 'int', possible loss of data
target_compile_options(app1 PRIVATE /wd4267)
# warning C4552: '*': operator has no effect; expected operator with side-effect
target_compile_options(app1 PRIVATE /wd4552)
# warning C4805: '==': unsafe mix of type 'const bool' and type 'const uint8_t' in operation
target_compile_options(app1 PRIVATE /wd4805)
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment