Skip to content

Commit

Permalink
cmake lint
Browse files Browse the repository at this point in the history
  • Loading branch information
averrin committed Jul 7, 2019
1 parent ceca5fe commit 815ab73
Showing 1 changed file with 50 additions and 44 deletions.
94 changes: 50 additions & 44 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.14)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
set(CMAKE_BUILD_TYPE Debug
CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif()
# (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Release)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_CXX_STANDARD 17)

project(vvm)
set (vvm_VERSION_MAJOR 0)
set (vvm_VERSION_MINOR 4)
set (vvm_VERSION_PATCH 2)
set(vvm_VERSION_MAJOR 0)
set(vvm_VERSION_MINOR 5)
set(vvm_VERSION_PATCH 0)

set(PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}")

file(GLOB SOURCE "${PROJECT_PATH}/src/*.cpp" "${PROJECT_PATH}/include/vvm/*.h")
file(COPY "${PROJECT_PATH}/font.ttf" DESTINATION "${PROJECT_PATH}/bin")

# Third party sources
SET(M3RDPARTY_DIR "${PROJECT_PATH}/include/zep/m3rdparty")
SET(M3RDPARTY_INCLUDE "")
set(M3RDPARTY_DIR "${PROJECT_PATH}/include/zep/m3rdparty")
set(M3RDPARTY_INCLUDE "")


# INCLUDE("${M3RDPARTY_DIR}/cmake/copy_files.cmake")
# INCLUDE("${M3RDPARTY_DIR}/list.cmake")

INCLUDE(ExternalProject)
ExternalProject_Add(
include(ExternalProject)
externalproject_add(
sdl2
PREFIX "${M3RDPARTY_DIR}"
CMAKE_ARGS -DCMAKE_DEBUG_POSTFIX='' -DCMAKE_STATIC=ON
Expand All @@ -36,7 +37,7 @@ ExternalProject_Add(
INSTALL_COMMAND ""
INSTALL_DIR ""
)
LIST(APPEND M3RDPARTY_INCLUDE
list(APPEND M3RDPARTY_INCLUDE
${M3RDPARTY_DIR}
${CMAKE_BINARY_DIR}
"${M3RDPARTY_DIR}/sdl"
Expand All @@ -49,15 +50,15 @@ LIST(APPEND M3RDPARTY_INCLUDE
# "${PROJECT_PATH}/include/yaml-cpp/include"
)

SET(SDL_LINKLIBS
set(SDL_LINKLIBS
GL
GLU
dl
SDL2
SDL2main
# SDL2-static
)
LINK_DIRECTORIES(${M3RDPARTY_DIR}/src/sdl2-build)
link_directories(${M3RDPARTY_DIR}/src/sdl2-build)
# target_link_libraries(sdl2 sndio)

add_subdirectory(imgui)
Expand All @@ -70,9 +71,13 @@ include_directories(
${OPENGL_INCLUDE_DIR}
)

file(GLOB ZEP_SOURCE "${PROJECT_PATH}/include/zep/src/*.cpp" "${PROJECT_PATH}/include/zep/src/*.h"
"${PROJECT_PATH}/include/zep/src/utils/*.cpp" "${PROJECT_PATH}/include/zep/src/utils/*.h"
"${PROJECT_PATH}/include/zep/src/imgui/*.cpp" "${PROJECT_PATH}/include/zep/src/imgui/*.h" )
file(GLOB ZEP_SOURCE
"${PROJECT_PATH}/include/zep/src/*.cpp"
"${PROJECT_PATH}/include/zep/src/*.h"
"${PROJECT_PATH}/include/zep/src/utils/*.cpp"
"${PROJECT_PATH}/include/zep/src/utils/*.h"
"${PROJECT_PATH}/include/zep/src/imgui/*.cpp"
"${PROJECT_PATH}/include/zep/src/imgui/*.h")
# add_library(zep ${ZEP_SOURCE})

add_subdirectory(backward-cpp)
Expand Down Expand Up @@ -103,51 +108,52 @@ add_backward(vvm)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

IF(NOT WIN32)
if(NOT WIN32)
# set(CMAKE_C_COMPILER /usr/bin/gcc-7)
# set(CMAKE_CXX_COMPILER /usr/bin/g++-7)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-security")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-zero-length")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-parentheses")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-catch-value")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

add_definitions("-Wall")
add_definitions("-Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-security")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-zero-length")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-parentheses")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-catch-value")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

add_definitions("-Wall")
add_definitions("-Werror")
else()
add_compile_options("/std:c++17")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
add_compile_options("/std:c++17")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE
"${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_PATH}/bin)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_PATH}/bin)

# OpenGL
find_package(OpenGL REQUIRED)

include_directories(${OpenGL_INCLUDE_DIRS})
link_directories(${OpenGL_LIBRARY_DIRS})
add_definitions(${OpenGL_DEFINITIONS})
if (OPENGL_FOUND)
if(OPENGL_FOUND)
target_link_libraries(${EXECUTABLE_NAME} ${OPENGL_LIBRARIES})
endif()

ADD_DEPENDENCIES(${PROJECT_NAME} sdl2)
IF(NOT WIN32)
target_link_libraries(${EXECUTABLE_NAME}
add_dependencies(${PROJECT_NAME} sdl2)
if(NOT WIN32)
target_link_libraries(${EXECUTABLE_NAME}
imgui
Threads::Threads
stdc++fs
Expand All @@ -158,7 +164,7 @@ IF(NOT WIN32)
# zep
)
else()
target_link_libraries(${EXECUTABLE_NAME} imgui Threads::Threads)
target_link_libraries(${EXECUTABLE_NAME} imgui Threads::Threads)
endif()

target_compile_features(vvm PRIVATE cxx_delegating_constructors)
Expand Down

0 comments on commit 815ab73

Please sign in to comment.