Skip to content

Commit

Permalink
update xmake.lua & cmake file
Browse files Browse the repository at this point in the history
  • Loading branch information
idealvin committed Jul 18, 2023
1 parent d721d82 commit 5ebb200
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ else()
endif()


# build with libcurl (openssl & zlib also required)
option(WITH_LIBCURL "build with libcurl" OFF)

# build with openssl 1.1.0+
option(WITH_OPENSSL "build with openssl" OFF)

# build with libcurl (openssl & zlib also required)
option(WITH_LIBCURL "build with libcurl" OFF)

# build with libbacktrace
option(WITH_BACKTRACE "build with libbacktrace" OFF)

Expand All @@ -48,6 +48,8 @@ option(FPIC "build with -fPIC" OFF)
# build all projects (libco, gen, test, unitest)
option(BUILD_ALL "Build all projects" OFF)

option(DISABLE_HOOK "disable hooks for system APIs" OFF)

# specify the value of L1 cache line size, 64 by default
set(CACHE_LINE_SIZE "64" CACHE STRING "set value of L1 cache line size")

Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ if(WITH_BACKTRACE)
target_link_libraries(co PUBLIC backtrace)
endif()

if(DISABLE_HOOK)
target_compile_definitions(co PRIVATE _CO_DISABLE_HOOK)
endif()

target_compile_features(co PUBLIC cxx_std_11)

if(FPIC)
Expand Down
5 changes: 5 additions & 0 deletions src/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ target("libco")
add_options("with_openssl")
add_options("with_libcurl")
add_options("cache_line_size")
add_options("disable_hook")
if is_plat("linux", "macosx") then
add_options("with_backtrace")
end
Expand All @@ -26,6 +27,10 @@ target("libco")
add_packages("openssl")
end

if has_config("disable_hook") then
add_defines("_CO_DISABLE_HOOK")
end

if is_kind("shared") then
set_symbols("debug", "hidden")
add_defines("BUILDING_CO_SHARED")
Expand Down
6 changes: 6 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ option("fpic")
add_cxflags("-fPIC")
option_end()

option("disable_hook")
set_default(false)
set_showmenu(true)
set_description("disable system API hook")
option_end()

option("cache_line_size")
set_default("64")
set_showmenu(true)
Expand Down

0 comments on commit 5ebb200

Please sign in to comment.