CMakeLists.txt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Minimal version of CMake
  2. cmake_minimum_required(VERSION 3.1)
  3. set(CMAKE_BUILD_TYPE "Release")
  4. # Build type
  5. if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  6. message(STATUS "Setting build type to 'Debug' as none was specified.")
  7. set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
  8. # Set the possible values of build type for cmake-gui
  9. set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
  10. endif ()
  11. # Define project name
  12. project(GPU_KAKTWOOS C)
  13. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/")
  14. find_package(OpenCL REQUIRED)
  15. include_directories(${OPENCL_INCLUDE_DIR})
  16. # Source code of application
  17. set(opencl_src main.c)
  18. # Compiler flags
  19. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNDEBUG -O3 -fno-strict-aliasing")
  20. # Set up executable
  21. add_executable(gpu ${opencl_src})
  22. target_link_libraries(gpu ${OpenCL_LIBRARY})
  23. add_custom_command(
  24. TARGET gpu PRE_BUILD
  25. COMMAND ${CMAKE_COMMAND} -E copy
  26. ${CMAKE_SOURCE_DIR}/kaktwoos.cl
  27. ${CMAKE_CURRENT_BINARY_DIR}/kaktwoos.cl)