chore: update build script
- change project layout for better understanding. - update build script for more close to standard cmake way.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# Minimum required CMake version
|
||||
cmake_minimum_required(VERSION 3.23)
|
||||
# Project definition
|
||||
project(NeMo
|
||||
VERSION 0.3.0
|
||||
VERSION 0.4.0
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
@@ -9,6 +11,11 @@ option(NEMO_BUILD_UNVIRT "Build Unvirt, the console interface operator of LibCmo
|
||||
option(NEMO_BUILD_BMAP "Build BMap, the example use of LibCmo which can read and write Ballance game map." OFF)
|
||||
option(NEMO_BUILD_DOC "Build document of LibCmo and all related stuff." OFF)
|
||||
|
||||
# Set C++ standards
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# Setup install path from CMake provided install path for convenient use.
|
||||
include(GNUInstallDirs)
|
||||
set(NEMO_INSTALL_INCLUDE_PATH ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH
|
||||
@@ -20,11 +27,14 @@ set(NEMO_INSTALL_BIN_PATH ${CMAKE_INSTALL_BINDIR} CACHE PATH
|
||||
set(NEMO_INSTALL_DOC_PATH ${CMAKE_INSTALL_DOCDIR} CACHE PATH
|
||||
"Non-arch doc install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
||||
|
||||
# Import essential packages
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMake/custom_import_zlib.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMake/custom_import_iconv.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMake/custom_import_yycc.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMake/custom_import_stb.cmake)
|
||||
# Add our CMake in module found path
|
||||
set(CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_LIST_DIR}/CMake"
|
||||
)
|
||||
# Find required packages
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(YYCCommonplace REQUIRED)
|
||||
find_package(STB REQUIRED)
|
||||
|
||||
# If we are not in Windows environment, and we need to build shared library BMap,
|
||||
# we should enable PIC (position independent code), otherwise build process will fail.
|
||||
@@ -36,7 +46,7 @@ if ((NOT WIN32) AND NEMO_BUILD_BMAP)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE True)
|
||||
endif ()
|
||||
|
||||
# Import build targets
|
||||
# Include build targets by options
|
||||
add_subdirectory(LibCmo)
|
||||
if (NEMO_BUILD_UNVIRT)
|
||||
add_subdirectory(Unvirt)
|
||||
|
||||
Reference in New Issue
Block a user