diff --git a/CMakeLists.txt b/CMakeLists.txt index bdcaaa86..b09514e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,12 +7,13 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # Several plugin options option(BUILTIN_RUNTIMES "Include the MinGW runtime into the binary itself." ON) option(FORCE_32BIT_BIN "Create a 32-bit executable binary if the compiler defaults to 64-bit." OFF) +option(PLUGIN_DEVEL "Switch to plugin development." OFF) option(ENABLE_MYSQL "Enable the MySQL library." OFF) option(ENABLE_API21 "Build for 2.1 API." OFF) # Default to c++14 standard if(CMAKE_VERSION VERSION_LESS "3.1") - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") endif() else() @@ -29,14 +30,14 @@ if(CMAKE_BUILD_TYPE MATCHES Debug) endif() # Include mingw runntime into the binary -if (GCC OR MINGW) +if(GCC OR MINGW) if(BUILTIN_RUNTIMES) set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static") endif() endif() # Enable position independent code -if (UNIX) +if(UNIX) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() # Include VCMP library @@ -47,7 +48,10 @@ add_subdirectory(squirrel) add_subdirectory(sqrat) # Include SDK library add_subdirectory(sdk) -# Include Module library -add_subdirectory(module) -# Include Sample module -#add_subdirectory(hello) +if(PLUGIN_DEVEL) + # Include Sample module + add_subdirectory(hello) +else() + # Include Module library + add_subdirectory(module) +end() \ No newline at end of file diff --git a/sdk/CMakeLists.txt b/sdk/CMakeLists.txt index 461bce36..2d6ac8c2 100644 --- a/sdk/CMakeLists.txt +++ b/sdk/CMakeLists.txt @@ -16,5 +16,7 @@ target_include_directories(SqSDK PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_include_directories(SqSDK PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include) # Link to required libraries target_link_libraries(SqSDK PRIVATE VCMP SquirrelAPI) -# Compile definitions -target_compile_definitions(SqSDK PUBLIC SQMOD_PLUGIN_API=1) \ No newline at end of file +# Switch to plugin-development mode +if(PLUGIN_DEVEL) + target_compile_definitions(SqSDK PUBLIC SQMOD_PLUGIN_API=1) +end() \ No newline at end of file diff --git a/sqrat/CMakeLists.txt b/sqrat/CMakeLists.txt index 87edc7a3..f52c7f2f 100644 --- a/sqrat/CMakeLists.txt +++ b/sqrat/CMakeLists.txt @@ -22,6 +22,10 @@ else() endif() # Set library compiler options target_compile_definitions(Sqrat PUBLIC SCRAT_USE_EXCEPTIONS=1 SCRAT_USE_CXX11_OPTIMIZATIONS=1) +# Switch to plugin-development mode +if(PLUGIN_DEVEL) + target_compile_definitions(Sqrat PUBLIC SQMOD_PLUGIN_API=1) +end() # Set specific compiler options if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") #target_compile_options(Sqrat PRIVATE -w diff --git a/squirrel/CMakeLists.txt b/squirrel/CMakeLists.txt index 38c52b92..799fa88b 100644 --- a/squirrel/CMakeLists.txt +++ b/squirrel/CMakeLists.txt @@ -70,4 +70,8 @@ target_include_directories(Squirrel PRIVATE ${CMAKE_CURRENT_LIST_DIR}/stdlib) # Create the Squirrel library add_library(SquirrelAPI INTERFACE) # Library includes -target_include_directories(SquirrelAPI INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) \ No newline at end of file +target_include_directories(SquirrelAPI INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) +# Switch to plugin-development mode +if(PLUGIN_DEVEL) + target_compile_definitions(SquirrelAPI PUBLIC SQMOD_PLUGIN_API=1) +end() \ No newline at end of file