|
| 1 | +<<<<<<< HEAD |
1 | 2 | cmake_minimum_required(VERSION 3.15) |
2 | 3 | project(ProXPL C) |
| 4 | +======= |
| 5 | +cmake_minimum_required(VERSION 3.13) |
| 6 | +project(ProXPL) |
| 7 | +>>>>>>> feature/opcode-tests |
3 | 8 |
|
| 9 | +# Enable C and C++ |
| 10 | +enable_language(C CXX) |
4 | 11 | set(CMAKE_C_STANDARD 99) |
| 12 | +<<<<<<< HEAD |
5 | 13 | set(CMAKE_C_STANDARD_REQUIRED ON) |
6 | 14 |
|
7 | 15 | if (MSVC) |
@@ -49,4 +57,52 @@ endif() |
49 | 57 |
|
50 | 58 | if (BUILD_BENCH) |
51 | 59 | add_subdirectory(tools/bench) |
| 60 | +======= |
| 61 | +set(CMAKE_CXX_STANDARD 17) |
| 62 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 63 | + |
| 64 | +# --- LLVM Configuration --- |
| 65 | +find_package(LLVM REQUIRED CONFIG) |
| 66 | + |
| 67 | +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") |
| 68 | +message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") |
| 69 | + |
| 70 | +# Include LLVM directories |
| 71 | +include_directories(${LLVM_INCLUDE_DIRS}) |
| 72 | +add_definitions(${LLVM_DEFINITIONS}) |
| 73 | + |
| 74 | +# Link directories |
| 75 | +link_directories(${LLVM_LIBRARY_DIRS}) |
| 76 | + |
| 77 | +# Map generic components to specific libs |
| 78 | +llvm_map_components_to_libnames(llvm_libs core support executionengine native ipo) |
| 79 | + |
| 80 | +# --- Project Source --- |
| 81 | +# Export symbols for Windows DLL |
| 82 | +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) |
| 83 | + |
| 84 | +# --- Project Source --- |
| 85 | +include_directories(include) |
| 86 | + |
| 87 | +# Gather sources (excluding main.c for library) |
| 88 | +file(GLOB_RECURSE LIB_SOURCES |
| 89 | + "src/*.c" |
| 90 | + "src/compiler/*.cpp" |
| 91 | +) |
| 92 | +list(FILTER LIB_SOURCES EXCLUDE REGEX ".*main\\.c$") |
| 93 | + |
| 94 | +# --- Shared Library --- |
| 95 | +add_library(proxpl_lib SHARED ${LIB_SOURCES}) |
| 96 | +target_link_libraries(proxpl_lib PRIVATE ${llvm_libs}) |
| 97 | + |
| 98 | +# --- Executable --- |
| 99 | +add_executable(proxpl src/main.c ${LIB_SOURCES}) |
| 100 | + |
| 101 | +# Link LLVM and standard libraries |
| 102 | +target_link_libraries(proxpl PRIVATE ${llvm_libs}) |
| 103 | + |
| 104 | +if(UNIX) |
| 105 | + target_link_libraries(proxpl PRIVATE pthread dl z tinfo) |
| 106 | + target_link_libraries(proxpl_lib PRIVATE pthread dl z tinfo) |
| 107 | +>>>>>>> feature/opcode-tests |
52 | 108 | endif() |
0 commit comments