Add new CMake build system
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(harikoff VERSION 0.00.002 LANGUAGES CXX)
|
||||
|
||||
# Set C++ standard
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Build type
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
# Compiler flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
|
||||
|
||||
# Mind oscillator configuration
|
||||
set(MIND_VOSCILLATOR_PERIOD_MS 33 CACHE STRING "Mind's virtual osc clock rate (ms)")
|
||||
if(NOT MIND_VOSCILLATOR_PERIOD_MS GREATER 0)
|
||||
message(FATAL_ERROR "MIND_VOSCILLATOR_PERIOD_MS must be a positive integer > 0")
|
||||
endif()
|
||||
math(EXPR MIND_VOSCILLATOR_FREQ_MS "1000 / ${MIND_VOSCILLATOR_PERIOD_MS}")
|
||||
|
||||
# Configure config.h
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/config.h
|
||||
)
|
||||
|
||||
# Include directories
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hcore/include
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include
|
||||
)
|
||||
|
||||
# Find dependencies
|
||||
find_package(Boost 1.69.0 REQUIRED COMPONENTS system)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
# Flex/Bison setup
|
||||
find_package(FLEX REQUIRED)
|
||||
find_package(BISON REQUIRED)
|
||||
|
||||
# XCB (optional, controlled by feature flags)
|
||||
option(ENABLE_XCB "Enable XCB/Xorg support" ON)
|
||||
if(ENABLE_XCB)
|
||||
pkg_check_modules(XCB REQUIRED xcb)
|
||||
endif()
|
||||
|
||||
# Add subdirectories
|
||||
add_subdirectory(hcore)
|
||||
add_subdirectory(commonLibs)
|
||||
|
||||
# Main executable
|
||||
add_executable(harikoff main.cpp)
|
||||
target_link_libraries(harikoff
|
||||
hcore
|
||||
deviceManager
|
||||
senseApis
|
||||
${Boost_LIBRARIES}
|
||||
dl
|
||||
)
|
||||
|
||||
# Install rules
|
||||
install(TARGETS harikoff DESTINATION bin)
|
||||
Reference in New Issue
Block a user