-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
54 lines (44 loc) · 1.65 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
cmake_minimum_required(VERSION 3.30 FATAL_ERROR)
# Project definition
project(gaussian-factorise
VERSION 1.0
LANGUAGES CXX
)
# Compiler requirements
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Force Clang with libc++
set(CMAKE_CXX_COMPILER "clang++")
# Basic compiler and linker flags for libc++
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
# Module-specific settings
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_MODULES -D_MODULES_STD -fmodules -fimplicit-modules -fprebuilt-module-path=${CMAKE_BINARY_DIR}/pcm")
# Create directory for precompiled module files
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/pcm)
# Don't try to import std module directly - let Clang handle it implicitly
add_compile_definitions(_LIBCPP_MODULE_NEEDS_INCLUDE_GUARD)
endif()
# Library: inputParser
add_library(inputParser)
target_sources(inputParser
PUBLIC
FILE_SET CXX_MODULES FILES
${CMAKE_SOURCE_DIR}/src/utility/inputparser.cppm
PRIVATE
${CMAKE_SOURCE_DIR}/src/utility/inputparser.cpp
)
# Library: gaussianInteger
add_library(gaussianInteger)
target_sources(gaussianInteger
PUBLIC
FILE_SET CXX_MODULES FILES
${CMAKE_SOURCE_DIR}/src/gaussian_integer/gaussian_integer.cppm
PRIVATE
${CMAKE_SOURCE_DIR}/src/gaussian_integer/gaussian_integer.cpp
)
# Main executable
add_executable(gaussian-factorise ${CMAKE_SOURCE_DIR}/src/main.cpp)
target_link_libraries(gaussian-factorise PRIVATE inputParser gaussianInteger)