cmake_minimum_required(VERSION 3.20)
project(lo_asm_profiler LANGUAGES CXX)
if(NOT WIN32 OR NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
  message(FATAL_ERROR "lo_asm_profiler requires Windows x64")
endif()
option(LO_ASM_PROFILER_BUILD_FIXTURE "Build the synthetic busy/waiting-thread fixture" OFF)
if(LO_ASM_PROFILER_BUILD_FIXTURE)
  add_executable(lo_asm_profiler_fixture fixture.cpp)
  target_compile_features(lo_asm_profiler_fixture PRIVATE cxx_std_17)
  if(MSVC)
    target_compile_options(lo_asm_profiler_fixture PRIVATE /W4 /Zi)
    target_link_options(lo_asm_profiler_fixture PRIVATE /DEBUG)
  endif()
endif()
add_executable(lo_asm_profiler collector.cpp)
target_compile_features(lo_asm_profiler PRIVATE cxx_std_17)
target_compile_definitions(lo_asm_profiler PRIVATE UNICODE _UNICODE WIN32_LEAN_AND_MEAN NOMINMAX)
target_link_libraries(lo_asm_profiler PRIVATE dbghelp)
if(MSVC)
  target_compile_options(lo_asm_profiler PRIVATE /W4 /permissive- /EHsc /utf-8)
endif()
