From 4ffe0ff4ac30361ea2a35dcfa07ca560ed865631 Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 21 Aug 2022 21:54:47 -0500 Subject: build with clang on visual studio --- .gitignore | 2 ++ CMakeLists.txt | 14 ++++++++------ CMakeSettings.json | 27 +++++++++++++++++++++++++++ libs/glfw-3.3.8/CMakeLists.txt | 8 ++++---- libs/honeysuckle/CMakeLists.txt | 3 --- 5 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 CMakeSettings.json diff --git a/.gitignore b/.gitignore index 3192b45..a2dc543 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ build/* *.#* demo/plagiarism.dae *.swp +out +.vs diff --git a/CMakeLists.txt b/CMakeLists.txt index a76d76b..b5e8502 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,10 @@ cmake_minimum_required(VERSION 3.2) project(honey_engine_demo) -set(CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic") -set(CMAKE_C_FLAGS "-g") +if (UNIX) + set(CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic") + set(CMAKE_C_FLAGS "-g") +endif() find_package(OpenGL REQUIRED) @@ -10,7 +12,7 @@ set(SRC_ROOT ${CMAKE_SOURCE_DIR}/src) set(LIB_ROOT ${CMAKE_SOURCE_DIR}/libs) include_directories( - ${LUA_INCLUDE_DIR} + ${LIB_ROOT}/lua-5.1.5/src ${CMAKE_SOURCE_DIR}/src ${LIB_ROOT}/honeysuckle/src ${LIB_ROOT}/glfw-3.3.8/include @@ -44,11 +46,11 @@ set(SOURCE_FILES add_executable(honey ${SOURCE_FILES}) -set(LIBRARIES lua5.1 honeysuckle assimp cairo m) +set(LIBRARIES lua5.1 honeysuckle assimp glfw) if (WIN32) - set(LIBRARIES ${LIBRARIES} glfw3 opengl32) + set(LIBRARIES ${LIBRARIES} opengl32) else() - set(LIBRARIES ${LIBRARIES} glfw GL dl) + set(LIBRARIES ${LIBRARIES} GL dl m) endif() target_link_libraries(honey ${LIBRARIES}) diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 0000000..7313f2b --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,27 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "" + }, + { + "name": "x64-Clang-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "clang_cl_x64_x64" ], + "variables": [] + } + ] +} \ No newline at end of file diff --git a/libs/glfw-3.3.8/CMakeLists.txt b/libs/glfw-3.3.8/CMakeLists.txt index 7506916..ba96561 100644 --- a/libs/glfw-3.3.8/CMakeLists.txt +++ b/libs/glfw-3.3.8/CMakeLists.txt @@ -19,10 +19,10 @@ endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) option(BUILD_SHARED_LIBS "Build shared libraries" OFF) -option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON) -option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON) -option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON) -option(GLFW_INSTALL "Generate installation target" ON) +option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) +option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) +option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF) +option(GLFW_INSTALL "Generate installation target" OFF) option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF) include(GNUInstallDirs) diff --git a/libs/honeysuckle/CMakeLists.txt b/libs/honeysuckle/CMakeLists.txt index 91222d2..1e16f40 100644 --- a/libs/honeysuckle/CMakeLists.txt +++ b/libs/honeysuckle/CMakeLists.txt @@ -3,9 +3,6 @@ project(honeysuckle VERSION 0.1.0 DESCRIPTION "A C library to make writing lua bindings simple") -find_package(Lua51 REQUIRED) -Include_directories(${LUA_INCLUDE_DIR}) - # build and link the library set(HS_ROOT ${honeysuckle_SOURCE_DIR}/src) set(HONEYSUCKLE_SOURCES -- cgit v1.2.1