From 70f6af18a9b2f93a67ad1fdd21a908c2b87f447f Mon Sep 17 00:00:00 2001 From: apachecd Date: Fri, 15 Jul 2022 18:53:15 +0800 Subject: [PATCH] init --- .gitignore | 1 + CMakeLists.txt | 34 ++++++++++++++++++++++++++++++++++ include/example.h | 17 +++++++++++++++++ include/exported.h | 18 ++++++++++++++++++ src/example.cpp | 12 ++++++++++++ 5 files changed, 82 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 include/example.h create mode 100644 include/exported.h create mode 100644 src/example.cpp diff --git a/.gitignore b/.gitignore index e257658..bc6d6c2 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ *.out *.app +/cmake-build-debug/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..2133f4c --- /dev/null +++ b/CMakeLists.txt @@ -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) diff --git a/include/example.h b/include/example.h new file mode 100644 index 0000000..c8a1181 --- /dev/null +++ b/include/example.h @@ -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 diff --git a/include/exported.h b/include/exported.h new file mode 100644 index 0000000..d92aa43 --- /dev/null +++ b/include/exported.h @@ -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 diff --git a/src/example.cpp b/src/example.cpp new file mode 100644 index 0000000..ac39697 --- /dev/null +++ b/src/example.cpp @@ -0,0 +1,12 @@ +// +// Created by Apache on 2022/7/15. +// + +#include "example.h" + + +int main() +{ + + return 0; +}