Skip to content

Commit

Permalink
CMakeLists: Restructurize
Browse files Browse the repository at this point in the history
  • Loading branch information
pongo1231 committed Jan 15, 2025
1 parent a05fc18 commit bddf0bc
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions ChaosMod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,42 @@ cmake_minimum_required(VERSION 3.13)

project(ChaosMod)

add_subdirectory(${PROJECT_SOURCE_DIR}/../vendor/shv shv)
add_subdirectory(${PROJECT_SOURCE_DIR}/../vendor/minhook minhook)
if (WITH_DEBUG_PANEL_SUPPORT)
set(USE_ZLIB OFF CACHE BOOL "Enable zlib support")
add_subdirectory(${PROJECT_SOURCE_DIR}/../vendor/IXWebSocket ixwebsocket)
endif ()

file(GLOB ROOT_SRC ${PROJECT_SOURCE_DIR}/*.cpp)
file(GLOB_RECURSE SRC ${PROJECT_SOURCE_DIR}/Components/*.cpp ${PROJECT_SOURCE_DIR}/Effects/*.cpp
${PROJECT_SOURCE_DIR}/Memory/*.cpp ${PROJECT_SOURCE_DIR}/Util/*.cpp)
file(GLOB PATTERNS_SRC ${PROJECT_SOURCE_DIR}/../vendor/Patterns/Patterns.cpp)
add_library(ChaosMod MODULE ${ROOT_SRC} ${SRC} ${PATTERNS_SRC} ChaosMod.rc)

set_property(TARGET ChaosMod PROPERTY CXX_STANDARD 20)

if (WITH_DEBUG_PANEL_SUPPORT)
target_compile_definitions(ChaosMod PRIVATE WITH_DEBUG_PANEL_SUPPORT)
endif ()
target_precompile_headers(ChaosMod PUBLIC stdafx.cpp)

if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_options(ChaosMod PRIVATE -DUNICODE -D_UNICODE -DNOMINMAX /Zi)
target_link_options(ChaosMod PRIVATE /DEBUG /OPT:REF /OPT:ICF)
else()
target_compile_options(ChaosMod PRIVATE -municode)
target_link_options(ChaosMod PRIVATE -static)
endif()
set_target_properties(ChaosMod PROPERTIES SUFFIX ".asi")
set_target_properties(ChaosMod PROPERTIES CXX_STANDARD 20)

target_include_directories(ChaosMod PRIVATE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/../vendor ${PROJECT_SOURCE_DIR}/../vendor/lua/include ${PROJECT_SOURCE_DIR}/../vendor/websocketpp)
target_compile_definitions(ChaosMod PUBLIC $<$<CONFIG:Debug>:_DEBUG>)

set(include_dirs ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/../vendor ${PROJECT_SOURCE_DIR}/../vendor/lua/include)
set(link_libs shv minhook lua54 winmm d3dcompiler xinput)

add_subdirectory(${PROJECT_SOURCE_DIR}/../vendor/shv shv)
add_subdirectory(${PROJECT_SOURCE_DIR}/../vendor/minhook minhook)
if (WITH_DEBUG_PANEL_SUPPORT)
set(link_libs ${link_libs} ixwebsocket wsock32 ws2_32)
endif ()
set(include_dirs ${include_dirs} ${PROJECT_SOURCE_DIR}/../vendor/IXWebSocket)
set(link_libs ${link_libs} wsock32 ws2_32 ixwebsocket)

target_link_directories(ChaosMod PRIVATE ${PROJECT_SOURCE_DIR}/../vendor/lua)
target_link_libraries(ChaosMod PRIVATE ${link_libs})
target_compile_definitions(ChaosMod PUBLIC WITH_DEBUG_PANEL_SUPPORT)

target_precompile_headers(ChaosMod PRIVATE stdafx.cpp)
set(USE_ZLIB OFF CACHE BOOL "Enable zlib support")
add_subdirectory(${PROJECT_SOURCE_DIR}/../vendor/IXWebSocket ixwebsocket)
endif ()

target_compile_definitions(ChaosMod PRIVATE $<$<CONFIG:Debug>:_DEBUG>)
set_target_properties(ChaosMod PROPERTIES SUFFIX ".asi")
target_include_directories(ChaosMod PUBLIC ${include_dirs})
target_link_directories(ChaosMod PUBLIC ${PROJECT_SOURCE_DIR}/../vendor/lua)
target_link_libraries(ChaosMod PUBLIC ${link_libs})

if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_options(ChaosMod PUBLIC -DUNICODE -D_UNICODE -DNOMINMAX /Zi)
target_link_options(ChaosMod PUBLIC /DEBUG /OPT:REF /OPT:ICF)
else()
target_compile_options(ChaosMod PUBLIC -municode)
target_link_options(ChaosMod PUBLIC -static)
endif()

0 comments on commit bddf0bc

Please sign in to comment.