Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
idealvin committed Aug 14, 2022
1 parent 75629a2 commit 99ed2ac
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(POLICY CMP0090)
cmake_policy(SET CMP0090 NEW)
endif()

project(cocoyaxi VERSION 2.0.3)
project(coost VERSION 2.0.3)

if(MSVC)
enable_language(C CXX ASM_MASM)
Expand Down
4 changes: 2 additions & 2 deletions cmake/cocoyaxi.pc.in → cmake/coost.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ exec_prefix=${prefix}
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@

Name: cocoyaxi
Description: A go-style coroutine library in C++11 and more.
Name: coost
Description: A tiny boost library in C++11.
Version: @PROJECT_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lco@CO_PKG_EXTRA_LIBS@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

include(CMakeFindDependencyMacro)
@CO_CMAKE_CONFIG_DEPS@
include("${CMAKE_CURRENT_LIST_DIR}/cocoyaxiTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/coostTargets.cmake")

check_required_components(co)
2 changes: 1 addition & 1 deletion include/co/config.h.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define COCOYAXI_SHARED ${COCOYAXI_SHARED}
#define COOST_SHARED ${COOST_SHARED}
6 changes: 3 additions & 3 deletions include/co/def.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ typedef uint64_t uint64;
// generated from config.h.in
#include "config.h"

// __coapi: used to export symbols in shared co
// Do not use (or reuse outside of cocoyaxi) this definiton yourself
#if COCOYAXI_SHARED > 0
// __coapi: used to export symbols in shared library
// Do not use (or reuse outside of coost) this definiton yourself
#if COOST_SHARED > 0
#ifdef _WIN32
#ifdef BUILDING_CO_SHARED
#define __coapi __declspec(dllexport)
Expand Down
46 changes: 23 additions & 23 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if(APPLE)
endif()

add_library(co ${CO_SRC_FILES})
add_library(cocoyaxi::co ALIAS co)
add_library(coost::co ALIAS co)

target_include_directories(co
PUBLIC
Expand All @@ -53,7 +53,7 @@ if(WITH_LIBCURL OR WITH_OPENSSL)
target_link_libraries(co PRIVATE OpenSSL::SSL OpenSSL::Crypto)
if(WIN32)
# FindOpenSSL.cmake shipped in CMake < 3.21.0 doesn't properly propagate
# crypt32. We should also handle ws2_32 but cocoyaxi link to it later.
# crypt32. We should also handle ws2_32 but coost link to it later.
target_link_libraries(co PRIVATE crypt32)
endif()
endif()
Expand All @@ -77,9 +77,9 @@ if(BUILD_SHARED_LIBS)
VISIBILITY_INLINES_HIDDEN ON
)
target_compile_definitions(co PRIVATE BUILDING_CO_SHARED)
set(COCOYAXI_SHARED 1)
set(COOST_SHARED 1)
else()
set(COCOYAXI_SHARED 0)
set(COOST_SHARED 0)
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/include/co/config.h.in"
Expand Down Expand Up @@ -112,7 +112,7 @@ endif()
## library & public headers
install(
TARGETS co
EXPORT cocoyaxiExport
EXPORT coostExport
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down Expand Up @@ -151,13 +151,13 @@ if((WITH_LIBCURL OR WITH_OPENSSL) AND NOT BUILD_SHARED_LIBS)
endif()

configure_file(
${PROJECT_SOURCE_DIR}/cmake/cocoyaxi.pc.in
cocoyaxi.pc
${PROJECT_SOURCE_DIR}/cmake/coost.pc.in
coost.pc
@ONLY
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/cocoyaxi.pc
FILES ${CMAKE_CURRENT_BINARY_DIR}/coost.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)

Expand All @@ -171,35 +171,35 @@ if(WITH_LIBCURL OR WITH_OPENSSL)
endif()

configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/cocoyaxiConfig.cmake.in
cocoyaxiConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cocoyaxi
${PROJECT_SOURCE_DIR}/cmake/coostConfig.cmake.in
coostConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/coost
)

write_basic_package_version_file(
cocoyaxiConfigVersion.cmake
coostConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)

export(
EXPORT cocoyaxiExport
NAMESPACE cocoyaxi::
FILE cocoyaxiTargets.cmake
EXPORT coostExport
NAMESPACE coost::
FILE coostTargets.cmake
)

install(
EXPORT cocoyaxiExport
NAMESPACE cocoyaxi::
FILE cocoyaxiTargets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cocoyaxi
EXPORT coostExport
NAMESPACE coost::
FILE coostTargets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/coost
)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/cocoyaxiConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/cocoyaxiConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cocoyaxi
${CMAKE_CURRENT_BINARY_DIR}/coostConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/coostConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/coost
)

export(PACKAGE cocoyaxi)
export(PACKAGE coost)
4 changes: 2 additions & 2 deletions src/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ target("libco")
if is_kind("shared") then
set_symbols("debug", "hidden")
add_defines("BUILDING_CO_SHARED")
set_configvar("COCOYAXI_SHARED", 1)
set_configvar("COOST_SHARED", 1)
else
set_configvar("COCOYAXI_SHARED", 0)
set_configvar("COOST_SHARED", 0)
end
add_configfiles("../include/co/config.h.in", {filename = "../include/co/config.h"})

Expand Down

0 comments on commit 99ed2ac

Please sign in to comment.