Skip to content

Commit

Permalink
Cleanup cmake output
Browse files Browse the repository at this point in the history
  • Loading branch information
xx-shitai-xx committed Feb 18, 2023
1 parent 55fc008 commit e395516
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 34 deletions.
24 changes: 11 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,38 +88,33 @@ configure_file(
${PROJECT_BINARY_DIR}/server/include/IConfig.h
)

message(STATUS "Configuring ${PROJECT_NAME} v${VER_FULL}")
list(APPEND CMAKE_MESSAGE_INDENT "* ")
option(STATIC "Compile as a static runtime." ON)
message(STATUS "Compile as static runtime:\t\t\t\t\t${STATIC}")
if(STATIC)
message("Compile as static runtime")
add_definitions(-DSTATICLIB)
set(BUILD_SHARED_LIBS FALSE CACHE BOOL "-" FORCE)
else()
message("Don't compile as a static runtime")
set(BUILD_SHARED_LIBS TRUE CACHE BOOL "-" FORCE)
endif()

option(GRALATNPC "Compile with Gralat NPC support, only works when V8NPCSERVER is enabled." ON)
message(STATUS "Compile with Gralat NPC support:\t\t\t${GRALATNPC}")
if(GRALATNPC)
message("Compile with Gralat NPC support")
add_definitions(-DGRALATNPC)
else()
message("Don't compile with Gralat NPC support")
endif()

option(V8NPCSERVER "Compile built-in V8 NPC-Server" OFF)
message(STATUS "Compile with built-in V8 NPC-Server:\t\t${V8NPCSERVER}")
if(V8NPCSERVER)
message("Enabling built-in V8 NPC-Server")
add_definitions(-DV8NPCSERVER)
else()
message("Disabling built-in V8 NPC-Server")
endif()

option(UPNP "Compile with UPNP support" OFF)
message(STATUS "Compile with UPNP support:\t\t\t\t\t${UPNP}")
if(UPNP)
message("Enabling UPNP support")
add_definitions(-DUPNP)
else()
message("Disabling UPNP support")
endif()

# Packaging
Expand Down Expand Up @@ -250,15 +245,15 @@ endif()
if(V8NPCSERVER)
find_package(V8)
if(NOT V8_FOUND)
message("v8 not found in system")
message(FATAL_ERROR "V8 not found in system")
endif()
endif()

if(UPNP)
find_package(Miniupnpc)

if(NOT MINIUPNPC_FOUND)
message("MiniUPNPC not found in system. Compiling it ourselves.")
message(STATUS "MiniUPNPC not found in system. Compiling it ourselves.")

if(STATIC)
add_definitions(-DMINIUPNP_STATICLIB)
Expand Down Expand Up @@ -294,6 +289,9 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/bin)
add_subdirectory(${PROJECT_SOURCE_DIR}/server)

enable_testing()
set(CMAKE_MESSAGE_INDENT "")
message(STATUS "Configure Unit Testing")
set(CMAKE_MESSAGE_INDENT "* ")
add_subdirectory(${PROJECT_SOURCE_DIR}/Catch_tests)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
26 changes: 13 additions & 13 deletions cmake/FindV8.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# V8_FOUND, if false, do not try to link to V8
# V8_INCLUDE_DIR, where to find the headers

message("Looking for monolithic v8...")
message(STATUS "Looking for monolithic V8...")

IF (NOT $ENV{V8_DIR} STREQUAL "")
SET(V8_DIR $ENV{V8_DIR})
Expand Down Expand Up @@ -113,13 +113,13 @@ FIND_LIBRARY(V8_LIBRARY

if(NOT V8_LIBRARY OR NOT V8_INCLUDE_DIR)
if(NOT V8_LIBRARY)
message("Couldn't find v8 library.")
message(STATUS "Couldn't find V8 library.")
endif()
if(NOT V8_INCLUDE_DIR)
message("Couldn't find v8 include dir.")
message(STATUS "Couldn't find v8 include dir.")
endif()

message("Monolith search failed, looking for mingw package")
message(STATUS "Monolith search failed, looking for mingw package")

find_library(V8_MAIN_LIBRARY libv8.dll.a
PATHS ${V8_LIBRARY_SEARCH_PATHS}
Expand All @@ -138,7 +138,7 @@ if(NOT V8_LIBRARY OR NOT V8_INCLUDE_DIR)
endif()

if(NOT V8_MAIN_LIBRARY OR NOT V8_BASE_LIBRARY OR NOT V8_PLATFORM_LIBRARY)
message("Mingw package search failed, looking for nuget package")
message(STATUS "Mingw package search failed, looking for nuget package")

if (NOT V8_LIBRARY AND NOT V8_INCLUDE_DIR AND MSVC)
file(DOWNLOAD https://dist.nuget.org/win-x86-commandline/latest/nuget.exe ${CMAKE_BINARY_DIR}/nuget.exe)
Expand All @@ -154,7 +154,7 @@ if(NOT V8_LIBRARY OR NOT V8_INCLUDE_DIR)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Release")
message("Searching for Release libraries as chosen")
message(STATUS "Searching for Release libraries as chosen")
set(V8_LIBRARY_SEARCH_PATHS
${CMAKE_SOURCE_DIR}/packages/${V8_NUGET_NAME}/lib/Release
${V8_DIR}/Release
Expand All @@ -167,11 +167,11 @@ if(NOT V8_LIBRARY OR NOT V8_INCLUDE_DIR)
set(V8_REDIST_DIR ${CMAKE_SOURCE_DIR}/packages/${V8_NUGET_REDIST}/lib/Release)
else()
if(NOT CMAKE_BUILD_TYPE)
message("Searching for Debug libraries by default")
message(STATUS "Searching for Debug libraries by default")
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
message("Searching for Debug library as chosen")
message(STATUS "Searching for Debug library as chosen")
else()
message("Build type not recognized, searching for Debug libraries")
message(STATUS "Build type not recognized, searching for Debug libraries")
endif()
set(V8_LIBRARY_SEARCH_PATHS
${CMAKE_SOURCE_DIR}/packages/${V8_NUGET_NAME}/lib/Debug
Expand All @@ -197,7 +197,7 @@ if(NOT V8_LIBRARY OR NOT V8_INCLUDE_DIR)
endif()

if(NOT V8_MAIN_LIBRARY OR NOT V8_BASE_LIBRARY OR NOT V8_PLATFORM_LIBRARY)
message("Couldn't find v8 libraries as nuget package")
message(STATUS "Couldn't find V8 libraries as nuget package")
else()
file(GLOB V8_REDIST_LIBS "${V8_REDIST_DIR}/*.dll" "${V8_REDIST_DIR}/snapshot_blob.bin")
foreach(V8_REDIST_LIB ${V8_REDIST_LIBS})
Expand All @@ -206,15 +206,15 @@ if(NOT V8_LIBRARY OR NOT V8_INCLUDE_DIR)
endforeach()
endif()
if(NOT V8_INCLUDE_DIR)
message("Couldn't find v8 include dir as nuget package")
message(STATUS "Couldn't find V8 include dir as nuget package")
endif()

endif()

IF (V8_INCLUDE_DIR AND ((V8_LIBRARY) OR (V8_MAIN_LIBRARY AND V8_BASE_LIBRARY AND V8_PLATFORM_LIBRARY)))
message("V8 found!")
message(STATUS "V8 found!")
set(V8_FOUND TRUE)
ELSE()
message("V8 lookup failed.")
message(FATAL_ERROR "V8 lookup failed.")
ENDIF()

2 changes: 1 addition & 1 deletion dependencies/gs2lib
Submodule gs2lib updated from 7185f9 to e209b6
13 changes: 6 additions & 7 deletions server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ elseif(WIN32)
# Using MSVC now looks for V8 as a nuget package first
# Looking in lib folders if not found
if(NOT V8_FOUND)
message("Findv8 failed, looking for v8 in supplied folders")
message(STATUS "FindV8 failed, looking for V8 in supplied folders")
target_link_libraries(${TARGET_NAME} v8.dll.lib v8_libbase.dll.lib v8_libplatform.dll.lib)
endif()
endif()
Expand Down Expand Up @@ -284,7 +284,7 @@ if (MINGW)
file(CHMOD "./objdump_unix2dos.sh" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)

function(install_library_with_deps LIBRARY)
message("Getting dependencies for ${LIBRARY}")
message(STATUS "Getting dependencies for ${LIBRARY}")

file(INSTALL
DESTINATION "${CMAKE_INSTALL_PREFIX}/"
Expand All @@ -302,14 +302,14 @@ if (MINGW)
if(NOT IS_SYMLINK ${FILE})
install_library_with_deps(${FILE})
else()
message( "Symlink ${LIBRARY}: ${FILE}")
message(STATUS "Symlink ${LIBRARY}: ${FILE}")
endif()
endforeach()
foreach(FILE ${UNRESOLVED_DEPS})
message( "Unresolved from ${LIBRARY}: ${FILE}")
message(STATUS "Unresolved from ${LIBRARY}: ${FILE}")
endforeach()
endfunction()
message("Getting dependencies for ${MY_EXE}")
message(STATUS "Getting dependencies for ${MY_EXE}")
file(GET_RUNTIME_DEPENDENCIES
EXECUTABLES ${MY_EXE}
RESOLVED_DEPENDENCIES_VAR RESOLVED_DEPS
Expand All @@ -321,7 +321,7 @@ if (MINGW)
install_library_with_deps(${FILE})
endforeach()
foreach(FILE ${UNRESOLVED_DEPS})
message( "Unresolved: ${FILE}")
message(STATUS "Unresolved: ${FILE}")
endforeach()
]])
endif()
Expand All @@ -340,7 +340,6 @@ if(V8NPCSERVER)
endif()
endif()

message("V8 include: ${V8_INCLUDE_DIR}")
include_directories(${V8_INCLUDE_DIR})

add_custom_command(
Expand Down

0 comments on commit e395516

Please sign in to comment.