Skip to content

Commit

Permalink
Merge pull request #104 from mVento3/cmake
Browse files Browse the repository at this point in the history
CMake support
  • Loading branch information
xoofx authored Jul 1, 2024
2 parents 5e5fe0a + d136f2b commit 2eaee79
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is not used for compiling but used
# when generating project using CMake generator.
# If you are not using CMake then just open .sln file

cmake_minimum_required(VERSION 3.22)

project(CppAst.NET CSharp)

set(CMAKE_CSharp_FLAGS "${CMAKE_CSharp_FLAGS} /langversion:latest")

set(CMAKE_DOTNET_TARGET_FRAMEWORK net8.0)
set(CMAKE_DOTNET_SDK "Microsoft.NET.Sdk")

add_subdirectory(src)
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.22)

add_subdirectory(CppAst)
add_subdirectory(CppAst.Tests)
10 changes: 10 additions & 0 deletions src/CppAst.Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
file(GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cs)

add_library(CppAst.Tests SHARED ${SOURCE_FILES})

set_target_properties(CppAst.Tests PROPERTIES
VS_PACKAGE_REFERENCES "Microsoft.NET.Test.Sdk_17.8.0;nunit_4.0.1;NUnit3TestAdapter_4.5.0"
)

target_compile_options(CppAst.Tests PUBLIC "/unsafe")
target_link_libraries(CppAst.Tests CppAst)
11 changes: 11 additions & 0 deletions src/CppAst/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
file(GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cs)

set(CMAKE_CSharp_FLAGS "${CMAKE_CSharp_FLAGS} /langversion:7.3")

add_library(CppAst SHARED ${SOURCE_FILES})

set_target_properties(CppAst PROPERTIES
VS_PACKAGE_REFERENCES "ClangSharp_17.0.1;Irony_1.2.0"
)

target_compile_options(CppAst PUBLIC "/unsafe")

0 comments on commit 2eaee79

Please sign in to comment.