Files
WickedEngine/CMakeLists.txt
T
matpx fcdcce9e83 CMake win32 fix (#837)
* use imgui_impl_win32 on windows

* make WICKED_LINUX_TEMPLATE a dependent option
2024-05-06 06:02:13 +02:00

67 lines
1.9 KiB
CMake

cmake_minimum_required(VERSION 3.8)
set(WICKED_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
option(WICKED_DYNAMIC_LIBRARY "Build WickedEngine as a dynamic library" OFF)
option(USE_LIBCXX "Link WickedEngine to llvm libc++ library - only available with the Clang compiler" OFF)
option(WICKED_EDITOR "Build WickedEngine editor" ON)
option(WICKED_TESTS "Build WickedEngine tests" ON)
option(WICKED_IMGUI_EXAMPLE "Build WickedEngine imgui example" ON)
include(CMakeDependentOption)
cmake_dependent_option(WICKED_LINUX_TEMPLATE "Build WickedEngine Linux template" ON "UNIX" OFF)
# Configure CMake global variables
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Use solution folders to organize projects
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
project(WickedEngine)
if (WIN32)
set(PLATFORM "Windows")
add_compile_definitions(WIN32=1)
# add_compile_definitions(_WIN32=1) this is a given from the compiler
set(DXC_TARGET "${CMAKE_CURRENT_SOURCE_DIR}/WickedEngine/dxc.exe")
elseif(UNIX)
set(PLATFORM "SDL2")
add_compile_definitions(SDL2=1)
set(DXC_TARGET "dxc")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdeclspec -fms-extensions")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} $<$<NOT:$<WICKED_DYNAMIC_LIBRARY>>:--for-linker=-no-pie>" )
if (USE_LIBCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
else()
endif()
add_subdirectory(WickedEngine)
if (WICKED_EDITOR)
add_subdirectory(Editor)
endif()
if (WICKED_TESTS)
add_subdirectory(Tests)
endif()
if (WICKED_IMGUI_EXAMPLE)
add_subdirectory(Example_ImGui)
add_subdirectory(Example_ImGui_Docking)
endif()
if (WICKED_LINUX_TEMPLATE)
add_subdirectory(Template_Linux)
endif()