Skip to content

Commit

Permalink
[CMake][cleanup] use INTERFACE (#3517)
Browse files Browse the repository at this point in the history
* [cleanup][CMake] Use INTERFACE for libcodelite

* [cleanup][CMake] Use INTERFACE for plugin
  • Loading branch information
Jarod42 authored Nov 3, 2024
1 parent 4506e46 commit cce3ea4
Show file tree
Hide file tree
Showing 53 changed files with 43 additions and 505 deletions.
8 changes: 0 additions & 8 deletions AutoSave/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

file(GLOB SRCS "*.cpp")

# Define the output
Expand Down
15 changes: 0 additions & 15 deletions CMakePlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ project(${PLUGIN_NAME})
# wxWidgets include
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories(
"${CL_SRC_ROOT}/Plugin"
"${CL_SRC_ROOT}/sdk/wxsqlite3/include"
"${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh"
"${CL_SRC_ROOT}/LiteEditor"
"${CL_SRC_ROOT}/PCH"
"${CL_SRC_ROOT}/Interfaces")

# Define some macros about DLL
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)
add_definitions(-DWXUSINGDLL_SDK)

# Only with precompiled headers
if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
Expand Down
8 changes: 0 additions & 8 deletions CallGraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
8 changes: 0 additions & 8 deletions ChatAI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
8 changes: 0 additions & 8 deletions CodeFormatter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
66 changes: 25 additions & 41 deletions CodeLite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,65 +23,39 @@ FLEX_TARGET(XmlFlex "${CMAKE_SOURCE_DIR}/CodeLite/XML/XMLLexer.l" "${CMAKE_CURRE

set(FlexSrcs "${FLEX_CxxFlex_OUTPUTS}" "${FLEX_IncludeFinderFlex_OUTPUTS}" "${FLEX_PhpFlex_OUTPUTS}" "${FLEX_XmlFlex_OUTPUTS}")

file(GLOB_RECURSE SRCS "*.cpp" "*.h" "*.hpp")

add_library(libcodelite SHARED ${SRCS} ${FlexSrcs})

# Include paths
include_directories(
target_include_directories(libcodelite
PUBLIC
"${CL_SRC_ROOT}/sdk/wxsqlite3/include"
"${CL_SRC_ROOT}/submodules/websocketpp"
"${CL_SRC_ROOT}/submodules/asio/asio/include"
"${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh"
"${CL_SRC_ROOT}/PCH"
"${CL_SRC_ROOT}/Interfaces"
"${CL_SRC_ROOT}/CodeLite/ssh")

set(ADDITIONAL_LIBRARIES "")

if(UNIX)
if(IS_FREEBSD)
set(ADDITIONAL_LIBRARIES "-lkvm -lutil")
elseif(IS_NETBSD)
set(ADDTIONAL_LIBRARIES "-lutil")
elseif(UNIX AND NOT APPLE)
set(ADDITIONAL_LIBRARIES "-ldl -lutil")
endif()
else(UNIX)
set(ADDITIONAL_LIBRARIES "-lws2_32")
endif(UNIX)

PRIVATE
"${CL_SRC_ROOT}/submodules/asio/asio/include"
"${CL_SRC_ROOT}/submodules/websocketpp"
)
# Macros
if(WIN32)
add_definitions(-DWXMAKINGDLL_CL)
endif(WIN32)
target_compile_definitions(libcodelite PRIVATE WXMAKINGDLL_CL INTERFACE WXUSINGDLL_CL)
target_compile_definitions(libcodelite PUBLIC WXUSINGDLL_WXSQLITE3)
endif()

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
endif()

add_definitions(-DWXUSINGDLL_WXSQLITE3)

# Add RPATH
if(NOT MINGW AND WXC_APP)
string(REPLACE "codelite" "wxcrafter" WXC_LIBS_DIR ${PLUGINS_DIR})
set(LINKER_OPTIONS -Wl,-rpath,"${WXC_LIBS_DIR}")
message("-- libcodelite.so is using RPATH set to ${WXC_LIBS_DIR}")
endif()

file(
GLOB
SRCS
"*.cpp"
"AsyncProcess/*.cpp"
"Console/*.cpp"
"Cxx/*.cpp"
"LSP/*.cpp"
"PHP/*.cpp"
"Platform/*.cpp"
"SocketAPI/*.cpp"
"XML/*.cpp"
"database/*.cpp"
"ssh/*.cpp")

# Define GTK libraries
if(GTK2_FOUND)
set(GTK_LIBS "${GTK2_LIBRARIES}")
Expand All @@ -91,8 +65,18 @@ else()
set(GTK_LIBS "")
endif()

# Define the output
add_library(libcodelite SHARED ${SRCS} ${FlexSrcs})
set(ADDITIONAL_LIBRARIES "")
if(UNIX)
if(IS_FREEBSD)
set(ADDITIONAL_LIBRARIES "-lkvm -lutil")
elseif(IS_NETBSD)
set(ADDTIONAL_LIBRARIES "-lutil")
elseif(UNIX AND NOT APPLE)
set(ADDITIONAL_LIBRARIES "-ldl -lutil")
endif()
else(UNIX)
set(ADDITIONAL_LIBRARIES "-lws2_32")
endif(UNIX)

if(UNIX OR APPLE)
set_target_properties(libcodelite PROPERTIES POSITION_INDEPENDENT_CODE ON)
Expand Down
15 changes: 0 additions & 15 deletions CodeLiteDiff/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@ project(${PLUGIN_NAME})
# wxWidgets include
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories(
"${CL_SRC_ROOT}/Plugin"
"${CL_SRC_ROOT}/sdk/wxsqlite3/include"
"${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh"
"${CL_SRC_ROOT}/LiteEditor"
"${CL_SRC_ROOT}/PCH"
"${CL_SRC_ROOT}/Interfaces")

# Define some macros about DLL
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)
add_definitions(-DWXUSINGDLL_SDK)

# Only with precompiled headers
if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
Expand Down
8 changes: 0 additions & 8 deletions ContinuousBuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
8 changes: 0 additions & 8 deletions Copyright/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
8 changes: 0 additions & 8 deletions CxxParserTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ project(CxxLocalVariables)
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
9 changes: 0 additions & 9 deletions DatabaseExplorer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,8 @@ endif()

# Include paths
include_directories(
"${CL_SRC_ROOT}/Plugin"
"${CL_SRC_ROOT}/sdk/wxsqlite3/include"
"${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh"
"${CL_SRC_ROOT}/PCH"
"${CL_SRC_ROOT}/Interfaces"
"${CL_SRC_ROOT}/sdk/databaselayer/include")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)
add_definitions(-DDBL_USE_SQLITE)

file(GLOB SRCS "*.cpp")
Expand Down
16 changes: 1 addition & 15 deletions DebugAdapterClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@ add_subdirectory("${CL_SRC_ROOT}/submodules/wxdap/dap" ${CMAKE_LIBRARY_OUTPUT_DI
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories(
"${CL_SRC_ROOT}/Plugin"
"${CL_SRC_ROOT}/sdk/wxsqlite3/include"
"${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh"
"${CL_SRC_ROOT}/PCH"
"${CL_SRC_ROOT}/Interfaces"
"${CL_SRC_ROOT}/submodules/wxdap")
# Definitions
add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)
add_definitions(-DWXUSINGDLL_DAP)

# By default, use the sources under the current folder
file(GLOB PLUGIN_SRCS "*.cpp")

Expand All @@ -39,6 +24,7 @@ target_link_libraries(
libcodelite
plugin
dapcxx)
target_include_directories(${PLUGIN_NAME} PRIVATE "${CL_SRC_ROOT}/submodules/wxdap")
# Installation destination
cl_install_plugin(${PLUGIN_NAME})
codelite_install_library_target(dapcxx)
8 changes: 0 additions & 8 deletions Debugger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
8 changes: 0 additions & 8 deletions Docker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
8 changes: 0 additions & 8 deletions EOSWiki/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
8 changes: 0 additions & 8 deletions EditorConfigPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
8 changes: 0 additions & 8 deletions ExternalTools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
8 changes: 0 additions & 8 deletions Gizmos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ project(${PLUGIN_NAME})
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")

# Include paths
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite"
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces")

add_definitions(-DWXUSINGDLL_WXSQLITE3)
add_definitions(-DWXUSINGDLL_CL)
add_definitions(-DWXUSINGDLL_SDK)

if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
Expand Down
Loading

0 comments on commit cce3ea4

Please sign in to comment.