master
apachecd 2022-07-15 18:53:15 +08:00
parent 38999f64d7
commit 70f6af18a9
5 changed files with 82 additions and 0 deletions

1
.gitignore vendored
View File

@ -32,3 +32,4 @@
*.out *.out
*.app *.app
/cmake-build-debug/

34
CMakeLists.txt Normal file
View File

@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.21)
set (PROJECT_VERSION "1.0")
project(telc VERSION ${PROJECT_VERSION})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
include_directories(include)
#target_include_directories(${PROJECT_NAME} PRIVATE ./lib/libdependency/src)
#add_subdirectory(./lib/libdependency/)
add_library(${PROJECT_NAME} SHARED src/example.cpp)
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
# G++
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
# MSVC
target_compile_options(${PROJECT_NAME} PRIVATE /EHsc /MTd /W2 /c)
# Set the DLLEXPORT variable to export symbols
target_compile_definitions(${PROJECT_NAME} PRIVATE WIN_EXPORT)
endif()
#target_link_libraries(${PROJECT_NAME} PRIVATE libdependency)

17
include/example.h Normal file
View File

@ -0,0 +1,17 @@
//
// Created by Apache on 2022/7/15.
//
#ifndef TEST_EMBED_LIBEVENT_CROSSPLATFORM_EXAMPLE_H
#define TEST_EMBED_LIBEVENT_CROSSPLATFORM_EXAMPLE_H
#pragma once
// Define EXPORTED for any platform
class example {
};
#endif //TEST_EMBED_LIBEVENT_CROSSPLATFORM_EXAMPLE_H

18
include/exported.h Normal file
View File

@ -0,0 +1,18 @@
//
// Created by Apache on 2022/7/15.
//
#ifndef TELC_EXPORTED_H
#define TELC_EXPORTED_H
#ifdef _WIN32
# ifdef WIN_EXPORT
# define EXPORTED __declspec( dllexport )
# else
# define EXPORTED __declspec( dllimport )
# endif
#else
# define EXPORTED
#endif
#endif //TELC_EXPORTED_H

12
src/example.cpp Normal file
View File

@ -0,0 +1,12 @@
//
// Created by Apache on 2022/7/15.
//
#include "example.h"
int main()
{
return 0;
}