diff --git a/kotlin-native/llvmDebugInfoC/.gitignore b/kotlin-native/llvmDebugInfoC/.gitignore new file mode 100644 index 00000000000..04e6b23011d --- /dev/null +++ b/kotlin-native/llvmDebugInfoC/.gitignore @@ -0,0 +1 @@ +CMakeLists.txt \ No newline at end of file diff --git a/kotlin-native/llvmDebugInfoC/README.md b/kotlin-native/llvmDebugInfoC/README.md new file mode 100644 index 00000000000..c9485d9dc04 --- /dev/null +++ b/kotlin-native/llvmDebugInfoC/README.md @@ -0,0 +1,7 @@ +# Working on C++ code + +1. Generate CMakeLists.txt +``` +./gradlew :kotlin-native:llvmDebugInfoC:generateCMakeLists +``` +2. Open this directory in CLion diff --git a/kotlin-native/llvmDebugInfoC/build.gradle.kts b/kotlin-native/llvmDebugInfoC/build.gradle.kts index 81c0d3c113f..1c4eed57086 100644 --- a/kotlin-native/llvmDebugInfoC/build.gradle.kts +++ b/kotlin-native/llvmDebugInfoC/build.gradle.kts @@ -23,9 +23,12 @@ plugins { native { val obj = if (HostManager.hostIsMingw) "obj" else "o" + val cxxStandard = 17 + val llvmIncludeDir = "${llvmDir}/include" + val cxxflags = mutableListOf( - "--std=c++17", - "-I${llvmDir}/include", + "--std=c++${cxxStandard}", + "-I${llvmIncludeDir}", "-I${projectDir}/src/main/include" ) suffixes { @@ -46,4 +49,26 @@ native { tool(*hostPlatform.clangForJni.llvmAr("").toTypedArray()) flags("-qcv", ruleOut(), *ruleInAll()) } -} + + // FIXME: Migrate to the compilation database approach when the clang calls are removed + tasks.register("generateCMakeLists") { + doLast { + projectDir.resolve("CMakeLists.txt").writeText( + """ + cmake_minimum_required(VERSION 3.26) + project(llvmDebugInfoC) + + set(CMAKE_CXX_STANDARD ${cxxStandard}) + + include_directories(${llvmIncludeDir}) + include_directories(src/main/include) + + add_library( + llvmDebugInfoC + src/main/cpp/DebugInfoC.cpp + ) + """.trimIndent() + ) + } + } +} \ No newline at end of file