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; +}