1
- From 2e0203168dcaf52b443949db4725da638f93c9c5 Mon Sep 17 00:00:00 2001
1
+ From d83f17d31e1cf0c6d6453f754d19c4e8956a8fbb Mon Sep 17 00:00:00 2001
2
2
3
3
Date: Tue, 25 Mar 2025 12:21:31 +0900
4
4
Subject: [PATCH] Rewrite CMake build scripts
5
5
6
6
---
7
- CMakeLists.txt | 578 +++--------------------
7
+ CMakeLists.txt | 577 +++--------------------
8
8
include/CMakeLists.txt | 1 +
9
9
include/clang-c/CMakeLists.txt | 1 +
10
10
include/clang/CMakeLists.txt | 1 +
11
11
include/clang/Interpreter/CMakeLists.txt | 1 +
12
12
lib/Interpreter/CMakeLists.txt | 157 +-----
13
- 6 files changed, 79 insertions(+), 660 deletions(-)
13
+ 6 files changed, 76 insertions(+), 662 deletions(-)
14
14
create mode 100644 include/CMakeLists.txt
15
15
create mode 100644 include/clang-c/CMakeLists.txt
16
16
create mode 100644 include/clang/CMakeLists.txt
17
17
create mode 100644 include/clang/Interpreter/CMakeLists.txt
18
18
19
19
diff --git a/CMakeLists.txt b/CMakeLists.txt
20
- index cb0c588..c4571d8 100644
20
+ index 5cf3707..61e01b0 100644
21
21
--- a/CMakeLists.txt
22
22
+++ b/CMakeLists.txt
23
- @@ -1,523 +1,77 @@
23
+ @@ -1,523 +1,72 @@
24
24
- cmake_minimum_required(VERSION 3.13)
25
25
+ cmake_minimum_required(VERSION 3.21)
26
26
@@ -274,9 +274,9 @@ index cb0c588..c4571d8 100644
274
274
- message(fatal "LLVM/CppInterOp requires c++14 or later")
275
275
- endif()
276
276
- endif()
277
- -
277
+ -
278
278
- ## Find supported Cling
279
- -
279
+ -
280
280
- if (CPPINTEROP_USE_CLING)
281
281
- if (NOT Cling_FOUND AND DEFINED Cling_DIR)
282
282
- find_package(Cling REQUIRED CONFIG ${cling_extra_hints} NO_DEFAULT_PATH)
@@ -310,7 +310,10 @@ index cb0c588..c4571d8 100644
310
310
311
311
- # In case this was a path to a build folder of llvm still try to find AddLLVM
312
312
- list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}")
313
- -
313
+ + find_package(Clang REQUIRED CONFIG)
314
+ + message(STATUS "Found Clang ${Clang_PACKAGE_VERSION}")
315
+ + message(STATUS "Using ClangConfig.cmake in: ${Clang_DIR}")
316
+
314
317
- # Fix bug in some AddLLVM.cmake implementation (-rpath "" problem)
315
318
- set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
316
319
-
@@ -530,7 +533,7 @@ index cb0c588..c4571d8 100644
530
533
- set(MSVC_EXPORTLIST ${MSVC_EXPORTLIST} ??3@YAXPAX0@Z ??_V@YAXPAX0@Z)
531
534
- endif()
532
535
-
533
- - if(MSVC_VERSION GREATER_EQUAL 1936)
536
+ - if(MSVC_VERSION GREATER_EQUAL 1936 AND NOT (CMAKE_C_COMPILER MATCHES "aarch64|arm") )
534
537
- set(MSVC_EXPORTLIST ${MSVC_EXPORTLIST}
535
538
- __std_find_trivial_1
536
539
- __std_find_trivial_2
@@ -542,10 +545,11 @@ index cb0c588..c4571d8 100644
542
545
- foreach(sym ${MSVC_EXPORTLIST})
543
546
- set(MSVC_EXPORTS "${MSVC_EXPORTS} /EXPORT:${sym}")
544
547
- endforeach(sym ${MSVC_EXPORTLIST})
545
- + find_package(Clang REQUIRED CONFIG)
546
- + message(STATUS "Found Clang ${Clang_PACKAGE_VERSION}")
547
- + message(STATUS "Using ClangConfig.cmake in: ${Clang_DIR}")
548
-
548
+ -
549
+ - endif()
550
+ -
551
+ - if (CPPINTEROP_INCLUDE_DOCS)
552
+ - add_subdirectory(docs)
549
553
+ add_library(CppInterOp SHARED)
550
554
+ add_subdirectory(lib)
551
555
+ add_subdirectory(include)
@@ -575,13 +579,6 @@ index cb0c588..c4571d8 100644
575
579
+
576
580
+ target_link_libraries(CppInterOp PUBLIC LLVM clang-cpp)
577
581
+
578
- + if(UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
579
- + target_link_options(CppInterOp PUBLIC -Wl,--export=__clang_Interpreter_SetValueNoAlloc)
580
- + target_link_options(CppInterOp PUBLIC -Wl,--export=__clang_Interpreter_SetValueWithAlloc)
581
- endif()
582
-
583
- - if (CPPINTEROP_INCLUDE_DOCS)
584
- - add_subdirectory(docs)
585
582
+ # Install CompilationDatabase
586
583
+ set_target_properties(CppInterOp PROPERTIES EXPORT_COMPILE_COMMANDS true)
587
584
+ set(ccmds_json ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json)
@@ -643,7 +640,7 @@ index 0000000..c6c9939
643
640
+ target_sources(CppInterOp PRIVATE ${CMAKE_CURRENT_LIST_DIR}/CppInterOp.h)
644
641
\ No newline at end of file
645
642
diff --git a/lib/Interpreter/CMakeLists.txt b/lib/Interpreter/CMakeLists.txt
646
- index 7568f7f ..4205ada 100644
643
+ index eccfc39 ..4205ada 100644
647
644
--- a/lib/Interpreter/CMakeLists.txt
648
645
+++ b/lib/Interpreter/CMakeLists.txt
649
646
@@ -1,148 +1,9 @@
@@ -763,12 +760,12 @@ index 7568f7f..4205ada 100644
763
760
-
764
761
-
765
762
- if(EMSCRIPTEN)
766
- - # FIXME: When dynamically linking the Emscripten shared library to the
763
+ - # FIXME: When dynamically linking the Emscripten shared library to the
767
764
- # unit tests main_module you get errors due to undefined symbols. The reading of the file
768
765
- # below into a SYMBOLS_LIST variable is a temporary workaround that exports the undefined
769
766
- # symbols from the shared library, until it can be determined why they are not being exported already.
770
767
- file(READ "${CMAKE_SOURCE_DIR}/lib/Interpreter/exports.ld" SYMBOLS_LIST)
771
- -
768
+ -
772
769
- # Replace newlines with spaces
773
770
- string(REPLACE "\n" " " SYMBOLS_LIST "${SYMBOLS_LIST}")
774
771
-
0 commit comments