From a878cdc42bf41355758dabd353d521d4b12e73fc Mon Sep 17 00:00:00 2001 From: Stephen Enders <84310577289916ceefd4132143fb36b63a5f0c71> Date: Wed, 22 Jun 2022 01:28:23 -0400 Subject: Add windows support Create res.h for handling resource loading Update CMakeLists.txt to ensure compilation is passed properly Fix unsupported functions () on Windows Use to_str(path) to get path as c_str() returns wchar_t* on windows --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 69cd9b2..c1902a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project(dng VERSION 0.1.0) set(CMAKE_CXX_STANDARD 20) set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}) +set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON) # Setup Lua Libraries # To determine which files look at the lua/makefile to see how the targets are built @@ -42,7 +43,9 @@ add_library(lualib STATIC ${LUA_SRC}/lstrlib.c ${LUA_SRC}/ltablib.c ${LUA_SRC}/lutf8lib.c) -target_compile_definitions(lualib PRIVATE -DLUA_USE_POSIX=1) # to properly use mkstemp +if(UNIX) + target_compile_definitions(lualib PRIVATE -DLUA_USE_POSIX=1) # to properly use mkstemp +endif() target_include_directories(lua PUBLIC lua) target_include_directories(lauxlib PUBLIC lua) target_include_directories(lualib PUBLIC lua) @@ -53,7 +56,9 @@ include_directories(${PROJECT_SOURCE_DIR}/thirdparty/lua) # System specific includes if (UNIX) set(RES_LIB src/linux/res.h) -endif () +elseif(WIN32) + set(RES_LIB src/windows/res.h) +endif() add_executable(${PROJECT_NAME} src/main.cpp src/Level.cpp src/Level.h src/CApi.h src/Scene.h src/LuaApi.h src/MessageBox.h ${RES_LIB}) target_link_libraries(${PROJECT_NAME} PUBLIC ${LUA_LIBRARIES}) @@ -65,7 +70,6 @@ if (WIN32) set(SFML_USE_STATIC_STD_LIBS TRUE) endif () set(SFML_USE_SYSTEM_DEPS ON) -set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON) add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/SFML EXCLUDE_FROM_ALL) target_link_libraries(${PROJECT_NAME} PUBLIC ${SFML_LIBRARIES} ${LUA_LIBRARIES}) -- cgit v1.2.3-54-g00ecf