Musa-Cpp-Lib-V2/CMakeLists.txt
Musa 55ce432097 Replace build scripts with cmake (#3)
Reviewed-on: #3
Co-authored-by: Musa <musasmahmood@gmail.com>
Co-committed-by: Musa <musasmahmood@gmail.com>
2025-12-19 02:28:51 +00:00

61 lines
1.8 KiB
CMake

############# README ############# README ############# README ############
# Option to choose between shared or static library
# Pass this as an argument as follows when configuring the project:
# `cmake -S . -B build
# then build it with either `Release` or `Debug` option:
# `cmake --build build --config Release`
############ /README ############ /README ############ /README ############
cmake_minimum_required(VERSION 3.20)
project(musa-explorer-cpp)
# Use C++11
SET (CMAKE_CXX_STANDARD 11)
SET (CMAKE_VERBOSE_MAKEFILE ON)
if (MSVC)
# Suppress warning: C++ exception handler used, but unwind semantics are not enabled.
add_compile_options(/wd4530)
endif()
SET (EXE_NAME "mexplore_v2")
SET (SRC_FILES
lib/third_party/dear-imgui/imgui.cpp
lib/third_party/dear-imgui/imgui_widgets.cpp
lib/third_party/dear-imgui/imgui_draw.cpp
lib/third_party/dear-imgui/imgui_tables.cpp
lib/third_party/dear-imgui/imgui_impl_dx11.cpp
lib/third_party/dear-imgui/imgui_impl_win32.cpp
exe_main.cpp
)
SET (INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/lib
${PROJECT_SOURCE_DIR}/lib/third_party
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET (LINK_LIB_DIRS
)
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
SET (LINK_LIB_DIRS
)
endif()
add_executable(${EXE_NAME} ${SRC_FILES})
target_include_directories(${EXE_NAME} PRIVATE ${INCLUDE_DIRS})
target_link_libraries(${EXE_NAME} PRIVATE ${LINK_LIBS_DIRS})
message(STATUS "Build type: $<CONFIG>")
add_custom_command(TARGET ${EXE_NAME} POST_BUILD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E echo "Running post-build script..."
COMMAND cmd.exe /c "${CMAKE_SOURCE_DIR}/copy_files.cmd" $<CONFIG>
COMMENT "Running custom post-build script."
)